NetworkPkg/TlsDxe: clean up byte order conversion for EfiTlsCipherList
[mirror_edk2.git] / NetworkPkg / TlsDxe / TlsProtocol.c
index a5f95a09834516e9ca7f90e0726216c3f22c2f25..298ffdd659a2829bd1d60cc23b3e987984b84a74 100644 (file)
@@ -60,6 +60,7 @@ TlsSetSessionData (
   EFI_STATUS                Status;\r
   TLS_INSTANCE              *Instance;\r
   UINT16                    *CipherId;\r
+  CONST EFI_TLS_CIPHER      *TlsCipherList;\r
   UINTN                     CipherCount;\r
   UINTN                     Index;\r
 \r
@@ -113,9 +114,11 @@ TlsSetSessionData (
       goto ON_EXIT;\r
     }\r
 \r
+    TlsCipherList = (CONST EFI_TLS_CIPHER *) Data;\r
     CipherCount = DataSize / sizeof (EFI_TLS_CIPHER);\r
     for (Index = 0; Index < CipherCount; Index++) {\r
-      *(CipherId +Index) = HTONS (*(((UINT16 *) Data) + Index));\r
+      CipherId[Index] = ((TlsCipherList[Index].Data1 << 8) |\r
+                         TlsCipherList[Index].Data2);\r
     }\r
 \r
     Status = TlsSetCipherList (Instance->TlsConn, CipherId, CipherCount);\r