[PATCH] Added Getentropy() support to beagle BSP
Sebastian Huber
sebastian.huber at embedded-brains.de
Thu Mar 15 07:49:08 UTC 2018
On 15/03/18 08:13, Udit agarwal wrote:
> Oh yes, i think i misinterpreted your previous suggestion of
> surrounding the while loop by mutex, it should be the outer while
> loop. some thing like this?:
> while (n > 0) {
> uint32_t random;
> size_t copy;
>
> rtems_mutex_lock(&atsam_trng_mutex);
Now you correctly use the mutex to produce 32-bits of random data.
Currently the likely user of getrandom() is
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=blob;f=newlib/libc/stdlib/arc4random.c;h=3cccc3ed46a5e9e756d4e216cb7686589eb60993;hb=HEAD#l89
So, you need 12 mutex lock/unlock operations for this. I would protect
the while (n > 0) loop with a single mutex lock/unlock.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the devel
mailing list