# Adding entropy from external source into random number generator - how?



## rowan194 (Mar 26, 2022)

I've developed simple firmware on a microcontroller which uses the values of multiple floating analog inputs to generate random numbers. I'd like to use this as an external source to add entropy into a FreeBSD system.

I think the best way to do it would be to call random_harvest_queue(...), but what do I use as the source enum (see /usr/include/sys/random.h)? ENTROPYSOURCE, I guess?

I believe it's also possible to open /dev/random for write to inject entropy, and I'm sure I saw mention of this being available around 12.0R, but I cannot find any mention of that scenario in the man pages.

I guess the other question to ask is whether ~45 Kbytes per second of additional entropy is even useful in a typical situation? There's no strict security requirement or anything like that, it's really just a fun project that I'm hoping to actually use.  All entropy is good entropy, right?

Thanks.


----------



## rigoletto@ (Mar 26, 2022)

rowan194 said:


> I've developed simple firmware on a microcontroller which uses the values of multiple floating analog inputs to generate random numbers. I'd like to use this as an external source to add entropy into a FreeBSD system.
> 
> I think the best way to do it would be to call random_harvest_queue(...), but what do I use as the source enum (see /usr/include/sys/random.h)? ENTROPYSOURCE, I guess?
> 
> ...



This sounds like a question you are more likely to get proper answers on a mailing list, likely freebsd-security.


----------

