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