]> git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyNull.c
ArmPkg/ArmMmuLib: Add new attribute WRITE_BACK_NONSHAREABLE
[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 - 2015, 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 @param[out] StackLength Length of signer's certificates in bytes.
31 @param[out] TrustedCert Pointer to a trusted certificate from Signer's certificates.
32 It's caller's responsibility to free the buffer with
33 Pkcs7FreeSigners().
34 @param[out] CertLength Length of the trusted certificate in bytes.
35
36 @retval FALSE This interface is not supported.
37
38 **/
39 BOOLEAN
40 EFIAPI
41 Pkcs7GetSigners (
42 IN CONST UINT8 *P7Data,
43 IN UINTN P7Length,
44 OUT UINT8 **CertStack,
45 OUT UINTN *StackLength,
46 OUT UINT8 **TrustedCert,
47 OUT UINTN *CertLength
48 )
49 {
50 ASSERT (FALSE);
51 return FALSE;
52 }
53
54 /**
55 Wrap function to use free() to free allocated memory for certificates.
56
57 If the interface is not supported, then ASSERT().
58
59 @param[in] Certs Pointer to the certificates to be freed.
60
61 **/
62 VOID
63 EFIAPI
64 Pkcs7FreeSigners (
65 IN UINT8 *Certs
66 )
67 {
68 ASSERT (FALSE);
69 }
70
71 /**
72 Retrieves all embedded certificates from PKCS#7 signed data as described in "PKCS #7:
73 Cryptographic Message Syntax Standard", and outputs two certificate lists chained and
74 unchained to the signer's certificates.
75 The input signed data could be wrapped in a ContentInfo structure.
76
77 @param[in] P7Data Pointer to the PKCS#7 message.
78 @param[in] P7Length Length of the PKCS#7 message in bytes.
79 @param[out] SignerChainCerts Pointer to the certificates list chained to signer's
80 certificate. It's caller's responsibility to free the buffer
81 with Pkcs7FreeSigners().
82 @param[out] ChainLength Length of the chained certificates list buffer in bytes.
83 @param[out] UnchainCerts Pointer to the unchained certificates lists. It's caller's
84 responsibility to free the buffer with Pkcs7FreeSigners().
85 @param[out] UnchainLength Length of the unchained certificates list buffer in bytes.
86
87 @retval TRUE The operation is finished successfully.
88 @retval FALSE Error occurs during the operation.
89
90 **/
91 BOOLEAN
92 EFIAPI
93 Pkcs7GetCertificatesList (
94 IN CONST UINT8 *P7Data,
95 IN UINTN P7Length,
96 OUT UINT8 **SignerChainCerts,
97 OUT UINTN *ChainLength,
98 OUT UINT8 **UnchainCerts,
99 OUT UINTN *UnchainLength
100 )
101 {
102 ASSERT (FALSE);
103 return FALSE;
104 }
105
106 /**
107 Verifies the validity of a PKCS#7 signed data as described in "PKCS #7:
108 Cryptographic Message Syntax Standard". The input signed data could be wrapped
109 in a ContentInfo structure.
110
111 Return FALSE to indicate this interface is not supported.
112
113 @param[in] P7Data Pointer to the PKCS#7 message to verify.
114 @param[in] P7Length Length of the PKCS#7 message in bytes.
115 @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which
116 is used for certificate chain verification.
117 @param[in] CertLength Length of the trusted certificate in bytes.
118 @param[in] InData Pointer to the content to be verified.
119 @param[in] DataLength Length of InData in bytes.
120
121 @retval FALSE This interface is not supported.
122
123 **/
124 BOOLEAN
125 EFIAPI
126 Pkcs7Verify (
127 IN CONST UINT8 *P7Data,
128 IN UINTN P7Length,
129 IN CONST UINT8 *TrustedCert,
130 IN UINTN CertLength,
131 IN CONST UINT8 *InData,
132 IN UINTN DataLength
133 )
134 {
135 ASSERT (FALSE);
136 return FALSE;
137 }
138
139 /**
140 Extracts the attached content from a PKCS#7 signed data if existed. The input signed
141 data could be wrapped in a ContentInfo structure.
142
143 Return FALSE to indicate this interface is not supported.
144
145 @param[in] P7Data Pointer to the PKCS#7 signed data to process.
146 @param[in] P7Length Length of the PKCS#7 signed data in bytes.
147 @param[out] Content Pointer to the extracted content from the PKCS#7 signedData.
148 It's caller's responsibility to free the buffer with FreePool().
149 @param[out] ContentSize The size of the extracted content in bytes.
150
151 @retval TRUE The P7Data was correctly formatted for processing.
152 @retval FALSE The P7Data was not correctly formatted for processing.
153
154 **/
155 BOOLEAN
156 EFIAPI
157 Pkcs7GetAttachedContent (
158 IN CONST UINT8 *P7Data,
159 IN UINTN P7Length,
160 OUT VOID **Content,
161 OUT UINTN *ContentSize
162 )
163 {
164 ASSERT (FALSE);
165 return FALSE;
166 }