This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH 5/5] Add arc4random() etc. from OpenBSD 5.8
- From: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- To: newlib at sourceware dot org
- Date: Fri, 18 Mar 2016 15:48:02 +0100
- Subject: Re: [PATCH 5/5] Add arc4random() etc. from OpenBSD 5.8
- Authentication-results: sourceware.org; auth=none
- References: <1458298168-20216-1-git-send-email-sebastian dot huber at embedded-brains dot de> <1458298168-20216-6-git-send-email-sebastian dot huber at embedded-brains dot de> <20160318112828 dot GK16696 at calimero dot vinschen dot de> <20160318135001 dot GM16696 at calimero dot vinschen dot de>
On 18/03/16 14:50, Corinna Vinschen wrote:
On Mar 18 12:28, Corinna Vinschen wrote:
>On Mar 18 11:49, Sebastian Huber wrote:
> >According to the OpenBSD man page, "A Replacement Call for Random". It
> >offers high quality random numbers derived from input data obtained by
> >the OpenBSD specific getentropy() system call which is declared in
> ><unistd.h> and must be implemented for each Newlib port externally. The
> >arc4random() functions are used for example in LibreSSL and OpenSSH.
> >
> >Cygwin provides currently its own implementation of the arc4random
> >family. Maybe it makes sense to use this getentropy() implementation:
> >
> >http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libcrypto/crypto/getentropy_win.c?rev=1.4&content-type=text/x-cvsweb-markup
>
>No, that pulls in a dependency to another DLL which we're trying to avoid.
>Using RtlGenRandom should work though. I have to test this.
All patches applied. I immediately implemented the changes required for
Cygwin. In the first place that required to add two functions
arc4random_stir and arc4random_addrandom to maintain backward
compatibility since both OpenBSD functions were already exported by
Cygwin.
My aim with the "newlib/libc/sys/*/include/machine/_arc4random.h" file
was to avoid #ifdef SYS_XYZ cascades in the generic files. It seems that
for Cygwin there is no "newlib/libc/sys/cygwin" directory. Would it be
possible to add this and place a
"newlib/libc/sys/cygwin/include/machine/_arc4random.h" in it?
I am not sure if we should add the arc4random_stir() and
arc4random_addrandom() functions, since this may lead configure scripts
to enable their use. With the getentropy() system call I am not sure if
this is harmful.
--
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@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschÃftliche Mitteilung im Sinne des EHUG.