X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=CryptoPkg%2FLibrary%2FBaseCryptLib%2FPk%2FCryptPkcs7Verify.c;h=dcaba436797a1507a14280c783d9c085a5c131e2;hp=242ba10bbf0e31f5946aee8673d792e4152ddcbd;hb=2998af862469c6a05657e169d7def6f55420caad;hpb=45419de6ca5bad34567e0ca2a16a4bc78f6a6f63 diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Verify.c b/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Verify.c index 242ba10bbf..dcaba43679 100644 --- a/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Verify.c +++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Verify.c @@ -10,7 +10,7 @@ WrapPkcs7Data(), Pkcs7GetSigners(), Pkcs7Verify() will get UEFI Authenticated Variable and will do basic check for data structure. -Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -229,7 +229,7 @@ _Exit: in a ContentInfo structure. If P7Data, CertStack, StackLength, TrustedCert or CertLength is NULL, then - return FALSE. If P7Length overflow, then return FAlSE. + return FALSE. If P7Length overflow, then return FALSE. Caution: This function may receive untrusted input. UEFI Authenticated Variable is external input, so this function will do basic @@ -238,10 +238,10 @@ _Exit: @param[in] P7Data Pointer to the PKCS#7 message to verify. @param[in] P7Length Length of the PKCS#7 message in bytes. @param[out] CertStack Pointer to Signer's certificates retrieved from P7Data. - It's caller's responsiblity to free the buffer. + It's caller's responsibility to free the buffer. @param[out] StackLength Length of signer's certificates in bytes. @param[out] TrustedCert Pointer to a trusted certificate from Signer's certificates. - It's caller's responsiblity to free the buffer. + It's caller's responsibility to free the buffer. @param[out] CertLength Length of the trusted certificate in bytes. @retval TRUE The operation is finished successfully. @@ -435,11 +435,11 @@ Pkcs7FreeSigners ( @param[in] P7Data Pointer to the PKCS#7 message. @param[in] P7Length Length of the PKCS#7 message in bytes. - @param[out] SingerChainCerts Pointer to the certificates list chained to signer's - certificate. It's caller's responsiblity to free the buffer. + @param[out] SignerChainCerts Pointer to the certificates list chained to signer's + certificate. It's caller's responsibility to free the buffer. @param[out] ChainLength Length of the chained certificates list buffer in bytes. @param[out] UnchainCerts Pointer to the unchained certificates lists. It's caller's - responsiblity to free the buffer. + responsibility to free the buffer. @param[out] UnchainLength Length of the unchained certificates list buffer in bytes. @retval TRUE The operation is finished successfully. @@ -489,6 +489,8 @@ Pkcs7GetCertificatesList ( OldBuf = NULL; Signers = NULL; + ZeroMem (&CertCtx, sizeof (CertCtx)); + // // Parameter Checking // @@ -521,7 +523,7 @@ Pkcs7GetCertificatesList ( // // Obtains Signer's Certificate from PKCS#7 data // NOTE: Only one signer case will be handled in this function, which means SignerInfos - // should include only one singer's certificate. + // should include only one signer's certificate. // Signers = PKCS7_get0_signers (Pkcs7, NULL, PKCS7_BINARY); if ((Signers == NULL) || (sk_X509_num (Signers) != 1)) { @@ -541,7 +543,7 @@ Pkcs7GetCertificatesList ( goto _Error; } } - sk_X509_delete_ptr (CertCtx.untrusted, Signer); + (VOID)sk_X509_delete_ptr (CertCtx.untrusted, Signer); // // Build certificates stack chained from Signer's certificate. @@ -571,7 +573,7 @@ Pkcs7GetCertificatesList ( if (!sk_X509_push (CertCtx.chain, Issuer)) { goto _Error; } - sk_X509_delete_ptr (CertCtx.untrusted, Issuer); + (VOID)sk_X509_delete_ptr (CertCtx.untrusted, Issuer); Cert = Issuer; continue; @@ -716,12 +718,12 @@ _Error: } /** - Verifies the validility of a PKCS#7 signed data as described in "PKCS #7: + Verifies the validity of a PKCS#7 signed data as described in "PKCS #7: Cryptographic Message Syntax Standard". The input signed data could be wrapped in a ContentInfo structure. If P7Data, TrustedCert or InData is NULL, then return FALSE. - If P7Length, CertLength or DataLength overflow, then return FAlSE. + If P7Length, CertLength or DataLength overflow, then return FALSE. Caution: This function may receive untrusted input. UEFI Authenticated Variable is external input, so this function will do basic @@ -895,7 +897,7 @@ _Exit: data could be wrapped in a ContentInfo structure. If P7Data, Content, or ContentSize is NULL, then return FALSE. If P7Length overflow, - then return FAlSE. If the P7Data is not correctly formatted, then return FALSE. + then return FALSE. If the P7Data is not correctly formatted, then return FALSE. Caution: This function may receive untrusted input. So this function will do basic check for PKCS#7 data structure. @@ -903,7 +905,7 @@ _Exit: @param[in] P7Data Pointer to the PKCS#7 signed data to process. @param[in] P7Length Length of the PKCS#7 signed data in bytes. @param[out] Content Pointer to the extracted content from the PKCS#7 signedData. - It's caller's responsiblity to free the buffer. + It's caller's responsibility to free the buffer. @param[out] ContentSize The size of the extracted content in bytes. @retval TRUE The P7Data was correctly formatted for processing.