]> git.proxmox.com Git - mirror_edk2.git/commitdiff
CryptoPkg/BaseCryptLib: Make HMAC_CTX size backward compatible
authorXiaoyu Lu <xiaoyux.lu@intel.com>
Wed, 29 May 2019 18:40:38 +0000 (18:40 +0000)
committerJian J Wang <jian.j.wang@intel.com>
Mon, 3 Jun 2019 00:28:03 +0000 (08:28 +0800)
Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=1089

OpenSSL internally redefines the size of HMAC_CTX at
crypto/hmac/hmac_lcl.h(OpenSSL commit e0810e35).
Ref: https://github.com/openssl/openssl/pull/4338

We should not use it directly and should remove relevant
functions(Hmac*GetContextSize).
Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=1792

But for compatiblility, temporarily change these definition
of HMAC_*_CTX_SIZE.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Signed-off-by: Xiaoyu Lu <xiaoyux.lu@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Gary Lin <glin@suse.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5.c
CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1.c
CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256.c

index 3134806797f84a264d578272905cd8e6ca7a42d2..19e9fbeae66fe9ab9a105f9249d7d93b8b8d3f12 100644 (file)
@@ -9,8 +9,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include "InternalCryptLib.h"\r
 #include <openssl/hmac.h>\r
 \r
-#define HMAC_MD5_CTX_SIZE    sizeof(void *) * 4 + sizeof(unsigned int) + \\r
-                             sizeof(unsigned char) * HMAC_MAX_MD_CBLOCK\r
+//\r
+// NOTE: OpenSSL redefines the size of HMAC_CTX at crypto/hmac/hmac_lcl.h\r
+//       #define HMAC_MAX_MD_CBLOCK_SIZE     144\r
+//\r
+#define HMAC_MD5_CTX_SIZE    (sizeof(void *) * 4 + sizeof(unsigned int) + \\r
+                             sizeof(unsigned char) * 144)\r
 \r
 /**\r
   Retrieves the size, in bytes, of the context buffer required for HMAC-MD5 operations.\r
index bbe3df4d4f704454c0a04af5d59424e4dffbd0c3..7d7df9640e7f6ad7a57b17b2deeb019bfe32aed9 100644 (file)
@@ -9,8 +9,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include "InternalCryptLib.h"\r
 #include <openssl/hmac.h>\r
 \r
-#define HMAC_SHA1_CTX_SIZE   sizeof(void *) * 4 + sizeof(unsigned int) + \\r
-                             sizeof(unsigned char) * HMAC_MAX_MD_CBLOCK\r
+//\r
+// NOTE: OpenSSL redefines the size of HMAC_CTX at crypto/hmac/hmac_lcl.h\r
+//       #define HMAC_MAX_MD_CBLOCK_SIZE     144\r
+//\r
+//\r
+#define  HMAC_SHA1_CTX_SIZE   (sizeof(void *) * 4 + sizeof(unsigned int) + \\r
+                             sizeof(unsigned char) * 144)\r
 \r
 /**\r
   Retrieves the size, in bytes, of the context buffer required for HMAC-SHA1 operations.\r
index ac9084fa850db0dfa9583231453bff7f16aa5a46..f24443e7455289ac56d6e41d3b9079799f24a366 100644 (file)
@@ -9,8 +9,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include "InternalCryptLib.h"\r
 #include <openssl/hmac.h>\r
 \r
-#define HMAC_SHA256_CTX_SIZE   sizeof(void *) * 4 + sizeof(unsigned int) + \\r
-                               sizeof(unsigned char) * HMAC_MAX_MD_CBLOCK\r
+//\r
+// NOTE: OpenSSL redefines the size of HMAC_CTX at crypto/hmac/hmac_lcl.h\r
+//       #define HMAC_MAX_MD_CBLOCK_SIZE     144\r
+//\r
+#define HMAC_SHA256_CTX_SIZE    (sizeof(void *) * 4 + sizeof(unsigned int) + \\r
+                             sizeof(unsigned char) * 144)\r
 \r
 /**\r
   Retrieves the size, in bytes, of the context buffer required for HMAC-SHA256 operations.\r