X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=NetworkPkg%2FHttpDxe%2FHttpsSupport.c;h=baab77225fdfedf0570e7e6180469fd148cd158f;hp=f5e5911b8656310047d14ef53b478dec9f415f5b;hb=78a6782158db2711c3192e46d0cf06f48d28d406;hpb=7ff68b5edc9fda1bd64a70c0e21949d566553484 diff --git a/NetworkPkg/HttpDxe/HttpsSupport.c b/NetworkPkg/HttpDxe/HttpsSupport.c index f5e5911b86..baab77225f 100644 --- a/NetworkPkg/HttpDxe/HttpsSupport.c +++ b/NetworkPkg/HttpDxe/HttpsSupport.c @@ -423,11 +423,8 @@ TlsConfigCertificate ( if (EFI_ERROR (Status)) { // // GetVariable still error or the variable is corrupted. - // Fall back to the default value. // - FreePool (CACert); - - return EFI_NOT_FOUND; + goto FreeCACert; } ASSERT (CACert != NULL); @@ -451,8 +448,7 @@ TlsConfigCertificate ( CertList->SignatureSize - sizeof (Cert->SignatureOwner) ); if (EFI_ERROR (Status)) { - FreePool (CACert); - return Status; + goto FreeCACert; } Cert = (EFI_SIGNATURE_DATA *) ((UINT8 *) Cert + CertList->SignatureSize); @@ -462,6 +458,7 @@ TlsConfigCertificate ( CertList = (EFI_SIGNATURE_LIST *) ((UINT8 *) CertList + CertList->SignatureListSize); } +FreeCACert: FreePool (CACert); return Status; } @@ -951,7 +948,7 @@ TlsReceiveOnePdu ( // // Allocate buffer to receive one TLS header. // - Len = sizeof (TLS_RECORD_HEADER); + Len = TLS_RECORD_HEADER_LENGTH; PduHdr = NetbufAlloc (Len); if (PduHdr == NULL) { Status = EFI_OUT_OF_RESOURCES; @@ -1391,11 +1388,19 @@ TlsCloseSession ( 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] Message Pointer 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. @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. + 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. @retval EFI_SUCCESS Message is processed successfully. @retval EFI_OUT_OF_RESOURCES Can't allocate memory resources. @@ -1498,6 +1503,9 @@ TlsProcessMessage ( ON_EXIT: if (OriginalFragmentTable != NULL) { + if( FragmentTable == OriginalFragmentTable) { + FragmentTable = NULL; + } FreePool (OriginalFragmentTable); OriginalFragmentTable = NULL; } @@ -1682,7 +1690,7 @@ HttpsReceive ( return Status; } - CopyMem (BufferIn, TempFragment.Bulk + sizeof (TLS_RECORD_HEADER), BufferInSize); + CopyMem (BufferIn, TempFragment.Bulk + TLS_RECORD_HEADER_LENGTH, BufferInSize); // // Free the buffer in TempFragment.