TianoCore EDK2 master
|
Go to the source code of this file.
Macros | |
#define | MAX_SIGNATURE_SIZE 1024 |
Functions | |
STATIC INT32 | MbedTlsPkcs7WriteDigestAlgorithm (UINT8 **Ptr, UINT8 *Start, mbedtls_md_type_t DigestType) |
STATIC INT32 | MbedTlsPkcs7WriteDigestAlgorithmSet (UINT8 **Ptr, UINT8 *Start, mbedtls_md_type_t *DigestTypes, INTN Count) |
STATIC INT32 | MbedTlsPkcs7WriteContentInfo (UINT8 **Ptr, UINT8 *Start, UINT8 *Content, INTN ContentLen) |
STATIC INT32 | MbedTlsPkcs7WriteCertificates (UINT8 **Ptr, UINT8 *Start, mbedtls_x509_crt *Cert, mbedtls_x509_crt *OtherCerts) |
STATIC INT32 | MbedTlsPkcs7WriteInt (UINT8 **Ptr, UINT8 *Start, UINT8 *SerialRaw, INTN SerialRawLen) |
STATIC INT32 | MbedTlsPkcs7WriteIssuerAndSerialNumber (UINT8 **Ptr, UINT8 *Start, UINT8 *Serial, INTN SerialLen, UINT8 *IssuerRaw, INTN IssuerRawLen) |
STATIC INT32 | MbedTlsPkcs7WriteSignerInfo (UINT8 **Ptr, UINT8 *Start, MbedtlsPkcs7SignerInfo *SignerInfo) |
STATIC INT32 | MbedTlsPkcs7WriteSignersInfoSet (UINT8 **Ptr, UINT8 *Start, MbedtlsPkcs7SignerInfo *SignersSet) |
STATIC INT32 | MbedTlsPkcs7WriteDer (UINT8 **Ptr, UINT8 *Start, MbedtlsPkcs7 *Pkcs7) |
BOOLEAN EFIAPI | Pkcs7Sign (IN CONST UINT8 *PrivateKey, IN UINTN PrivateKeySize, IN CONST UINT8 *KeyPassword, IN UINT8 *InData, IN UINTN InDataSize, IN UINT8 *SignCert, IN UINT8 *OtherCerts OPTIONAL, OUT UINT8 **SignedData, OUT UINTN *SignedDataSize) |
Variables | |
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 | MbedtlsOidDigestAlgSha256 [] = MBEDTLS_OID_DIGEST_ALG_SHA256 |
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 | MbedtlsOidPkcs1Rsa [] = MBEDTLS_OID_PKCS1_RSA |
PKCS#7 SignedData Sign Wrapper and PKCS#7 SignedData Verification Wrapper Implementation over mbedtls.
RFC 8422 - Elliptic Curve Cryptography (ECC) Cipher Suites FIPS 186-4 - Digital Signature Standard (DSS)
Copyright (c) 2024, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file CryptPkcs7Sign.c.
#define MAX_SIGNATURE_SIZE 1024 |
Enough to store any signature generated by PKCS7
Definition at line 19 of file CryptPkcs7Sign.c.
STATIC INT32 MbedTlsPkcs7WriteCertificates | ( | UINT8 ** | Ptr, |
UINT8 * | Start, | ||
mbedtls_x509_crt * | Cert, | ||
mbedtls_x509_crt * | OtherCerts | ||
) |
certificates :: SET OF ExtendedCertificateOrCertificate, ExtendedCertificateOrCertificate ::= CHOICE { certificate Certificate – x509, extendedCertificate[0] IMPLICIT ExtendedCertificate }.
[in,out] | Ptr | The reference to the current position pointer. |
[in] | Start | The start of the buffer, for bounds-checking. |
[in] | Cert | Certificate. |
[in] | OtherCerts | Ohter Certificate. |
number | The number of bytes written to p on success. |
negative | A negative MBEDTLS_ERR_ASN1_XXX error code on failure. |
Write OtherCerts
Write Cert
Write NextContext
Definition at line 178 of file CryptPkcs7Sign.c.
STATIC INT32 MbedTlsPkcs7WriteContentInfo | ( | UINT8 ** | Ptr, |
UINT8 * | Start, | ||
UINT8 * | Content, | ||
INTN | ContentLen | ||
) |
ContentInfo ::= SEQUENCE { contentType ContentType, content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }.
[in,out] | Ptr | The reference to the current position pointer. |
[in] | Start | The start of the buffer, for bounds-checking. |
[in] | Content | ContentInfo. |
[in] | ContentLen | Size of ContentInfo. |
number | The number of bytes written to p on success. |
negative | A negative MBEDTLS_ERR_ASN1_XXX error code on failure. |
Definition at line 130 of file CryptPkcs7Sign.c.
STATIC INT32 MbedTlsPkcs7WriteDer | ( | UINT8 ** | Ptr, |
UINT8 * | Start, | ||
MbedtlsPkcs7 * | Pkcs7 | ||
) |
Signed Data Type SignedData ::= SEQUENCE { version Version, digestAlgorithms DigestAlgorithmIdentifiers, contentInfo ContentInfo, certificates [0] IMPLICIT ExtendedCertificatesAndCertificates OPTIONAL, crls [1] IMPLICIT CertificateRevocationLists OPTIONAL, signerInfos SignerInfos }
DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
SignerInfos ::= SET OF SignerInfo.
[in,out] | Ptr | The reference to the current position pointer. |
[in] | Start | The start of the buffer, for bounds-checking. |
[in] | Pkcs7 | MbedtlsPkcs7 |
number | The number of bytes written to p on success. |
negative | A negative MBEDTLS_ERR_ASN1_XXX error code on failure. |
Definition at line 394 of file CryptPkcs7Sign.c.
STATIC INT32 MbedTlsPkcs7WriteDigestAlgorithm | ( | UINT8 ** | Ptr, |
UINT8 * | Start, | ||
mbedtls_md_type_t | DigestType | ||
) |
Write DigestAlgorithmIdentifier.
[in,out] | Ptr | The reference to the current position pointer. |
[in] | Start | The start of the buffer, for bounds-checking. |
[in] | DigestType | Digest Type |
number | The number of bytes written to p on success. |
negative | A negative MBEDTLS_ERR_ASN1_XXX error code on failure. |
Definition at line 36 of file CryptPkcs7Sign.c.
STATIC INT32 MbedTlsPkcs7WriteDigestAlgorithmSet | ( | UINT8 ** | Ptr, |
UINT8 * | Start, | ||
mbedtls_md_type_t * | DigestTypes, | ||
INTN | Count | ||
) |
DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier.
[in,out] | Ptr | The reference to the current position pointer. |
[in] | Start | The start of the buffer, for bounds-checking. |
[in] | DigestTypes | Digest Type array. |
[in] | Count | The index for Digest Type. |
number | The number of bytes written to p on success. |
negative | A negative MBEDTLS_ERR_ASN1_XXX error code on failure. |
Definition at line 68 of file CryptPkcs7Sign.c.
STATIC INT32 MbedTlsPkcs7WriteInt | ( | UINT8 ** | Ptr, |
UINT8 * | Start, | ||
UINT8 * | SerialRaw, | ||
INTN | SerialRawLen | ||
) |
write Pkcs7 Int.
[in,out] | Ptr | The reference to the current position pointer. |
[in] | Start | The start of the buffer, for bounds-checking. |
[in] | SerialRaw | SerialRaw. |
[in] | SerialRawLen | Size of SerialRaw. |
number | The number of bytes written to p on success. |
negative | A negative MBEDTLS_ERR_ASN1_XXX error code on failure. |
Definition at line 220 of file CryptPkcs7Sign.c.
STATIC INT32 MbedTlsPkcs7WriteIssuerAndSerialNumber | ( | UINT8 ** | Ptr, |
UINT8 * | Start, | ||
UINT8 * | Serial, | ||
INTN | SerialLen, | ||
UINT8 * | IssuerRaw, | ||
INTN | IssuerRawLen | ||
) |
write Pkcs7 Issuer And SerialNumber.
[in,out] | Ptr | The reference to the current position pointer. |
[in] | Start | The start of the buffer, for bounds-checking. |
[in] | Serial | Serial. |
[in] | SerialLen | Size of Serial. |
[in] | IssuerRaw | IssuerRawLen. |
[in] | IssuerRawLen | Size of IssuerRawLen. |
number | The number of bytes written to p on success. |
negative | A negative MBEDTLS_ERR_ASN1_XXX error code on failure. |
Definition at line 259 of file CryptPkcs7Sign.c.
STATIC INT32 MbedTlsPkcs7WriteSignerInfo | ( | UINT8 ** | Ptr, |
UINT8 * | Start, | ||
MbedtlsPkcs7SignerInfo * | SignerInfo | ||
) |
SignerInfo ::= SEQUENCE { version Version; issuerAndSerialNumber IssuerAndSerialNumber, digestAlgorithm DigestAlgorithmIdentifier, authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL, digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier, encryptedDigest EncryptedDigest, unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL.
[in,out] | Ptr | The reference to the current position pointer. |
[in] | Start | The start of the buffer, for bounds-checking. |
[in] | SignerInfo | SignerInfo. |
number | The number of bytes written to p on success. |
negative | A negative MBEDTLS_ERR_ASN1_XXX error code on failure. |
Definition at line 303 of file CryptPkcs7Sign.c.
STATIC INT32 MbedTlsPkcs7WriteSignersInfoSet | ( | UINT8 ** | Ptr, |
UINT8 * | Start, | ||
MbedtlsPkcs7SignerInfo * | SignersSet | ||
) |
write Pkcs7 Signers Info Set.
[in,out] | Ptr | The reference to the current position pointer. |
[in] | Start | The start of the buffer, for bounds-checking. |
[in] | SignersSet | SignerInfo Set. |
number | The number of bytes written to p on success. |
negative | A negative MBEDTLS_ERR_ASN1_XXX error code on failure. |
Definition at line 342 of file CryptPkcs7Sign.c.
BOOLEAN EFIAPI Pkcs7Sign | ( | IN CONST UINT8 * | PrivateKey, |
IN UINTN | PrivateKeySize, | ||
IN CONST UINT8 * | KeyPassword, | ||
IN UINT8 * | InData, | ||
IN UINTN | InDataSize, | ||
IN UINT8 * | SignCert, | ||
IN UINT8 *OtherCerts | OPTIONAL, | ||
OUT UINT8 ** | SignedData, | ||
OUT UINTN * | SignedDataSize | ||
) |
Creates a PKCS#7 signedData as described in "PKCS #7: Cryptographic Message Syntax Standard, version 1.5". This interface is only intended to be used for application to perform PKCS#7 functionality validation.
If this interface is not supported, then return FALSE.
[in] | PrivateKey | Pointer to the PEM-formatted private key data for data signing. |
[in] | PrivateKeySize | Size of the PEM private key data in bytes. |
[in] | KeyPassword | NULL-terminated passphrase used for encrypted PEM key data. |
[in] | InData | Pointer to the content to be signed. |
[in] | InDataSize | Size of InData in bytes. |
[in] | SignCert | Pointer to signer's DER-encoded certificate to sign with. |
[in] | OtherCerts | Pointer to an optional additional set of certificates to include in the PKCS#7 signedData (e.g. any intermediate CAs in the chain). |
[out] | SignedData | Pointer to output PKCS#7 signedData. It's caller's responsibility to free the buffer with FreePool(). |
[out] | SignedDataSize | Size of SignedData in bytes. |
TRUE | PKCS#7 data signing succeeded. |
FALSE | PKCS#7 data signing failed. |
FALSE | This interface is not supported. |
Calculate InData Digest
Pk Sign
Enlarge buffer if buffer is too small
Definition at line 452 of file CryptPkcs7Sign.c.
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 MbedtlsOidDigestAlgSha256[] = MBEDTLS_OID_DIGEST_ALG_SHA256 |
Definition at line 21 of file CryptPkcs7Sign.c.
GLOBAL_REMOVE_IF_UNREFERENCED UINT8 MbedtlsOidPkcs1Rsa[] = MBEDTLS_OID_PKCS1_RSA |
Definition at line 22 of file CryptPkcs7Sign.c.