From: "Wang, Jian J" <jian.j.wang@intel.com>
To: devel@edk2.groups.io
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>, Laszlo Ersek <lersek@redhat.com>
Subject: [PATCH v3 2/2] CryptoPkg/BaseCryptLib: remove HmacXxxGetContextSize interface
Date: Thu, 16 Jan 2020 14:10:03 +0800 [thread overview]
Message-ID: <20200116061004.636-3-jian.j.wang@intel.com> (raw)
In-Reply-To: <20200116061004.636-1-jian.j.wang@intel.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1792
Hmac(Md5|Sha1|Sha256)GetContextSize() use a deprecated macro
HMAC_MAX_MD_CBLOCK defined in openssl. They should be dropped to
avoid misuses in the future. For context allocation and release,
use HmacXxxNew() and HmacXxxFree() instead.
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
---
CryptoPkg/Include/Library/BaseCryptLib.h | 17 ----------
.../Library/BaseCryptLib/Hmac/CryptHmacMd5.c | 31 ------------------
.../BaseCryptLib/Hmac/CryptHmacMd5Null.c | 20 ------------
.../Library/BaseCryptLib/Hmac/CryptHmacSha1.c | 32 -------------------
.../BaseCryptLib/Hmac/CryptHmacSha1Null.c | 20 ------------
.../BaseCryptLib/Hmac/CryptHmacSha256.c | 31 ------------------
.../BaseCryptLib/Hmac/CryptHmacSha256Null.c | 20 ------------
.../BaseCryptLibNull/Hmac/CryptHmacMd5Null.c | 20 ------------
.../BaseCryptLibNull/Hmac/CryptHmacSha1Null.c | 20 ------------
.../Hmac/CryptHmacSha256Null.c | 20 ------------
10 files changed, 231 deletions(-)
diff --git a/CryptoPkg/Include/Library/BaseCryptLib.h b/CryptoPkg/Include/Library/BaseCryptLib.h
index c5803ea673..09fed8b041 100644
--- a/CryptoPkg/Include/Library/BaseCryptLib.h
+++ b/CryptoPkg/Include/Library/BaseCryptLib.h
@@ -1025,23 +1025,6 @@ Sm3HashAll (
// MAC (Message Authentication Code) Primitive
//=====================================================================================
-/**
- Retrieves the size, in bytes, of the context buffer required for HMAC-MD5 operations.
- (NOTE: This API is deprecated.
- Use HmacMd5New() / HmacMd5Free() for HMAC-MD5 Context operations.)
-
- If this interface is not supported, then return zero.
-
- @return The size, in bytes, of the context buffer required for HMAC-MD5 operations.
- @retval 0 This interface is not supported.
-
-**/
-UINTN
-EFIAPI
-HmacMd5GetContextSize (
- VOID
- );
-
/**
Allocates and initializes one HMAC_CTX context for subsequent HMAC-MD5 use.
diff --git a/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5.c b/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5.c
index 7d49dc2698..6775e93ca5 100644
--- a/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5.c
+++ b/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5.c
@@ -9,37 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "InternalCryptLib.h"
#include <openssl/hmac.h>
-//
-// 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.
- (NOTE: This API is deprecated.
- Use HmacMd5New() / HmacMd5Free() for HMAC-MD5 Context operations.)
-
- @return The size, in bytes, of the context buffer required for HMAC-MD5 operations.
-
-**/
-UINTN
-EFIAPI
-HmacMd5GetContextSize (
- VOID
- )
-{
- //
- // Retrieves the OpenSSL HMAC-MD5 Context Size
- // NOTE: HMAC_CTX object was made opaque in openssl-1.1.x, here we just use the
- // fixed size as a workaround to make this API work for compatibility.
- // We should retire HmacMd5GetContextSize() in future, and use HmacMd5New()
- // and HmacMd5Free() for context allocation and release.
- //
- return (UINTN) HMAC_MD5_CTX_SIZE;
-}
-
/**
Allocates and initializes one HMAC_CTX context for subsequent HMAC-MD5 use.
diff --git a/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5Null.c b/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5Null.c
index b77a2266db..9da132eeee 100644
--- a/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5Null.c
+++ b/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5Null.c
@@ -8,26 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "InternalCryptLib.h"
-/**
- Retrieves the size, in bytes, of the context buffer required for HMAC-MD5 operations.
- (NOTE: This API is deprecated.
- Use HmacMd5New() / HmacMd5Free() for HMAC-MD5 Context operations.)
-
- Return zero to indicate this interface is not supported.
-
- @retval 0 This interface is not supported.
-
-**/
-UINTN
-EFIAPI
-HmacMd5GetContextSize (
- VOID
- )
-{
- ASSERT (FALSE);
- return 0;
-}
-
/**
Allocates and initializes one HMAC_CTX context for subsequent HMAC-MD5 use.
diff --git a/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1.c b/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1.c
index 8126fb525f..27d0004a3a 100644
--- a/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1.c
+++ b/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1.c
@@ -9,38 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "InternalCryptLib.h"
#include <openssl/hmac.h>
-//
-// 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.
- (NOTE: This API is deprecated.
- Use HmacSha1New() / HmacSha1Free() for HMAC-SHA1 Context operations.)
-
- @return The size, in bytes, of the context buffer required for HMAC-SHA1 operations.
-
-**/
-UINTN
-EFIAPI
-HmacSha1GetContextSize (
- VOID
- )
-{
- //
- // Retrieves the OpenSSL HMAC-SHA1 Context Size
- // NOTE: HMAC_CTX object was made opaque in openssl-1.1.x, here we just use the
- // fixed size as a workaround to make this API work for compatibility.
- // We should retire HmacSha15GetContextSize() in future, and use HmacSha1New()
- // and HmacSha1Free() for context allocation and release.
- //
- return (UINTN) HMAC_SHA1_CTX_SIZE;
-}
-
/**
Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA1 use.
diff --git a/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1Null.c b/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1Null.c
index 84f204a542..2c26e9d514 100644
--- a/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1Null.c
+++ b/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1Null.c
@@ -8,26 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "InternalCryptLib.h"
-/**
- Retrieves the size, in bytes, of the context buffer required for HMAC-SHA1 operations.
- (NOTE: This API is deprecated.
- Use HmacSha1New() / HmacSha1Free() for HMAC-SHA1 Context operations.)
-
- Return zero to indicate this interface is not supported.
-
- @retval 0 This interface is not supported.
-
-**/
-UINTN
-EFIAPI
-HmacSha1GetContextSize (
- VOID
- )
-{
- ASSERT (FALSE);
- return 0;
-}
-
/**
Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA1 use.
diff --git a/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256.c b/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256.c
index f8fd0b172a..4271eaa27e 100644
--- a/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256.c
+++ b/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256.c
@@ -9,37 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "InternalCryptLib.h"
#include <openssl/hmac.h>
-//
-// 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.
- (NOTE: This API is deprecated.
- Use HmacSha256New() / HmacSha256Free() for HMAC-SHA256 Context operations.)
-
- @return The size, in bytes, of the context buffer required for HMAC-SHA256 operations.
-
-**/
-UINTN
-EFIAPI
-HmacSha256GetContextSize (
- VOID
- )
-{
- //
- // Retrieves the OpenSSL HMAC-SHA256 Context Size
- // NOTE: HMAC_CTX object was made opaque in openssl-1.1.x, here we just use the
- // fixed size as a workaround to make this API work for compatibility.
- // We should retire HmacSha256GetContextSize() in future, and use HmacSha256New()
- // and HmacSha256Free() for context allocation and release.
- //
- return (UINTN)HMAC_SHA256_CTX_SIZE;
-}
-
/**
Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA256 use.
diff --git a/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256Null.c b/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256Null.c
index cededebaa0..1af625ec9f 100644
--- a/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256Null.c
+++ b/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256Null.c
@@ -8,26 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "InternalCryptLib.h"
-/**
- Retrieves the size, in bytes, of the context buffer required for HMAC-SHA256 operations.
- (NOTE: This API is deprecated.
- Use HmacSha256New() / HmacSha256Free() for HMAC-SHA256 Context operations.)
-
- Return zero to indicate this interface is not supported.
-
- @retval 0 This interface is not supported.
-
-**/
-UINTN
-EFIAPI
-HmacSha256GetContextSize (
- VOID
- )
-{
- ASSERT (FALSE);
- return 0;
-}
-
/**
Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA256 use.
diff --git a/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacMd5Null.c b/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacMd5Null.c
index b77a2266db..9da132eeee 100644
--- a/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacMd5Null.c
+++ b/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacMd5Null.c
@@ -8,26 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "InternalCryptLib.h"
-/**
- Retrieves the size, in bytes, of the context buffer required for HMAC-MD5 operations.
- (NOTE: This API is deprecated.
- Use HmacMd5New() / HmacMd5Free() for HMAC-MD5 Context operations.)
-
- Return zero to indicate this interface is not supported.
-
- @retval 0 This interface is not supported.
-
-**/
-UINTN
-EFIAPI
-HmacMd5GetContextSize (
- VOID
- )
-{
- ASSERT (FALSE);
- return 0;
-}
-
/**
Allocates and initializes one HMAC_CTX context for subsequent HMAC-MD5 use.
diff --git a/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacSha1Null.c b/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacSha1Null.c
index 84f204a542..2c26e9d514 100644
--- a/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacSha1Null.c
+++ b/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacSha1Null.c
@@ -8,26 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "InternalCryptLib.h"
-/**
- Retrieves the size, in bytes, of the context buffer required for HMAC-SHA1 operations.
- (NOTE: This API is deprecated.
- Use HmacSha1New() / HmacSha1Free() for HMAC-SHA1 Context operations.)
-
- Return zero to indicate this interface is not supported.
-
- @retval 0 This interface is not supported.
-
-**/
-UINTN
-EFIAPI
-HmacSha1GetContextSize (
- VOID
- )
-{
- ASSERT (FALSE);
- return 0;
-}
-
/**
Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA1 use.
diff --git a/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacSha256Null.c b/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacSha256Null.c
index cededebaa0..1af625ec9f 100644
--- a/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacSha256Null.c
+++ b/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacSha256Null.c
@@ -8,26 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "InternalCryptLib.h"
-/**
- Retrieves the size, in bytes, of the context buffer required for HMAC-SHA256 operations.
- (NOTE: This API is deprecated.
- Use HmacSha256New() / HmacSha256Free() for HMAC-SHA256 Context operations.)
-
- Return zero to indicate this interface is not supported.
-
- @retval 0 This interface is not supported.
-
-**/
-UINTN
-EFIAPI
-HmacSha256GetContextSize (
- VOID
- )
-{
- ASSERT (FALSE);
- return 0;
-}
-
/**
Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA256 use.
--
2.24.0.windows.2
next prev parent reply other threads:[~2020-01-16 6:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-16 6:10 [PATCH v3 0/2] Remove deprecated code in BaseCryptLib Wang, Jian J
2020-01-16 6:10 ` [PATCH v3 1/2] CryptoPkg/BaseCryptLib: replace HmacXxxInit API with HmacXxxSetKey Wang, Jian J
2020-01-16 9:08 ` Laszlo Ersek
2020-01-17 2:19 ` Wang, Jian J
2020-01-16 6:10 ` Wang, Jian J [this message]
2020-01-16 9:13 ` [PATCH v3 2/2] CryptoPkg/BaseCryptLib: remove HmacXxxGetContextSize interface Laszlo Ersek
2020-01-19 2:04 ` [edk2-devel] [PATCH v3 0/2] Remove deprecated code in BaseCryptLib Xiaoyu Lu
2020-01-20 16:25 ` Wang, Jian J
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200116061004.636-3-jian.j.wang@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox