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