[openssl-users] Doubt about OpenSSL library initialization in an HTTP client application

silvioprog silvioprog at gmail.com
Mon Dec 12 19:01:00 UTC 2016


On Mon, Dec 12, 2016 at 3:53 PM, Jeffrey Walton <noloader at gmail.com> wrote:

> > So what is the correct way, 1 or 2?
> >
> > 1)
> >
> > RAND_poll()
> > /* RAND_bytes is unnecessary */
> > /* RAND_add is unnecessary */
> >
> > 2)
> >
> > RAND_poll()
> > RAND_bytes(buf, 128);
> > /* RAND_add is unnecessary */
>
> On Windows, you call CryptGenRandom to obtain your seed for the
> OpenSSL PRNG. On Linux, you use one of the random devices, like
> /dev/srandom, /dev/random, or /dev/urandom.
>
> Windows Phone and Windows Store apps add a twist, like requiring calls
> to BCryptGenRandom. There's no way to wrote portable code when you
> factor in Windows Phone and Windows Store. It will be a #define mess.
>
> Jeff


Perfect! So I just need to call RAND_poll(), because it seems already
choosing that funcs above. :-)

https://github.com/openssl/openssl/blob/master/crypto/rand/rand_win.c#L49

https://github.com/openssl/openssl/blob/master/crypto/rand/rand_unix.c#L161

Thanks a lot dude!

--
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20161212/9e4dff61/attachment.html>


More information about the openssl-users mailing list