X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=CryptoPkg%2FLibrary%2FBaseCryptLib%2FHmac%2FCryptHmacSha256.c;h=7e83551c1b22fc51fbc45610fe10bec64b03b161;hp=3fdef064f93a4e80ffcfc79674b685aaa1962c6b;hb=7c342378317039e632d9a1a5d4cf7c21aec8cb7a;hpb=2b16a4fb91b9b31c0d152588f5ac51080c6c0763 diff --git a/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256.c b/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256.c index 3fdef064f9..7e83551c1b 100644 --- a/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256.c +++ b/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256.c @@ -25,7 +25,7 @@ HmacSha256New ( // // Allocates & Initializes HMAC_CTX Context by OpenSSL HMAC_CTX_new() // - return (VOID *) HMAC_CTX_new (); + return (VOID *)HMAC_CTX_new (); } /** @@ -71,11 +71,11 @@ HmacSha256SetKey ( // // Check input parameters. // - if (HmacSha256Context == NULL || KeySize > INT_MAX) { + if ((HmacSha256Context == NULL) || (KeySize > INT_MAX)) { return FALSE; } - if (HMAC_Init_ex ((HMAC_CTX *)HmacSha256Context, Key, (UINT32) KeySize, EVP_sha256(), NULL) != 1) { + if (HMAC_Init_ex ((HMAC_CTX *)HmacSha256Context, Key, (UINT32)KeySize, EVP_sha256 (), NULL) != 1) { return FALSE; } @@ -105,7 +105,7 @@ HmacSha256Duplicate ( // // Check input parameters. // - if (HmacSha256Context == NULL || NewHmacSha256Context == NULL) { + if ((HmacSha256Context == NULL) || (NewHmacSha256Context == NULL)) { return FALSE; } @@ -152,7 +152,7 @@ HmacSha256Update ( // // Check invalid parameters, in case that only DataLength was checked in OpenSSL // - if (Data == NULL && DataSize != 0) { + if ((Data == NULL) && (DataSize != 0)) { return FALSE; } @@ -198,7 +198,7 @@ HmacSha256Final ( // // Check input parameters. // - if (HmacSha256Context == NULL || HmacValue == NULL) { + if ((HmacSha256Context == NULL) || (HmacValue == NULL)) { return FALSE; } @@ -208,6 +208,7 @@ HmacSha256Final ( if (HMAC_Final ((HMAC_CTX *)HmacSha256Context, HmacValue, &Length) != 1) { return FALSE; } + if (HMAC_CTX_reset ((HMAC_CTX *)HmacSha256Context) != 1) { return FALSE; }