]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/TlsConfig.h
MdePkg/Include/Protocol/Tls.h: pack structures from the TLS RFC
[mirror_edk2.git] / MdePkg / Include / Protocol / TlsConfig.h
CommitLineData
973f8862
HW
1/** @file\r
2 EFI TLS Configuration Protocol as defined in UEFI 2.5.\r
3 The EFI TLS Configuration Protocol provides a way to set and get TLS configuration.\r
4\r
5 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14 @par Revision Reference:\r
15 This Protocol is introduced in UEFI Specification 2.5\r
16\r
17**/\r
18#ifndef __EFI_TLS_CONFIGURATION_PROTOCOL_H__\r
19#define __EFI_TLS_CONFIGURATION_PROTOCOL_H__\r
20\r
21///\r
22/// The EFI Configuration protocol provides a way to set and get TLS configuration.\r
23///\r
24#define EFI_TLS_CONFIGURATION_PROTOCOL_GUID \\r
25 { \\r
26 0x1682fe44, 0xbd7a, 0x4407, { 0xb7, 0xc7, 0xdc, 0xa3, 0x7c, 0xa3, 0x92, 0x2d } \\r
27 }\r
28\r
29typedef struct _EFI_TLS_CONFIGURATION_PROTOCOL EFI_TLS_CONFIGURATION_PROTOCOL;\r
30\r
31///\r
32/// EFI_TLS_CONFIG_DATA_TYPE\r
33///\r
34typedef enum {\r
35 ///\r
36 /// Local host configuration data: public certificate data.\r
37 /// This data should be DER-encoded binary X.509 certificate\r
38 /// or PEM-encoded X.509 certificate.\r
39 ///\r
40 EfiTlsConfigDataTypeHostPublicCert,\r
41 ///\r
42 /// Local host configuration data: private key data.\r
43 ///\r
44 EfiTlsConfigDataTypeHostPrivateKey,\r
45 ///\r
46 /// CA certificate to verify peer. This data should be PEM-encoded\r
47 /// RSA or PKCS#8 private key.\r
48 ///\r
49 EfiTlsConfigDataTypeCACertificate,\r
50 ///\r
51 /// CA-supplied Certificate Revocation List data. This data should\r
52 /// be DER-encoded CRL data.\r
53 ///\r
54 EfiTlsConfigDataTypeCertRevocationList,\r
55\r
56 EfiTlsConfigDataTypeMaximum\r
57\r
58} EFI_TLS_CONFIG_DATA_TYPE;\r
59\r
60/**\r
61 Set TLS configuration data.\r
62\r
63 The SetData() function sets TLS configuration to non-volatile storage or volatile\r
64 storage.\r
65\r
66 @param[in] This Pointer to the EFI_TLS_CONFIGURATION_PROTOCOL instance.\r
67 @param[in] DataType Configuration data type.\r
68 @param[in] Data Pointer to configuration data.\r
69 @param[in] DataSize Total size of configuration data.\r
70\r
71 @retval EFI_SUCCESS The TLS configuration data is set successfully.\r
72 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
73 This is NULL.\r
74 Data is NULL.\r
75 DataSize is 0.\r
76 @retval EFI_UNSUPPORTED The DataType is unsupported.\r
77 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
78\r
79**/\r
80typedef\r
81EFI_STATUS\r
82(EFIAPI *EFI_TLS_CONFIGURATION_SET_DATA)(\r
83 IN EFI_TLS_CONFIGURATION_PROTOCOL *This,\r
84 IN EFI_TLS_CONFIG_DATA_TYPE DataType,\r
85 IN VOID *Data,\r
86 IN UINTN DataSize\r
87 );\r
88\r
89/**\r
90 Get TLS configuration data.\r
91\r
92 The GetData() function gets TLS configuration.\r
93\r
94 @param[in] This Pointer to the EFI_TLS_CONFIGURATION_PROTOCOL instance.\r
95 @param[in] DataType Configuration data type.\r
96 @param[in, out] Data Pointer to configuration data.\r
97 @param[in, out] DataSize Total size of configuration data. On input, it means\r
98 the size of Data buffer. On output, it means the size\r
99 of copied Data buffer if EFI_SUCCESS, and means the\r
100 size of desired Data buffer if EFI_BUFFER_TOO_SMALL.\r
101\r
102 @retval EFI_SUCCESS The TLS configuration data is got successfully.\r
103 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
104 This is NULL.\r
105 DataSize is NULL.\r
106 Data is NULL if *DataSize is not zero.\r
107 @retval EFI_UNSUPPORTED The DataType is unsupported.\r
108 @retval EFI_NOT_FOUND The TLS configuration data is not found.\r
109 @retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold the data.\r
110\r
111**/\r
112typedef\r
113EFI_STATUS\r
114(EFIAPI *EFI_TLS_CONFIGURATION_GET_DATA)(\r
115 IN EFI_TLS_CONFIGURATION_PROTOCOL *This,\r
116 IN EFI_TLS_CONFIG_DATA_TYPE DataType,\r
117 IN OUT VOID *Data, OPTIONAL\r
118 IN OUT UINTN *DataSize\r
119 );\r
120\r
121///\r
122/// The EFI_TLS_CONFIGURATION_PROTOCOL is designed to provide a way to set and get\r
123/// TLS configuration, such as Certificate, private key data.\r
124///\r
125struct _EFI_TLS_CONFIGURATION_PROTOCOL {\r
126 EFI_TLS_CONFIGURATION_SET_DATA SetData;\r
127 EFI_TLS_CONFIGURATION_GET_DATA GetData;\r
128};\r
129\r
130extern EFI_GUID gEfiTlsConfigurationProtocolGuid;\r
131\r
132#endif //__EFI_TLS_CONFIGURATION_PROTOCOL_H__\r
133\r