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