[edk2-devel] [PATCH V2 7/7] CryptoPkg: Make the MD5 disable as default for security

Gao, Zhichao posted 7 patches 5 years, 3 months ago
There is a newer version of this series
[edk2-devel] [PATCH V2 7/7] CryptoPkg: Make the MD5 disable as default for security
Posted by Gao, Zhichao 5 years, 3 months ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3021

Make the deprecated MD5 disable as default setting for
security.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
---
 CryptoPkg/Driver/Crypto.c                              | 4 ++--
 CryptoPkg/Include/Library/BaseCryptLib.h               | 2 +-
 CryptoPkg/Library/BaseCryptLib/Hash/CryptMd5.c         | 2 +-
 CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/CryptoPkg/Driver/Crypto.c b/CryptoPkg/Driver/Crypto.c
index d9096ea603..26f280cd5d 100644
--- a/CryptoPkg/Driver/Crypto.c
+++ b/CryptoPkg/Driver/Crypto.c
@@ -243,7 +243,7 @@ DeprecatedCryptoServiceMd4HashAll (
   return BaseCryptLibServiceDeprecated ("Md4HashAll"), FALSE;
 }
 
-#ifdef DISABLE_MD5_DEPRECATED_INTERFACES
+#ifndef ENABLE_MD5_DEPRECATED_INTERFACES
 /**
   Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
 
@@ -4494,7 +4494,7 @@ const EDKII_CRYPTO_PROTOCOL mEdkiiCrypto = {
   DeprecatedCryptoServiceMd4Update,
   DeprecatedCryptoServiceMd4Final,
   DeprecatedCryptoServiceMd4HashAll,
-#ifdef DISABLE_MD5_DEPRECATED_INTERFACES
+#ifndef ENABLE_MD5_DEPRECATED_INTERFACES
   /// Md5 - deprecated and unsupported
   DeprecatedCryptoServiceMd5GetContextSize,
   DeprecatedCryptoServiceMd5Init,
diff --git a/CryptoPkg/Include/Library/BaseCryptLib.h b/CryptoPkg/Include/Library/BaseCryptLib.h
index ae9bde9e37..496121e6a4 100644
--- a/CryptoPkg/Include/Library/BaseCryptLib.h
+++ b/CryptoPkg/Include/Library/BaseCryptLib.h
@@ -72,7 +72,7 @@ typedef enum {
 //    One-Way Cryptographic Hash Primitives
 //=====================================================================================
 
-#ifndef DISABLE_MD5_DEPRECATED_INTERFACES
+#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
 /**
   Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
 
diff --git a/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd5.c b/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd5.c
index b85e7f4d12..d670f17424 100644
--- a/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd5.c
+++ b/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd5.c
@@ -9,7 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include "InternalCryptLib.h"
 #include <openssl/md5.h>
 
-#ifndef DISABLE_MD5_DEPRECATED_INTERFACES
+#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
 /**
   Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
 
diff --git a/CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c b/CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c
index 3f14c6d262..8b43d1363c 100644
--- a/CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c
+++ b/CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c
@@ -99,7 +99,7 @@ CryptoServiceNotAvailable (
 //    One-Way Cryptographic Hash Primitives
 //=====================================================================================
 
-#ifndef DISABLE_MD5_DEPRECATED_INTERFACES
+#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
 /**
   Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.
 
-- 
2.21.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66626): https://edk2.groups.io/g/devel/message/66626
Mute This Topic: https://groups.io/mt/77831682/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH V2 7/7] CryptoPkg: Make the MD5 disable as default for security
Posted by Yao, Jiewen 5 years, 3 months ago
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>

> -----Original Message-----
> From: Gao, Zhichao <zhichao.gao@intel.com>
> Sent: Tuesday, October 27, 2020 10:43 AM
> To: devel@edk2.groups.io
> Cc: Yao, Jiewen <jiewen.yao@intel.com>; Wang, Jian J
> <jian.j.wang@intel.com>; Lu, XiaoyuX <xiaoyux.lu@intel.com>; Jiang, Guomin
> <guomin.jiang@intel.com>
> Subject: [PATCH V2 7/7] CryptoPkg: Make the MD5 disable as default for
> security
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3021
> 
> Make the deprecated MD5 disable as default setting for
> security.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
> Cc: Guomin Jiang <guomin.jiang@intel.com>
> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
> ---
>  CryptoPkg/Driver/Crypto.c                              | 4 ++--
>  CryptoPkg/Include/Library/BaseCryptLib.h               | 2 +-
>  CryptoPkg/Library/BaseCryptLib/Hash/CryptMd5.c         | 2 +-
>  CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c | 2 +-
>  4 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/CryptoPkg/Driver/Crypto.c b/CryptoPkg/Driver/Crypto.c
> index d9096ea603..26f280cd5d 100644
> --- a/CryptoPkg/Driver/Crypto.c
> +++ b/CryptoPkg/Driver/Crypto.c
> @@ -243,7 +243,7 @@ DeprecatedCryptoServiceMd4HashAll (
>    return BaseCryptLibServiceDeprecated ("Md4HashAll"), FALSE;
>  }
> 
> -#ifdef DISABLE_MD5_DEPRECATED_INTERFACES
> +#ifndef ENABLE_MD5_DEPRECATED_INTERFACES
>  /**
>    Retrieves the size, in bytes, of the context buffer required for MD5 hash
> operations.
> 
> @@ -4494,7 +4494,7 @@ const EDKII_CRYPTO_PROTOCOL mEdkiiCrypto = {
>    DeprecatedCryptoServiceMd4Update,
>    DeprecatedCryptoServiceMd4Final,
>    DeprecatedCryptoServiceMd4HashAll,
> -#ifdef DISABLE_MD5_DEPRECATED_INTERFACES
> +#ifndef ENABLE_MD5_DEPRECATED_INTERFACES
>    /// Md5 - deprecated and unsupported
>    DeprecatedCryptoServiceMd5GetContextSize,
>    DeprecatedCryptoServiceMd5Init,
> diff --git a/CryptoPkg/Include/Library/BaseCryptLib.h
> b/CryptoPkg/Include/Library/BaseCryptLib.h
> index ae9bde9e37..496121e6a4 100644
> --- a/CryptoPkg/Include/Library/BaseCryptLib.h
> +++ b/CryptoPkg/Include/Library/BaseCryptLib.h
> @@ -72,7 +72,7 @@ typedef enum {
>  //    One-Way Cryptographic Hash Primitives
> 
> //===============================================================
> ======================
> 
> -#ifndef DISABLE_MD5_DEPRECATED_INTERFACES
> +#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
>  /**
>    Retrieves the size, in bytes, of the context buffer required for MD5 hash
> operations.
> 
> diff --git a/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd5.c
> b/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd5.c
> index b85e7f4d12..d670f17424 100644
> --- a/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd5.c
> +++ b/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd5.c
> @@ -9,7 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #include "InternalCryptLib.h"
>  #include <openssl/md5.h>
> 
> -#ifndef DISABLE_MD5_DEPRECATED_INTERFACES
> +#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
>  /**
>    Retrieves the size, in bytes, of the context buffer required for MD5 hash
> operations.
> 
> diff --git a/CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c
> b/CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c
> index 3f14c6d262..8b43d1363c 100644
> --- a/CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c
> +++ b/CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c
> @@ -99,7 +99,7 @@ CryptoServiceNotAvailable (
>  //    One-Way Cryptographic Hash Primitives
> 
> //===============================================================
> ======================
> 
> -#ifndef DISABLE_MD5_DEPRECATED_INTERFACES
> +#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
>  /**
>    Retrieves the size, in bytes, of the context buffer required for MD5 hash
> operations.
> 
> --
> 2.21.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66630): https://edk2.groups.io/g/devel/message/66630
Mute This Topic: https://groups.io/mt/77831682/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-