- Timestamp:
- 01/25/10 09:29:35 (3 years ago)
- Location:
- branches/eraser6/CodeReview
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
Eraser.Manager/EntropySource.cs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/CodeReview
- Property svn:mergeinfo changed
/branches/eraser6/6.0 merged: 1633,1635,1637,1639,1641,1643,1649,1653,1659,1664,1666,1669,1673 /trunk/eraser6 merged: 1627-1680
- Property svn:mergeinfo changed
-
branches/eraser6/CodeReview/Eraser.Manager/EntropySource.cs
r1568 r1681 1 1 /* 2 2 * $Id$ 3 * Copyright 2008-20 09The Eraser Project3 * Copyright 2008-2010 The Eraser Project 4 4 * Original Author: Joel Low <lowjoel@users.sourceforge.net> 5 5 * Modified By: Kasra Nassiri <cjax@users.sourceforge.net> … … 418 418 } 419 419 #endif 420 421 //Query performance data. Because the Win32 version of this API (through422 //the registry) may be buggy, use the NT Native API instead.423 //424 //Scan the first 64 possible information types (we don't bother with increasing425 //the buffer size as we do with the Win32 version of the performance data426 //read, we may miss a few classes but it's no big deal). In addition the427 //returned size value for some classes is wrong (eg 23 and 24 return a428 //size of 0) so we miss a few more things, but again it's no big deal. This429 //scan typically yields around 20 pieces of data, there's nothing in the430 //range 65...128 so chances are there won't be anything above there either.431 uint dataWritten = 0;432 byte[] infoBuffer = new byte[65536];433 uint totalEntropy = 0;434 for (uint infoType = 0; infoType < 64; ++infoType)435 {436 uint sysInfo = NTApi.NtQuerySystemInformation(infoType, infoBuffer,437 (uint)infoBuffer.Length, out dataWritten);438 439 if (sysInfo == Win32ErrorCode.Success && dataWritten > 0)440 {441 byte[] entropy = new byte[dataWritten];442 Buffer.BlockCopy(infoBuffer, 0, entropy, 0, (int)dataWritten);443 result.AddRange(entropy);444 totalEntropy += dataWritten;445 }446 }447 448 result.AddRange(StructToBuffer(totalEntropy));449 450 420 //Finally, our good friend CryptGenRandom() 451 421 byte[] cryptGenRandom = new byte[1536];
Note: See TracChangeset
for help on using the changeset viewer.
