TianoCore EDK2 master
Loading...
Searching...
No Matches
CryptPkcs7VerifyBase.c File Reference
#include "InternalCryptLib.h"
#include <openssl/objects.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <openssl/pkcs7.h>

Go to the source code of this file.

Functions

STATIC BOOLEAN Pkcs7TypeIsOther (IN PKCS7 *P7)
 
STATIC ASN1_OCTET_STRING * Pkcs7GetOctetString (IN PKCS7 *P7)
 
BOOLEAN EFIAPI Pkcs7GetAttachedContent (IN CONST UINT8 *P7Data, IN UINTN P7Length, OUT VOID **Content, OUT UINTN *ContentSize)
 

Detailed Description

Non-runtime specific implementation of PKCS#7 SignedData Verification Wrapper.

Copyright (c) 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file CryptPkcs7VerifyBase.c.

Function Documentation

◆ Pkcs7GetAttachedContent()

BOOLEAN EFIAPI Pkcs7GetAttachedContent ( IN CONST UINT8 *  P7Data,
IN UINTN  P7Length,
OUT VOID **  Content,
OUT UINTN ContentSize 
)

Extracts the attached content from a PKCS#7 signed data if existed. The input signed 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.

Caution: This function may receive untrusted input. So this function will do basic check for PKCS#7 data structure.

Parameters
[in]P7DataPointer to the PKCS#7 signed data to process.
[in]P7LengthLength of the PKCS#7 signed data in bytes.
[out]ContentPointer to the extracted content from the PKCS#7 signedData. It's caller's responsibility to free the buffer with FreePool().
[out]ContentSizeThe size of the extracted content in bytes.
Return values
TRUEThe P7Data was correctly formatted for processing.
FALSEThe P7Data was not correctly formatted for processing.

Definition at line 100 of file CryptPkcs7VerifyBase.c.

◆ Pkcs7GetOctetString()

STATIC ASN1_OCTET_STRING * Pkcs7GetOctetString ( IN PKCS7 P7)

Get the ASN.1 string for the PKCS7.

It is copied from PKCS7_get_octet_string() in pk7_doit.c.

Parameters
[in]P7Pointer to the location at which the PKCS7 is located.
Returns
ASN1_OCTET_STRING ASN.1 string.

Definition at line 61 of file CryptPkcs7VerifyBase.c.

◆ Pkcs7TypeIsOther()

STATIC BOOLEAN Pkcs7TypeIsOther ( IN PKCS7 P7)

Check the contents of PKCS7 is not data.

It is copied from PKCS7_type_is_other() in pk7_doit.c.

Parameters
[in]P7Pointer to the location at which the PKCS7 is located.
Return values
TRUEIf the type is others.
FALSEIf the type is expected.

Definition at line 28 of file CryptPkcs7VerifyBase.c.