X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=CryptoPkg%2FLibrary%2FBaseCryptLib%2FRand%2FCryptRandTsc.c;h=15f0b3fecaa3d7ba56a0d61fe58a1f6ec331f899;hb=2998af862469c6a05657e169d7def6f55420caad;hp=dbdd6383a4d654f284718ebf0b8a9acfe6dd96b4;hpb=b3a18a1a1770316bfabbc29a44586db24c8c9076;p=mirror_edk2.git diff --git a/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c b/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c index dbdd6383a4..15f0b3feca 100644 --- a/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c +++ b/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c @@ -1,7 +1,7 @@ /** @file Pseudorandom Number Generator Wrapper Implementation over OpenSSL. -Copyright (c) 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2012 - 2013, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "InternalCryptLib.h" #include +#include #include /** @@ -45,6 +46,14 @@ RandomSeed ( return FALSE; } + // + // The software PRNG implementation built in OpenSSL depends on message digest algorithm. + // Make sure SHA-1 digest algorithm is available here. + // + if (EVP_add_digest (EVP_sha1 ()) == 0) { + return FALSE; + } + // // Seed the pseudorandom number generator with user-supplied value. // NOTE: A cryptographic PRNG must be seeded with unpredictable data. @@ -78,7 +87,7 @@ RandomSeed ( If Output is NULL, then return FALSE. @param[out] Output Pointer to buffer to receive random value. - @param[in] Size Size of randome bytes to generate. + @param[in] Size Size of random bytes to generate. @retval TRUE Pseudorandom byte stream generated successfully. @retval FALSE Pseudorandom number generator fails to generate due to lack of entropy.