Subrata Banik | 20fe24b | 2021-12-09 02:46:38 +0530 | [diff] [blame] | 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 | 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 | #ifndef __EFI_TLS_CONFIGURATION_PROTOCOL_H__ |
| 13 | #define __EFI_TLS_CONFIGURATION_PROTOCOL_H__ |
| 14 | |
| 15 | /// |
| 16 | /// The EFI Configuration protocol provides a way to set and get TLS configuration. |
| 17 | /// |
| 18 | #define EFI_TLS_CONFIGURATION_PROTOCOL_GUID \ |
| 19 | { \ |
| 20 | 0x1682fe44, 0xbd7a, 0x4407, { 0xb7, 0xc7, 0xdc, 0xa3, 0x7c, 0xa3, 0x92, 0x2d } \ |
| 21 | } |
| 22 | |
| 23 | typedef struct _EFI_TLS_CONFIGURATION_PROTOCOL EFI_TLS_CONFIGURATION_PROTOCOL; |
| 24 | |
| 25 | /// |
| 26 | /// EFI_TLS_CONFIG_DATA_TYPE |
| 27 | /// |
| 28 | typedef enum { |
| 29 | /// |
| 30 | /// Local host configuration data: public certificate data. |
| 31 | /// This data should be DER-encoded binary X.509 certificate |
| 32 | /// or PEM-encoded X.509 certificate. |
| 33 | /// |
| 34 | EfiTlsConfigDataTypeHostPublicCert, |
| 35 | /// |
| 36 | /// Local host configuration data: private key data. |
| 37 | /// |
| 38 | EfiTlsConfigDataTypeHostPrivateKey, |
| 39 | /// |
| 40 | /// CA certificate to verify peer. This data should be PEM-encoded |
| 41 | /// RSA or PKCS#8 private key. |
| 42 | /// |
| 43 | EfiTlsConfigDataTypeCACertificate, |
| 44 | /// |
| 45 | /// CA-supplied Certificate Revocation List data. This data should |
| 46 | /// be DER-encoded CRL data. |
| 47 | /// |
| 48 | EfiTlsConfigDataTypeCertRevocationList, |
| 49 | |
| 50 | EfiTlsConfigDataTypeMaximum |
| 51 | |
| 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 | **/ |
| 74 | typedef |
| 75 | EFI_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 | **/ |
| 106 | typedef |
| 107 | EFI_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 | /// |
| 119 | struct _EFI_TLS_CONFIGURATION_PROTOCOL { |
| 120 | EFI_TLS_CONFIGURATION_SET_DATA SetData; |
| 121 | EFI_TLS_CONFIGURATION_GET_DATA GetData; |
| 122 | }; |
| 123 | |
| 124 | extern EFI_GUID gEfiTlsConfigurationProtocolGuid; |
| 125 | |
| 126 | #endif //__EFI_TLS_CONFIGURATION_PROTOCOL_H__ |
| 127 | |