CryptoPkg: Add some comments for API usage clarification.
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLibRuntimeCryptProtocol / 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
12d95665 5Copyright (c) 2012 - 2014, 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
130/**\r
131 Retrieve the RSA Public Key from one DER-encoded X509 certificate.\r
132\r
133 Return FALSE 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] RsaContext Pointer to new-generated RSA context which contain the retrieved\r
138 RSA public key component. Use RsaFree() function to free the\r
139 resource.\r
140\r
141 @retval FALSE This interface is not supported.\r
142\r
143**/\r
144BOOLEAN\r
145EFIAPI\r
146RsaGetPublicKeyFromX509 (\r
147 IN CONST UINT8 *Cert,\r
148 IN UINTN CertSize,\r
149 OUT VOID **RsaContext\r
150 )\r
151{\r
152 ASSERT (FALSE);\r
153 return FALSE;\r
154}\r
155\r
156/**\r
157 Verify one X509 certificate was issued by the trusted CA.\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 to be verified.\r
162 @param[in] CertSize Size of the X509 certificate in bytes.\r
163 @param[in] CACert Pointer to the DER-encoded trusted CA certificate.\r
164 @param[in] CACertSize Size of the CA Certificate in bytes.\r
165\r
166 @retval FALSE This interface is not supported.\r
167 \r
168**/\r
169BOOLEAN\r
170EFIAPI\r
171X509VerifyCert (\r
172 IN CONST UINT8 *Cert,\r
173 IN UINTN CertSize,\r
174 IN CONST UINT8 *CACert,\r
175 IN UINTN CACertSize\r
176 )\r
177{\r
178 ASSERT (FALSE);\r
179 return FALSE;\r
180}\r
12d95665
LQ
181\r
182/**\r
183 Retrieve the TBSCertificate from one given X.509 certificate.\r
184\r
185 Return FALSE to indicate this interface is not supported.\r
186\r
187 @param[in] Cert Pointer to the given DER-encoded X509 certificate.\r
188 @param[in] CertSize Size of the X509 certificate in bytes.\r
189 @param[out] TBSCert DER-Encoded To-Be-Signed certificate.\r
190 @param[out] TBSCertSize Size of the TBS certificate in bytes.\r
191\r
192 @retval FALSE This interface is not supported.\r
193\r
194**/\r
195BOOLEAN\r
196EFIAPI\r
197X509GetTBSCert (\r
198 IN CONST UINT8 *Cert,\r
199 IN UINTN CertSize,\r
200 OUT UINT8 **TBSCert,\r
201 OUT UINTN *TBSCertSize\r
202 )\r
203{\r
204 ASSERT (FALSE);\r
205 return FALSE;\r
206}