Revision: 14392
http://edk2.svn.sourceforge.net/edk2/?rev=14392&view=rev
Author: tye1
Date: 2013-05-29 05:30:13 +0000 (Wed, 29 May 2013)
Log Message:
-----------
Though the comment of RandomSeed() states it should return FALSE if there is
not enough entropy for random generation, the function always returns TRUE.
This commit checks the status of pseudorandom number generator to match the
comment.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Ching-Pang Lin <[email protected]>
Reviewed-by: Long Qin <[email protected]>
Reviewed-by: Ye Ting <[email protected]>
Modified Paths:
--------------
trunk/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRand.c
trunk/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c
trunk/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c
Modified: trunk/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRand.c
===================================================================
--- trunk/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRand.c 2013-05-28
20:21:51 UTC (rev 14391)
+++ trunk/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRand.c 2013-05-29
05:30:13 UTC (rev 14392)
@@ -57,7 +57,11 @@
RAND_seed (DefaultSeed, sizeof (DefaultSeed));
}
- return TRUE;
+ if (RAND_status () == 1) {
+ return TRUE;
+ }
+
+ return FALSE;
}
/**
Modified: trunk/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c
===================================================================
--- trunk/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c
2013-05-28 20:21:51 UTC (rev 14391)
+++ trunk/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c
2013-05-29 05:30:13 UTC (rev 14392)
@@ -65,7 +65,11 @@
RAND_seed (DefaultSeed, sizeof (DefaultSeed));
}
- return TRUE;
+ if (RAND_status () == 1) {
+ return TRUE;
+ }
+
+ return FALSE;
}
/**
Modified: trunk/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c
===================================================================
--- trunk/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c
2013-05-28 20:21:51 UTC (rev 14391)
+++ trunk/edk2/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c
2013-05-29 05:30:13 UTC (rev 14392)
@@ -65,7 +65,11 @@
RAND_seed (DefaultSeed, sizeof (DefaultSeed));
}
- return TRUE;
+ if (RAND_status () == 1) {
+ return TRUE;
+ }
+
+ return FALSE;
}
/**
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits