]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/HttpDxe/HttpsSupport.h
NetworkPkg: Convert files to CRLF line ending
[mirror_edk2.git] / NetworkPkg / HttpDxe / HttpsSupport.h
index fcb3aa05c157d407052b49426147eafb010617f0..68a6073cebf3a082ff67210339925fa5adedcb7a 100644 (file)
-/** @file
-  The header files of miscellaneous routines specific to Https for HttpDxe driver.
-
-Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution.  The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __EFI_HTTPS_SUPPORT_H__
-#define __EFI_HTTPS_SUPPORT_H__
-
-#define HTTPS_DEFAULT_PORT       443
-
-#define HTTPS_FLAG               "https://"
-
-/**
-  Check whether the Url is from Https.
-
-  @param[in]    Url             The pointer to a HTTP or HTTPS URL string.
-
-  @retval TRUE                  The Url is from HTTPS.
-  @retval FALSE                 The Url is from HTTP.
-
-**/
-BOOLEAN
-IsHttpsUrl (
-  IN CHAR8    *Url
-  );
-
-/**
-  Creates a Tls child handle, open EFI_TLS_PROTOCOL and EFI_TLS_CONFIGURATION_PROTOCOL.
-
-  @param[in]  ImageHandle           The firmware allocated handle for the UEFI image.
-  @param[out] TlsProto              Pointer to the EFI_TLS_PROTOCOL instance.
-  @param[out] TlsConfiguration      Pointer to the EFI_TLS_CONFIGURATION_PROTOCOL instance.
-
-  @return  The child handle with opened EFI_TLS_PROTOCOL and EFI_TLS_CONFIGURATION_PROTOCOL.
-
-**/
-EFI_HANDLE
-EFIAPI
-TlsCreateChild (
-  IN  EFI_HANDLE                     ImageHandle,
-  OUT EFI_TLS_PROTOCOL               **TlsProto,
-  OUT EFI_TLS_CONFIGURATION_PROTOCOL **TlsConfiguration
-  );
-
-/**
-  Create event for the TLS receive and transmit tokens which are used to receive and
-  transmit TLS related messages.
-
-  @param[in, out]  HttpInstance       Pointer to HTTP_PROTOCOL structure.
-
-  @retval EFI_SUCCESS            The events are created successfully.
-  @retval others                 Other error as indicated.
-
-**/
-EFI_STATUS
-EFIAPI
-TlsCreateTxRxEvent (
-  IN OUT HTTP_PROTOCOL      *HttpInstance
-  );
-
-/**
-  Close events in the TlsTxToken and TlsRxToken.
-
-  @param[in]  HttpInstance   Pointer to HTTP_PROTOCOL structure.
-
-**/
-VOID
-EFIAPI
-TlsCloseTxRxEvent (
-  IN  HTTP_PROTOCOL        *HttpInstance
-  );
-
-/**
-  Read the TlsCaCertificate variable and configure it.
-
-  @param[in, out]  HttpInstance       The HTTP instance private data.
-
-  @retval EFI_SUCCESS            TlsCaCertificate is configured.
-  @retval EFI_OUT_OF_RESOURCES   Can't allocate memory resources.
-  @retval EFI_NOT_FOUND          Fail to get "TlsCaCertificate" variable.
-  @retval Others                 Other error as indicated.
-
-**/
-EFI_STATUS
-TlsConfigCertificate (
-  IN OUT HTTP_PROTOCOL      *HttpInstance
-  );
-
-/**
-  Configure TLS session data.
-
-  @param[in, out]  HttpInstance       The HTTP instance private data.
-
-  @retval EFI_SUCCESS            TLS session data is configured.
-  @retval Others                 Other error as indicated.
-
-**/
-EFI_STATUS
-EFIAPI
-TlsConfigureSession (
-  IN OUT HTTP_PROTOCOL      *HttpInstance
-  );
-
-/**
-  Transmit the Packet by processing the associated HTTPS token.
-
-  @param[in, out]   HttpInstance    Pointer to HTTP_PROTOCOL structure.
-  @param[in]        Packet          The packet to transmit.
-
-  @retval EFI_SUCCESS            The packet is transmitted.
-  @retval EFI_INVALID_PARAMETER  HttpInstance is NULL or Packet is NULL.
-  @retval EFI_OUT_OF_RESOURCES   Can't allocate memory resources.
-  @retval EFI_DEVICE_ERROR       An unexpected system or network error occurred.
-  @retval Others                 Other errors as indicated.
-
-**/
-EFI_STATUS
-EFIAPI
-TlsCommonTransmit (
-  IN OUT HTTP_PROTOCOL      *HttpInstance,
-  IN     NET_BUF            *Packet
-  );
-
-/**
-  Receive the Packet by processing the associated HTTPS token.
-
-  @param[in, out]   HttpInstance    Pointer to HTTP_PROTOCOL structure.
-  @param[in]        Packet          The packet to transmit.
-  @param[in]        Timeout         The time to wait for connection done.
-
-  @retval EFI_SUCCESS            The Packet is received.
-  @retval EFI_INVALID_PARAMETER  HttpInstance is NULL or Packet is NULL.
-  @retval EFI_OUT_OF_RESOURCES   Can't allocate memory resources.
-  @retval EFI_TIMEOUT            The operation is time out.
-  @retval Others                 Other error as indicated.
-
-**/
-EFI_STATUS
-EFIAPI
-TlsCommonReceive (
-  IN OUT HTTP_PROTOCOL      *HttpInstance,
-  IN     NET_BUF            *Packet,
-  IN     EFI_EVENT          Timeout
-  );
-
-/**
-  Receive one TLS PDU. An TLS PDU contains an TLS record header and it's
-  corresponding record data. These two parts will be put into two blocks of buffers in the
-  net buffer.
-
-  @param[in, out]      HttpInstance    Pointer to HTTP_PROTOCOL structure.
-  @param[out]          Pdu             The received TLS PDU.
-  @param[in]           Timeout         The time to wait for connection done.
-
-  @retval EFI_SUCCESS          An TLS PDU is received.
-  @retval EFI_OUT_OF_RESOURCES Can't allocate memory resources.
-  @retval EFI_PROTOCOL_ERROR   An unexpected TLS packet was received.
-  @retval Others               Other errors as indicated.
-
-**/
-EFI_STATUS
-EFIAPI
-TlsReceiveOnePdu (
-  IN OUT HTTP_PROTOCOL      *HttpInstance,
-     OUT NET_BUF            **Pdu,
-  IN     EFI_EVENT          Timeout
-  );
-
-/**
-  Connect one TLS session by finishing the TLS handshake process.
-
-  @param[in]  HttpInstance       The HTTP instance private data.
-  @param[in]  Timeout            The time to wait for connection done.
-
-  @retval EFI_SUCCESS            The TLS session is established.
-  @retval EFI_OUT_OF_RESOURCES   Can't allocate memory resources.
-  @retval EFI_ABORTED            TLS session state is incorrect.
-  @retval Others                 Other error as indicated.
-
-**/
-EFI_STATUS
-EFIAPI
-TlsConnectSession (
-  IN  HTTP_PROTOCOL            *HttpInstance,
-  IN  EFI_EVENT                Timeout
-  );
-
-/**
-  Close the TLS session and send out the close notification message.
-
-  @param[in]  HttpInstance       The HTTP instance private data.
-
-  @retval EFI_SUCCESS            The TLS session is closed.
-  @retval EFI_INVALID_PARAMETER  HttpInstance is NULL or Packet is NULL.
-  @retval EFI_OUT_OF_RESOURCES   Can't allocate memory resources.
-  @retval Others                 Other error as indicated.
-
-**/
-EFI_STATUS
-EFIAPI
-TlsCloseSession (
-  IN  HTTP_PROTOCOL            *HttpInstance
-  );
-
-/**
-  Process one message according to the CryptMode.
-
-  @param[in]           HttpInstance    Pointer to HTTP_PROTOCOL structure.
-  @param[in]           Message         Pointer to the message buffer needed to processed.
-  @param[in]           MessageSize     Pointer to the message buffer size.
-  @param[in]           ProcessMode     Process mode.
-  @param[in, out]      Fragment        Only one Fragment returned after the Message is
-                                       processed successfully.
-
-  @retval EFI_SUCCESS          Message is processed successfully.
-  @retval EFI_OUT_OF_RESOURCES   Can't allocate memory resources.
-  @retval Others               Other errors as indicated.
-
-**/
-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
-  );
-
-/**
-  Receive one fragment decrypted from one TLS record.
-
-  @param[in]           HttpInstance    Pointer to HTTP_PROTOCOL structure.
-  @param[in, out]      Fragment        The received Fragment.
-  @param[in]           Timeout         The time to wait for connection done.
-
-  @retval EFI_SUCCESS          One fragment is received.
-  @retval EFI_OUT_OF_RESOURCES Can't allocate memory resources.
-  @retval EFI_ABORTED          Something wrong decryption the message.
-  @retval Others               Other errors as indicated.
-
-**/
-EFI_STATUS
-EFIAPI
-HttpsReceive (
-  IN     HTTP_PROTOCOL         *HttpInstance,
-  IN OUT NET_FRAGMENT          *Fragment,
-  IN     EFI_EVENT             Timeout
-  );
-
-#endif
+/** @file\r
+  The header files of miscellaneous routines specific to Https for HttpDxe driver.\r
+\r
+Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef __EFI_HTTPS_SUPPORT_H__\r
+#define __EFI_HTTPS_SUPPORT_H__\r
+\r
+#define HTTPS_DEFAULT_PORT       443\r
+\r
+#define HTTPS_FLAG               "https://"\r
+\r
+/**\r
+  Check whether the Url is from Https.\r
+\r
+  @param[in]    Url             The pointer to a HTTP or HTTPS URL string.\r
+\r
+  @retval TRUE                  The Url is from HTTPS.\r
+  @retval FALSE                 The Url is from HTTP.\r
+\r
+**/\r
+BOOLEAN\r
+IsHttpsUrl (\r
+  IN CHAR8    *Url\r
+  );\r
+\r
+/**\r
+  Creates a Tls child handle, open EFI_TLS_PROTOCOL and EFI_TLS_CONFIGURATION_PROTOCOL.\r
+\r
+  @param[in]  ImageHandle           The firmware allocated handle for the UEFI image.\r
+  @param[out] TlsProto              Pointer to the EFI_TLS_PROTOCOL instance.\r
+  @param[out] TlsConfiguration      Pointer to the EFI_TLS_CONFIGURATION_PROTOCOL instance.\r
+\r
+  @return  The child handle with opened EFI_TLS_PROTOCOL and EFI_TLS_CONFIGURATION_PROTOCOL.\r
+\r
+**/\r
+EFI_HANDLE\r
+EFIAPI\r
+TlsCreateChild (\r
+  IN  EFI_HANDLE                     ImageHandle,\r
+  OUT EFI_TLS_PROTOCOL               **TlsProto,\r
+  OUT EFI_TLS_CONFIGURATION_PROTOCOL **TlsConfiguration\r
+  );\r
+\r
+/**\r
+  Create event for the TLS receive and transmit tokens which are used to receive and\r
+  transmit TLS related messages.\r
+\r
+  @param[in, out]  HttpInstance       Pointer to HTTP_PROTOCOL structure.\r
+\r
+  @retval EFI_SUCCESS            The events are created successfully.\r
+  @retval others                 Other error as indicated.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TlsCreateTxRxEvent (\r
+  IN OUT HTTP_PROTOCOL      *HttpInstance\r
+  );\r
+\r
+/**\r
+  Close events in the TlsTxToken and TlsRxToken.\r
+\r
+  @param[in]  HttpInstance   Pointer to HTTP_PROTOCOL structure.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+TlsCloseTxRxEvent (\r
+  IN  HTTP_PROTOCOL        *HttpInstance\r
+  );\r
+\r
+/**\r
+  Read the TlsCaCertificate variable and configure it.\r
+\r
+  @param[in, out]  HttpInstance       The HTTP instance private data.\r
+\r
+  @retval EFI_SUCCESS            TlsCaCertificate is configured.\r
+  @retval EFI_OUT_OF_RESOURCES   Can't allocate memory resources.\r
+  @retval EFI_NOT_FOUND          Fail to get "TlsCaCertificate" variable.\r
+  @retval Others                 Other error as indicated.\r
+\r
+**/\r
+EFI_STATUS\r
+TlsConfigCertificate (\r
+  IN OUT HTTP_PROTOCOL      *HttpInstance\r
+  );\r
+\r
+/**\r
+  Configure TLS session data.\r
+\r
+  @param[in, out]  HttpInstance       The HTTP instance private data.\r
+\r
+  @retval EFI_SUCCESS            TLS session data is configured.\r
+  @retval Others                 Other error as indicated.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TlsConfigureSession (\r
+  IN OUT HTTP_PROTOCOL      *HttpInstance\r
+  );\r
+\r
+/**\r
+  Transmit the Packet by processing the associated HTTPS token.\r
+\r
+  @param[in, out]   HttpInstance    Pointer to HTTP_PROTOCOL structure.\r
+  @param[in]        Packet          The packet to transmit.\r
+\r
+  @retval EFI_SUCCESS            The packet is transmitted.\r
+  @retval EFI_INVALID_PARAMETER  HttpInstance is NULL or Packet is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES   Can't allocate memory resources.\r
+  @retval EFI_DEVICE_ERROR       An unexpected system or network error occurred.\r
+  @retval Others                 Other errors as indicated.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TlsCommonTransmit (\r
+  IN OUT HTTP_PROTOCOL      *HttpInstance,\r
+  IN     NET_BUF            *Packet\r
+  );\r
+\r
+/**\r
+  Receive the Packet by processing the associated HTTPS token.\r
+\r
+  @param[in, out]   HttpInstance    Pointer to HTTP_PROTOCOL structure.\r
+  @param[in]        Packet          The packet to transmit.\r
+  @param[in]        Timeout         The time to wait for connection done.\r
+\r
+  @retval EFI_SUCCESS            The Packet is received.\r
+  @retval EFI_INVALID_PARAMETER  HttpInstance is NULL or Packet is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES   Can't allocate memory resources.\r
+  @retval EFI_TIMEOUT            The operation is time out.\r
+  @retval Others                 Other error as indicated.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TlsCommonReceive (\r
+  IN OUT HTTP_PROTOCOL      *HttpInstance,\r
+  IN     NET_BUF            *Packet,\r
+  IN     EFI_EVENT          Timeout\r
+  );\r
+\r
+/**\r
+  Receive one TLS PDU. An TLS PDU contains an TLS record header and it's\r
+  corresponding record data. These two parts will be put into two blocks of buffers in the\r
+  net buffer.\r
+\r
+  @param[in, out]      HttpInstance    Pointer to HTTP_PROTOCOL structure.\r
+  @param[out]          Pdu             The received TLS PDU.\r
+  @param[in]           Timeout         The time to wait for connection done.\r
+\r
+  @retval EFI_SUCCESS          An TLS PDU is received.\r
+  @retval EFI_OUT_OF_RESOURCES Can't allocate memory resources.\r
+  @retval EFI_PROTOCOL_ERROR   An unexpected TLS packet was received.\r
+  @retval Others               Other errors as indicated.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TlsReceiveOnePdu (\r
+  IN OUT HTTP_PROTOCOL      *HttpInstance,\r
+     OUT NET_BUF            **Pdu,\r
+  IN     EFI_EVENT          Timeout\r
+  );\r
+\r
+/**\r
+  Connect one TLS session by finishing the TLS handshake process.\r
+\r
+  @param[in]  HttpInstance       The HTTP instance private data.\r
+  @param[in]  Timeout            The time to wait for connection done.\r
+\r
+  @retval EFI_SUCCESS            The TLS session is established.\r
+  @retval EFI_OUT_OF_RESOURCES   Can't allocate memory resources.\r
+  @retval EFI_ABORTED            TLS session state is incorrect.\r
+  @retval Others                 Other error as indicated.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TlsConnectSession (\r
+  IN  HTTP_PROTOCOL            *HttpInstance,\r
+  IN  EFI_EVENT                Timeout\r
+  );\r
+\r
+/**\r
+  Close the TLS session and send out the close notification message.\r
+\r
+  @param[in]  HttpInstance       The HTTP instance private data.\r
+\r
+  @retval EFI_SUCCESS            The TLS session is closed.\r
+  @retval EFI_INVALID_PARAMETER  HttpInstance is NULL or Packet is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES   Can't allocate memory resources.\r
+  @retval Others                 Other error as indicated.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TlsCloseSession (\r
+  IN  HTTP_PROTOCOL            *HttpInstance\r
+  );\r
+\r
+/**\r
+  Process one message according to the CryptMode.\r
+\r
+  @param[in]           HttpInstance    Pointer to HTTP_PROTOCOL structure.\r
+  @param[in]           Message         Pointer to the message buffer needed to processed.\r
+  @param[in]           MessageSize     Pointer to the message buffer size.\r
+  @param[in]           ProcessMode     Process mode.\r
+  @param[in, out]      Fragment        Only one Fragment returned after the Message is\r
+                                       processed successfully.\r
+\r
+  @retval EFI_SUCCESS          Message is processed successfully.\r
+  @retval EFI_OUT_OF_RESOURCES   Can't allocate memory resources.\r
+  @retval Others               Other errors as indicated.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TlsProcessMessage (\r
+  IN     HTTP_PROTOCOL            *HttpInstance,\r
+  IN     UINT8                    *Message,\r
+  IN     UINTN                    MessageSize,\r
+  IN     EFI_TLS_CRYPT_MODE       ProcessMode,\r
+  IN OUT NET_FRAGMENT             *Fragment\r
+  );\r
+\r
+/**\r
+  Receive one fragment decrypted from one TLS record.\r
+\r
+  @param[in]           HttpInstance    Pointer to HTTP_PROTOCOL structure.\r
+  @param[in, out]      Fragment        The received Fragment.\r
+  @param[in]           Timeout         The time to wait for connection done.\r
+\r
+  @retval EFI_SUCCESS          One fragment is received.\r
+  @retval EFI_OUT_OF_RESOURCES Can't allocate memory resources.\r
+  @retval EFI_ABORTED          Something wrong decryption the message.\r
+  @retval Others               Other errors as indicated.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+HttpsReceive (\r
+  IN     HTTP_PROTOCOL         *HttpInstance,\r
+  IN OUT NET_FRAGMENT          *Fragment,\r
+  IN     EFI_EVENT             Timeout\r
+  );\r
+\r
+#endif\r
+\r