Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <3CE64087.1090400@lapo.it> Date: Sat, 18 May 2002 13:52:39 +0200 From: Lapo Luchini User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; it-IT; rv:1.0rc3) Gecko/20020516 X-Accept-Language: it, en, fr, es MIME-Version: 1.0 To: Mailing List: CygWin Subject: /dev/[u]random sources Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit > > >int >fhandler_dev_random::write (const void *ptr, size_t len) >{ > if (!len) > return 0; > if (!ptr) > { > set_errno (EINVAL); > return -1; > } > > /* Limit len to a value <= 512 since we don't want to overact. > Copy to local buffer because CryptGenRandom violates const. */ > unsigned char buf[512]; > size_t limited_len = len <= 512 ? len : 512; > memcpy (buf, ptr, limited_len); > > /* Mess up system entropy source. Return error if device is /dev/random. */ > if (!crypt_gen_random (buf, limited_len) && unit == RANDOM) > { > __seterrno (); > return -1; > } > /* Mess up the pseudo random number generator. */ > pseudo_write (buf, limited_len); > return len; >} > I think chaning the comment from /* Mess up system entropy source. Return error if device is /dev/random. */ to /* Mess up system entropy source. Return eventual error only if device is /dev/random. */ could clarify things a bit, at least for me it took a bit of time to notice that the Windows system call is used both for seeding and for retreiving and that that "if" does actually seed the buffer and returns error only if failed it (AND it is /dev/random). Of course this is not an important/urgent issue at all. Paranoic issue: how good is the default windows crypto provider? does it uses (at least on the NT series, I mean) latency from h/w and so on? I can find no such infos on MSDN as they are provider-specific. -- Lapo 'Raist' Luchini lapo AT lapo DOT it (PGP & X.509 keys available) http://www.lapo.it (ICQ UIN: 529796) -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/