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