// 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
+ Status = EFI_NOT_FOUND;\r
+ goto FreeCACert;\r
}\r
\r
ASSERT (CACert != NULL);\r
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
CertList = (EFI_SIGNATURE_LIST *) ((UINT8 *) CertList + CertList->SignatureListSize);\r
}\r
\r
+FreeCACert:\r
FreePool (CACert);\r
return Status;\r
}\r
//\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
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
ON_EXIT:\r
\r
if (OriginalFragmentTable != NULL) {\r
+ if( FragmentTable == OriginalFragmentTable) {\r
+ FragmentTable = NULL;\r
+ }\r
FreePool (OriginalFragmentTable);\r
OriginalFragmentTable = NULL;\r
}\r
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