TianoCore EDK2 master
Loading...
Searching...
No Matches
HttpsSupport.h File Reference

Go to the source code of this file.

Macros

#define HTTPS_DEFAULT_PORT   443
 
#define HTTPS_FLAG   "https://"
 

Functions

BOOLEAN IsHttpsUrl (IN CHAR8 *Url)
 
EFI_STATUS EFIAPI TlsCreateChild (IN HTTP_PROTOCOL *HttpInstance)
 
EFI_STATUS EFIAPI TlsCreateTxRxEvent (IN OUT HTTP_PROTOCOL *HttpInstance)
 
VOID EFIAPI TlsCloseTxRxEvent (IN HTTP_PROTOCOL *HttpInstance)
 
EFI_STATUS TlsConfigCertificate (IN OUT HTTP_PROTOCOL *HttpInstance)
 
EFI_STATUS EFIAPI TlsConfigureSession (IN OUT HTTP_PROTOCOL *HttpInstance)
 
EFI_STATUS EFIAPI TlsCommonTransmit (IN OUT HTTP_PROTOCOL *HttpInstance, IN NET_BUF *Packet)
 
EFI_STATUS EFIAPI TlsCommonReceive (IN OUT HTTP_PROTOCOL *HttpInstance, IN NET_BUF *Packet, IN EFI_EVENT Timeout)
 
EFI_STATUS EFIAPI TlsReceiveOnePdu (IN OUT HTTP_PROTOCOL *HttpInstance, OUT NET_BUF **Pdu, IN EFI_EVENT Timeout)
 
EFI_STATUS EFIAPI TlsConnectSession (IN HTTP_PROTOCOL *HttpInstance, IN EFI_EVENT Timeout)
 
EFI_STATUS EFIAPI TlsCloseSession (IN HTTP_PROTOCOL *HttpInstance)
 
EFI_STATUS EFIAPI TlsProcessMessage (IN HTTP_PROTOCOL *HttpInstance, IN UINT8 *Message, IN UINTN MessageSize, IN EFI_TLS_CRYPT_MODE ProcessMode, IN OUT NET_FRAGMENT *Fragment)
 
EFI_STATUS EFIAPI HttpsReceive (IN HTTP_PROTOCOL *HttpInstance, IN OUT NET_FRAGMENT *Fragment, IN EFI_EVENT Timeout)
 

Detailed Description

The header files of miscellaneous routines specific to Https for HttpDxe driver.

Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file HttpsSupport.h.

Macro Definition Documentation

◆ HTTPS_DEFAULT_PORT

#define HTTPS_DEFAULT_PORT   443

Definition at line 13 of file HttpsSupport.h.

◆ HTTPS_FLAG

#define HTTPS_FLAG   "https://"

Definition at line 15 of file HttpsSupport.h.

Function Documentation

◆ HttpsReceive()

EFI_STATUS EFIAPI HttpsReceive ( IN HTTP_PROTOCOL HttpInstance,
IN OUT NET_FRAGMENT Fragment,
IN EFI_EVENT  Timeout 
)

Receive one fragment decrypted from one TLS record.

Parameters
[in]HttpInstancePointer to HTTP_PROTOCOL structure.
[in,out]FragmentThe received Fragment.
[in]TimeoutThe time to wait for connection done.
Return values
EFI_SUCCESSOne fragment is received.
EFI_OUT_OF_RESOURCESCan't allocate memory resources.
EFI_ABORTEDSomething wrong decryption the message.
OthersOther errors as indicated.

Definition at line 1665 of file HttpsSupport.c.

◆ IsHttpsUrl()

BOOLEAN IsHttpsUrl ( IN CHAR8 *  Url)

Check whether the Url is from Https.

Parameters
[in]UrlThe pointer to a HTTP or HTTPS URL string.
Return values
TRUEThe Url is from HTTPS.
FALSEThe Url is from HTTP.

Definition at line 119 of file HttpsSupport.c.

◆ TlsCloseSession()

EFI_STATUS EFIAPI TlsCloseSession ( IN HTTP_PROTOCOL HttpInstance)

Close the TLS session and send out the close notification message.

Parameters
[in]HttpInstanceThe HTTP instance private data.
Return values
EFI_SUCCESSThe TLS session is closed.
EFI_INVALID_PARAMETERHttpInstance is NULL or Packet is NULL.
EFI_OUT_OF_RESOURCESCan't allocate memory resources.
OthersOther error as indicated.

Close the TLS session and send out the close notification message.

Parameters
[in]HttpInstanceThe HTTP instance private data.
Return values
EFI_SUCCESSThe TLS session is closed.
EFI_INVALID_PARAMETERHttpInstance is NULL.
EFI_OUT_OF_RESOURCESCan't allocate memory resources.
OthersOther error as indicated.

Definition at line 1426 of file HttpsSupport.c.

◆ TlsCloseTxRxEvent()

VOID EFIAPI TlsCloseTxRxEvent ( IN HTTP_PROTOCOL HttpInstance)

Close events in the TlsTxToken and TlsRxToken.

Parameters
[in]HttpInstancePointer to HTTP_PROTOCOL structure.

Definition at line 344 of file HttpsSupport.c.

◆ TlsCommonReceive()

EFI_STATUS EFIAPI TlsCommonReceive ( IN OUT HTTP_PROTOCOL HttpInstance,
IN NET_BUF Packet,
IN EFI_EVENT  Timeout 
)

Receive the Packet by processing the associated HTTPS token.

Parameters
[in,out]HttpInstancePointer to HTTP_PROTOCOL structure.
[in]PacketThe packet to transmit.
[in]TimeoutThe time to wait for connection done.
Return values
EFI_SUCCESSThe Packet is received.
EFI_INVALID_PARAMETERHttpInstance is NULL or Packet is NULL.
EFI_OUT_OF_RESOURCESCan't allocate memory resources.
EFI_TIMEOUTThe operation is time out.
OthersOther error as indicated.

Definition at line 891 of file HttpsSupport.c.

◆ TlsCommonTransmit()

EFI_STATUS EFIAPI TlsCommonTransmit ( IN OUT HTTP_PROTOCOL HttpInstance,
IN NET_BUF Packet 
)

Transmit the Packet by processing the associated HTTPS token.

Parameters
[in,out]HttpInstancePointer to HTTP_PROTOCOL structure.
[in]PacketThe packet to transmit.
Return values
EFI_SUCCESSThe packet is transmitted.
EFI_INVALID_PARAMETERHttpInstance is NULL or Packet is NULL.
EFI_OUT_OF_RESOURCESCan't allocate memory resources.
EFI_DEVICE_ERRORAn unexpected system or network error occurred.
OthersOther errors as indicated.

Definition at line 773 of file HttpsSupport.c.

◆ TlsConfigCertificate()

EFI_STATUS TlsConfigCertificate ( IN OUT HTTP_PROTOCOL HttpInstance)

Read the TlsCaCertificate variable and configure it.

Parameters
[in,out]HttpInstanceThe HTTP instance private data.
Return values
EFI_SUCCESSTlsCaCertificate is configured.
EFI_OUT_OF_RESOURCESCan't allocate memory resources.
EFI_NOT_FOUNDFail to get "TlsCaCertificate" variable.
OthersOther error as indicated.

Read the TlsCaCertificate variable and configure it.

Parameters
[in,out]HttpInstanceThe HTTP instance private data.
Return values
EFI_SUCCESSTlsCaCertificate is configured.
EFI_OUT_OF_RESOURCESCan't allocate memory resources.
EFI_NOT_FOUNDFail to get 'TlsCaCertificate' variable.
OthersOther error as indicated.

Definition at line 384 of file HttpsSupport.c.

◆ TlsConfigureSession()

EFI_STATUS EFIAPI TlsConfigureSession ( IN OUT HTTP_PROTOCOL HttpInstance)

Configure TLS session data.

Parameters
[in,out]HttpInstanceThe HTTP instance private data.
Return values
EFI_SUCCESSTLS session data is configured.
OthersOther error as indicated.

Definition at line 650 of file HttpsSupport.c.

◆ TlsConnectSession()

EFI_STATUS EFIAPI TlsConnectSession ( IN HTTP_PROTOCOL HttpInstance,
IN EFI_EVENT  Timeout 
)

Connect one TLS session by finishing the TLS handshake process.

Parameters
[in]HttpInstanceThe HTTP instance private data.
[in]TimeoutThe time to wait for connection done.
Return values
EFI_SUCCESSThe TLS session is established.
EFI_OUT_OF_RESOURCESCan't allocate memory resources.
EFI_ABORTEDTLS session state is incorrect.
OthersOther error as indicated.

Definition at line 1174 of file HttpsSupport.c.

◆ TlsCreateChild()

EFI_STATUS EFIAPI TlsCreateChild ( IN HTTP_PROTOCOL HttpInstance)

Creates a Tls child handle, open EFI_TLS_PROTOCOL and EFI_TLS_CONFIGURATION_PROTOCOL.

Parameters
[in]HttpInstancePointer to HTTP_PROTOCOL structure.
Returns
EFI_SUCCESS TLS child handle is returned in HttpInstance->TlsChildHandle with opened EFI_TLS_PROTOCOL and EFI_TLS_CONFIGURATION_PROTOCOL. EFI_DEVICE_ERROR TLS service binding protocol is not found. Otherwise Fail to create TLS chile handle.

Definition at line 148 of file HttpsSupport.c.

◆ TlsCreateTxRxEvent()

EFI_STATUS EFIAPI TlsCreateTxRxEvent ( IN OUT HTTP_PROTOCOL HttpInstance)

Create event for the TLS receive and transmit tokens which are used to receive and transmit TLS related messages.

Parameters
[in,out]HttpInstancePointer to HTTP_PROTOCOL structure.
Return values
EFI_SUCCESSThe events are created successfully.
othersOther error as indicated.

Definition at line 229 of file HttpsSupport.c.

◆ TlsProcessMessage()

EFI_STATUS EFIAPI TlsProcessMessage ( IN HTTP_PROTOCOL HttpInstance,
IN UINT8 *  Message,
IN UINTN  MessageSize,
IN EFI_TLS_CRYPT_MODE  ProcessMode,
IN OUT NET_FRAGMENT Fragment 
)

Process one message according to the CryptMode.

Parameters
[in]HttpInstancePointer to HTTP_PROTOCOL structure.
[in]MessagePointer to the message buffer needed to processed. If ProcessMode is EfiTlsEncrypt, the message contain the TLS header and plain text TLS APP payload. If ProcessMode is EfiTlsDecrypt, the message contain the TLS header and cipher text TLS APP payload.
[in]MessageSizePointer to the message buffer size.
[in]ProcessModeProcess mode.
[in,out]FragmentOnly one Fragment returned after the Message is processed successfully. If ProcessMode is EfiTlsEncrypt, the fragment contain the TLS header and cipher text TLS APP payload. If ProcessMode is EfiTlsDecrypt, the fragment contain the TLS header and plain text TLS APP payload.
Return values
EFI_SUCCESSMessage is processed successfully.
EFI_OUT_OF_RESOURCESCan't allocate memory resources.
OthersOther errors as indicated.

Definition at line 1537 of file HttpsSupport.c.

◆ TlsReceiveOnePdu()

EFI_STATUS EFIAPI TlsReceiveOnePdu ( IN OUT HTTP_PROTOCOL HttpInstance,
OUT NET_BUF **  Pdu,
IN EFI_EVENT  Timeout 
)

Receive one TLS PDU. An TLS PDU contains an TLS record header and its corresponding record data. These two parts will be put into two blocks of buffers in the net buffer.

Parameters
[in,out]HttpInstancePointer to HTTP_PROTOCOL structure.
[out]PduThe received TLS PDU.
[in]TimeoutThe time to wait for connection done.
Return values
EFI_SUCCESSAn TLS PDU is received.
EFI_OUT_OF_RESOURCESCan't allocate memory resources.
EFI_PROTOCOL_ERRORAn unexpected TLS packet was received.
OthersOther errors as indicated.

Major versions are same.

Definition at line 1039 of file HttpsSupport.c.