]> git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/Library/BaseCryptLib/Pk/CryptX509Null.c
559236820a38b41619c7822f9e7e919fcad5ffb4
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / Pk / CryptX509Null.c
1 /** @file
2 X.509 Certificate Handler 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 Construct a X509 object from DER-encoded certificate data.
14
15 Return FALSE to indicate this interface is not supported.
16
17 @param[in] Cert Pointer to the DER-encoded certificate data.
18 @param[in] CertSize The size of certificate data in bytes.
19 @param[out] SingleX509Cert The generated X509 object.
20
21 @retval FALSE This interface is not supported.
22
23 **/
24 BOOLEAN
25 EFIAPI
26 X509ConstructCertificate (
27 IN CONST UINT8 *Cert,
28 IN UINTN CertSize,
29 OUT UINT8 **SingleX509Cert
30 )
31 {
32 ASSERT (FALSE);
33 return FALSE;
34 }
35
36 /**
37 Construct a X509 stack object from a list of DER-encoded certificate data.
38
39 Return FALSE to indicate this interface is not supported.
40
41 @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object.
42 On output, pointer to the X509 stack object with new
43 inserted X509 certificate.
44 @param ... A list of DER-encoded single certificate data followed
45 by certificate size. A NULL terminates the list. The
46 pairs are the arguments to X509ConstructCertificate().
47
48 @retval FALSE This interface is not supported.
49
50 **/
51 BOOLEAN
52 EFIAPI
53 X509ConstructCertificateStack (
54 IN OUT UINT8 **X509Stack,
55 ...
56 )
57 {
58 ASSERT (FALSE);
59 return FALSE;
60 }
61
62 /**
63 Release the specified X509 object.
64
65 If the interface is not supported, then ASSERT().
66
67 @param[in] X509Cert Pointer to the X509 object to be released.
68
69 **/
70 VOID
71 EFIAPI
72 X509Free (
73 IN VOID *X509Cert
74 )
75 {
76 ASSERT (FALSE);
77 }
78
79 /**
80 Release the specified X509 stack object.
81
82 If the interface is not supported, then ASSERT().
83
84 @param[in] X509Stack Pointer to the X509 stack object to be released.
85
86 **/
87 VOID
88 EFIAPI
89 X509StackFree (
90 IN VOID *X509Stack
91 )
92 {
93 ASSERT (FALSE);
94 }
95
96 /**
97 Retrieve the subject bytes from one X.509 certificate.
98
99 Return FALSE to indicate this interface is not supported.
100
101 @param[in] Cert Pointer to the DER-encoded X509 certificate.
102 @param[in] CertSize Size of the X509 certificate in bytes.
103 @param[out] CertSubject Pointer to the retrieved certificate subject bytes.
104 @param[in, out] SubjectSize The size in bytes of the CertSubject buffer on input,
105 and the size of buffer returned CertSubject on output.
106
107
108 @retval FALSE This interface is not supported.
109
110 **/
111 BOOLEAN
112 EFIAPI
113 X509GetSubjectName (
114 IN CONST UINT8 *Cert,
115 IN UINTN CertSize,
116 OUT UINT8 *CertSubject,
117 IN OUT UINTN *SubjectSize
118 )
119 {
120 ASSERT (FALSE);
121 return FALSE;
122 }
123
124 /**
125 Retrieve the common name (CN) string from one X.509 certificate.
126
127 Return RETURN_UNSUPPORTED to indicate this interface is not supported.
128
129 @param[in] Cert Pointer to the DER-encoded X509 certificate.
130 @param[in] CertSize Size of the X509 certificate in bytes.
131 @param[out] CommonName Buffer to contain the retrieved certificate common
132 name string (UTF8). At most CommonNameSize bytes will be
133 written and the string will be null terminated. May be
134 NULL in order to determine the size buffer needed.
135 @param[in,out] CommonNameSize The size in bytes of the CommonName buffer on input,
136 and the size of buffer returned CommonName on output.
137 If CommonName is NULL then the amount of space needed
138 in buffer (including the final null) is returned.
139
140 @retval RETURN_UNSUPPORTED The operation is not supported.
141
142 **/
143 RETURN_STATUS
144 EFIAPI
145 X509GetCommonName (
146 IN CONST UINT8 *Cert,
147 IN UINTN CertSize,
148 OUT CHAR8 *CommonName, OPTIONAL
149 IN OUT UINTN *CommonNameSize
150 )
151 {
152 ASSERT (FALSE);
153 return RETURN_UNSUPPORTED;
154 }
155
156 /**
157 Retrieve the RSA Public Key from one DER-encoded X509 certificate.
158
159 Return FALSE to indicate this interface is not supported.
160
161 @param[in] Cert Pointer to the DER-encoded X509 certificate.
162 @param[in] CertSize Size of the X509 certificate in bytes.
163 @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved
164 RSA public key component. Use RsaFree() function to free the
165 resource.
166
167 @retval FALSE This interface is not supported.
168
169 **/
170 BOOLEAN
171 EFIAPI
172 RsaGetPublicKeyFromX509 (
173 IN CONST UINT8 *Cert,
174 IN UINTN CertSize,
175 OUT VOID **RsaContext
176 )
177 {
178 ASSERT (FALSE);
179 return FALSE;
180 }
181
182 /**
183 Verify one X509 certificate was issued by the trusted CA.
184
185 Return FALSE to indicate this interface is not supported.
186
187 @param[in] Cert Pointer to the DER-encoded X509 certificate to be verified.
188 @param[in] CertSize Size of the X509 certificate in bytes.
189 @param[in] CACert Pointer to the DER-encoded trusted CA certificate.
190 @param[in] CACertSize Size of the CA Certificate in bytes.
191
192 @retval FALSE This interface is not supported.
193
194 **/
195 BOOLEAN
196 EFIAPI
197 X509VerifyCert (
198 IN CONST UINT8 *Cert,
199 IN UINTN CertSize,
200 IN CONST UINT8 *CACert,
201 IN UINTN CACertSize
202 )
203 {
204 ASSERT (FALSE);
205 return FALSE;
206 }
207
208 /**
209 Retrieve the TBSCertificate from one given X.509 certificate.
210
211 Return FALSE to indicate this interface is not supported.
212
213 @param[in] Cert Pointer to the given DER-encoded X509 certificate.
214 @param[in] CertSize Size of the X509 certificate in bytes.
215 @param[out] TBSCert DER-Encoded To-Be-Signed certificate.
216 @param[out] TBSCertSize Size of the TBS certificate in bytes.
217
218 @retval FALSE This interface is not supported.
219
220 **/
221 BOOLEAN
222 EFIAPI
223 X509GetTBSCert (
224 IN CONST UINT8 *Cert,
225 IN UINTN CertSize,
226 OUT UINT8 **TBSCert,
227 OUT UINTN *TBSCertSize
228 )
229 {
230 ASSERT (FALSE);
231 return FALSE;
232 }