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.
| 973 | |
| 974 | **/ |
| 975 | EFI_STATUS |
| 976 | EFIAPI |
| 977 | TlsReceiveOnePdu ( |
| 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 || |
no test coverage detected