]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/HttpDxe/HttpsSupport.c
NetworkPkg/HttpDxe: drop misleading comment / status code in cert config
[mirror_edk2.git] / NetworkPkg / HttpDxe / HttpsSupport.c
index f5e5911b8656310047d14ef53b478dec9f415f5b..baab77225fdfedf0570e7e6180469fd148cd158f 100644 (file)
@@ -423,11 +423,8 @@ TlsConfigCertificate (
   if (EFI_ERROR (Status)) {\r
     //\r
     // GetVariable still error or the variable is corrupted.\r
-    // Fall back to the default value.\r
     //\r
-    FreePool (CACert);\r
-\r
-    return EFI_NOT_FOUND;\r
+    goto FreeCACert;\r
   }\r
 \r
   ASSERT (CACert != NULL);\r
@@ -451,8 +448,7 @@ TlsConfigCertificate (
                                                  CertList->SignatureSize - sizeof (Cert->SignatureOwner)\r
                                                  );\r
       if (EFI_ERROR (Status)) {\r
-        FreePool (CACert);\r
-        return Status;\r
+        goto FreeCACert;\r
       }\r
 \r
       Cert = (EFI_SIGNATURE_DATA *) ((UINT8 *) Cert + CertList->SignatureSize);\r
@@ -462,6 +458,7 @@ TlsConfigCertificate (
     CertList = (EFI_SIGNATURE_LIST *) ((UINT8 *) CertList + CertList->SignatureListSize);\r
   }\r
 \r
+FreeCACert:\r
   FreePool (CACert);\r
   return Status;\r
 }\r
@@ -951,7 +948,7 @@ TlsReceiveOnePdu (
   //\r
   // Allocate buffer to receive one TLS header.\r
   //\r
-  Len     = sizeof (TLS_RECORD_HEADER);\r
+  Len     = TLS_RECORD_HEADER_LENGTH;\r
   PduHdr  = NetbufAlloc (Len);\r
   if (PduHdr == NULL) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
@@ -1391,11 +1388,19 @@ TlsCloseSession (
   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]           Message         Pointer to the message buffer needed to processed. \r
+                                       If ProcessMode is EfiTlsEncrypt, the message contain the TLS\r
+                                       header and plain text TLS APP payload.\r
+                                       If ProcessMode is EfiTlsDecrypt, the message contain the TLS \r
+                                       header and cipher text TLS APP payload.\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
+                                       If ProcessMode is EfiTlsEncrypt, the fragment contain the TLS \r
+                                       header and cipher text TLS APP payload.\r
+                                       If ProcessMode is EfiTlsDecrypt, the fragment contain the TLS \r
+                                       header and plain text TLS APP payload.\r
 \r
   @retval EFI_SUCCESS          Message is processed successfully.\r
   @retval EFI_OUT_OF_RESOURCES   Can't allocate memory resources.\r
@@ -1498,6 +1503,9 @@ TlsProcessMessage (
 ON_EXIT:\r
 \r
   if (OriginalFragmentTable != NULL) {\r
+    if( FragmentTable == OriginalFragmentTable) {\r
+      FragmentTable = NULL;\r
+    }\r
     FreePool (OriginalFragmentTable);\r
     OriginalFragmentTable = NULL;\r
   }\r
@@ -1682,7 +1690,7 @@ HttpsReceive (
       return Status;\r
     }\r
 \r
-    CopyMem (BufferIn, TempFragment.Bulk + sizeof (TLS_RECORD_HEADER), BufferInSize);\r
+    CopyMem (BufferIn, TempFragment.Bulk + TLS_RECORD_HEADER_LENGTH, BufferInSize);\r
 \r
     //\r
     // Free the buffer in TempFragment.\r