MdePkg/Include/Protocol/Tls.h: pack structures from the TLS RFC
authorLaszlo Ersek <lersek@redhat.com>
Sat, 31 Mar 2018 14:20:37 +0000 (16:20 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Fri, 13 Apr 2018 12:06:06 +0000 (14:06 +0200)
The structures defined in RFC 5246 are not to have any padding between
fields or at the end; use the "pack" pragma as necessary.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=915
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
MdePkg/Include/Protocol/Tls.h

index 2119f33c0f5b7e60f413562add491be1a8d2acbf..dafaabcd2a8b1695ceaad3b6d1f06d3ca44444b7 100644 (file)
@@ -141,10 +141,12 @@ typedef enum {
 ///       Hello Messages". The value of EFI_TLS_CIPHER is from TLS Cipher\r
 ///       Suite Registry of IANA.\r
 ///\r
 ///       Hello Messages". The value of EFI_TLS_CIPHER is from TLS Cipher\r
 ///       Suite Registry of IANA.\r
 ///\r
+#pragma pack (1)\r
 typedef struct {\r
   UINT8                         Data1;\r
   UINT8                         Data2;\r
 } EFI_TLS_CIPHER;\r
 typedef struct {\r
   UINT8                         Data1;\r
   UINT8                         Data2;\r
 } EFI_TLS_CIPHER;\r
+#pragma pack ()\r
 \r
 ///\r
 /// EFI_TLS_COMPRESSION\r
 \r
 ///\r
 /// EFI_TLS_COMPRESSION\r
@@ -157,11 +159,13 @@ typedef UINT8 EFI_TLS_COMPRESSION;
 /// Note: The definition of EFI_TLS_EXTENSION if from "RFC 5246 A.4.1.\r
 ///       Hello Messages".\r
 ///\r
 /// Note: The definition of EFI_TLS_EXTENSION if from "RFC 5246 A.4.1.\r
 ///       Hello Messages".\r
 ///\r
+#pragma pack (1)\r
 typedef struct {\r
   UINT16                        ExtensionType;\r
   UINT16                        Length;\r
   UINT8                         Data[1];\r
 } EFI_TLS_EXTENSION;\r
 typedef struct {\r
   UINT16                        ExtensionType;\r
   UINT16                        Length;\r
   UINT8                         Data[1];\r
 } EFI_TLS_EXTENSION;\r
+#pragma pack ()\r
 \r
 ///\r
 /// EFI_TLS_VERIFY\r
 \r
 ///\r
 /// EFI_TLS_VERIFY\r
@@ -194,29 +198,35 @@ typedef UINT32  EFI_TLS_VERIFY;
 /// Note: The definition of EFI_TLS_RANDOM is from "RFC 5246 A.4.1.\r
 ///       Hello Messages".\r
 ///\r
 /// Note: The definition of EFI_TLS_RANDOM is from "RFC 5246 A.4.1.\r
 ///       Hello Messages".\r
 ///\r
+#pragma pack (1)\r
 typedef struct {\r
   UINT32                        GmtUnixTime;\r
   UINT8                         RandomBytes[28];\r
 } EFI_TLS_RANDOM;\r
 typedef struct {\r
   UINT32                        GmtUnixTime;\r
   UINT8                         RandomBytes[28];\r
 } EFI_TLS_RANDOM;\r
+#pragma pack ()\r
 \r
 ///\r
 /// EFI_TLS_MASTER_SECRET\r
 /// Note: The definition of EFI_TLS_MASTER_SECRET is from "RFC 5246 8.1.\r
 ///       Computing the Master Secret".\r
 ///\r
 \r
 ///\r
 /// EFI_TLS_MASTER_SECRET\r
 /// Note: The definition of EFI_TLS_MASTER_SECRET is from "RFC 5246 8.1.\r
 ///       Computing the Master Secret".\r
 ///\r
+#pragma pack (1)\r
 typedef struct {\r
   UINT8                         Data[48];\r
 } EFI_TLS_MASTER_SECRET;\r
 typedef struct {\r
   UINT8                         Data[48];\r
 } EFI_TLS_MASTER_SECRET;\r
+#pragma pack ()\r
 \r
 ///\r
 /// EFI_TLS_SESSION_ID\r
 /// Note: The definition of EFI_TLS_SESSION_ID is from "RFC 5246 A.4.1. Hello Messages".\r
 ///\r
 #define MAX_TLS_SESSION_ID_LENGTH  32\r
 \r
 ///\r
 /// EFI_TLS_SESSION_ID\r
 /// Note: The definition of EFI_TLS_SESSION_ID is from "RFC 5246 A.4.1. Hello Messages".\r
 ///\r
 #define MAX_TLS_SESSION_ID_LENGTH  32\r
+#pragma pack (1)\r
 typedef struct {\r
   UINT16                        Length;\r
   UINT8                         Data[MAX_TLS_SESSION_ID_LENGTH];\r
 } EFI_TLS_SESSION_ID;\r
 typedef struct {\r
   UINT16                        Length;\r
   UINT8                         Data[MAX_TLS_SESSION_ID_LENGTH];\r
 } EFI_TLS_SESSION_ID;\r
+#pragma pack ()\r
 \r
 ///\r
 /// EFI_TLS_SESSION_STATE\r
 \r
 ///\r
 /// EFI_TLS_SESSION_STATE\r