61 UINTN VerifyMethodSize;
70 if ((This ==
NULL) || (Data ==
NULL) || (DataSize == 0)) {
71 return EFI_INVALID_PARAMETER;
74 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
76 Instance = TLS_INSTANCE_FROM_PROTOCOL (This);
79 Status = EFI_NOT_READY;
89 Status = EFI_INVALID_PARAMETER;
97 Status = EFI_INVALID_PARAMETER;
105 Status = EFI_INVALID_PARAMETER;
110 if (CipherId ==
NULL) {
111 Status = EFI_OUT_OF_RESOURCES;
117 for (Index = 0; Index < CipherCount; Index++) {
118 CipherId[Index] = ((TlsCipherList[Index].Data1 << 8) |
119 TlsCipherList[Index].Data2);
139 if (EFI_ERROR (Status)) {
146 Status = EFI_UNSUPPORTED;
150 Status = EFI_INVALID_PARAMETER;
158 Status = EFI_INVALID_PARAMETER;
167 Status = EFI_INVALID_PARAMETER;
175 Status = EFI_INVALID_PARAMETER;
179 Status = This->GetSessionData (This,
EfiTlsVerifyMethod, &VerifyMethod, &VerifyMethodSize);
180 if (EFI_ERROR (Status)) {
185 Status = EFI_INVALID_PARAMETER;
189 Status =
TlsSetVerifyHost (Instance->TlsConn, TlsVerifyHost->Flags, TlsVerifyHost->HostName);
194 Status = EFI_INVALID_PARAMETER;
206 Status = EFI_INVALID_PARAMETER;
216 Status = EFI_ACCESS_DENIED;
219 Status = EFI_ACCESS_DENIED;
222 Status = EFI_ACCESS_DENIED;
228 Status = EFI_UNSUPPORTED;
232 gBS->RestoreTPL (OldTpl);
264 IN OUT VOID *Data OPTIONAL,
275 if ((This ==
NULL) || (DataSize ==
NULL) || ((Data ==
NULL) && (*DataSize != 0))) {
276 return EFI_INVALID_PARAMETER;
279 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
281 Instance = TLS_INSTANCE_FROM_PROTOCOL (This);
287 Status = EFI_NOT_READY;
295 Status = EFI_BUFFER_TOO_SMALL;
300 *((UINT16 *)Data) = HTONS (
TlsGetVersion (Instance->TlsConn));
305 Status = EFI_BUFFER_TOO_SMALL;
318 Status = EFI_BUFFER_TOO_SMALL;
324 *((UINT16 *)Data) = HTONS (*((UINT16 *)Data));
332 Status = EFI_BUFFER_TOO_SMALL;
340 Status = EFI_UNSUPPORTED;
345 Status = EFI_BUFFER_TOO_SMALL;
355 Status = EFI_BUFFER_TOO_SMALL;
369 Status = EFI_BUFFER_TOO_SMALL;
374 CopyMem (Data, &Instance->TlsSessionState, *DataSize);
379 Status = EFI_BUFFER_TOO_SMALL;
389 Status = EFI_BUFFER_TOO_SMALL;
399 Status = EFI_BUFFER_TOO_SMALL;
410 Status = EFI_UNSUPPORTED;
414 gBS->RestoreTPL (OldTpl);
460 IN UINT8 *RequestBuffer OPTIONAL,
462 OUT UINT8 *Buffer OPTIONAL,
472 if ((This ==
NULL) || (BufferSize ==
NULL) ||
473 ((RequestBuffer ==
NULL) && (RequestSize != 0)) ||
474 ((RequestBuffer !=
NULL) && (RequestSize == 0)) ||
475 ((Buffer ==
NULL) && (*BufferSize != 0)))
477 return EFI_INVALID_PARAMETER;
480 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
482 Instance = TLS_INSTANCE_FROM_PROTOCOL (This);
484 if ((RequestBuffer ==
NULL) && (RequestSize == 0)) {
485 switch (Instance->TlsSessionState) {
497 if (EFI_ERROR (Status)) {
504 if (*BufferSize == 0) {
505 Status = EFI_ABORTED;
521 if (EFI_ERROR (Status)) {
528 if (*BufferSize == 0) {
529 Status = EFI_ABORTED;
546 if (EFI_ERROR (Status)) {
555 Status = EFI_NOT_READY;
572 if (EFI_ERROR (Status)) {
583 ASSERT (((
TLS_RECORD_HEADER *)RequestBuffer)->ContentType == TlsContentTypeAlert);
592 if (EFI_ERROR (Status)) {
593 if (Status != EFI_BUFFER_TOO_SMALL) {
603 gBS->RestoreTPL (OldTpl);
646 IN UINT32 *FragmentCount,
657 if ((This ==
NULL) || (FragmentTable ==
NULL) || (FragmentCount ==
NULL)) {
658 return EFI_INVALID_PARAMETER;
661 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
663 Instance = TLS_INSTANCE_FROM_PROTOCOL (This);
666 Status = EFI_NOT_READY;
683 return EFI_INVALID_PARAMETER;
687 gBS->RestoreTPL (OldTpl);
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
#define EFI_TLS_VERIFY_FLAG_MULTI_LABEL_WILDCARDS
#define EFI_TLS_VERIFY_FLAG_NEVER_CHECK_SUBJECT
@ EfiTlsSessionHandShaking
@ EfiTlsSessionDataTransferring
@ EfiTlsSessionNotStarted
EFI_TLS_SESSION_DATA_TYPE
@ EfiTlsCompressionMethod
UINT8 EFI_TLS_COMPRESSION
#define EFI_TLS_VERIFY_PEER
#define EFI_TLS_VERIFY_FLAG_NO_WILDCARDS
#define EFI_TLS_VERIFY_FLAG_NO_PARTIAL_WILDCARDS
#define EFI_TLS_VERIFY_FLAG_ALWAYS_CHECK_SUBJECT
EFI_STATUS TlsDecryptPacket(IN TLS_INSTANCE *TlsInstance, IN OUT EFI_TLS_FRAGMENT_DATA **FragmentTable, IN UINT32 *FragmentCount)
EFI_STATUS TlsEncryptPacket(IN TLS_INSTANCE *TlsInstance, IN OUT EFI_TLS_FRAGMENT_DATA **FragmentTable, IN UINT32 *FragmentCount)
VOID EFIAPI TlsGetServerRandom(IN VOID *Tls, IN OUT UINT8 *ServerRandom)
EFI_STATUS EFIAPI TlsDoHandshake(IN VOID *Tls, IN UINT8 *BufferIn OPTIONAL, IN UINTN BufferInSize OPTIONAL, OUT UINT8 *BufferOut OPTIONAL, IN OUT UINTN *BufferOutSize)
EFI_STATUS EFIAPI TlsSetVerifyHost(IN VOID *Tls, IN UINT32 Flags, IN CHAR8 *HostName)
EFI_STATUS EFIAPI TlsGetKeyMaterial(IN VOID *Tls, IN OUT UINT8 *KeyMaterial)
UINT32 EFIAPI TlsGetVerify(IN VOID *Tls)
EFI_STATUS EFIAPI TlsGetCurrentCipher(IN VOID *Tls, IN OUT UINT16 *CipherId)
EFI_STATUS EFIAPI TlsSetCompressionMethod(IN UINT8 CompMethod)
EFI_STATUS EFIAPI TlsSetCipherList(IN VOID *Tls, IN UINT16 *CipherId, IN UINTN CipherNum)
EFI_STATUS EFIAPI TlsGetCurrentCompressionId(IN VOID *Tls, IN OUT UINT8 *CompressionId)
EFI_STATUS EFIAPI TlsSetConnectionEnd(IN VOID *Tls, IN BOOLEAN IsServer)
EFI_STATUS EFIAPI TlsSetSessionId(IN VOID *Tls, IN UINT8 *SessionId, IN UINT16 SessionIdLen)
UINT8 EFIAPI TlsGetConnectionEnd(IN VOID *Tls)
VOID EFIAPI TlsSetVerify(IN VOID *Tls, IN UINT32 VerifyMode)
VOID EFIAPI TlsGetClientRandom(IN VOID *Tls, IN OUT UINT8 *ClientRandom)
BOOLEAN EFIAPI TlsInHandshake(IN VOID *Tls)
EFI_STATUS EFIAPI TlsSetVersion(IN VOID *Tls, IN UINT8 MajorVer, IN UINT8 MinorVer)
EFI_STATUS EFIAPI TlsHandleAlert(IN VOID *Tls, IN UINT8 *BufferIn OPTIONAL, IN UINTN BufferInSize OPTIONAL, OUT UINT8 *BufferOut OPTIONAL, IN OUT UINTN *BufferOutSize)
EFI_STATUS EFIAPI TlsCloseNotify(IN VOID *Tls, IN OUT UINT8 *Buffer, IN OUT UINTN *BufferSize)
EFI_STATUS EFIAPI TlsGetSessionId(IN VOID *Tls, IN OUT UINT8 *SessionId, IN OUT UINT16 *SessionIdLen)
UINT16 EFIAPI TlsGetVersion(IN VOID *Tls)
EFI_STATUS EFIAPI TlsBuildResponsePacket(IN EFI_TLS_PROTOCOL *This, IN UINT8 *RequestBuffer OPTIONAL, IN UINTN RequestSize OPTIONAL, OUT UINT8 *Buffer OPTIONAL, IN OUT UINTN *BufferSize)
EFI_STATUS EFIAPI TlsSetSessionData(IN EFI_TLS_PROTOCOL *This, IN EFI_TLS_SESSION_DATA_TYPE DataType, IN VOID *Data, IN UINTN DataSize)
EFI_STATUS EFIAPI TlsProcessPacket(IN EFI_TLS_PROTOCOL *This, IN OUT EFI_TLS_FRAGMENT_DATA **FragmentTable, IN UINT32 *FragmentCount, IN EFI_TLS_CRYPT_MODE CryptMode)
EFI_STATUS EFIAPI TlsGetSessionData(IN EFI_TLS_PROTOCOL *This, IN EFI_TLS_SESSION_DATA_TYPE DataType, IN OUT VOID *Data OPTIONAL, IN OUT UINTN *DataSize)