Changeset 85718 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib
- Timestamp:
- Aug 12, 2020 4:09:12 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 139865
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 1 added
- 10 deleted
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776,129194-133213 /vendor/edk2/current 103735-103757,103769-103776,129194-139864
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
r80721 r85718 7 7 # buffer overflow or integer overflow. 8 8 # 9 # Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR> 9 # Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> 10 # Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR> 10 11 # SPDX-License-Identifier: BSD-2-Clause-Patent 11 12 # … … 24 25 # The following information is for reference only and not required by the build tools. 25 26 # 26 # VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 27 # VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64 27 28 # 28 29 29 30 [Sources] 30 31 InternalCryptLib.h 31 Hash/CryptMd4.c32 32 Hash/CryptMd5.c 33 33 Hash/CryptSha1.c … … 35 35 Hash/CryptSha512.c 36 36 Hash/CryptSm3.c 37 Hmac/CryptHmacMd5.c38 Hmac/CryptHmacSha1.c39 37 Hmac/CryptHmacSha256.c 40 38 Kdf/CryptHkdf.c 41 39 Cipher/CryptAes.c 42 Cipher/CryptTdes.c43 Cipher/CryptArc4.c44 40 Pk/CryptRsaBasic.c 45 41 Pk/CryptRsaExt.c … … 59 55 SysCall/TimerWrapper.c 60 56 SysCall/BaseMemAllocation.c 57 SysCall/inet_pton.c 61 58 62 59 [Sources.Ia32] … … 70 67 71 68 [Sources.AARCH64] 69 Rand/CryptRand.c 70 71 [Sources.RISCV64] 72 72 Rand/CryptRand.c 73 73 … … 102 102 GCC:*_CLANG35_*_CC_FLAGS = -std=c99 103 103 GCC:*_CLANG38_*_CC_FLAGS = -std=c99 104 GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types 104 105 105 106 XCODE:*_*_*_CC_FLAGS = -std=c99 -
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/Cipher/CryptAes.c
r80721 r85718 76 76 return FALSE; 77 77 } 78 return TRUE;79 }80 81 /**82 Performs AES encryption on a data buffer of the specified size in ECB mode.83 84 This function performs AES encryption on data buffer pointed by Input, of specified85 size of InputSize, in ECB mode.86 InputSize must be multiple of block size (16 bytes). This function does not perform87 padding. Caller must perform padding, if necessary, to ensure valid input data size.88 AesContext should be already correctly initialized by AesInit(). Behavior with89 invalid AES context is undefined.90 91 If AesContext is NULL, then return FALSE.92 If Input is NULL, then return FALSE.93 If InputSize is not multiple of block size (16 bytes), then return FALSE.94 If Output is NULL, then return FALSE.95 96 @param[in] AesContext Pointer to the AES context.97 @param[in] Input Pointer to the buffer containing the data to be encrypted.98 @param[in] InputSize Size of the Input buffer in bytes.99 @param[out] Output Pointer to a buffer that receives the AES encryption output.100 101 @retval TRUE AES encryption succeeded.102 @retval FALSE AES encryption failed.103 104 **/105 BOOLEAN106 EFIAPI107 AesEcbEncrypt (108 IN VOID *AesContext,109 IN CONST UINT8 *Input,110 IN UINTN InputSize,111 OUT UINT8 *Output112 )113 {114 AES_KEY *AesKey;115 116 //117 // Check input parameters.118 //119 if (AesContext == NULL || Input == NULL || (InputSize % AES_BLOCK_SIZE) != 0 || Output == NULL) {120 return FALSE;121 }122 123 AesKey = (AES_KEY *) AesContext;124 125 //126 // Perform AES data encryption with ECB mode (block-by-block)127 //128 while (InputSize > 0) {129 AES_ecb_encrypt (Input, Output, AesKey, AES_ENCRYPT);130 Input += AES_BLOCK_SIZE;131 Output += AES_BLOCK_SIZE;132 InputSize -= AES_BLOCK_SIZE;133 }134 135 return TRUE;136 }137 138 /**139 Performs AES decryption on a data buffer of the specified size in ECB mode.140 141 This function performs AES decryption on data buffer pointed by Input, of specified142 size of InputSize, in ECB mode.143 InputSize must be multiple of block size (16 bytes). This function does not perform144 padding. Caller must perform padding, if necessary, to ensure valid input data size.145 AesContext should be already correctly initialized by AesInit(). Behavior with146 invalid AES context is undefined.147 148 If AesContext is NULL, then return FALSE.149 If Input is NULL, then return FALSE.150 If InputSize is not multiple of block size (16 bytes), then return FALSE.151 If Output is NULL, then return FALSE.152 153 @param[in] AesContext Pointer to the AES context.154 @param[in] Input Pointer to the buffer containing the data to be decrypted.155 @param[in] InputSize Size of the Input buffer in bytes.156 @param[out] Output Pointer to a buffer that receives the AES decryption output.157 158 @retval TRUE AES decryption succeeded.159 @retval FALSE AES decryption failed.160 161 **/162 BOOLEAN163 EFIAPI164 AesEcbDecrypt (165 IN VOID *AesContext,166 IN CONST UINT8 *Input,167 IN UINTN InputSize,168 OUT UINT8 *Output169 )170 {171 AES_KEY *AesKey;172 173 //174 // Check input parameters.175 //176 if (AesContext == NULL || Input == NULL || (InputSize % AES_BLOCK_SIZE) != 0 || Output == NULL) {177 return FALSE;178 }179 180 AesKey = (AES_KEY *) AesContext;181 182 //183 // Perform AES data decryption with ECB mode (block-by-block)184 //185 while (InputSize > 0) {186 AES_ecb_encrypt (Input, Output, AesKey + 1, AES_DECRYPT);187 Input += AES_BLOCK_SIZE;188 Output += AES_BLOCK_SIZE;189 InputSize -= AES_BLOCK_SIZE;190 }191 192 78 return TRUE; 193 79 } -
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/Cipher/CryptAesNull.c
r80721 r85718 45 45 IN CONST UINT8 *Key, 46 46 IN UINTN KeyLength 47 )48 {49 ASSERT (FALSE);50 return FALSE;51 }52 53 /**54 Performs AES encryption on a data buffer of the specified size in ECB mode.55 56 Return FALSE to indicate this interface is not supported.57 58 @param[in] AesContext Pointer to the AES context.59 @param[in] Input Pointer to the buffer containing the data to be encrypted.60 @param[in] InputSize Size of the Input buffer in bytes.61 @param[out] Output Pointer to a buffer that receives the AES encryption output.62 63 @retval FALSE This interface is not supported.64 65 **/66 BOOLEAN67 EFIAPI68 AesEcbEncrypt (69 IN VOID *AesContext,70 IN CONST UINT8 *Input,71 IN UINTN InputSize,72 OUT UINT8 *Output73 )74 {75 ASSERT (FALSE);76 return FALSE;77 }78 79 /**80 Performs AES decryption on a data buffer of the specified size in ECB mode.81 82 Return FALSE to indicate this interface is not supported.83 84 @param[in] AesContext Pointer to the AES context.85 @param[in] Input Pointer to the buffer containing the data to be decrypted.86 @param[in] InputSize Size of the Input buffer in bytes.87 @param[out] Output Pointer to a buffer that receives the AES decryption output.88 89 @retval FALSE This interface is not supported.90 91 **/92 BOOLEAN93 EFIAPI94 AesEcbDecrypt (95 IN VOID *AesContext,96 IN CONST UINT8 *Input,97 IN UINTN InputSize,98 OUT UINT8 *Output99 47 ) 100 48 { -
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256.c
r80721 r85718 2 2 HMAC-SHA256 Wrapper Implementation over OpenSSL. 3 3 4 Copyright (c) 2016 - 20 17, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.<BR> 5 5 SPDX-License-Identifier: BSD-2-Clause-Patent 6 6 … … 10 10 #include <openssl/hmac.h> 11 11 12 //13 // NOTE: OpenSSL redefines the size of HMAC_CTX at crypto/hmac/hmac_lcl.h14 // #define HMAC_MAX_MD_CBLOCK_SIZE 14415 //16 #define HMAC_SHA256_CTX_SIZE (sizeof(void *) * 4 + sizeof(unsigned int) + \17 sizeof(unsigned char) * 144)18 19 /**20 Retrieves the size, in bytes, of the context buffer required for HMAC-SHA256 operations.21 (NOTE: This API is deprecated.22 Use HmacSha256New() / HmacSha256Free() for HMAC-SHA256 Context operations.)23 24 @return The size, in bytes, of the context buffer required for HMAC-SHA256 operations.25 26 **/27 UINTN28 EFIAPI29 HmacSha256GetContextSize (30 VOID31 )32 {33 //34 // Retrieves the OpenSSL HMAC-SHA256 Context Size35 // NOTE: HMAC_CTX object was made opaque in openssl-1.1.x, here we just use the36 // fixed size as a workaround to make this API work for compatibility.37 // We should retire HmacSha256GetContextSize() in future, and use HmacSha256New()38 // and HmacSha256Free() for context allocation and release.39 //40 return (UINTN)HMAC_SHA256_CTX_SIZE;41 }42 43 12 /** 44 13 Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA256 use. … … 79 48 80 49 /** 81 Initializes user-supplied memory pointed by HmacSha256Context as HMAC-SHA256 context for82 subsequent use.83 84 If HmacSha256Context is NULL, then return FALSE. 85 86 @param[out] HmacSha256Context Pointer to HMAC-SHA256 context being initialized.50 Set user-supplied key for subsequent use. It must be done before any 51 calling to HmacSha256Update(). 52 53 If HmacSha256Context is NULL, then return FALSE. 54 55 @param[out] HmacSha256Context Pointer to HMAC-SHA256 context. 87 56 @param[in] Key Pointer to the user-supplied key. 88 57 @param[in] KeySize Key size in bytes. 89 58 90 @retval TRUE HMAC-SHA256 context initialization succeeded.91 @retval FALSE HMAC-SHA256 context initialization failed.92 93 **/ 94 BOOLEAN 95 EFIAPI 96 HmacSha256 Init(59 @retval TRUE The Key is set successfully. 60 @retval FALSE The Key is set unsuccessfully. 61 62 **/ 63 BOOLEAN 64 EFIAPI 65 HmacSha256SetKey ( 97 66 OUT VOID *HmacSha256Context, 98 67 IN CONST UINT8 *Key, … … 107 76 } 108 77 109 //110 // OpenSSL HMAC-SHA256 Context Initialization111 //112 memset(HmacSha256Context, 0, HMAC_SHA256_CTX_SIZE);113 if (HMAC_CTX_reset ((HMAC_CTX *)HmacSha256Context) != 1) {114 return FALSE;115 }116 78 if (HMAC_Init_ex ((HMAC_CTX *)HmacSha256Context, Key, (UINT32) KeySize, EVP_sha256(), NULL) != 1) { 117 79 return FALSE; … … 160 122 This function performs HMAC-SHA256 digest on a data buffer of the specified size. 161 123 It can be called multiple times to compute the digest of long or discontinuous data streams. 162 HMAC-SHA256 context should be already correctly initialized by HmacSha256Init(), and should not163 b e finalized by HmacSha256Final(). Behavior with invalid context is undefined.124 HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized 125 by HmacSha256Final(). Behavior with invalid context is undefined. 164 126 165 127 If HmacSha256Context is NULL, then return FALSE. … … 211 173 the specified memory. After this function has been called, the HMAC-SHA256 context cannot 212 174 be used again. 213 HMAC-SHA256 context should be already correctly initialized by HmacSha256Init(), and should214 not be finalizedby HmacSha256Final(). Behavior with invalid HMAC-SHA256 context is undefined.175 HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized 176 by HmacSha256Final(). Behavior with invalid HMAC-SHA256 context is undefined. 215 177 216 178 If HmacSha256Context is NULL, then return FALSE. -
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256Null.c
r80721 r85718 2 2 HMAC-SHA256 Wrapper Implementation which does not provide real capabilities. 3 3 4 Copyright (c) 2016 - 20 17, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.<BR> 5 5 SPDX-License-Identifier: BSD-2-Clause-Patent 6 6 … … 8 8 9 9 #include "InternalCryptLib.h" 10 11 /**12 Retrieves the size, in bytes, of the context buffer required for HMAC-SHA256 operations.13 (NOTE: This API is deprecated.14 Use HmacSha256New() / HmacSha256Free() for HMAC-SHA256 Context operations.)15 16 Return zero to indicate this interface is not supported.17 18 @retval 0 This interface is not supported.19 20 **/21 UINTN22 EFIAPI23 HmacSha256GetContextSize (24 VOID25 )26 {27 ASSERT (FALSE);28 return 0;29 }30 10 31 11 /** … … 66 46 67 47 /** 68 Initializes user-supplied memory pointed by HmacSha256Context as HMAC-SHA256 context for69 subsequent use.48 Set user-supplied key for subsequent use. It must be done before any 49 calling to HmacSha256Update(). 70 50 71 51 Return FALSE to indicate this interface is not supported. 72 52 73 @param[out] HmacSha256Context Pointer to HMAC-SHA256 context being initialized.53 @param[out] HmacSha256Context Pointer to HMAC-SHA256 context. 74 54 @param[in] Key Pointer to the user-supplied key. 75 55 @param[in] KeySize Key size in bytes. … … 80 60 BOOLEAN 81 61 EFIAPI 82 HmacSha256 Init(62 HmacSha256SetKey ( 83 63 OUT VOID *HmacSha256Context, 84 64 IN CONST UINT8 *Key, -
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
r80721 r85718 7 7 # buffer overflow or integer overflow. 8 8 # 9 # Note: MD4 Digest functions,10 # HMAC- MD5 functions, HMAC-SHA1/SHA256 functions, AES/TDES/ARC4functions, RSA external9 # Note: 10 # HMAC-SHA256 functions, AES functions, RSA external 11 11 # functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, X.509 12 12 # certificate handler functions, authenticode signature verification functions, … … 14 14 # supported in this instance. 15 15 # 16 # Copyright (c) 2010 - 20 19, Intel Corporation. All rights reserved.<BR>16 # Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> 17 17 # SPDX-License-Identifier: BSD-2-Clause-Patent 18 18 # … … 36 36 [Sources] 37 37 InternalCryptLib.h 38 Hash/CryptMd4Null.c39 38 Hash/CryptMd5.c 40 39 Hash/CryptSha1.c … … 42 41 Hash/CryptSm3.c 43 42 Hash/CryptSha512.c 44 Hmac/CryptHmacMd5Null.c45 Hmac/CryptHmacSha1Null.c46 43 Hmac/CryptHmacSha256Null.c 47 44 Kdf/CryptHkdfNull.c 48 45 Cipher/CryptAesNull.c 49 Cipher/CryptTdesNull.c50 Cipher/CryptArc4Null.c51 46 Pk/CryptRsaBasic.c 52 47 Pk/CryptRsaExtNull.c … … 97 92 GCC:*_CLANG35_*_CC_FLAGS = -std=c99 98 93 GCC:*_CLANG38_*_CC_FLAGS = -std=c99 94 GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types 99 95 100 96 XCODE:*_*_*_CC_FLAGS = -std=c99 -
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.uni
r80721 r85718 7 7 // buffer overflow or integer overflow. 8 8 // 9 // Note: MD4 Digest functions, HMAC-MD5 functions, HMAC-SHA1 functions, AES/10 // TDES/ARC4functions, RSA external functions, PKCS#7 SignedData sign functions,9 // Note: AES 10 // functions, RSA external functions, PKCS#7 SignedData sign functions, 11 11 // Diffie-Hellman functions, X.509 certificate handler functions, authenticode 12 12 // signature verification functions, PEM handler functions, and pseudorandom number 13 13 // generator functions are not supported in this instance. 14 14 // 15 // Copyright (c) 2010 - 20 18, Intel Corporation. All rights reserved.<BR>15 // Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> 16 16 // 17 17 // SPDX-License-Identifier: BSD-2-Clause-Patent … … 22 22 #string STR_MODULE_ABSTRACT #language en-US "Cryptographic Library Instance for PEIM" 23 23 24 #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: MD4 Digest functions, HMAC-MD5 functions, HMAC-SHA1 functions, AES/ TDES/ARC4functions, 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."24 #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." 25 25 -
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c
r80721 r85718 2 2 PEM (Privacy Enhanced Mail) Format Handler Wrapper Implementation over OpenSSL. 3 3 4 Copyright (c) 2010 - 20 18, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> 5 5 SPDX-License-Identifier: BSD-2-Clause-Patent 6 6 … … 83 83 // 84 84 // Add possible block-cipher descriptor for PEM data decryption. 85 // NOTE: Only support most popular ciphers (3DES, AES)for the encrypted PEM.85 // NOTE: Only support most popular ciphers AES for the encrypted PEM. 86 86 // 87 if (EVP_add_cipher (EVP_des_ede3_cbc ()) == 0) {88 return FALSE;89 }90 87 if (EVP_add_cipher (EVP_aes_128_cbc ()) == 0) { 91 88 return FALSE; -
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyBase.c
r80721 r85718 13 13 #include <openssl/x509v3.h> 14 14 #include <openssl/pkcs7.h> 15 16 /** 17 Check the contents of PKCS7 is not data. 18 19 It is copied from PKCS7_type_is_other() in pk7_doit.c. 20 21 @param[in] P7 Pointer to the location at which the PKCS7 is located. 22 23 @retval TRUE If the type is others. 24 @retval FALSE If the type is expected. 25 **/ 26 STATIC 27 BOOLEAN 28 Pkcs7TypeIsOther ( 29 IN PKCS7 *P7 30 ) 31 { 32 BOOLEAN Others; 33 INTN Nid = OBJ_obj2nid (P7->type); 34 35 switch (Nid) { 36 case NID_pkcs7_data: 37 case NID_pkcs7_signed: 38 case NID_pkcs7_enveloped: 39 case NID_pkcs7_signedAndEnveloped: 40 case NID_pkcs7_encrypted: 41 Others = FALSE; 42 break; 43 default: 44 Others = TRUE; 45 } 46 47 return Others; 48 } 49 50 /** 51 Get the ASN.1 string for the PKCS7. 52 53 It is copied from PKCS7_get_octet_string() in pk7_doit.c. 54 55 @param[in] P7 Pointer to the location at which the PKCS7 is located. 56 57 @return ASN1_OCTET_STRING ASN.1 string. 58 **/ 59 STATIC 60 ASN1_OCTET_STRING* 61 Pkcs7GetOctetString ( 62 IN PKCS7 *P7 63 ) 64 { 65 if (PKCS7_type_is_data (P7)) { 66 return P7->d.data; 67 } 68 69 if (Pkcs7TypeIsOther(P7) && (P7->d.other != NULL) && 70 (P7->d.other->type == V_ASN1_OCTET_STRING)) { 71 return P7->d.other->value.octet_string; 72 } 73 74 return NULL; 75 } 15 76 16 77 /** … … 99 160 // Retrieve the attached content in PKCS7 signedData 100 161 // 101 OctStr = Pkcs7->d.sign->contents->d.data; 162 OctStr = Pkcs7GetOctetString (Pkcs7->d.sign->contents); 163 if (OctStr == NULL) { 164 goto _Exit; 165 } 166 102 167 if ((OctStr->length > 0) && (OctStr->data != NULL)) { 103 168 *ContentSize = OctStr->length; -
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaBasic.c
r80721 r85718 8 8 4) RsaPkcs1Verify 9 9 10 Copyright (c) 2009 - 20 18, Intel Corporation. All rights reserved.<BR>10 Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> 11 11 SPDX-License-Identifier: BSD-2-Clause-Patent 12 12 … … 251 251 If MessageHash is NULL, then return FALSE. 252 252 If Signature is NULL, then return FALSE. 253 If HashSize is not equal to the size of MD5, SHA-1 or SHA-256digest, then return FALSE.253 If HashSize is not equal to the size of MD5, SHA-1, SHA-256, SHA-384 or SHA-512 digest, then return FALSE. 254 254 255 255 @param[in] RsaContext Pointer to RSA context for signature verification. … … 289 289 // 290 290 // Determine the message digest algorithm according to digest size. 291 // Only MD5, SHA-1 or SHA-256algorithm is supported.291 // Only MD5, SHA-1, SHA-256, SHA-384 or SHA-512 algorithm is supported. 292 292 // 293 293 switch (HashSize) { … … 302 302 case SHA256_DIGEST_SIZE: 303 303 DigestType = NID_sha256; 304 break; 305 306 case SHA384_DIGEST_SIZE: 307 DigestType = NID_sha384; 308 break; 309 310 case SHA512_DIGEST_SIZE: 311 DigestType = NID_sha512; 304 312 break; 305 313 -
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaExt.c
r80721 r85718 8 8 4) RsaPkcs1Sign 9 9 10 Copyright (c) 2009 - 20 18, Intel Corporation. All rights reserved.<BR>10 Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> 11 11 SPDX-License-Identifier: BSD-2-Clause-Patent 12 12 … … 277 277 If RsaContext is NULL, then return FALSE. 278 278 If MessageHash is NULL, then return FALSE. 279 If HashSize is not equal to the size of MD5, SHA-1 or SHA-256digest, then return FALSE.279 If HashSize is not equal to the size of MD5, SHA-1, SHA-256, SHA-384 or SHA-512 digest, then return FALSE. 280 280 If SigSize is large enough but Signature is NULL, then return FALSE. 281 281 … … 327 327 // 328 328 // Determine the message digest algorithm according to digest size. 329 // Only MD5, SHA-1 or SHA-256algorithm is supported.329 // Only MD5, SHA-1, SHA-256, SHA-384 or SHA-512 algorithm is supported. 330 330 // 331 331 switch (HashSize) { … … 340 340 case SHA256_DIGEST_SIZE: 341 341 DigestType = NID_sha256; 342 break; 343 344 case SHA384_DIGEST_SIZE: 345 DigestType = NID_sha384; 346 break; 347 348 case SHA512_DIGEST_SIZE: 349 DigestType = NID_sha512; 342 350 break; 343 351 -
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c
r80721 r85718 2 2 X.509 Certificate Handler Wrapper Implementation over OpenSSL. 3 3 4 Copyright (c) 2010 - 20 18, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> 5 5 SPDX-License-Identifier: BSD-2-Clause-Patent 6 6 … … 61 61 62 62 If X509Stack is NULL, then return FALSE. 63 If this interface is not supported, then return FALSE. 63 64 64 65 @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object. 65 66 On output, pointer to the X509 stack object with new 66 67 inserted X509 certificate. 67 @param ... A list of DER-encoded single certificate data followed 68 @param[in] Args VA_LIST marker for the variable argument list. 69 A list of DER-encoded single certificate data followed 68 70 by certificate size. A NULL terminates the list. The 69 71 pairs are the arguments to X509ConstructCertificate(). … … 71 73 @retval TRUE The X509 stack construction succeeded. 72 74 @retval FALSE The construction operation failed. 75 @retval FALSE This interface is not supported. 73 76 74 77 **/ 75 78 BOOLEAN 76 79 EFIAPI 77 X509ConstructCertificateStack (78 IN OUT UINT8 **X509Stack,79 ...80 X509ConstructCertificateStackV ( 81 IN OUT UINT8 **X509Stack, 82 IN VA_LIST Args 80 83 ) 81 84 { … … 85 88 STACK_OF(X509) *CertStack; 86 89 BOOLEAN Status; 87 VA_LIST Args;88 90 UINTN Index; 89 91 … … 107 109 } 108 110 } 109 110 VA_START (Args, X509Stack);111 111 112 112 for (Index = 0; ; Index++) { … … 146 146 } 147 147 148 VA_END (Args);149 150 148 if (!Status) { 151 149 sk_X509_pop_free (CertStack, X509_free); … … 155 153 156 154 return Status; 155 } 156 157 /** 158 Construct a X509 stack object from a list of DER-encoded certificate data. 159 160 If X509Stack is NULL, then return FALSE. 161 162 @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object. 163 On output, pointer to the X509 stack object with new 164 inserted X509 certificate. 165 @param ... A list of DER-encoded single certificate data followed 166 by certificate size. A NULL terminates the list. The 167 pairs are the arguments to X509ConstructCertificate(). 168 169 @retval TRUE The X509 stack construction succeeded. 170 @retval FALSE The construction operation failed. 171 172 **/ 173 BOOLEAN 174 EFIAPI 175 X509ConstructCertificateStack ( 176 IN OUT UINT8 **X509Stack, 177 ... 178 ) 179 { 180 VA_LIST Args; 181 BOOLEAN Result; 182 183 VA_START (Args, X509Stack); 184 Result = X509ConstructCertificateStackV (X509Stack, Args); 185 VA_END (Args); 186 return Result; 157 187 } 158 188 -
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509Null.c
r80721 r85718 3 3 real capabilities. 4 4 5 Copyright (c) 2012 - 20 18, Intel Corporation. All rights reserved.<BR>5 Copyright (c) 2012 - 2020, Intel Corporation. All rights reserved.<BR> 6 6 SPDX-License-Identifier: BSD-2-Clause-Patent 7 7 … … 28 28 IN UINTN CertSize, 29 29 OUT UINT8 **SingleX509Cert 30 ) 31 { 32 ASSERT (FALSE); 33 return FALSE; 34 } 35 36 /** 37 Construct a X509 stack object from a list of DER-encoded certificate data. 38 39 If X509Stack is NULL, then return FALSE. 40 If this interface is not supported, then return FALSE. 41 42 @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object. 43 On output, pointer to the X509 stack object with new 44 inserted X509 certificate. 45 @param[in] Args VA_LIST marker for the variable argument list. 46 A list of DER-encoded single certificate data followed 47 by certificate size. A NULL terminates the list. The 48 pairs are the arguments to X509ConstructCertificate(). 49 50 @retval TRUE The X509 stack construction succeeded. 51 @retval FALSE The construction operation failed. 52 @retval FALSE This interface is not supported. 53 54 **/ 55 BOOLEAN 56 EFIAPI 57 X509ConstructCertificateStackV ( 58 IN OUT UINT8 **X509Stack, 59 IN VA_LIST Args 30 60 ) 31 61 { -
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
r80721 r85718 7 7 # buffer overflow or integer overflow. 8 8 # 9 # Note: MD4 Digest functions,SHA-384 Digest functions, SHA-512 Digest functions,10 # HMAC- MD5 functions, HMAC-SHA1/SHA256 functions, AES/TDES/ARC4functions, RSA external9 # Note: SHA-384 Digest functions, SHA-512 Digest functions, 10 # HMAC-SHA256 functions, AES functions, RSA external 11 11 # functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, and 12 12 # authenticode signature verification functions are not supported in this instance. 13 13 # 14 # Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR> 14 # Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> 15 # Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR> 15 16 # SPDX-License-Identifier: BSD-2-Clause-Patent 16 17 # … … 35 36 [Sources] 36 37 InternalCryptLib.h 37 Hash/CryptMd4Null.c38 38 Hash/CryptMd5.c 39 39 Hash/CryptSha1.c … … 41 41 Hash/CryptSm3.c 42 42 Hash/CryptSha512Null.c 43 Hmac/CryptHmacMd5Null.c44 Hmac/CryptHmacSha1Null.c45 43 Hmac/CryptHmacSha256Null.c 46 44 Kdf/CryptHkdfNull.c 47 45 Cipher/CryptAesNull.c 48 Cipher/CryptTdesNull.c49 Cipher/CryptArc4Null.c50 46 Pk/CryptRsaBasic.c 51 47 Pk/CryptRsaExtNull.c … … 76 72 77 73 [Sources.AARCH64] 74 Rand/CryptRand.c 75 76 [Sources.RISCV64] 78 77 Rand/CryptRand.c 79 78 … … 108 107 GCC:*_CLANG35_*_CC_FLAGS = -std=c99 109 108 GCC:*_CLANG38_*_CC_FLAGS = -std=c99 109 GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types 110 110 111 111 XCODE:*_*_*_CC_FLAGS = -std=c99 -
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.uni
r80721 r85718 7 7 // buffer overflow or integer overflow. 8 8 // 9 // Note: MD4 Digest functions, HMAC-MD5 functions, HMAC-SHA1 functions, AES/10 // TDES/ARC4functions, RSA external functions, PKCS#7 SignedData sign functions,9 // Note: AES 10 // functions, RSA external functions, PKCS#7 SignedData sign functions, 11 11 // Diffie-Hellman functions, and authenticode signature verification functions are 12 12 // not supported in this instance. 13 13 // 14 // Copyright (c) 2009 - 20 18, Intel Corporation. All rights reserved.<BR>14 // Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> 15 15 // 16 16 // SPDX-License-Identifier: BSD-2-Clause-Patent … … 21 21 #string STR_MODULE_ABSTRACT #language en-US "Cryptographic Library Instance for DXE_RUNTIME_DRIVER" 22 22 23 #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: MD4 Digest functions, HMAC-MD5 functions, HMAC-SHA1 functions, AES/ TDES/ARC4functions, RSA external functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, and authenticode signature verification functions are not supported in this instance."23 #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." 24 24 -
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
r80721 r85718 7 7 # buffer overflow or integer overflow. 8 8 # 9 # Note: MD4 Digest functions, SHA-384 Digest functions, SHA-512 Digest functions, 10 # HMAC-MD5 functions, HMAC-SHA1 functions, TDES/ARC4 functions, RSA external 11 # functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, and 9 # Note: SHA-384 Digest functions, SHA-512 Digest functions, 10 # RSA external functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, and 12 11 # authenticode signature verification functions are not supported in this instance. 13 12 # 14 # Copyright (c) 2010 - 20 19, Intel Corporation. All rights reserved.<BR>13 # Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> 15 14 # SPDX-License-Identifier: BSD-2-Clause-Patent 16 15 # … … 35 34 [Sources] 36 35 InternalCryptLib.h 37 Hash/CryptMd4Null.c38 36 Hash/CryptMd5.c 39 37 Hash/CryptSha1.c … … 41 39 Hash/CryptSm3.c 42 40 Hash/CryptSha512Null.c 43 Hmac/CryptHmacMd5Null.c44 Hmac/CryptHmacSha1Null.c45 41 Hmac/CryptHmacSha256.c 46 42 Kdf/CryptHkdfNull.c 47 43 Cipher/CryptAes.c 48 Cipher/CryptTdesNull.c49 Cipher/CryptArc4Null.c50 44 Pk/CryptRsaBasic.c 51 45 Pk/CryptRsaExtNull.c … … 105 99 GCC:*_CLANG35_*_CC_FLAGS = -std=c99 106 100 GCC:*_CLANG38_*_CC_FLAGS = -std=c99 101 GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types -
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.uni
r80721 r85718 7 7 // buffer overflow or integer overflow. 8 8 // 9 // Note: MD4 Digest functions, HMAC-MD5 functions, HMAC-SHA1 functions, AES/10 // TDES/ARC4functions, RSA external functions, PKCS#7 SignedData sign functions,9 // Note: AES 10 // functions, RSA external functions, PKCS#7 SignedData sign functions, 11 11 // Diffie-Hellman functions, and authenticode signature verification functions are 12 12 // not supported in this instance. 13 13 // 14 // Copyright (c) 2010 - 20 18, Intel Corporation. All rights reserved.<BR>14 // Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.<BR> 15 15 // 16 16 // SPDX-License-Identifier: BSD-2-Clause-Patent … … 21 21 #string STR_MODULE_ABSTRACT #language en-US "Cryptographic Library Instance for SMM driver" 22 22 23 #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: MD4 Digest functions, HMAC-MD5 functions, HMAC-SHA1 functions, AES/ TDES/ARC4functions, RSA external functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, and authenticode signature verification functions are not supported in this instance."23 #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." 24 24 -
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
r80721 r85718 116 116 // 117 117 118 char *strchr(const char *str, int ch) 119 { 120 return ScanMem8 (str, AsciiStrSize (str), (UINT8)ch); 121 } 122 118 123 /* Scan a string for the last occurrence of a character */ 119 124 char *strrchr (const char *str, int c)
Note:
See TracChangeset
for help on using the changeset viewer.