]>
Commit | Line | Data |
---|---|---|
532616bb | 1 | /** @file\r |
2 | X.509 Certificate Handler Wrapper Implementation which does not provide\r | |
3 | real capabilities.\r | |
4 | \r | |
66862136 | 5 | Copyright (c) 2012 - 2020, Intel Corporation. All rights reserved.<BR>\r |
2009f6b4 | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
532616bb | 7 | \r |
8 | **/\r | |
9 | \r | |
10 | #include "InternalCryptLib.h"\r | |
11 | \r | |
12 | /**\r | |
13 | Construct a X509 object from DER-encoded certificate data.\r | |
14 | \r | |
15 | Return FALSE to indicate this interface is not supported.\r | |
16 | \r | |
17 | @param[in] Cert Pointer to the DER-encoded certificate data.\r | |
18 | @param[in] CertSize The size of certificate data in bytes.\r | |
19 | @param[out] SingleX509Cert The generated X509 object.\r | |
20 | \r | |
21 | @retval FALSE This interface is not supported.\r | |
22 | \r | |
23 | **/\r | |
24 | BOOLEAN\r | |
25 | EFIAPI\r | |
26 | X509ConstructCertificate (\r | |
27 | IN CONST UINT8 *Cert,\r | |
28 | IN UINTN CertSize,\r | |
29 | OUT UINT8 **SingleX509Cert\r | |
30 | )\r | |
31 | {\r | |
32 | ASSERT (FALSE);\r | |
33 | return FALSE;\r | |
34 | }\r | |
35 | \r | |
66862136 MK |
36 | /**\r |
37 | Construct a X509 stack object from a list of DER-encoded certificate data.\r | |
38 | \r | |
39 | If X509Stack is NULL, then return FALSE.\r | |
40 | If this interface is not supported, then return FALSE.\r | |
41 | \r | |
42 | @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object.\r | |
43 | On output, pointer to the X509 stack object with new\r | |
44 | inserted X509 certificate.\r | |
45 | @param[in] Args VA_LIST marker for the variable argument list.\r | |
46 | A list of DER-encoded single certificate data followed\r | |
47 | by certificate size. A NULL terminates the list. The\r | |
48 | pairs are the arguments to X509ConstructCertificate().\r | |
49 | \r | |
50 | @retval TRUE The X509 stack construction succeeded.\r | |
51 | @retval FALSE The construction operation failed.\r | |
52 | @retval FALSE This interface is not supported.\r | |
53 | \r | |
54 | **/\r | |
55 | BOOLEAN\r | |
56 | EFIAPI\r | |
57 | X509ConstructCertificateStackV (\r | |
58 | IN OUT UINT8 **X509Stack,\r | |
59 | IN VA_LIST Args\r | |
60 | )\r | |
61 | {\r | |
62 | ASSERT (FALSE);\r | |
63 | return FALSE;\r | |
64 | }\r | |
65 | \r | |
532616bb | 66 | /**\r |
67 | Construct a X509 stack object from a list of DER-encoded certificate data.\r | |
68 | \r | |
69 | Return FALSE to indicate this interface is not supported.\r | |
70 | \r | |
952bd229 | 71 | @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object.\r |
532616bb | 72 | On output, pointer to the X509 stack object with new\r |
73 | inserted X509 certificate.\r | |
74 | @param ... A list of DER-encoded single certificate data followed\r | |
75 | by certificate size. A NULL terminates the list. The\r | |
76 | pairs are the arguments to X509ConstructCertificate().\r | |
630f67dd | 77 | \r |
532616bb | 78 | @retval FALSE This interface is not supported.\r |
79 | \r | |
80 | **/\r | |
81 | BOOLEAN\r | |
82 | EFIAPI\r | |
83 | X509ConstructCertificateStack (\r | |
84 | IN OUT UINT8 **X509Stack,\r | |
630f67dd | 85 | ...\r |
532616bb | 86 | )\r |
87 | {\r | |
88 | ASSERT (FALSE);\r | |
89 | return FALSE;\r | |
90 | }\r | |
91 | \r | |
92 | /**\r | |
93 | Release the specified X509 object.\r | |
94 | \r | |
95 | If the interface is not supported, then ASSERT().\r | |
96 | \r | |
97 | @param[in] X509Cert Pointer to the X509 object to be released.\r | |
98 | \r | |
99 | **/\r | |
100 | VOID\r | |
101 | EFIAPI\r | |
102 | X509Free (\r | |
103 | IN VOID *X509Cert\r | |
104 | )\r | |
630f67dd | 105 | {\r |
532616bb | 106 | ASSERT (FALSE);\r |
107 | }\r | |
108 | \r | |
109 | /**\r | |
110 | Release the specified X509 stack object.\r | |
111 | \r | |
112 | If the interface is not supported, then ASSERT().\r | |
113 | \r | |
114 | @param[in] X509Stack Pointer to the X509 stack object to be released.\r | |
115 | \r | |
116 | **/\r | |
117 | VOID\r | |
118 | EFIAPI\r | |
119 | X509StackFree (\r | |
120 | IN VOID *X509Stack\r | |
121 | )\r | |
122 | {\r | |
123 | ASSERT (FALSE);\r | |
124 | }\r | |
125 | \r | |
126 | /**\r | |
127 | Retrieve the subject bytes from one X.509 certificate.\r | |
128 | \r | |
129 | Return FALSE to indicate this interface is not supported.\r | |
130 | \r | |
131 | @param[in] Cert Pointer to the DER-encoded X509 certificate.\r | |
132 | @param[in] CertSize Size of the X509 certificate in bytes.\r | |
133 | @param[out] CertSubject Pointer to the retrieved certificate subject bytes.\r | |
134 | @param[in, out] SubjectSize The size in bytes of the CertSubject buffer on input,\r | |
135 | and the size of buffer returned CertSubject on output.\r | |
136 | \r | |
137 | \r | |
138 | @retval FALSE This interface is not supported.\r | |
139 | \r | |
140 | **/\r | |
141 | BOOLEAN\r | |
142 | EFIAPI\r | |
143 | X509GetSubjectName (\r | |
144 | IN CONST UINT8 *Cert,\r | |
145 | IN UINTN CertSize,\r | |
146 | OUT UINT8 *CertSubject,\r | |
147 | IN OUT UINTN *SubjectSize\r | |
148 | )\r | |
149 | {\r | |
150 | ASSERT (FALSE);\r | |
151 | return FALSE;\r | |
152 | }\r | |
153 | \r | |
5b7c2245 QL |
154 | /**\r |
155 | Retrieve the common name (CN) string from one X.509 certificate.\r | |
156 | \r | |
157 | Return RETURN_UNSUPPORTED to indicate this interface is not supported.\r | |
158 | \r | |
159 | @param[in] Cert Pointer to the DER-encoded X509 certificate.\r | |
160 | @param[in] CertSize Size of the X509 certificate in bytes.\r | |
161 | @param[out] CommonName Buffer to contain the retrieved certificate common\r | |
0b6457ef | 162 | name string (UTF8). At most CommonNameSize bytes will be\r |
5b7c2245 QL |
163 | written and the string will be null terminated. May be\r |
164 | NULL in order to determine the size buffer needed.\r | |
165 | @param[in,out] CommonNameSize The size in bytes of the CommonName buffer on input,\r | |
166 | and the size of buffer returned CommonName on output.\r | |
167 | If CommonName is NULL then the amount of space needed\r | |
168 | in buffer (including the final null) is returned.\r | |
169 | \r | |
170 | @retval RETURN_UNSUPPORTED The operation is not supported.\r | |
171 | \r | |
172 | **/\r | |
173 | RETURN_STATUS\r | |
174 | EFIAPI\r | |
175 | X509GetCommonName (\r | |
176 | IN CONST UINT8 *Cert,\r | |
177 | IN UINTN CertSize,\r | |
c8f46130 | 178 | OUT CHAR8 *CommonName OPTIONAL,\r |
5b7c2245 QL |
179 | IN OUT UINTN *CommonNameSize\r |
180 | )\r | |
181 | {\r | |
182 | ASSERT (FALSE);\r | |
183 | return RETURN_UNSUPPORTED;\r | |
184 | }\r | |
185 | \r | |
912e1e1e BB |
186 | /**\r |
187 | Retrieve the organization name (ON) string from one X.509 certificate.\r | |
188 | \r | |
189 | Return RETURN_UNSUPPORTED to indicate this interface is not supported.\r | |
190 | \r | |
191 | @param[in] Cert Pointer to the DER-encoded X509 certificate.\r | |
192 | @param[in] CertSize Size of the X509 certificate in bytes.\r | |
193 | @param[out] NameBuffer Buffer to contain the retrieved certificate organization\r | |
194 | name string. At most NameBufferSize bytes will be\r | |
195 | written and the string will be null terminated. May be\r | |
196 | NULL in order to determine the size buffer needed.\r | |
197 | @param[in,out] NameBufferSize The size in bytes of the Name buffer on input,\r | |
198 | and the size of buffer returned Name on output.\r | |
199 | If NameBuffer is NULL then the amount of space needed\r | |
200 | in buffer (including the final null) is returned.\r | |
201 | \r | |
202 | @retval RETURN_UNSUPPORTED The operation is not supported.\r | |
203 | \r | |
204 | **/\r | |
205 | RETURN_STATUS\r | |
206 | EFIAPI\r | |
207 | X509GetOrganizationName (\r | |
7c342378 MK |
208 | IN CONST UINT8 *Cert,\r |
209 | IN UINTN CertSize,\r | |
210 | OUT CHAR8 *NameBuffer OPTIONAL,\r | |
211 | IN OUT UINTN *NameBufferSize\r | |
912e1e1e BB |
212 | )\r |
213 | {\r | |
214 | ASSERT (FALSE);\r | |
215 | return RETURN_UNSUPPORTED;\r | |
216 | }\r | |
217 | \r | |
532616bb | 218 | /**\r |
219 | Retrieve the RSA Public Key from one DER-encoded X509 certificate.\r | |
220 | \r | |
221 | Return FALSE to indicate this interface is not supported.\r | |
222 | \r | |
223 | @param[in] Cert Pointer to the DER-encoded X509 certificate.\r | |
224 | @param[in] CertSize Size of the X509 certificate in bytes.\r | |
225 | @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved\r | |
226 | RSA public key component. Use RsaFree() function to free the\r | |
227 | resource.\r | |
228 | \r | |
229 | @retval FALSE This interface is not supported.\r | |
230 | \r | |
231 | **/\r | |
232 | BOOLEAN\r | |
233 | EFIAPI\r | |
234 | RsaGetPublicKeyFromX509 (\r | |
235 | IN CONST UINT8 *Cert,\r | |
236 | IN UINTN CertSize,\r | |
237 | OUT VOID **RsaContext\r | |
238 | )\r | |
239 | {\r | |
240 | ASSERT (FALSE);\r | |
241 | return FALSE;\r | |
242 | }\r | |
243 | \r | |
244 | /**\r | |
245 | Verify one X509 certificate was issued by the trusted CA.\r | |
246 | \r | |
247 | Return FALSE to indicate this interface is not supported.\r | |
248 | \r | |
249 | @param[in] Cert Pointer to the DER-encoded X509 certificate to be verified.\r | |
250 | @param[in] CertSize Size of the X509 certificate in bytes.\r | |
251 | @param[in] CACert Pointer to the DER-encoded trusted CA certificate.\r | |
252 | @param[in] CACertSize Size of the CA Certificate in bytes.\r | |
253 | \r | |
254 | @retval FALSE This interface is not supported.\r | |
630f67dd | 255 | \r |
532616bb | 256 | **/\r |
257 | BOOLEAN\r | |
258 | EFIAPI\r | |
259 | X509VerifyCert (\r | |
260 | IN CONST UINT8 *Cert,\r | |
261 | IN UINTN CertSize,\r | |
262 | IN CONST UINT8 *CACert,\r | |
263 | IN UINTN CACertSize\r | |
264 | )\r | |
265 | {\r | |
266 | ASSERT (FALSE);\r | |
267 | return FALSE;\r | |
268 | }\r | |
12d95665 LQ |
269 | \r |
270 | /**\r | |
271 | Retrieve the TBSCertificate from one given X.509 certificate.\r | |
272 | \r | |
273 | Return FALSE to indicate this interface is not supported.\r | |
274 | \r | |
275 | @param[in] Cert Pointer to the given DER-encoded X509 certificate.\r | |
276 | @param[in] CertSize Size of the X509 certificate in bytes.\r | |
277 | @param[out] TBSCert DER-Encoded To-Be-Signed certificate.\r | |
278 | @param[out] TBSCertSize Size of the TBS certificate in bytes.\r | |
279 | \r | |
280 | @retval FALSE This interface is not supported.\r | |
281 | \r | |
282 | **/\r | |
283 | BOOLEAN\r | |
284 | EFIAPI\r | |
285 | X509GetTBSCert (\r | |
286 | IN CONST UINT8 *Cert,\r | |
287 | IN UINTN CertSize,\r | |
288 | OUT UINT8 **TBSCert,\r | |
289 | OUT UINTN *TBSCertSize\r | |
290 | )\r | |
291 | {\r | |
292 | ASSERT (FALSE);\r | |
293 | return FALSE;\r | |
294 | }\r |