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