]> git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyNull.c
0ddf16a61b31587795051ef6a0a6620179a0baf2
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / Pk / CryptPkcs7VerifyNull.c
1 /** @file
2 PKCS#7 SignedData Verification Wrapper Implementation which does not provide
3 real capabilities.
4
5 Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #include "InternalCryptLib.h"
11
12 /**
13 Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7:
14 Cryptographic Message Syntax Standard". The input signed data could be wrapped
15 in a ContentInfo structure.
16
17 Return FALSE to indicate this interface is not supported.
18
19 @param[in] P7Data Pointer to the PKCS#7 message to verify.
20 @param[in] P7Length Length of the PKCS#7 message in bytes.
21 @param[out] CertStack Pointer to Signer's certificates retrieved from P7Data.
22 It's caller's responsibility to free the buffer with
23 Pkcs7FreeSigners().
24 This data structure is EFI_CERT_STACK type.
25 @param[out] StackLength Length of signer's certificates in bytes.
26 @param[out] TrustedCert Pointer to a trusted certificate from Signer's certificates.
27 It's caller's responsibility to free the buffer with
28 Pkcs7FreeSigners().
29 @param[out] CertLength Length of the trusted certificate in bytes.
30
31 @retval FALSE This interface is not supported.
32
33 **/
34 BOOLEAN
35 EFIAPI
36 Pkcs7GetSigners (
37 IN CONST UINT8 *P7Data,
38 IN UINTN P7Length,
39 OUT UINT8 **CertStack,
40 OUT UINTN *StackLength,
41 OUT UINT8 **TrustedCert,
42 OUT UINTN *CertLength
43 )
44 {
45 ASSERT (FALSE);
46 return FALSE;
47 }
48
49 /**
50 Wrap function to use free() to free allocated memory for certificates.
51
52 If the interface is not supported, then ASSERT().
53
54 @param[in] Certs Pointer to the certificates to be freed.
55
56 **/
57 VOID
58 EFIAPI
59 Pkcs7FreeSigners (
60 IN UINT8 *Certs
61 )
62 {
63 ASSERT (FALSE);
64 }
65
66 /**
67 Retrieves all embedded certificates from PKCS#7 signed data as described in "PKCS #7:
68 Cryptographic Message Syntax Standard", and outputs two certificate lists chained and
69 unchained to the signer's certificates.
70 The input signed data could be wrapped in a ContentInfo structure.
71
72 @param[in] P7Data Pointer to the PKCS#7 message.
73 @param[in] P7Length Length of the PKCS#7 message in bytes.
74 @param[out] SignerChainCerts Pointer to the certificates list chained to signer's
75 certificate. It's caller's responsibility to free the buffer
76 with Pkcs7FreeSigners().
77 This data structure is EFI_CERT_STACK type.
78 @param[out] ChainLength Length of the chained certificates list buffer in bytes.
79 @param[out] UnchainCerts Pointer to the unchained certificates lists. It's caller's
80 responsibility to free the buffer with Pkcs7FreeSigners().
81 This data structure is EFI_CERT_STACK type.
82 @param[out] UnchainLength Length of the unchained certificates list buffer in bytes.
83
84 @retval TRUE The operation is finished successfully.
85 @retval FALSE Error occurs during the operation.
86
87 **/
88 BOOLEAN
89 EFIAPI
90 Pkcs7GetCertificatesList (
91 IN CONST UINT8 *P7Data,
92 IN UINTN P7Length,
93 OUT UINT8 **SignerChainCerts,
94 OUT UINTN *ChainLength,
95 OUT UINT8 **UnchainCerts,
96 OUT UINTN *UnchainLength
97 )
98 {
99 ASSERT (FALSE);
100 return FALSE;
101 }
102
103 /**
104 Verifies the validity of a PKCS#7 signed data as described in "PKCS #7:
105 Cryptographic Message Syntax Standard". The input signed data could be wrapped
106 in a ContentInfo structure.
107
108 Return FALSE to indicate this interface is not supported.
109
110 @param[in] P7Data Pointer to the PKCS#7 message to verify.
111 @param[in] P7Length Length of the PKCS#7 message in bytes.
112 @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which
113 is used for certificate chain verification.
114 @param[in] CertLength Length of the trusted certificate in bytes.
115 @param[in] InData Pointer to the content to be verified.
116 @param[in] DataLength Length of InData in bytes.
117
118 @retval FALSE This interface is not supported.
119
120 **/
121 BOOLEAN
122 EFIAPI
123 Pkcs7Verify (
124 IN CONST UINT8 *P7Data,
125 IN UINTN P7Length,
126 IN CONST UINT8 *TrustedCert,
127 IN UINTN CertLength,
128 IN CONST UINT8 *InData,
129 IN UINTN DataLength
130 )
131 {
132 ASSERT (FALSE);
133 return FALSE;
134 }
135
136 /**
137 Extracts the attached content from a PKCS#7 signed data if existed. The input signed
138 data could be wrapped in a ContentInfo structure.
139
140 Return FALSE to indicate this interface is not supported.
141
142 @param[in] P7Data Pointer to the PKCS#7 signed data to process.
143 @param[in] P7Length Length of the PKCS#7 signed data in bytes.
144 @param[out] Content Pointer to the extracted content from the PKCS#7 signedData.
145 It's caller's responsibility to free the buffer with FreePool().
146 @param[out] ContentSize The size of the extracted content in bytes.
147
148 @retval TRUE The P7Data was correctly formatted for processing.
149 @retval FALSE The P7Data was not correctly formatted for processing.
150
151 **/
152 BOOLEAN
153 EFIAPI
154 Pkcs7GetAttachedContent (
155 IN CONST UINT8 *P7Data,
156 IN UINTN P7Length,
157 OUT VOID **Content,
158 OUT UINTN *ContentSize
159 )
160 {
161 ASSERT (FALSE);
162 return FALSE;
163 }