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 <g...@suse.com> --- CryptoPkg/Library/BaseCryptLib/Rand/CryptRand.c | 2 +- CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c | 2 +- CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CryptoPkg/Library/BaseCryptLib/Rand/CryptRand.c b/CryptoPkg/Library/BaseCryptLib/Rand/CryptRand.c index 4a056e8..81d1a29 100644 --- a/CryptoPkg/Library/BaseCryptLib/Rand/CryptRand.c +++ b/CryptoPkg/Library/BaseCryptLib/Rand/CryptRand.c @@ -57,7 +57,7 @@ RandomSeed ( RAND_seed (DefaultSeed, sizeof (DefaultSeed)); } - return TRUE; + return !!RAND_status(); } /** diff --git a/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c b/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c index dcc1853..a8a6b51 100644 --- a/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c +++ b/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandItc.c @@ -65,7 +65,7 @@ RandomSeed ( RAND_seed (DefaultSeed, sizeof (DefaultSeed)); } - return TRUE; + return !!RAND_status(); } /** diff --git a/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c b/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c index 7259ed5..c75726d 100644 --- a/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c +++ b/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c @@ -65,7 +65,7 @@ RandomSeed ( RAND_seed (DefaultSeed, sizeof (DefaultSeed)); } - return TRUE; + return !!RAND_status(); } /** -- 1.8.1.4 ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel