]> git.proxmox.com Git - mirror_edk2.git/blame - CryptoPkg/Include/Library/TlsLib.h
CryptoPkg: Apply uncrustify changes
[mirror_edk2.git] / CryptoPkg / Include / Library / TlsLib.h
CommitLineData
264702a0
HW
1/** @file\r
2 Defines TLS Library APIs.\r
3\r
0878771f 4Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>\r
2009f6b4 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
264702a0
HW
6\r
7**/\r
8\r
9#ifndef __TLS_LIB_H__\r
10#define __TLS_LIB_H__\r
11\r
12/**\r
13 Initializes the OpenSSL library.\r
14\r
15 This function registers ciphers and digests used directly and indirectly\r
16 by SSL/TLS, and initializes the readable error messages.\r
17 This function must be called before any other action takes places.\r
18\r
0878771f
JW
19 @retval TRUE The OpenSSL library has been initialized.\r
20 @retval FALSE Failed to initialize the OpenSSL library.\r
21\r
264702a0 22**/\r
0878771f 23BOOLEAN\r
264702a0
HW
24EFIAPI\r
25TlsInitialize (\r
26 VOID\r
27 );\r
28\r
29/**\r
30 Free an allocated SSL_CTX object.\r
31\r
32 @param[in] TlsCtx Pointer to the SSL_CTX object to be released.\r
33\r
34**/\r
35VOID\r
36EFIAPI\r
37TlsCtxFree (\r
7c342378 38 IN VOID *TlsCtx\r
264702a0
HW
39 );\r
40\r
41/**\r
42 Creates a new SSL_CTX object as framework to establish TLS/SSL enabled\r
43 connections.\r
44\r
45 @param[in] MajorVer Major Version of TLS/SSL Protocol.\r
46 @param[in] MinorVer Minor Version of TLS/SSL Protocol.\r
47\r
48 @return Pointer to an allocated SSL_CTX object.\r
49 If the creation failed, TlsCtxNew() returns NULL.\r
50\r
51**/\r
52VOID *\r
53EFIAPI\r
54TlsCtxNew (\r
7c342378
MK
55 IN UINT8 MajorVer,\r
56 IN UINT8 MinorVer\r
264702a0
HW
57 );\r
58\r
59/**\r
60 Free an allocated TLS object.\r
61\r
62 This function removes the TLS object pointed to by Tls and frees up the\r
63 allocated memory. If Tls is NULL, nothing is done.\r
64\r
65 @param[in] Tls Pointer to the TLS object to be freed.\r
66\r
67**/\r
68VOID\r
69EFIAPI\r
70TlsFree (\r
7c342378 71 IN VOID *Tls\r
264702a0
HW
72 );\r
73\r
74/**\r
75 Create a new TLS object for a connection.\r
76\r
77 This function creates a new TLS object for a connection. The new object\r
78 inherits the setting of the underlying context TlsCtx: connection method,\r
79 options, verification setting.\r
80\r
81 @param[in] TlsCtx Pointer to the SSL_CTX object.\r
82\r
83 @return Pointer to an allocated SSL object.\r
84 If the creation failed, TlsNew() returns NULL.\r
85\r
86**/\r
87VOID *\r
88EFIAPI\r
89TlsNew (\r
7c342378 90 IN VOID *TlsCtx\r
264702a0
HW
91 );\r
92\r
93/**\r
94 Checks if the TLS handshake was done.\r
95\r
96 This function will check if the specified TLS handshake was done.\r
97\r
98 @param[in] Tls Pointer to the TLS object for handshake state checking.\r
99\r
100 @retval TRUE The TLS handshake was done.\r
101 @retval FALSE The TLS handshake was not done.\r
102\r
103**/\r
104BOOLEAN\r
105EFIAPI\r
106TlsInHandshake (\r
7c342378 107 IN VOID *Tls\r
264702a0
HW
108 );\r
109\r
110/**\r
111 Perform a TLS/SSL handshake.\r
112\r
113 This function will perform a TLS/SSL handshake.\r
114\r
115 @param[in] Tls Pointer to the TLS object for handshake operation.\r
116 @param[in] BufferIn Pointer to the most recently received TLS Handshake packet.\r
117 @param[in] BufferInSize Packet size in bytes for the most recently received TLS\r
118 Handshake packet.\r
119 @param[out] BufferOut Pointer to the buffer to hold the built packet.\r
120 @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is\r
121 the buffer size provided by the caller. On output, it\r
122 is the buffer size in fact needed to contain the\r
123 packet.\r
124\r
125 @retval EFI_SUCCESS The required TLS packet is built successfully.\r
126 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
127 Tls is NULL.\r
128 BufferIn is NULL but BufferInSize is NOT 0.\r
129 BufferInSize is 0 but BufferIn is NOT NULL.\r
130 BufferOutSize is NULL.\r
131 BufferOut is NULL if *BufferOutSize is not zero.\r
132 @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet.\r
133 @retval EFI_ABORTED Something wrong during handshake.\r
134\r
135**/\r
136EFI_STATUS\r
137EFIAPI\r
138TlsDoHandshake (\r
7c342378
MK
139 IN VOID *Tls,\r
140 IN UINT8 *BufferIn OPTIONAL,\r
141 IN UINTN BufferInSize OPTIONAL,\r
142 OUT UINT8 *BufferOut OPTIONAL,\r
143 IN OUT UINTN *BufferOutSize\r
264702a0
HW
144 );\r
145\r
146/**\r
147 Handle Alert message recorded in BufferIn. If BufferIn is NULL and BufferInSize is zero,\r
148 TLS session has errors and the response packet needs to be Alert message based on error type.\r
149\r
150 @param[in] Tls Pointer to the TLS object for state checking.\r
151 @param[in] BufferIn Pointer to the most recently received TLS Alert packet.\r
152 @param[in] BufferInSize Packet size in bytes for the most recently received TLS\r
153 Alert packet.\r
154 @param[out] BufferOut Pointer to the buffer to hold the built packet.\r
155 @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is\r
156 the buffer size provided by the caller. On output, it\r
157 is the buffer size in fact needed to contain the\r
158 packet.\r
159\r
160 @retval EFI_SUCCESS The required TLS packet is built successfully.\r
161 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
162 Tls is NULL.\r
163 BufferIn is NULL but BufferInSize is NOT 0.\r
164 BufferInSize is 0 but BufferIn is NOT NULL.\r
165 BufferOutSize is NULL.\r
166 BufferOut is NULL if *BufferOutSize is not zero.\r
167 @retval EFI_ABORTED An error occurred.\r
168 @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet.\r
169\r
170**/\r
171EFI_STATUS\r
172EFIAPI\r
173TlsHandleAlert (\r
7c342378
MK
174 IN VOID *Tls,\r
175 IN UINT8 *BufferIn OPTIONAL,\r
176 IN UINTN BufferInSize OPTIONAL,\r
177 OUT UINT8 *BufferOut OPTIONAL,\r
178 IN OUT UINTN *BufferOutSize\r
264702a0
HW
179 );\r
180\r
181/**\r
182 Build the CloseNotify packet.\r
183\r
184 @param[in] Tls Pointer to the TLS object for state checking.\r
185 @param[in, out] Buffer Pointer to the buffer to hold the built packet.\r
186 @param[in, out] BufferSize Pointer to the buffer size in bytes. On input, it is\r
187 the buffer size provided by the caller. On output, it\r
188 is the buffer size in fact needed to contain the\r
189 packet.\r
190\r
191 @retval EFI_SUCCESS The required TLS packet is built successfully.\r
192 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
193 Tls is NULL.\r
194 BufferSize is NULL.\r
195 Buffer is NULL if *BufferSize is not zero.\r
196 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small to hold the response packet.\r
197\r
198**/\r
199EFI_STATUS\r
200EFIAPI\r
201TlsCloseNotify (\r
7c342378
MK
202 IN VOID *Tls,\r
203 IN OUT UINT8 *Buffer,\r
204 IN OUT UINTN *BufferSize\r
264702a0
HW
205 );\r
206\r
207/**\r
208 Attempts to read bytes from one TLS object and places the data in Buffer.\r
209\r
210 This function will attempt to read BufferSize bytes from the TLS object\r
211 and places the data in Buffer.\r
212\r
213 @param[in] Tls Pointer to the TLS object.\r
214 @param[in,out] Buffer Pointer to the buffer to store the data.\r
215 @param[in] BufferSize The size of Buffer in bytes.\r
216\r
217 @retval >0 The amount of data successfully read from the TLS object.\r
218 @retval <=0 No data was successfully read.\r
219\r
220**/\r
221INTN\r
222EFIAPI\r
223TlsCtrlTrafficOut (\r
7c342378
MK
224 IN VOID *Tls,\r
225 IN OUT VOID *Buffer,\r
226 IN UINTN BufferSize\r
264702a0
HW
227 );\r
228\r
229/**\r
230 Attempts to write data from the buffer to TLS object.\r
231\r
232 This function will attempt to write BufferSize bytes data from the Buffer\r
233 to the TLS object.\r
234\r
235 @param[in] Tls Pointer to the TLS object.\r
236 @param[in] Buffer Pointer to the data buffer.\r
237 @param[in] BufferSize The size of Buffer in bytes.\r
238\r
239 @retval >0 The amount of data successfully written to the TLS object.\r
240 @retval <=0 No data was successfully written.\r
241\r
242**/\r
243INTN\r
244EFIAPI\r
245TlsCtrlTrafficIn (\r
7c342378
MK
246 IN VOID *Tls,\r
247 IN VOID *Buffer,\r
248 IN UINTN BufferSize\r
264702a0
HW
249 );\r
250\r
251/**\r
252 Attempts to read bytes from the specified TLS connection into the buffer.\r
253\r
254 This function tries to read BufferSize bytes data from the specified TLS\r
255 connection into the Buffer.\r
256\r
257 @param[in] Tls Pointer to the TLS connection for data reading.\r
258 @param[in,out] Buffer Pointer to the data buffer.\r
259 @param[in] BufferSize The size of Buffer in bytes.\r
260\r
261 @retval >0 The read operation was successful, and return value is the\r
262 number of bytes actually read from the TLS connection.\r
263 @retval <=0 The read operation was not successful.\r
264\r
265**/\r
266INTN\r
267EFIAPI\r
268TlsRead (\r
7c342378
MK
269 IN VOID *Tls,\r
270 IN OUT VOID *Buffer,\r
271 IN UINTN BufferSize\r
264702a0
HW
272 );\r
273\r
274/**\r
275 Attempts to write data to a TLS connection.\r
276\r
277 This function tries to write BufferSize bytes data from the Buffer into the\r
278 specified TLS connection.\r
279\r
280 @param[in] Tls Pointer to the TLS connection for data writing.\r
281 @param[in] Buffer Pointer to the data buffer.\r
282 @param[in] BufferSize The size of Buffer in bytes.\r
283\r
284 @retval >0 The write operation was successful, and return value is the\r
285 number of bytes actually written to the TLS connection.\r
286 @retval <=0 The write operation was not successful.\r
287\r
288**/\r
289INTN\r
290EFIAPI\r
291TlsWrite (\r
7c342378
MK
292 IN VOID *Tls,\r
293 IN VOID *Buffer,\r
294 IN UINTN BufferSize\r
264702a0
HW
295 );\r
296\r
297/**\r
298 Set a new TLS/SSL method for a particular TLS object.\r
299\r
300 This function sets a new TLS/SSL method for a particular TLS object.\r
301\r
302 @param[in] Tls Pointer to a TLS object.\r
303 @param[in] MajorVer Major Version of TLS/SSL Protocol.\r
304 @param[in] MinorVer Minor Version of TLS/SSL Protocol.\r
305\r
306 @retval EFI_SUCCESS The TLS/SSL method was set successfully.\r
307 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
308 @retval EFI_UNSUPPORTED Unsupported TLS/SSL method.\r
309\r
310**/\r
311EFI_STATUS\r
312EFIAPI\r
313TlsSetVersion (\r
7c342378
MK
314 IN VOID *Tls,\r
315 IN UINT8 MajorVer,\r
316 IN UINT8 MinorVer\r
264702a0
HW
317 );\r
318\r
319/**\r
320 Set TLS object to work in client or server mode.\r
321\r
322 This function prepares a TLS object to work in client or server mode.\r
323\r
324 @param[in] Tls Pointer to a TLS object.\r
325 @param[in] IsServer Work in server mode.\r
326\r
327 @retval EFI_SUCCESS The TLS/SSL work mode was set successfully.\r
328 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
329 @retval EFI_UNSUPPORTED Unsupported TLS/SSL work mode.\r
330\r
331**/\r
332EFI_STATUS\r
333EFIAPI\r
334TlsSetConnectionEnd (\r
7c342378
MK
335 IN VOID *Tls,\r
336 IN BOOLEAN IsServer\r
264702a0
HW
337 );\r
338\r
339/**\r
340 Set the ciphers list to be used by the TLS object.\r
341\r
342 This function sets the ciphers for use by a specified TLS object.\r
343\r
344 @param[in] Tls Pointer to a TLS object.\r
2167c7f7
LE
345 @param[in] CipherId Array of UINT16 cipher identifiers. Each UINT16\r
346 cipher identifier comes from the TLS Cipher Suite\r
347 Registry of the IANA, interpreting Byte1 and Byte2\r
348 in network (big endian) byte order.\r
264702a0
HW
349 @param[in] CipherNum The number of cipher in the list.\r
350\r
351 @retval EFI_SUCCESS The ciphers list was set successfully.\r
352 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
2167c7f7
LE
353 @retval EFI_UNSUPPORTED No supported TLS cipher was found in CipherId.\r
354 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.\r
264702a0
HW
355\r
356**/\r
357EFI_STATUS\r
358EFIAPI\r
359TlsSetCipherList (\r
7c342378
MK
360 IN VOID *Tls,\r
361 IN UINT16 *CipherId,\r
362 IN UINTN CipherNum\r
264702a0
HW
363 );\r
364\r
365/**\r
366 Set the compression method for TLS/SSL operations.\r
367\r
368 This function handles TLS/SSL integrated compression methods.\r
369\r
370 @param[in] CompMethod The compression method ID.\r
371\r
372 @retval EFI_SUCCESS The compression method for the communication was\r
373 set successfully.\r
374 @retval EFI_UNSUPPORTED Unsupported compression method.\r
375\r
376**/\r
377EFI_STATUS\r
378EFIAPI\r
379TlsSetCompressionMethod (\r
7c342378 380 IN UINT8 CompMethod\r
264702a0
HW
381 );\r
382\r
383/**\r
384 Set peer certificate verification mode for the TLS connection.\r
385\r
386 This function sets the verification mode flags for the TLS connection.\r
387\r
388 @param[in] Tls Pointer to the TLS object.\r
389 @param[in] VerifyMode A set of logically or'ed verification mode flags.\r
390\r
391**/\r
392VOID\r
393EFIAPI\r
394TlsSetVerify (\r
7c342378
MK
395 IN VOID *Tls,\r
396 IN UINT32 VerifyMode\r
264702a0
HW
397 );\r
398\r
2ca74e1a
WJ
399/**\r
400 Set the specified host name to be verified.\r
401\r
402 @param[in] Tls Pointer to the TLS object.\r
403 @param[in] Flags The setting flags during the validation.\r
404 @param[in] HostName The specified host name to be verified.\r
405\r
406 @retval EFI_SUCCESS The HostName setting was set successfully.\r
407 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
408 @retval EFI_ABORTED Invalid HostName setting.\r
409\r
410**/\r
411EFI_STATUS\r
412EFIAPI\r
413TlsSetVerifyHost (\r
7c342378
MK
414 IN VOID *Tls,\r
415 IN UINT32 Flags,\r
416 IN CHAR8 *HostName\r
2ca74e1a
WJ
417 );\r
418\r
264702a0
HW
419/**\r
420 Sets a TLS/SSL session ID to be used during TLS/SSL connect.\r
421\r
422 This function sets a session ID to be used when the TLS/SSL connection is\r
423 to be established.\r
424\r
425 @param[in] Tls Pointer to the TLS object.\r
426 @param[in] SessionId Session ID data used for session resumption.\r
427 @param[in] SessionIdLen Length of Session ID in bytes.\r
428\r
429 @retval EFI_SUCCESS Session ID was set successfully.\r
430 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
431 @retval EFI_UNSUPPORTED No available session for ID setting.\r
432\r
433**/\r
434EFI_STATUS\r
435EFIAPI\r
436TlsSetSessionId (\r
7c342378
MK
437 IN VOID *Tls,\r
438 IN UINT8 *SessionId,\r
439 IN UINT16 SessionIdLen\r
264702a0
HW
440 );\r
441\r
442/**\r
443 Adds the CA to the cert store when requesting Server or Client authentication.\r
444\r
445 This function adds the CA certificate to the list of CAs when requesting\r
446 Server or Client authentication for the chosen TLS connection.\r
447\r
448 @param[in] Tls Pointer to the TLS object.\r
449 @param[in] Data Pointer to the data buffer of a DER-encoded binary\r
450 X.509 certificate or PEM-encoded X.509 certificate.\r
451 @param[in] DataSize The size of data buffer in bytes.\r
452\r
453 @retval EFI_SUCCESS The operation succeeded.\r
454 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
455 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.\r
456 @retval EFI_ABORTED Invalid X.509 certificate.\r
457\r
458**/\r
459EFI_STATUS\r
460EFIAPI\r
461TlsSetCaCertificate (\r
7c342378
MK
462 IN VOID *Tls,\r
463 IN VOID *Data,\r
464 IN UINTN DataSize\r
264702a0
HW
465 );\r
466\r
467/**\r
468 Loads the local public certificate into the specified TLS object.\r
469\r
470 This function loads the X.509 certificate into the specified TLS object\r
471 for TLS negotiation.\r
472\r
473 @param[in] Tls Pointer to the TLS object.\r
474 @param[in] Data Pointer to the data buffer of a DER-encoded binary\r
475 X.509 certificate or PEM-encoded X.509 certificate.\r
476 @param[in] DataSize The size of data buffer in bytes.\r
477\r
478 @retval EFI_SUCCESS The operation succeeded.\r
479 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
480 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.\r
481 @retval EFI_ABORTED Invalid X.509 certificate.\r
482\r
483**/\r
484EFI_STATUS\r
485EFIAPI\r
486TlsSetHostPublicCert (\r
7c342378
MK
487 IN VOID *Tls,\r
488 IN VOID *Data,\r
489 IN UINTN DataSize\r
264702a0
HW
490 );\r
491\r
492/**\r
493 Adds the local private key to the specified TLS object.\r
494\r
495 This function adds the local private key (PEM-encoded RSA or PKCS#8 private\r
496 key) into the specified TLS object for TLS negotiation.\r
497\r
498 @param[in] Tls Pointer to the TLS object.\r
499 @param[in] Data Pointer to the data buffer of a PEM-encoded RSA\r
500 or PKCS#8 private key.\r
501 @param[in] DataSize The size of data buffer in bytes.\r
502\r
503 @retval EFI_SUCCESS The operation succeeded.\r
504 @retval EFI_UNSUPPORTED This function is not supported.\r
505 @retval EFI_ABORTED Invalid private key data.\r
506\r
507**/\r
508EFI_STATUS\r
509EFIAPI\r
510TlsSetHostPrivateKey (\r
7c342378
MK
511 IN VOID *Tls,\r
512 IN VOID *Data,\r
513 IN UINTN DataSize\r
264702a0
HW
514 );\r
515\r
516/**\r
517 Adds the CA-supplied certificate revocation list for certificate validation.\r
518\r
519 This function adds the CA-supplied certificate revocation list data for\r
520 certificate validity checking.\r
521\r
522 @param[in] Data Pointer to the data buffer of a DER-encoded CRL data.\r
523 @param[in] DataSize The size of data buffer in bytes.\r
524\r
525 @retval EFI_SUCCESS The operation succeeded.\r
526 @retval EFI_UNSUPPORTED This function is not supported.\r
527 @retval EFI_ABORTED Invalid CRL data.\r
528\r
529**/\r
530EFI_STATUS\r
531EFIAPI\r
532TlsSetCertRevocationList (\r
7c342378
MK
533 IN VOID *Data,\r
534 IN UINTN DataSize\r
264702a0
HW
535 );\r
536\r
537/**\r
538 Gets the protocol version used by the specified TLS connection.\r
539\r
540 This function returns the protocol version used by the specified TLS\r
541 connection.\r
542\r
9c14f76b
JW
543 If Tls is NULL, then ASSERT().\r
544\r
264702a0
HW
545 @param[in] Tls Pointer to the TLS object.\r
546\r
547 @return The protocol version of the specified TLS connection.\r
548\r
549**/\r
550UINT16\r
551EFIAPI\r
552TlsGetVersion (\r
7c342378 553 IN VOID *Tls\r
264702a0
HW
554 );\r
555\r
556/**\r
557 Gets the connection end of the specified TLS connection.\r
558\r
559 This function returns the connection end (as client or as server) used by\r
560 the specified TLS connection.\r
561\r
9c14f76b
JW
562 If Tls is NULL, then ASSERT().\r
563\r
264702a0
HW
564 @param[in] Tls Pointer to the TLS object.\r
565\r
566 @return The connection end used by the specified TLS connection.\r
567\r
568**/\r
569UINT8\r
570EFIAPI\r
571TlsGetConnectionEnd (\r
7c342378 572 IN VOID *Tls\r
264702a0
HW
573 );\r
574\r
575/**\r
576 Gets the cipher suite used by the specified TLS connection.\r
577\r
578 This function returns current cipher suite used by the specified\r
579 TLS connection.\r
580\r
581 @param[in] Tls Pointer to the TLS object.\r
582 @param[in,out] CipherId The cipher suite used by the TLS object.\r
583\r
584 @retval EFI_SUCCESS The cipher suite was returned successfully.\r
585 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
586 @retval EFI_UNSUPPORTED Unsupported cipher suite.\r
587\r
588**/\r
589EFI_STATUS\r
590EFIAPI\r
591TlsGetCurrentCipher (\r
7c342378
MK
592 IN VOID *Tls,\r
593 IN OUT UINT16 *CipherId\r
264702a0
HW
594 );\r
595\r
596/**\r
597 Gets the compression methods used by the specified TLS connection.\r
598\r
599 This function returns current integrated compression methods used by\r
600 the specified TLS connection.\r
601\r
602 @param[in] Tls Pointer to the TLS object.\r
603 @param[in,out] CompressionId The current compression method used by\r
604 the TLS object.\r
605\r
606 @retval EFI_SUCCESS The compression method was returned successfully.\r
607 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
608 @retval EFI_ABORTED Invalid Compression method.\r
609 @retval EFI_UNSUPPORTED This function is not supported.\r
610\r
611**/\r
612EFI_STATUS\r
613EFIAPI\r
614TlsGetCurrentCompressionId (\r
7c342378
MK
615 IN VOID *Tls,\r
616 IN OUT UINT8 *CompressionId\r
264702a0
HW
617 );\r
618\r
619/**\r
620 Gets the verification mode currently set in the TLS connection.\r
621\r
622 This function returns the peer verification mode currently set in the\r
623 specified TLS connection.\r
624\r
9c14f76b
JW
625 If Tls is NULL, then ASSERT().\r
626\r
264702a0
HW
627 @param[in] Tls Pointer to the TLS object.\r
628\r
629 @return The verification mode set in the specified TLS connection.\r
630\r
631**/\r
632UINT32\r
633EFIAPI\r
634TlsGetVerify (\r
7c342378 635 IN VOID *Tls\r
264702a0
HW
636 );\r
637\r
638/**\r
639 Gets the session ID used by the specified TLS connection.\r
640\r
641 This function returns the TLS/SSL session ID currently used by the\r
642 specified TLS connection.\r
643\r
644 @param[in] Tls Pointer to the TLS object.\r
645 @param[in,out] SessionId Buffer to contain the returned session ID.\r
646 @param[in,out] SessionIdLen The length of Session ID in bytes.\r
647\r
648 @retval EFI_SUCCESS The Session ID was returned successfully.\r
649 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
650 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.\r
651\r
652**/\r
653EFI_STATUS\r
654EFIAPI\r
655TlsGetSessionId (\r
7c342378
MK
656 IN VOID *Tls,\r
657 IN OUT UINT8 *SessionId,\r
658 IN OUT UINT16 *SessionIdLen\r
264702a0
HW
659 );\r
660\r
661/**\r
662 Gets the client random data used in the specified TLS connection.\r
663\r
664 This function returns the TLS/SSL client random data currently used in\r
665 the specified TLS connection.\r
666\r
667 @param[in] Tls Pointer to the TLS object.\r
668 @param[in,out] ClientRandom Buffer to contain the returned client\r
669 random data (32 bytes).\r
670\r
671**/\r
672VOID\r
673EFIAPI\r
674TlsGetClientRandom (\r
7c342378
MK
675 IN VOID *Tls,\r
676 IN OUT UINT8 *ClientRandom\r
264702a0
HW
677 );\r
678\r
679/**\r
680 Gets the server random data used in the specified TLS connection.\r
681\r
682 This function returns the TLS/SSL server random data currently used in\r
683 the specified TLS connection.\r
684\r
685 @param[in] Tls Pointer to the TLS object.\r
686 @param[in,out] ServerRandom Buffer to contain the returned server\r
687 random data (32 bytes).\r
688\r
689**/\r
690VOID\r
691EFIAPI\r
692TlsGetServerRandom (\r
7c342378
MK
693 IN VOID *Tls,\r
694 IN OUT UINT8 *ServerRandom\r
264702a0
HW
695 );\r
696\r
697/**\r
698 Gets the master key data used in the specified TLS connection.\r
699\r
700 This function returns the TLS/SSL master key material currently used in\r
701 the specified TLS connection.\r
702\r
703 @param[in] Tls Pointer to the TLS object.\r
704 @param[in,out] KeyMaterial Buffer to contain the returned key material.\r
705\r
706 @retval EFI_SUCCESS Key material was returned successfully.\r
707 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
708 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.\r
709\r
710**/\r
711EFI_STATUS\r
712EFIAPI\r
713TlsGetKeyMaterial (\r
7c342378
MK
714 IN VOID *Tls,\r
715 IN OUT UINT8 *KeyMaterial\r
264702a0
HW
716 );\r
717\r
718/**\r
719 Gets the CA Certificate from the cert store.\r
720\r
721 This function returns the CA certificate for the chosen\r
722 TLS connection.\r
723\r
724 @param[in] Tls Pointer to the TLS object.\r
725 @param[out] Data Pointer to the data buffer to receive the CA\r
726 certificate data sent to the client.\r
727 @param[in,out] DataSize The size of data buffer in bytes.\r
728\r
729 @retval EFI_SUCCESS The operation succeeded.\r
730 @retval EFI_UNSUPPORTED This function is not supported.\r
731 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.\r
732\r
733**/\r
734EFI_STATUS\r
735EFIAPI\r
736TlsGetCaCertificate (\r
7c342378
MK
737 IN VOID *Tls,\r
738 OUT VOID *Data,\r
739 IN OUT UINTN *DataSize\r
264702a0
HW
740 );\r
741\r
742/**\r
743 Gets the local public Certificate set in the specified TLS object.\r
744\r
745 This function returns the local public certificate which was currently set\r
746 in the specified TLS object.\r
747\r
748 @param[in] Tls Pointer to the TLS object.\r
749 @param[out] Data Pointer to the data buffer to receive the local\r
750 public certificate.\r
751 @param[in,out] DataSize The size of data buffer in bytes.\r
752\r
753 @retval EFI_SUCCESS The operation succeeded.\r
754 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
755 @retval EFI_NOT_FOUND The certificate is not found.\r
756 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.\r
757\r
758**/\r
759EFI_STATUS\r
760EFIAPI\r
761TlsGetHostPublicCert (\r
7c342378
MK
762 IN VOID *Tls,\r
763 OUT VOID *Data,\r
764 IN OUT UINTN *DataSize\r
264702a0
HW
765 );\r
766\r
767/**\r
768 Gets the local private key set in the specified TLS object.\r
769\r
770 This function returns the local private key data which was currently set\r
771 in the specified TLS object.\r
772\r
773 @param[in] Tls Pointer to the TLS object.\r
774 @param[out] Data Pointer to the data buffer to receive the local\r
775 private key data.\r
776 @param[in,out] DataSize The size of data buffer in bytes.\r
777\r
778 @retval EFI_SUCCESS The operation succeeded.\r
779 @retval EFI_UNSUPPORTED This function is not supported.\r
780 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.\r
781\r
782**/\r
783EFI_STATUS\r
784EFIAPI\r
785TlsGetHostPrivateKey (\r
7c342378
MK
786 IN VOID *Tls,\r
787 OUT VOID *Data,\r
788 IN OUT UINTN *DataSize\r
264702a0
HW
789 );\r
790\r
791/**\r
792 Gets the CA-supplied certificate revocation list data set in the specified\r
793 TLS object.\r
794\r
795 This function returns the CA-supplied certificate revocation list data which\r
796 was currently set in the specified TLS object.\r
797\r
798 @param[out] Data Pointer to the data buffer to receive the CRL data.\r
799 @param[in,out] DataSize The size of data buffer in bytes.\r
800\r
801 @retval EFI_SUCCESS The operation succeeded.\r
802 @retval EFI_UNSUPPORTED This function is not supported.\r
803 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.\r
804\r
805**/\r
806EFI_STATUS\r
807EFIAPI\r
808TlsGetCertRevocationList (\r
7c342378
MK
809 OUT VOID *Data,\r
810 IN OUT UINTN *DataSize\r
264702a0
HW
811 );\r
812\r
813#endif // __TLS_LIB_H__\r