]> git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyNull.c
CryptoPkg: Clean up source files
[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 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #include "InternalCryptLib.h"
17
18 /**
19 Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7:
20 Cryptographic Message Syntax Standard". The input signed data could be wrapped
21 in a ContentInfo structure.
22
23 Return FALSE to indicate this interface is not supported.
24
25 @param[in] P7Data Pointer to the PKCS#7 message to verify.
26 @param[in] P7Length Length of the PKCS#7 message in bytes.
27 @param[out] CertStack Pointer to Signer's certificates retrieved from P7Data.
28 It's caller's responsibility to free the buffer with
29 Pkcs7FreeSigners().
30 This data structure is EFI_CERT_STACK type.
31 @param[out] StackLength Length of signer's certificates in bytes.
32 @param[out] TrustedCert Pointer to a trusted certificate from Signer's certificates.
33 It's caller's responsibility to free the buffer with
34 Pkcs7FreeSigners().
35 @param[out] CertLength Length of the trusted certificate in bytes.
36
37 @retval FALSE This interface is not supported.
38
39 **/
40 BOOLEAN
41 EFIAPI
42 Pkcs7GetSigners (
43 IN CONST UINT8 *P7Data,
44 IN UINTN P7Length,
45 OUT UINT8 **CertStack,
46 OUT UINTN *StackLength,
47 OUT UINT8 **TrustedCert,
48 OUT UINTN *CertLength
49 )
50 {
51 ASSERT (FALSE);
52 return FALSE;
53 }
54
55 /**
56 Wrap function to use free() to free allocated memory for certificates.
57
58 If the interface is not supported, then ASSERT().
59
60 @param[in] Certs Pointer to the certificates to be freed.
61
62 **/
63 VOID
64 EFIAPI
65 Pkcs7FreeSigners (
66 IN UINT8 *Certs
67 )
68 {
69 ASSERT (FALSE);
70 }
71
72 /**
73 Retrieves all embedded certificates from PKCS#7 signed data as described in "PKCS #7:
74 Cryptographic Message Syntax Standard", and outputs two certificate lists chained and
75 unchained to the signer's certificates.
76 The input signed data could be wrapped in a ContentInfo structure.
77
78 @param[in] P7Data Pointer to the PKCS#7 message.
79 @param[in] P7Length Length of the PKCS#7 message in bytes.
80 @param[out] SignerChainCerts Pointer to the certificates list chained to signer's
81 certificate. It's caller's responsibility to free the buffer
82 with Pkcs7FreeSigners().
83 This data structure is EFI_CERT_STACK type.
84 @param[out] ChainLength Length of the chained certificates list buffer in bytes.
85 @param[out] UnchainCerts Pointer to the unchained certificates lists. It's caller's
86 responsibility to free the buffer with Pkcs7FreeSigners().
87 This data structure is EFI_CERT_STACK type.
88 @param[out] UnchainLength Length of the unchained certificates list buffer in bytes.
89
90 @retval TRUE The operation is finished successfully.
91 @retval FALSE Error occurs during the operation.
92
93 **/
94 BOOLEAN
95 EFIAPI
96 Pkcs7GetCertificatesList (
97 IN CONST UINT8 *P7Data,
98 IN UINTN P7Length,
99 OUT UINT8 **SignerChainCerts,
100 OUT UINTN *ChainLength,
101 OUT UINT8 **UnchainCerts,
102 OUT UINTN *UnchainLength
103 )
104 {
105 ASSERT (FALSE);
106 return FALSE;
107 }
108
109 /**
110 Verifies the validity of a PKCS#7 signed data as described in "PKCS #7:
111 Cryptographic Message Syntax Standard". The input signed data could be wrapped
112 in a ContentInfo structure.
113
114 Return FALSE to indicate this interface is not supported.
115
116 @param[in] P7Data Pointer to the PKCS#7 message to verify.
117 @param[in] P7Length Length of the PKCS#7 message in bytes.
118 @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which
119 is used for certificate chain verification.
120 @param[in] CertLength Length of the trusted certificate in bytes.
121 @param[in] InData Pointer to the content to be verified.
122 @param[in] DataLength Length of InData in bytes.
123
124 @retval FALSE This interface is not supported.
125
126 **/
127 BOOLEAN
128 EFIAPI
129 Pkcs7Verify (
130 IN CONST UINT8 *P7Data,
131 IN UINTN P7Length,
132 IN CONST UINT8 *TrustedCert,
133 IN UINTN CertLength,
134 IN CONST UINT8 *InData,
135 IN UINTN DataLength
136 )
137 {
138 ASSERT (FALSE);
139 return FALSE;
140 }
141
142 /**
143 Extracts the attached content from a PKCS#7 signed data if existed. The input signed
144 data could be wrapped in a ContentInfo structure.
145
146 Return FALSE to indicate this interface is not supported.
147
148 @param[in] P7Data Pointer to the PKCS#7 signed data to process.
149 @param[in] P7Length Length of the PKCS#7 signed data in bytes.
150 @param[out] Content Pointer to the extracted content from the PKCS#7 signedData.
151 It's caller's responsibility to free the buffer with FreePool().
152 @param[out] ContentSize The size of the extracted content in bytes.
153
154 @retval TRUE The P7Data was correctly formatted for processing.
155 @retval FALSE The P7Data was not correctly formatted for processing.
156
157 **/
158 BOOLEAN
159 EFIAPI
160 Pkcs7GetAttachedContent (
161 IN CONST UINT8 *P7Data,
162 IN UINTN P7Length,
163 OUT VOID **Content,
164 OUT UINTN *ContentSize
165 )
166 {
167 ASSERT (FALSE);
168 return FALSE;
169 }