Skip to content

Commit

Permalink
CryptoPkg: Add all .inf files for BaseCryptLibMbedTls
Browse files Browse the repository at this point in the history
Add .inf files and other support files.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4177

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yi Li <yi1.li@intel.com>
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Signed-off-by: Wenxing Hou <wenxing.hou@intel.com>
Reviewed-by: Yi Li <yi1.li@intel.com>
  • Loading branch information
Wenxing-hou authored and mergify[bot] committed Oct 12, 2023
1 parent 97f51f2 commit b26f7df
Show file tree
Hide file tree
Showing 19 changed files with 1,718 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CryptoPkg/CryptoPkg.dec
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
Library/OpensslLib/openssl/providers/implementations/include
Library/OpensslLib/OpensslGen/include
Library/OpensslLib/OpensslGen/providers/common/include
Library/MbedTlsLib/Include
Library/MbedTlsLib/mbedtls
Library/MbedTlsLib/mbedtls/include
Library/MbedTlsLib/mbedtls/include/mbedtls

[LibraryClasses]
## @libraryclass Provides basic library functions for cryptographic primitives.
Expand Down
280 changes: 280 additions & 0 deletions CryptoPkg/CryptoPkgMbedTls.dsc

Large diffs are not rendered by default.

81 changes: 81 additions & 0 deletions CryptoPkg/Library/BaseCryptLibMbedTls/BaseCryptLib.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
## @file
# Cryptographic Library Instance for DXE_DRIVER.
#
# Caution: This module requires additional review when modified.
# This library will have external input - signature.
# This external input must be validated carefully to avoid security issues such as
# buffer overflow or integer overflow.
#
# Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##

[Defines]
INF_VERSION = 0x00010005
BASE_NAME = BaseCryptLib
FILE_GUID = 693C5308-AF95-4CE5-ADE9-CA011C2FC642
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = BaseCryptLib|DXE_DRIVER DXE_CORE UEFI_APPLICATION UEFI_DRIVER

#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
#

[Sources]
InternalCryptLib.h
Cipher/CryptAeadAesGcmNull.c
Cipher/CryptAes.c
Hash/CryptSha256.c
Hash/CryptSha512.c
Hash/CryptParallelHashNull.c
Hash/CryptSm3Null.c
Hash/CryptMd5.c
Hash/CryptSha1.c
Hmac/CryptHmac.c
Kdf/CryptHkdf.c
Pk/CryptRsaBasic.c
Pk/CryptRsaExtNull.c
Pk/CryptRsaPss.c
Pk/CryptRsaPssSignNull.c
Bn/CryptBnNull.c
Pem/CryptPemNull.c
Pk/CryptDhNull.c
Pk/CryptEcNull.c
Pk/CryptPkcs1OaepNull.c
Pk/CryptPkcs5Pbkdf2Null.c
Pk/CryptPkcs7SignNull.c
Pk/CryptPkcs7VerifyNull.c
Pk/CryptPkcs7VerifyEkuNull.c
Pk/CryptX509Null.c
Pk/CryptAuthenticodeNull.c
Pk/CryptTsNull.c
Rand/CryptRandNull.c
SysCall/CrtWrapper.c
SysCall/TimerWrapper.c

[Packages]
MdePkg/MdePkg.dec
CryptoPkg/CryptoPkg.dec

[LibraryClasses]
BaseLib
BaseMemoryLib
MemoryAllocationLib
UefiRuntimeServicesTableLib
DebugLib
MbedTlsLib
PrintLib
IntrinsicLib
RngLib
SynchronizationLib
[Protocols]
gEfiMpServiceProtocolGuid
#
# Remove these [BuildOptions] after this library is cleaned up
#
[BuildOptions]
MSFT:*_*_*_CC_FLAGS = /GL-
101 changes: 101 additions & 0 deletions CryptoPkg/Library/BaseCryptLibMbedTls/PeiCryptLib.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
## @file
# Cryptographic Library Instance for PEIM.
#
# Caution: This module requires additional review when modified.
# This library will have external input - signature.
# This external input must be validated carefully to avoid security issues such as
# buffer overflow or integer overflow.
#
# Note:
# HMAC-SHA256 functions, AES functions, RSA external
# functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, X.509
# certificate handler functions, authenticode signature verification functions,
# PEM handler functions, and pseudorandom number generator functions are not
# supported in this instance.
#
# Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##

[Defines]
INF_VERSION = 0x00010005
BASE_NAME = PeiCryptLib
MODULE_UNI_FILE = PeiCryptLib.uni
FILE_GUID = 91E0A3C3-37A7-4AEE-8689-C5B0AD2C8E63
MODULE_TYPE = PEIM
VERSION_STRING = 1.0
LIBRARY_CLASS = BaseCryptLib|PEIM PEI_CORE

#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64
#

[Sources]
InternalCryptLib.h
Hash/CryptMd5.c
Hash/CryptSha1.c
Hash/CryptSha256.c
Hash/CryptSm3Null.c
Hash/CryptSha512.c
Hash/CryptParallelHashNull.c
Hmac/CryptHmac.c
Kdf/CryptHkdf.c
Cipher/CryptAes.c
Cipher/CryptAeadAesGcmNull.c
Pk/CryptRsaBasic.c
Pk/CryptRsaExtNull.c
Pk/CryptRsaPss.c
Pk/CryptRsaPssSignNull.c
Bn/CryptBnNull.c
Pem/CryptPemNull.c
Pk/CryptDhNull.c
Pk/CryptEcNull.c
Pk/CryptPkcs1OaepNull.c
Pk/CryptPkcs5Pbkdf2Null.c
Pk/CryptPkcs7SignNull.c
Pk/CryptPkcs7VerifyNull.c
Pk/CryptPkcs7VerifyEkuNull.c
Pk/CryptX509Null.c
Pk/CryptAuthenticodeNull.c
Pk/CryptTsNull.c
Rand/CryptRandNull.c
SysCall/CrtWrapper.c
SysCall/ConstantTimeClock.c

[Packages]
MdePkg/MdePkg.dec
CryptoPkg/CryptoPkg.dec

[LibraryClasses]
BaseLib
BaseMemoryLib
MemoryAllocationLib
DebugLib
MbedTlsLib
IntrinsicLib
PrintLib
PeiServicesTablePointerLib
PeiServicesLib
SynchronizationLib

[Ppis]
gEfiPeiMpServicesPpiGuid
#
# Remove these [BuildOptions] after this library is cleaned up
#
[BuildOptions]
#
# 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:*_CLANG38_*_CC_FLAGS = -std=c99
GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types

XCODE:*_*_*_CC_FLAGS = -std=c99
25 changes: 25 additions & 0 deletions CryptoPkg/Library/BaseCryptLibMbedTls/PeiCryptLib.uni
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// /** @file
// Cryptographic Library Instance for PEIM.
//
// Caution: This module requires additional review when modified.
// This library will have external input - signature.
// This external input must be validated carefully to avoid security issues such as
// buffer overflow or integer overflow.
//
// Note: AES
// functions, RSA external functions, PKCS#7 SignedData sign functions,
// Diffie-Hellman functions, X.509 certificate handler functions, authenticode
// signature verification functions, PEM handler functions, and pseudorandom number
// generator functions are not supported in this instance.
//
// Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
// **/


#string STR_MODULE_ABSTRACT #language en-US "Cryptographic Library Instance for PEIM"

#string STR_MODULE_DESCRIPTION #language en-US "Caution: This module requires additional review when modified. This library will have external input - signature. This external input must be validated carefully to avoid security issues such as buffer overflow or integer overflow. Note: AES functions, RSA external functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, X.509 certificate handler functions, authenticode signature verification functions, PEM handler functions, and pseudorandom number generator functions are not supported in this instance."

92 changes: 92 additions & 0 deletions CryptoPkg/Library/BaseCryptLibMbedTls/RuntimeCryptLib.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
## @file
# Cryptographic Library Instance for DXE_RUNTIME_DRIVER.
#
# Caution: This module requires additional review when modified.
# This library will have external input - signature.
# This external input must be validated carefully to avoid security issues such as
# buffer overflow or integer overflow.
#
# Note: SHA-384 Digest functions, SHA-512 Digest functions,
# HMAC-SHA256 functions, AES functions, RSA external
# functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, and
# authenticode signature verification functions are not supported in this instance.
#
# Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##

[Defines]
INF_VERSION = 0x00010005
BASE_NAME = RuntimeCryptLib
MODULE_UNI_FILE = RuntimeCryptLib.uni
FILE_GUID = D263B580-D9FC-4DC4-B445-578AAEFF530E
MODULE_TYPE = DXE_RUNTIME_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = BaseCryptLib|DXE_RUNTIME_DRIVER
CONSTRUCTOR = RuntimeCryptLibConstructor

#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
#

[Sources]
InternalCryptLib.h
Hash/CryptMd5.c
Hash/CryptSha1.c
Hash/CryptSha256.c
Hash/CryptSm3Null.c
Hash/CryptSha512.c
Hash/CryptParallelHashNull.c
Hmac/CryptHmac.c
Kdf/CryptHkdf.c
Cipher/CryptAes.c
Cipher/CryptAeadAesGcmNull.c
Pk/CryptRsaBasic.c
Pk/CryptRsaExtNull.c
Pk/CryptRsaPssNull.c
Pk/CryptRsaPssSignNull.c
Bn/CryptBnNull.c
Pem/CryptPemNull.c
Pk/CryptDhNull.c
Pk/CryptEcNull.c
Pk/CryptPkcs1OaepNull.c
Pk/CryptPkcs5Pbkdf2Null.c
Pk/CryptPkcs7SignNull.c
Pk/CryptPkcs7VerifyNull.c
Pk/CryptPkcs7VerifyEkuNull.c
Pk/CryptX509Null.c
Pk/CryptAuthenticodeNull.c
Pk/CryptTsNull.c
Rand/CryptRandNull.c
SysCall/CrtWrapper.c
SysCall/TimerWrapper.c
SysCall/RuntimeMemAllocation.c

[Packages]
MdePkg/MdePkg.dec
CryptoPkg/CryptoPkg.dec

[LibraryClasses]
BaseLib
BaseMemoryLib
UefiRuntimeServicesTableLib
DebugLib
MbedTlsLib
IntrinsicLib
PrintLib

#
# Remove these [BuildOptions] after this library is cleaned up
#
[BuildOptions]
#
# suppress the following warnings so we do not break the build with warnings-as-errors:
#
GCC:*_CLANG35_*_CC_FLAGS = -std=c99
GCC:*_CLANG38_*_CC_FLAGS = -std=c99
GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types

XCODE:*_*_*_CC_FLAGS = -std=c99
22 changes: 22 additions & 0 deletions CryptoPkg/Library/BaseCryptLibMbedTls/RuntimeCryptLib.uni
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// /** @file
// Cryptographic Library Instance for DXE_RUNTIME_DRIVER.
//
// Caution: This module requires additional review when modified.
// This library will have external input - signature.
// This external input must be validated carefully to avoid security issues such as
// buffer overflow or integer overflow.
//
// Note: AES
// functions, RSA external functions, PKCS#7 SignedData sign functions,
// Diffie-Hellman functions, and authenticode signature verification functions are
// not supported in this instance.
//
// Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
// **/

#string STR_MODULE_ABSTRACT #language en-US "Cryptographic Library Instance for DXE_RUNTIME_DRIVER"

#string STR_MODULE_DESCRIPTION #language en-US "Caution: This module requires additional review when modified. This library will have external input - signature. This external input must be validated carefully to avoid security issues such as buffer overflow or integer overflow. Note: AES functions, RSA external functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, and authenticode signature verification functions are not supported in this instance."
Loading

0 comments on commit b26f7df

Please sign in to comment.