// AES uses different key contexts for encryption and decryption, so here memory\r
// for 2 copies of AES_KEY is allocated.\r
//\r
- return (UINTN) (2 * sizeof (AES_KEY));\r
+ return (UINTN)(2 * sizeof (AES_KEY));\r
}\r
\r
/**\r
//\r
// Check input parameters.\r
//\r
- if (AesContext == NULL || Key == NULL || (KeyLength != 128 && KeyLength != 192 && KeyLength != 256)) {\r
+ if ((AesContext == NULL) || (Key == NULL) || ((KeyLength != 128) && (KeyLength != 192) && (KeyLength != 256))) {\r
return FALSE;\r
}\r
\r
//\r
// Initialize AES encryption & decryption key schedule.\r
//\r
- AesKey = (AES_KEY *) AesContext;\r
- if (AES_set_encrypt_key (Key, (UINT32) KeyLength, AesKey) != 0) {\r
+ AesKey = (AES_KEY *)AesContext;\r
+ if (AES_set_encrypt_key (Key, (UINT32)KeyLength, AesKey) != 0) {\r
return FALSE;\r
}\r
- if (AES_set_decrypt_key (Key, (UINT32) KeyLength, AesKey + 1) != 0) {\r
+\r
+ if (AES_set_decrypt_key (Key, (UINT32)KeyLength, AesKey + 1) != 0) {\r
return FALSE;\r
}\r
+\r
return TRUE;\r
}\r
\r
//\r
// Check input parameters.\r
//\r
- if (AesContext == NULL || Input == NULL || (InputSize % AES_BLOCK_SIZE) != 0) {\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
+ if ((Ivec == NULL) || (Output == NULL) || (InputSize > INT_MAX)) {\r
return FALSE;\r
}\r
\r
- AesKey = (AES_KEY *) AesContext;\r
+ AesKey = (AES_KEY *)AesContext;\r
CopyMem (IvecBuffer, Ivec, AES_BLOCK_SIZE);\r
\r
//\r
// Perform AES data encryption with CBC mode\r
//\r
- AES_cbc_encrypt (Input, Output, (UINT32) InputSize, AesKey, IvecBuffer, AES_ENCRYPT);\r
+ AES_cbc_encrypt (Input, Output, (UINT32)InputSize, AesKey, IvecBuffer, AES_ENCRYPT);\r
\r
return TRUE;\r
}\r
//\r
// Check input parameters.\r
//\r
- if (AesContext == NULL || Input == NULL || (InputSize % AES_BLOCK_SIZE) != 0) {\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
+ if ((Ivec == NULL) || (Output == NULL) || (InputSize > INT_MAX)) {\r
return FALSE;\r
}\r
\r
- AesKey = (AES_KEY *) AesContext;\r
+ AesKey = (AES_KEY *)AesContext;\r
CopyMem (IvecBuffer, Ivec, AES_BLOCK_SIZE);\r
\r
//\r
// Perform AES data decryption with CBC mode\r
//\r
- AES_cbc_encrypt (Input, Output, (UINT32) InputSize, AesKey + 1, IvecBuffer, AES_DECRYPT);\r
+ AES_cbc_encrypt (Input, Output, (UINT32)InputSize, AesKey + 1, IvecBuffer, AES_DECRYPT);\r
\r
return TRUE;\r
}\r