delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/05/18/07:54:38

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
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 <lapo AT lapo DOT it>
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 <cygwin AT cygwin DOT com>
Subject: /dev/[u]random sources

>
>
>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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019