Re: Entropy sources under WinXP



On 5/18/2007 4:13 PM, Sebastian G. wrote:
Mark Nudelman wrote:


You can use CryptGenRandom to generate random numbers, or directly read
the registry value HKLM\Software\Microsoft\Cryptography\RNG\Seed.

You cannot directly read this value without risking a buffer overflow on
Windows version before Windows Vista.

Eh? As far as I'm aware, it can be read safely the same way any other
registry value of unknown size can be read: call RegQueryValueEx once to
discover the size of the value in the registry, and then call it again
to read the amount of data you want.


And if the size of the value can change in between (which is the case
for this one), you have a problem. You'd require either a lock (which
you won't get) or transactional semantics (only on Windows Vista).

I don't see the problem. When you read a registry value using
RegQueryValueEx, you specify the size of your buffer in the last
parameter. The buffer cannot be overrun unless you specify a size
that's larger than your buffer, which is a programming bug. If the
registry value grows so that it's larger than you expected, an
ERROR_MORE_DATA status is returned. In no case does it write past the
end of the buffer that you supply.

--Mark
.



Relevant Pages

  • Re: DVD reader after sp3
    ... The CD drive or the DVD drive does not work as expected on a computer that you upgraded to Windows Vista ... You upgrade a computer to Windows Vista or install Windows Vista Service Pack 1 or you install or uninstall applications that have a CD/DVD filter driver. ... Important This section, method, or task contains steps that tell you how to modify the registry. ...
    (microsoft.public.windowsupdate)
  • Re: Entropy sources under WinXP
    ... Windows version before Windows Vista. ... The way the registry works. ... using a large buffer isn't sufficient. ... Windows registry programming), I'm going to have to thrash you. ...
    (sci.crypt)
  • Re: Reading GUID from registry
    ... buffer for the string without space for the NULL. ... Don Burn (MVP, Windows DDK) ... Now I am setting this value in Registry. ...
    (microsoft.public.development.device.drivers)
  • Re: TcpClient buffer size limit?
    ... > Are there any other registry setting that I can set to make the TCP ... socket option or buffer size. ... Take care of your adapter settings, ...
    (microsoft.public.dotnet.languages.csharp)
  • HKEY_CURRENT_USER and NTUSER.DAT
    ... i need to apply restrictions through GPO to a specific local user in windows ... Saving Hkey_current_user registry to NTuser.dat file; ... This works fine in windows XP but In a specific computer is not working ... The NTUSER.DAT file in windows vista has the same functions that in windows ...
    (microsoft.public.win2000.registry)

Quantcast