• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   EFI TLS Configuration Protocol as defined in UEFI 2.5.
3   The EFI TLS Configuration Protocol provides a way to set and get TLS configuration.
4 
5   Copyright (c) 2016, 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   @par Revision Reference:
15   This Protocol is introduced in UEFI Specification 2.5
16 
17 **/
18 #ifndef __EFI_TLS_CONFIGURATION_PROTOCOL_H__
19 #define __EFI_TLS_CONFIGURATION_PROTOCOL_H__
20 
21 ///
22 /// The EFI Configuration protocol provides a way to set and get TLS configuration.
23 ///
24 #define EFI_TLS_CONFIGURATION_PROTOCOL_GUID  \
25   { \
26     0x1682fe44, 0xbd7a, 0x4407, { 0xb7, 0xc7, 0xdc, 0xa3, 0x7c, 0xa3, 0x92, 0x2d }  \
27   }
28 
29 typedef struct _EFI_TLS_CONFIGURATION_PROTOCOL EFI_TLS_CONFIGURATION_PROTOCOL;
30 
31 ///
32 /// EFI_TLS_CONFIG_DATA_TYPE
33 ///
34 typedef enum {
35   ///
36   /// Local host configuration data: public certificate data.
37   /// This data should be DER-encoded binary X.509 certificate
38   /// or PEM-encoded X.509 certificate.
39   ///
40   EfiTlsConfigDataTypeHostPublicCert,
41   ///
42   /// Local host configuration data: private key data.
43   ///
44   EfiTlsConfigDataTypeHostPrivateKey,
45   ///
46   /// CA certificate to verify peer. This data should be PEM-encoded
47   /// RSA or PKCS#8 private key.
48   ///
49   EfiTlsConfigDataTypeCACertificate,
50   ///
51   /// CA-supplied Certificate Revocation List data. This data should
52   /// be DER-encoded CRL data.
53   ///
54   EfiTlsConfigDataTypeCertRevocationList,
55 
56   EfiTlsConfigDataTypeMaximum
57 
58 } EFI_TLS_CONFIG_DATA_TYPE;
59 
60 /**
61   Set TLS configuration data.
62 
63   The SetData() function sets TLS configuration to non-volatile storage or volatile
64   storage.
65 
66   @param[in]  This                Pointer to the EFI_TLS_CONFIGURATION_PROTOCOL instance.
67   @param[in]  DataType            Configuration data type.
68   @param[in]  Data                Pointer to configuration data.
69   @param[in]  DataSize            Total size of configuration data.
70 
71   @retval EFI_SUCCESS             The TLS configuration data is set successfully.
72   @retval EFI_INVALID_PARAMETER   One or more of the following conditions is TRUE:
73                                   This is NULL.
74                                   Data is NULL.
75                                   DataSize is 0.
76   @retval EFI_UNSUPPORTED         The DataType is unsupported.
77   @retval EFI_OUT_OF_RESOURCES    Required system resources could not be allocated.
78 
79 **/
80 typedef
81 EFI_STATUS
82 (EFIAPI *EFI_TLS_CONFIGURATION_SET_DATA)(
83   IN EFI_TLS_CONFIGURATION_PROTOCOL  *This,
84   IN EFI_TLS_CONFIG_DATA_TYPE        DataType,
85   IN VOID                            *Data,
86   IN UINTN                           DataSize
87   );
88 
89 /**
90   Get TLS configuration data.
91 
92   The GetData() function gets TLS configuration.
93 
94   @param[in]       This           Pointer to the EFI_TLS_CONFIGURATION_PROTOCOL instance.
95   @param[in]       DataType       Configuration data type.
96   @param[in, out]  Data           Pointer to configuration data.
97   @param[in, out]  DataSize       Total size of configuration data. On input, it means
98                                   the size of Data buffer. On output, it means the size
99                                   of copied Data buffer if EFI_SUCCESS, and means the
100                                   size of desired Data buffer if EFI_BUFFER_TOO_SMALL.
101 
102   @retval EFI_SUCCESS             The TLS configuration data is got successfully.
103   @retval EFI_INVALID_PARAMETER   One or more of the following conditions is TRUE:
104                                   This is NULL.
105                                   DataSize is NULL.
106                                   Data is NULL if *DataSize is not zero.
107   @retval EFI_UNSUPPORTED         The DataType is unsupported.
108   @retval EFI_NOT_FOUND           The TLS configuration data is not found.
109   @retval EFI_BUFFER_TOO_SMALL    The buffer is too small to hold the data.
110 
111 **/
112 typedef
113 EFI_STATUS
114 (EFIAPI *EFI_TLS_CONFIGURATION_GET_DATA)(
115   IN EFI_TLS_CONFIGURATION_PROTOCOL  *This,
116   IN EFI_TLS_CONFIG_DATA_TYPE        DataType,
117   IN OUT VOID                        *Data,  OPTIONAL
118   IN OUT UINTN                       *DataSize
119   );
120 
121 ///
122 /// The EFI_TLS_CONFIGURATION_PROTOCOL is designed to provide a way to set and get
123 /// TLS configuration, such as Certificate, private key data.
124 ///
125 struct _EFI_TLS_CONFIGURATION_PROTOCOL {
126   EFI_TLS_CONFIGURATION_SET_DATA     SetData;
127   EFI_TLS_CONFIGURATION_GET_DATA     GetData;
128 };
129 
130 extern EFI_GUID gEfiTlsConfigurationProtocolGuid;
131 
132 #endif  //__EFI_TLS_CONFIGURATION_PROTOCOL_H__
133