CryptoPkg/Library: Cleanup BaseCryptLib and TlsLib
* Move SysCall/inet_pton.c from BaseCryptLib to TlsLib. The functions in this file are only used by TlsLib instances and not any CryptLib instances. * Fix type mismatch in call to FreePool() in TlsConfig.c * Remove use of gEfiCryptoPkgTokenSpaceGuid.PcdOpensslEcEnabled from TslLib and CryptLib instances * Add missing *Null.c files to SecCryptLib.inf and RuntimeCryptLib.inf. * Remove ARM and AARCH64 sections from SmmCryptLib.inf that does not support those architectures. * Add missing PrintLib dependencies to [LibraryClasses] sections of CryptLib INF files * Remove extra library classes from [LibraryClasses] sections of CryptLib INF files * Remove unnecessary warning disables from [BuildOptions] sections of TlsLib and CryptLib INF files * Remove RVCT support from SecCryptLib.inf Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com> Cc: Guomin Jiang <guomin.jiang@intel.com> Cc: Christopher Zurcher <christopher.zurcher@microsoft.com> Cc: Rebecca Cran <quic_rcran@quicinc.com> Cc: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
961fadf60c
commit
dd00f92b2f
@ -54,15 +54,13 @@
|
|||||||
Pk/CryptTs.c
|
Pk/CryptTs.c
|
||||||
Pk/CryptRsaPss.c
|
Pk/CryptRsaPss.c
|
||||||
Pk/CryptRsaPssSign.c
|
Pk/CryptRsaPssSign.c
|
||||||
Pk/CryptEcNull.c |*|*|*|!gEfiCryptoPkgTokenSpaceGuid.PcdOpensslEcEnabled
|
Pk/CryptEc.c
|
||||||
Pk/CryptEc.c |*|*|*|gEfiCryptoPkgTokenSpaceGuid.PcdOpensslEcEnabled
|
|
||||||
Pem/CryptPem.c
|
Pem/CryptPem.c
|
||||||
Bn/CryptBn.c
|
Bn/CryptBn.c
|
||||||
|
|
||||||
SysCall/CrtWrapper.c
|
SysCall/CrtWrapper.c
|
||||||
SysCall/TimerWrapper.c
|
SysCall/TimerWrapper.c
|
||||||
SysCall/BaseMemAllocation.c
|
SysCall/BaseMemAllocation.c
|
||||||
SysCall/inet_pton.c
|
|
||||||
|
|
||||||
[Sources.Ia32]
|
[Sources.Ia32]
|
||||||
Rand/CryptRandTsc.c
|
Rand/CryptRandTsc.c
|
||||||
@ -96,19 +94,13 @@
|
|||||||
IntrinsicLib
|
IntrinsicLib
|
||||||
PrintLib
|
PrintLib
|
||||||
|
|
||||||
[FixedPcd]
|
|
||||||
gEfiCryptoPkgTokenSpaceGuid.PcdOpensslEcEnabled
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Remove these [BuildOptions] after this library is cleaned up
|
# Remove these [BuildOptions] after this library is cleaned up
|
||||||
#
|
#
|
||||||
[BuildOptions]
|
[BuildOptions]
|
||||||
#
|
#
|
||||||
# suppress the following warnings so we do not break the build with warnings-as-errors:
|
# suppress the following warnings so we do not break the build with warnings-as-errors:
|
||||||
# C4090: 'function' : different 'const' qualifiers
|
|
||||||
#
|
#
|
||||||
MSFT:*_*_*_CC_FLAGS = /wd4090
|
|
||||||
|
|
||||||
GCC:*_CLANG35_*_CC_FLAGS = -std=c99
|
GCC:*_CLANG35_*_CC_FLAGS = -std=c99
|
||||||
GCC:*_CLANG38_*_CC_FLAGS = -std=c99
|
GCC:*_CLANG38_*_CC_FLAGS = -std=c99
|
||||||
GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
|
GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
|
||||||
|
@ -79,9 +79,7 @@
|
|||||||
DebugLib
|
DebugLib
|
||||||
OpensslLib
|
OpensslLib
|
||||||
IntrinsicLib
|
IntrinsicLib
|
||||||
|
PrintLib
|
||||||
[FixedPcd]
|
|
||||||
gEfiCryptoPkgTokenSpaceGuid.PcdOpensslEcEnabled
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Remove these [BuildOptions] after this library is cleaned up
|
# Remove these [BuildOptions] after this library is cleaned up
|
||||||
@ -89,11 +87,7 @@
|
|||||||
[BuildOptions]
|
[BuildOptions]
|
||||||
#
|
#
|
||||||
# suppress the following warnings so we do not break the build with warnings-as-errors:
|
# suppress the following warnings so we do not break the build with warnings-as-errors:
|
||||||
# C4090: 'function' : different 'const' qualifiers
|
|
||||||
# C4718: 'function call' : recursive call has no side effects, deleting
|
|
||||||
#
|
#
|
||||||
MSFT:*_*_*_CC_FLAGS = /wd4090 /wd4718
|
|
||||||
|
|
||||||
GCC:*_CLANG35_*_CC_FLAGS = -std=c99
|
GCC:*_CLANG35_*_CC_FLAGS = -std=c99
|
||||||
GCC:*_CLANG38_*_CC_FLAGS = -std=c99
|
GCC:*_CLANG38_*_CC_FLAGS = -std=c99
|
||||||
GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
|
GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
|
||||||
|
@ -153,7 +153,6 @@ EcGetPrivateKeyFromPem (
|
|||||||
OUT VOID **EcContext
|
OUT VOID **EcContext
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if FixedPcdGetBool (PcdOpensslEcEnabled)
|
|
||||||
BOOLEAN Status;
|
BOOLEAN Status;
|
||||||
BIO *PemBio;
|
BIO *PemBio;
|
||||||
|
|
||||||
@ -209,7 +208,4 @@ _Exit:
|
|||||||
BIO_free (PemBio);
|
BIO_free (PemBio);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
#else
|
|
||||||
return FALSE;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -881,7 +881,6 @@ EcGetPublicKeyFromX509 (
|
|||||||
OUT VOID **EcContext
|
OUT VOID **EcContext
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if FixedPcdGetBool (PcdOpensslEcEnabled)
|
|
||||||
BOOLEAN Status;
|
BOOLEAN Status;
|
||||||
EVP_PKEY *Pkey;
|
EVP_PKEY *Pkey;
|
||||||
X509 *X509Cert;
|
X509 *X509Cert;
|
||||||
@ -935,9 +934,6 @@ _Exit:
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
#else
|
|
||||||
return FALSE;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,7 +60,9 @@
|
|||||||
Pk/CryptTsNull.c
|
Pk/CryptTsNull.c
|
||||||
Pk/CryptRsaPssNull.c
|
Pk/CryptRsaPssNull.c
|
||||||
Pk/CryptRsaPssSignNull.c
|
Pk/CryptRsaPssSignNull.c
|
||||||
|
Pk/CryptEcNull.c
|
||||||
Pem/CryptPem.c
|
Pem/CryptPem.c
|
||||||
|
Bn/CryptBnNull.c
|
||||||
|
|
||||||
SysCall/CrtWrapper.c
|
SysCall/CrtWrapper.c
|
||||||
SysCall/TimerWrapper.c
|
SysCall/TimerWrapper.c
|
||||||
@ -91,26 +93,19 @@
|
|||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
BaseLib
|
BaseLib
|
||||||
BaseMemoryLib
|
BaseMemoryLib
|
||||||
UefiBootServicesTableLib
|
|
||||||
UefiRuntimeServicesTableLib
|
UefiRuntimeServicesTableLib
|
||||||
DebugLib
|
DebugLib
|
||||||
OpensslLib
|
OpensslLib
|
||||||
IntrinsicLib
|
IntrinsicLib
|
||||||
PrintLib
|
PrintLib
|
||||||
|
|
||||||
[FixedPcd]
|
|
||||||
gEfiCryptoPkgTokenSpaceGuid.PcdOpensslEcEnabled
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Remove these [BuildOptions] after this library is cleaned up
|
# Remove these [BuildOptions] after this library is cleaned up
|
||||||
#
|
#
|
||||||
[BuildOptions]
|
[BuildOptions]
|
||||||
#
|
#
|
||||||
# suppress the following warnings so we do not break the build with warnings-as-errors:
|
# suppress the following warnings so we do not break the build with warnings-as-errors:
|
||||||
# C4090: 'function' : different 'const' qualifiers
|
|
||||||
#
|
#
|
||||||
MSFT:*_*_*_CC_FLAGS = /wd4090
|
|
||||||
|
|
||||||
GCC:*_CLANG35_*_CC_FLAGS = -std=c99
|
GCC:*_CLANG35_*_CC_FLAGS = -std=c99
|
||||||
GCC:*_CLANG38_*_CC_FLAGS = -std=c99
|
GCC:*_CLANG38_*_CC_FLAGS = -std=c99
|
||||||
GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
|
GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
Hmac/CryptHmacNull.c
|
Hmac/CryptHmacNull.c
|
||||||
Kdf/CryptHkdfNull.c
|
Kdf/CryptHkdfNull.c
|
||||||
Cipher/CryptAesNull.c
|
Cipher/CryptAesNull.c
|
||||||
|
Cipher/CryptAeadAesGcmNull.c
|
||||||
Pk/CryptRsaBasicNull.c
|
Pk/CryptRsaBasicNull.c
|
||||||
Pk/CryptRsaExtNull.c
|
Pk/CryptRsaExtNull.c
|
||||||
Pk/CryptPkcs1OaepNull.c
|
Pk/CryptPkcs1OaepNull.c
|
||||||
@ -53,6 +54,8 @@
|
|||||||
Rand/CryptRandNull.c
|
Rand/CryptRandNull.c
|
||||||
Pk/CryptRsaPssNull.c
|
Pk/CryptRsaPssNull.c
|
||||||
Pk/CryptRsaPssSignNull.c
|
Pk/CryptRsaPssSignNull.c
|
||||||
|
Pk/CryptEcNull.c
|
||||||
|
Bn/CryptBnNull.c
|
||||||
|
|
||||||
SysCall/CrtWrapper.c
|
SysCall/CrtWrapper.c
|
||||||
SysCall/ConstantTimeClock.c
|
SysCall/ConstantTimeClock.c
|
||||||
@ -69,6 +72,7 @@
|
|||||||
DebugLib
|
DebugLib
|
||||||
OpensslLib
|
OpensslLib
|
||||||
IntrinsicLib
|
IntrinsicLib
|
||||||
|
PrintLib
|
||||||
|
|
||||||
#
|
#
|
||||||
# Remove these [BuildOptions] after this library is cleaned up
|
# Remove these [BuildOptions] after this library is cleaned up
|
||||||
@ -76,15 +80,7 @@
|
|||||||
[BuildOptions]
|
[BuildOptions]
|
||||||
#
|
#
|
||||||
# suppress the following warnings so we do not break the build with warnings-as-errors:
|
# suppress the following warnings so we do not break the build with warnings-as-errors:
|
||||||
# C4090: 'function' : different 'const' qualifiers
|
|
||||||
# C4718: 'function call' : recursive call has no side effects, deleting
|
|
||||||
#
|
#
|
||||||
MSFT:*_*_*_CC_FLAGS = /wd4090 /wd4718
|
|
||||||
|
|
||||||
# -JCryptoPkg/Include : To disable the use of the system includes provided by RVCT
|
|
||||||
# --diag_remark=1 : Reduce severity of "#1-D: last line of file ends without a newline"
|
|
||||||
RVCT:*_*_ARM_CC_FLAGS = -JCryptoPkg/Include --diag_remark=1
|
|
||||||
|
|
||||||
GCC:*_CLANG35_*_CC_FLAGS = -std=c99
|
GCC:*_CLANG35_*_CC_FLAGS = -std=c99
|
||||||
GCC:*_CLANG38_*_CC_FLAGS = -std=c99
|
GCC:*_CLANG38_*_CC_FLAGS = -std=c99
|
||||||
GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
|
GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
|
||||||
|
@ -74,19 +74,12 @@
|
|||||||
[Sources.X64]
|
[Sources.X64]
|
||||||
Rand/CryptRandTsc.c
|
Rand/CryptRandTsc.c
|
||||||
|
|
||||||
[Sources.ARM]
|
|
||||||
Rand/CryptRand.c
|
|
||||||
|
|
||||||
[Sources.AARCH64]
|
|
||||||
Rand/CryptRand.c
|
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
CryptoPkg/CryptoPkg.dec
|
CryptoPkg/CryptoPkg.dec
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
BaseLib
|
BaseLib
|
||||||
IoLib
|
|
||||||
BaseMemoryLib
|
BaseMemoryLib
|
||||||
MemoryAllocationLib
|
MemoryAllocationLib
|
||||||
OpensslLib
|
OpensslLib
|
||||||
@ -95,18 +88,13 @@
|
|||||||
MmServicesTableLib
|
MmServicesTableLib
|
||||||
SynchronizationLib
|
SynchronizationLib
|
||||||
|
|
||||||
[FixedPcd]
|
|
||||||
gEfiCryptoPkgTokenSpaceGuid.PcdOpensslEcEnabled
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Remove these [BuildOptions] after this library is cleaned up
|
# Remove these [BuildOptions] after this library is cleaned up
|
||||||
#
|
#
|
||||||
[BuildOptions]
|
[BuildOptions]
|
||||||
#
|
#
|
||||||
# suppress the following warnings so we do not break the build with warnings-as-errors:
|
# suppress the following warnings so we do not break the build with warnings-as-errors:
|
||||||
# C4090: 'function' : different 'const' qualifiers
|
|
||||||
#
|
#
|
||||||
MSFT:*_*_*_CC_FLAGS = /wd4090
|
|
||||||
|
|
||||||
XCODE:*_*_*_CC_FLAGS = -mmmx -msse -std=c99
|
XCODE:*_*_*_CC_FLAGS = -mmmx -msse -std=c99
|
||||||
|
|
||||||
|
@ -478,7 +478,7 @@ FreeCipherString:
|
|||||||
FreePool (CipherString);
|
FreePool (CipherString);
|
||||||
|
|
||||||
FreeMappedCipher:
|
FreeMappedCipher:
|
||||||
FreePool (MappedCipher);
|
FreePool ((VOID *)MappedCipher);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@ -1136,9 +1136,6 @@ TlsSetEcCurve (
|
|||||||
IN UINTN DataSize
|
IN UINTN DataSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if !FixedPcdGetBool (PcdOpensslEcEnabled)
|
|
||||||
return EFI_UNSUPPORTED;
|
|
||||||
#else
|
|
||||||
TLS_CONNECTION *TlsConn;
|
TLS_CONNECTION *TlsConn;
|
||||||
EC_KEY *EcKey;
|
EC_KEY *EcKey;
|
||||||
INT32 Nid;
|
INT32 Nid;
|
||||||
@ -1170,23 +1167,22 @@ TlsSetEcCurve (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (SSL_set1_curves (TlsConn->Ssl, &Nid, 1) != 1) {
|
if (SSL_set1_curves (TlsConn->Ssl, &Nid, 1) != 1) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
EcKey = EC_KEY_new_by_curve_name (Nid);
|
EcKey = EC_KEY_new_by_curve_name (Nid);
|
||||||
if (EcKey == NULL) {
|
if (EcKey == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = SSL_set_tmp_ecdh (TlsConn->Ssl, EcKey);
|
Ret = SSL_set_tmp_ecdh (TlsConn->Ssl, EcKey);
|
||||||
EC_KEY_free (EcKey);
|
EC_KEY_free (EcKey);
|
||||||
|
|
||||||
if (Ret != 1) {
|
if (Ret != 1) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
TlsInit.c
|
TlsInit.c
|
||||||
TlsConfig.c
|
TlsConfig.c
|
||||||
TlsProcess.c
|
TlsProcess.c
|
||||||
|
SysCall/inet_pton.c
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
@ -41,14 +42,3 @@
|
|||||||
MemoryAllocationLib
|
MemoryAllocationLib
|
||||||
OpensslLib
|
OpensslLib
|
||||||
SafeIntLib
|
SafeIntLib
|
||||||
|
|
||||||
[FixedPcd]
|
|
||||||
gEfiCryptoPkgTokenSpaceGuid.PcdOpensslEcEnabled
|
|
||||||
|
|
||||||
[BuildOptions]
|
|
||||||
#
|
|
||||||
# suppress the following warnings so we do not break the build with warnings-as-errors:
|
|
||||||
# C4090: 'function' : different 'const' qualifiers
|
|
||||||
#
|
|
||||||
MSFT:*_*_*_CC_FLAGS = /wd4090
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user