diff options
Diffstat (limited to 'CryptoPkg/Library/BaseCryptLib/Cipher')
-rw-r--r-- | CryptoPkg/Library/BaseCryptLib/Cipher/CryptAes.c | 12 | ||||
-rw-r--r-- | CryptoPkg/Library/BaseCryptLib/Cipher/CryptArc4.c | 4 | ||||
-rw-r--r-- | CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdes.c | 12 |
3 files changed, 22 insertions, 6 deletions
diff --git a/CryptoPkg/Library/BaseCryptLib/Cipher/CryptAes.c b/CryptoPkg/Library/BaseCryptLib/Cipher/CryptAes.c index c8dbb797fa..753d79814f 100644 --- a/CryptoPkg/Library/BaseCryptLib/Cipher/CryptAes.c +++ b/CryptoPkg/Library/BaseCryptLib/Cipher/CryptAes.c @@ -241,7 +241,11 @@ AesCbcEncrypt ( //
// Check input parameters.
//
- if (AesContext == NULL || Input == NULL || (InputSize % AES_BLOCK_SIZE) != 0 || Ivec == NULL || Output == NULL) {
+ if (AesContext == NULL || Input == NULL || (InputSize % AES_BLOCK_SIZE) != 0) {
+ return FALSE;
+ }
+
+ if (Ivec == NULL || Output == NULL || InputSize > INT_MAX) {
return FALSE;
}
@@ -299,7 +303,11 @@ AesCbcDecrypt ( //
// Check input parameters.
//
- if (AesContext == NULL || Input == NULL || (InputSize % AES_BLOCK_SIZE) != 0 || Ivec == NULL || Output == NULL) {
+ if (AesContext == NULL || Input == NULL || (InputSize % AES_BLOCK_SIZE) != 0) {
+ return FALSE;
+ }
+
+ if (Ivec == NULL || Output == NULL || InputSize > INT_MAX) {
return FALSE;
}
diff --git a/CryptoPkg/Library/BaseCryptLib/Cipher/CryptArc4.c b/CryptoPkg/Library/BaseCryptLib/Cipher/CryptArc4.c index 0e5331c20d..f3c4d31a2d 100644 --- a/CryptoPkg/Library/BaseCryptLib/Cipher/CryptArc4.c +++ b/CryptoPkg/Library/BaseCryptLib/Cipher/CryptArc4.c @@ -115,7 +115,7 @@ Arc4Encrypt ( //
// Check input parameters.
//
- if (Arc4Context == NULL || Input == NULL || Output == NULL) {
+ if (Arc4Context == NULL || Input == NULL || Output == NULL || InputSize > INT_MAX) {
return FALSE;
}
@@ -161,7 +161,7 @@ Arc4Decrypt ( //
// Check input parameters.
//
- if (Arc4Context == NULL || Input == NULL || Output == NULL) {
+ if (Arc4Context == NULL || Input == NULL || Output == NULL || InputSize > INT_MAX) {
return FALSE;
}
diff --git a/CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdes.c b/CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdes.c index f3a1eb7293..f89094a581 100644 --- a/CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdes.c +++ b/CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdes.c @@ -275,7 +275,11 @@ TdesCbcEncrypt ( //
// Check input parameters.
//
- if (TdesContext == NULL || Input == NULL || (InputSize % TDES_BLOCK_SIZE) != 0 || Ivec == NULL || Output == NULL) {
+ if (TdesContext == NULL || Input == NULL || (InputSize % TDES_BLOCK_SIZE) != 0) {
+ return FALSE;
+ }
+
+ if (Ivec == NULL || Output == NULL || InputSize > INT_MAX) {
return FALSE;
}
@@ -339,7 +343,11 @@ TdesCbcDecrypt ( //
// Check input parameters.
//
- if (TdesContext == NULL || Input == NULL || (InputSize % TDES_BLOCK_SIZE) != 0 || Ivec == NULL || Output == NULL) {
+ if (TdesContext == NULL || Input == NULL || (InputSize % TDES_BLOCK_SIZE) != 0) {
+ return FALSE;
+ }
+
+ if (Ivec == NULL || Output == NULL || InputSize > INT_MAX) {
return FALSE;
}
|