TianoCore EDK2 master
Loading...
Searching...
No Matches
TlsConfigProtocol.c
Go to the documentation of this file.
1
10#include "TlsImpl.h"
11
12EFI_TLS_CONFIGURATION_PROTOCOL mTlsConfigurationProtocol = {
15};
16
38EFIAPI
42 IN VOID *Data,
43 IN UINTN DataSize
44 )
45{
46 EFI_STATUS Status;
47 TLS_INSTANCE *Instance;
48 EFI_TPL OldTpl;
49
50 Status = EFI_SUCCESS;
51
52 if ((This == NULL) || (Data == NULL) || (DataSize == 0)) {
53 return EFI_INVALID_PARAMETER;
54 }
55
56 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
57
58 Instance = TLS_INSTANCE_FROM_CONFIGURATION (This);
59
60 switch (DataType) {
62 Status = TlsSetCaCertificate (Instance->TlsConn, Data, DataSize);
63 break;
65 Status = TlsSetHostPublicCert (Instance->TlsConn, Data, DataSize);
66 break;
68 Status = TlsSetHostPrivateKey (Instance->TlsConn, Data, DataSize);
69 break;
71 Status = TlsSetCertRevocationList (Data, DataSize);
72 break;
73 default:
74 Status = EFI_UNSUPPORTED;
75 }
76
77 gBS->RestoreTPL (OldTpl);
78 return Status;
79}
80
104EFIAPI
108 IN OUT VOID *Data OPTIONAL,
109 IN OUT UINTN *DataSize
110 )
111{
112 EFI_STATUS Status;
113 TLS_INSTANCE *Instance;
114
115 EFI_TPL OldTpl;
116
117 Status = EFI_SUCCESS;
118
119 if ((This == NULL) || (DataSize == NULL) || ((Data == NULL) && (*DataSize != 0))) {
120 return EFI_INVALID_PARAMETER;
121 }
122
123 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
124
125 Instance = TLS_INSTANCE_FROM_CONFIGURATION (This);
126
127 switch (DataType) {
129 Status = TlsGetCaCertificate (Instance->TlsConn, Data, DataSize);
130 break;
132 Status = TlsGetHostPublicCert (Instance->TlsConn, Data, DataSize);
133 break;
135 Status = TlsGetHostPrivateKey (Instance->TlsConn, Data, DataSize);
136 break;
138 Status = TlsGetCertRevocationList (Data, DataSize);
139 break;
140 default:
141 Status = EFI_UNSUPPORTED;
142 }
143
144 gBS->RestoreTPL (OldTpl);
145 return Status;
146}
UINT64 UINTN
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EFI_TLS_CONFIG_DATA_TYPE
Definition: TlsConfig.h:29
@ EfiTlsConfigDataTypeCertRevocationList
Definition: TlsConfig.h:49
@ EfiTlsConfigDataTypeHostPublicCert
Definition: TlsConfig.h:35
@ EfiTlsConfigDataTypeCACertificate
Definition: TlsConfig.h:44
@ EfiTlsConfigDataTypeHostPrivateKey
Definition: TlsConfig.h:39
EFI_STATUS EFIAPI TlsConfigurationGetData(IN EFI_TLS_CONFIGURATION_PROTOCOL *This, IN EFI_TLS_CONFIG_DATA_TYPE DataType, IN OUT VOID *Data OPTIONAL, IN OUT UINTN *DataSize)
EFI_STATUS EFIAPI TlsConfigurationSetData(IN EFI_TLS_CONFIGURATION_PROTOCOL *This, IN EFI_TLS_CONFIG_DATA_TYPE DataType, IN VOID *Data, IN UINTN DataSize)
EFI_STATUS EFIAPI TlsGetHostPublicCert(IN VOID *Tls, OUT VOID *Data, IN OUT UINTN *DataSize)
Definition: CryptLib.c:4638
EFI_STATUS EFIAPI TlsSetCertRevocationList(IN VOID *Data, IN UINTN DataSize)
Definition: CryptLib.c:4323
EFI_STATUS EFIAPI TlsGetCertRevocationList(OUT VOID *Data, IN OUT UINTN *DataSize)
Definition: CryptLib.c:4691
EFI_STATUS EFIAPI TlsSetCaCertificate(IN VOID *Tls, IN VOID *Data, IN UINTN DataSize)
Definition: CryptLib.c:4213
EFI_STATUS EFIAPI TlsSetHostPrivateKey(IN VOID *Tls, IN VOID *Data, IN UINTN DataSize)
Definition: CryptLib.c:4298
EFI_STATUS EFIAPI TlsSetHostPublicCert(IN VOID *Tls, IN VOID *Data, IN UINTN DataSize)
Definition: CryptLib.c:4241
EFI_STATUS EFIAPI TlsGetCaCertificate(IN VOID *Tls, OUT VOID *Data, IN OUT UINTN *DataSize)
Definition: CryptLib.c:4610
EFI_STATUS EFIAPI TlsGetHostPrivateKey(IN VOID *Tls, OUT VOID *Data, IN OUT UINTN *DataSize)
Definition: CryptLib.c:4665
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
UINTN EFI_TPL
Definition: UefiBaseType.h:41
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS