CryptoPkg/BaseCryptLib: Make HMAC_CTX size backward compatible

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>
This commit is contained in:
Xiaoyu Lu 2019-05-29 18:40:38 +00:00 committed by Jian J Wang
parent 456dd8b99f
commit acfb909118
3 changed files with 19 additions and 6 deletions

View File

@ -9,8 +9,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "InternalCryptLib.h"
#include <openssl/hmac.h>
#define HMAC_MD5_CTX_SIZE sizeof(void *) * 4 + sizeof(unsigned int) + \
sizeof(unsigned char) * HMAC_MAX_MD_CBLOCK
//
// NOTE: OpenSSL redefines the size of HMAC_CTX at crypto/hmac/hmac_lcl.h
// #define HMAC_MAX_MD_CBLOCK_SIZE 144
//
#define HMAC_MD5_CTX_SIZE (sizeof(void *) * 4 + sizeof(unsigned int) + \
sizeof(unsigned char) * 144)
/**
Retrieves the size, in bytes, of the context buffer required for HMAC-MD5 operations.

View File

@ -9,8 +9,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "InternalCryptLib.h"
#include <openssl/hmac.h>
#define HMAC_SHA1_CTX_SIZE sizeof(void *) * 4 + sizeof(unsigned int) + \
sizeof(unsigned char) * HMAC_MAX_MD_CBLOCK
//
// NOTE: OpenSSL redefines the size of HMAC_CTX at crypto/hmac/hmac_lcl.h
// #define HMAC_MAX_MD_CBLOCK_SIZE 144
//
//
#define HMAC_SHA1_CTX_SIZE (sizeof(void *) * 4 + sizeof(unsigned int) + \
sizeof(unsigned char) * 144)
/**
Retrieves the size, in bytes, of the context buffer required for HMAC-SHA1 operations.

View File

@ -9,8 +9,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "InternalCryptLib.h"
#include <openssl/hmac.h>
#define HMAC_SHA256_CTX_SIZE sizeof(void *) * 4 + sizeof(unsigned int) + \
sizeof(unsigned char) * HMAC_MAX_MD_CBLOCK
//
// NOTE: OpenSSL redefines the size of HMAC_CTX at crypto/hmac/hmac_lcl.h
// #define HMAC_MAX_MD_CBLOCK_SIZE 144
//
#define HMAC_SHA256_CTX_SIZE (sizeof(void *) * 4 + sizeof(unsigned int) + \
sizeof(unsigned char) * 144)
/**
Retrieves the size, in bytes, of the context buffer required for HMAC-SHA256 operations.