]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/BaseCryptLib/Cipher/CryptAes.c
Fix several issues in BaseCryptLib:
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / Cipher / CryptAes.c
index 45e4a4392efa18a26916a4a51c73f49b709111fb..753d79814f724c4619eeb480cbaa555751960084 100644 (file)
@@ -38,7 +38,7 @@ AesGetContextSize (
   Initializes user-supplied memory as AES context for subsequent use.\r
 \r
   This function initializes user-supplied memory pointed by AesContext as AES context.\r
-  In addtion, it sets up all AES key materials for subsequent encryption and decryption\r
+  In addition, it sets up all AES key materials for subsequent encryption and decryption\r
   operations.\r
   There are 3 options for key length, 128 bits, 192 bits, and 256 bits.\r
 \r
@@ -241,7 +241,11 @@ AesCbcEncrypt (
   //\r
   // Check input parameters.\r
   //\r
-  if (AesContext == NULL || Input == NULL || (InputSize % AES_BLOCK_SIZE) != 0 || Ivec == NULL || Output == NULL) {\r
+  if (AesContext == NULL || Input == NULL || (InputSize % AES_BLOCK_SIZE) != 0) {\r
+    return FALSE;\r
+  }\r
+\r
+  if (Ivec == NULL || Output == NULL || InputSize > INT_MAX) {\r
     return FALSE;\r
   }\r
 \r
@@ -299,7 +303,11 @@ AesCbcDecrypt (
   //\r
   // Check input parameters.\r
   //\r
-  if (AesContext == NULL || Input == NULL || (InputSize % AES_BLOCK_SIZE) != 0 || Ivec == NULL || Output == NULL) {\r
+  if (AesContext == NULL || Input == NULL || (InputSize % AES_BLOCK_SIZE) != 0) {\r
+    return FALSE;\r
+  }\r
+\r
+  if (Ivec == NULL || Output == NULL || InputSize > INT_MAX) {\r
     return FALSE;\r
   }\r
 \r