From 72bb39c0237f8bcc3afa8b623e8b097eec6d69cd Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Mon, 6 Oct 2014 15:39:48 -0700 Subject: Import upstream version 0.7 --- Cryptlib/Rand/CryptRand.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'Cryptlib/Rand/CryptRand.c') diff --git a/Cryptlib/Rand/CryptRand.c b/Cryptlib/Rand/CryptRand.c index 4b275951..dc3ab992 100644 --- a/Cryptlib/Rand/CryptRand.c +++ b/Cryptlib/Rand/CryptRand.c @@ -43,6 +43,10 @@ RandomSeed ( IN UINTN SeedSize ) { + if (SeedSize > INT_MAX) { + return FALSE; + } + // // Seed the pseudorandom number generator with user-supplied value. // NOTE: A cryptographic PRNG must be seeded with unpredictable data. @@ -53,7 +57,11 @@ RandomSeed ( RAND_seed (DefaultSeed, sizeof (DefaultSeed)); } - return TRUE; + if (RAND_status () == 1) { + return TRUE; + } + + return FALSE; } /** @@ -78,7 +86,7 @@ RandomBytes ( // // Check input parameters. // - if (Output == NULL) { + if (Output == NULL || Size > INT_MAX) { return FALSE; } -- cgit v1.2.3