]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/BaseCryptLib/Cipher/CryptArc4.c
Fix several issues in BaseCryptLib:
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / Cipher / CryptArc4.c
index 69214181373ec6ee7b1df948da28c2bbfbbff672..f3c4d31a2d9c1598fd7f295fc187f28fe2bf57ed 100644 (file)
@@ -32,14 +32,14 @@ Arc4GetContextSize (
   // for backup copy. When Arc4Reset() is called, we can use the backup copy to restore\r
   // the working copy to the initial state.\r
   //\r
-  return (UINTN) (2 * sizeof(RC4_KEY));\r
+  return (UINTN) (2 * sizeof (RC4_KEY));\r
 }\r
 \r
 /**\r
   Initializes user-supplied memory as ARC4 context for subsequent use.\r
 \r
   This function initializes user-supplied memory pointed by Arc4Context as ARC4 context.\r
-  In addtion, it sets up all ARC4 key materials for subsequent encryption and decryption\r
+  In addition, it sets up all ARC4 key materials for subsequent encryption and decryption\r
   operations.\r
 \r
   If Arc4Context is NULL, then return FALSE.\r
@@ -75,7 +75,7 @@ Arc4Init (
 \r
   RC4_set_key (Rc4Key, (UINT32) KeySize, Key);\r
 \r
-  CopyMem (Rc4Key +  1, Rc4Key, sizeof(RC4_KEY));\r
+  CopyMem (Rc4Key +  1, Rc4Key, sizeof (RC4_KEY));\r
 \r
   return TRUE;\r
 }\r
@@ -115,7 +115,7 @@ Arc4Encrypt (
   //\r
   // Check input parameters.\r
   //\r
-  if (Arc4Context == NULL || Input == NULL || Output == NULL) {\r
+  if (Arc4Context == NULL || Input == NULL || Output == NULL || InputSize > INT_MAX) {\r
     return FALSE;\r
   }\r
 \r
@@ -161,7 +161,7 @@ Arc4Decrypt (
   //\r
   // Check input parameters.\r
   //\r
-  if (Arc4Context == NULL || Input == NULL || Output == NULL) {\r
+  if (Arc4Context == NULL || Input == NULL || Output == NULL || InputSize > INT_MAX) {\r
     return FALSE;\r
   }\r
 \r
@@ -205,7 +205,7 @@ Arc4Reset (
   \r
   Rc4Key = (RC4_KEY *) Arc4Context;\r
 \r
-  CopyMem (Rc4Key, Rc4Key + 1, sizeof(RC4_KEY));\r
+  CopyMem (Rc4Key, Rc4Key + 1, sizeof (RC4_KEY));\r
 \r
   return TRUE;\r
 }\r