/** @file\r
Common interfaces to call Security library.\r
\r
- Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
BOOLEAN mInitialRandomSeed = FALSE;\r
\r
/**\r
- Get the block size of specified encryption alogrithm.\r
+ Get the block size of specified encryption algorithm.\r
\r
@param[in] AlgorithmId The encryption algorithm ID.\r
\r
}\r
\r
/**\r
- Get the key length of the specified encryption alogrithm.\r
+ Get the key length of the specified encryption algorithm.\r
\r
@param[in] AlgorithmId The encryption algorithm ID.\r
\r
}\r
\r
/**\r
- Get the IV size of the specified encryption alogrithm.\r
+ Get the IV size of the specified encryption algorithm.\r
\r
@param[in] AlgorithmId The encryption algorithm ID.\r
\r
}\r
\r
/**\r
- Get the ICV size of the specified Authenticaion alogrithm.\r
+ Get the ICV size of the specified Authenticaion algorithm.\r
\r
@param[in] AlgorithmId The Authentication algorithm ID.\r
\r
}\r
\r
/**\r
- Get index of the specified encryption alogrithm from the mIpsecEncryptAlgorithemList.\r
+ Get index of the specified encryption algorithm from the mIpsecEncryptAlgorithmList.\r
\r
@param[in] AlgorithmId The encryption algorithm ID.\r
\r
}\r
\r
/**\r
- Get index of the specified encryption alogrithm from the mIpsecAuthAlgorithemList.\r
+ Get index of the specified encryption algorithm from the mIpsecAuthAlgorithmList.\r
\r
@param[in] AlgorithmId The encryption algorithm ID.\r
\r
Encrypt the buffer.\r
\r
This function calls relevant encryption interface from CryptoLib according to\r
- the input alogrithm ID. The InData should be multiple of block size. This function\r
+ the input algorithm ID. The InData should be multiple of block size. This function\r
doesn't perform the padding. If it has the Ivec data, the length of it should be\r
same with the block size. The block size is different from the different algorithm.\r
\r
- @param[in] AlgorithmId The Alogrithem identification defined in RFC.\r
+ @param[in] AlgorithmId The Algorithm identification defined in RFC.\r
@param[in] Key Pointer to the buffer containing encrypting key.\r
@param[in] KeyBits The length of the key in bits.\r
- @param[in] Ivec Point to the buffer containning the Initializeion\r
+ @param[in] Ivec Point to the buffer containing the Initialization\r
Vector (IV) data.\r
@param[in] InData Point to the buffer containing the data to be\r
encrypted.\r
Decrypts the buffer.\r
\r
This function calls relevant Decryption interface from CryptoLib according to\r
- the input alogrithm ID. The InData should be multiple of block size. This function\r
+ the input algorithm ID. The InData should be multiple of block size. This function\r
doesn't perform the padding. If it has the Ivec data, the length of it should be\r
same with the block size. The block size is different from the different algorithm.\r
\r
- @param[in] AlgorithmId The Alogrithem identification defined in RFC.\r
+ @param[in] AlgorithmId The Algorithm identification defined in RFC.\r
@param[in] Key Pointer to the buffer containing encrypting key.\r
@param[in] KeyBits The length of the key in bits.\r
- @param[in] Ivec Point to the buffer containning the Initializeion\r
+ @param[in] Ivec Point to the buffer containing the Initialization\r
Vector (IV) data.\r
@param[in] InData Point to the buffer containing the data to be\r
decrypted.\r
Digests the Payload with key and store the result into the OutData.\r
\r
This function calls relevant Hmac interface from CryptoLib according to\r
- the input alogrithm ID. It computes all datas from InDataFragment and output\r
+ the input algorithm ID. It computes all datas from InDataFragment and output\r
the result into the OutData buffer. If the OutDataSize is larger than the related\r
- HMAC alogrithm output size, return EFI_INVALID_PARAMETER.\r
+ HMAC algorithm output size, return EFI_INVALID_PARAMETER.\r
\r
@param[in] AlgorithmId The authentication Identification.\r
@param[in] Key Pointer of the authentication key.\r
Digests the Payload and store the result into the OutData.\r
\r
This function calls relevant Hash interface from CryptoLib according to\r
- the input alogrithm ID. It computes all datas from InDataFragment and output\r
+ the input algorithm ID. It computes all datas from InDataFragment and output\r
the result into the OutData buffer. If the OutDataSize is larger than the related\r
- Hash alogrithm output size, return EFI_INVALID_PARAMETER.\r
+ Hash algorithm output size, return EFI_INVALID_PARAMETER.\r
\r
@param[in] AlgorithmId The authentication Identification.\r
@param[in] InDataFragment A list contains all data to be authenticated.\r
Generates the Diffie-Hellman public key.\r
\r
This function first initiate a DHContext, then call the DhSetParameter() to set\r
- the prime and primelenght, at end call the DhGenerateKey() to generates random\r
+ the prime and primelength, at end call the DhGenerateKey() to generates random\r
secret exponent, and computes the public key. The output returned via parameter\r
PublicKey and PublicKeySize. DH context is updated accordingly. If the PublicKey\r
buffer is too small to hold the public key, EFI_INVALID_PARAMETER is returned\r
and PublicKeySize is set to the required buffer size to obtain the public key.\r
\r
@param[in, out] DhContext Pointer to the DH context.\r
- @param[in] Generator Vlaue of generator.\r
+ @param[in] Generator Value of generator.\r
@param[in] PrimeLength Length in bits of prime to be generated.\r
@param[in] Prime Pointer to the buffer to receive the generated\r
prime number.\r
For out, the size of data returned in PublicKey\r
buffer in bytes.\r
\r
- @retval EFI_SUCCESS The operation perfoms successfully.\r
+ @retval EFI_SUCCESS The operation performs successfully.\r
@retval Otherwise The operation is failed.\r
\r
**/\r
For out, the size of data returned in Key\r
buffer in bytes.\r
\r
- @retval EFI_SUCCESS The operation perfoms successfully.\r
+ @retval EFI_SUCCESS The operation performs successfully.\r
@retval Otherwise The operation is failed.\r
\r
**/\r
\r
@param[in, out] DhContext Pointer to the DH context to be freed.\r
\r
- @retval EFI_SUCCESS The operation perfoms successfully.\r
+ @retval EFI_SUCCESS The operation performs successfully.\r
@retval EFI_INVALID_PARAMETER The DhContext is NULL.\r
\r
**/\r
If the Random Generator wasn't initiated, initiate it first, then call RandomBytes.\r
\r
@param[out] OutBuffer Pointer to buffer to receive random value.\r
- @param[in] Bytes Size of randome bytes to generate.\r
+ @param[in] Bytes Size of random bytes to generate.\r
\r
- @retval EFI_SUCCESS The operation perfoms successfully.\r
+ @retval EFI_SUCCESS The operation performs successfully.\r
@retval Otherwise The operation is failed.\r
\r
**/\r
@param[in] CertLen The size of Certificate in bytes.\r
@param[in] InCa Pointer to the CA certificate\r
@param[in] CaLen The size of CA certificate in bytes.\r
- @param[in] InData Pointer to octect message hash to be checked.\r
+ @param[in] InData Pointer to octet message hash to be checked.\r
@param[in] InDataSize Size of the message hash in bytes.\r
- @param[in] Singnature The pointer to the RSA PKCS1-V1_5 signature to be verifed.\r
+ @param[in] Singnature The pointer to the RSA PKCS1-V1_5 signature to be verified.\r
@param[in] SigSize Size of signature in bytes.\r
\r
@retval TRUE Valid signature encoded in PKCS1-v1_5.\r
RsaGetKey (RsaContext, RsaKeyN, NULL, PublicKeyLen);\r
\r
*PublicKey = AllocateZeroPool (*PublicKeyLen);\r
- ASSERT (*PublicKey != NULL);\r
+ if (*PublicKey == NULL) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto EXIT;\r
+ }\r
\r
if (!RsaGetKey (RsaContext, RsaKeyN, *PublicKey, PublicKeyLen)) {\r
Status = EFI_INVALID_PARAMETER;\r