diff options
| author | Steve Langasek <steve.langasek@canonical.com> | 2014-10-06 17:17:33 -0700 |
|---|---|---|
| committer | Steve Langasek <steve.langasek@canonical.com> | 2014-10-06 17:17:33 -0700 |
| commit | 59945b252e76a601fc6bbf43fb49f8a8f0d0c9a9 (patch) | |
| tree | 70e8a684bf6b3480abf1504e7befb1f8f955d962 /Cryptlib/Rand | |
| parent | 5fc0e7f624b64f40d5d4694e35f8c967a7317902 (diff) | |
| parent | 72bb39c0237f8bcc3afa8b623e8b097eec6d69cd (diff) | |
| download | efi-boot-shim-59945b252e76a601fc6bbf43fb49f8a8f0d0c9a9.tar.gz efi-boot-shim-59945b252e76a601fc6bbf43fb49f8a8f0d0c9a9.zip | |
Merge upstream version 0.7
Diffstat (limited to 'Cryptlib/Rand')
| -rw-r--r-- | Cryptlib/Rand/CryptRand.c | 12 |
1 files changed, 10 insertions, 2 deletions
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;
}
|
