MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / TlsReceiveOnePdu

Function TlsReceiveOnePdu

NetworkPkg/HttpDxe/HttpsSupport.c:975–1095  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

973
974**/
975EFI_STATUS
976EFIAPI
977TlsReceiveOnePdu (
978 IN OUT HTTP_PROTOCOL *HttpInstance,
979 OUT NET_BUF **Pdu,
980 IN EFI_EVENT Timeout
981 )
982{
983 EFI_STATUS Status;
984
985 LIST_ENTRY *NbufList;
986
987 UINT32 Len;
988
989 NET_BUF *PduHdr;
990 UINT8 *Header;
991 TLS_RECORD_HEADER RecordHeader;
992
993 NET_BUF *DataSeg;
994
995 NbufList = NULL;
996 PduHdr = NULL;
997 Header = NULL;
998 DataSeg = NULL;
999
1000 NbufList = AllocatePool (sizeof (LIST_ENTRY));
1001 if (NbufList == NULL) {
1002 return EFI_OUT_OF_RESOURCES;
1003 }
1004
1005 InitializeListHead (NbufList);
1006
1007 //
1008 // Allocate buffer to receive one TLS header.
1009 //
1010 Len = TLS_RECORD_HEADER_LENGTH;
1011 PduHdr = NetbufAlloc (Len);
1012 if (PduHdr == NULL) {
1013 Status = EFI_OUT_OF_RESOURCES;
1014 goto ON_EXIT;
1015 }
1016
1017 Header = NetbufAllocSpace (PduHdr, Len, NET_BUF_TAIL);
1018 if (Header == NULL) {
1019 Status = EFI_OUT_OF_RESOURCES;
1020 goto ON_EXIT;
1021 }
1022
1023 //
1024 // First step, receive one TLS header.
1025 //
1026 Status = TlsCommonReceive (HttpInstance, PduHdr, Timeout);
1027 if (EFI_ERROR (Status)) {
1028 goto ON_EXIT;
1029 }
1030
1031 RecordHeader = *(TLS_RECORD_HEADER *) Header;
1032 if ((RecordHeader.ContentType == TlsContentTypeHandshake ||

Callers 2

TlsConnectSessionFunction · 0.85
HttpsReceiveFunction · 0.85

Calls 4

TlsCommonReceiveFunction · 0.85
FreeNbufListFunction · 0.85
AllocatePoolFunction · 0.50
SwapBytes16Function · 0.50

Tested by

no test coverage detected