From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3780F226C7C20 for ; Tue, 3 Apr 2018 08:08:35 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 08:08:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,401,1517904000"; d="scan'208";a="39055993" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by FMSMGA003.fm.intel.com with ESMTP; 03 Apr 2018 08:08:35 -0700 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 3 Apr 2018 08:08:34 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 3 Apr 2018 08:08:34 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.226]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.129]) with mapi id 14.03.0319.002; Tue, 3 Apr 2018 23:08:32 +0800 From: "Gao, Liming" To: Laszlo Ersek , edk2-devel-01 CC: "Wu, Jiaxin" , "Kinney, Michael D" , "Fu, Siyuan" Thread-Topic: [PATCH 02/13] MdePkg/Include/Protocol/Tls.h: pack structures from the TLS RFC Thread-Index: AQHTy1tU/YhzzcbIgUOqaeFIyyeisaPvJEKA Date: Tue, 3 Apr 2018 15:08:32 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E1F1B10@SHSMSX104.ccr.corp.intel.com> References: <20180403145149.8925-1-lersek@redhat.com> <20180403145149.8925-3-lersek@redhat.com> In-Reply-To: <20180403145149.8925-3-lersek@redhat.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 02/13] MdePkg/Include/Protocol/Tls.h: pack structures from the TLS RFC X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 15:08:36 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Laszlo: Could you use one pack to scope all structure definitions? Thanks Liming > -----Original Message----- > From: Laszlo Ersek [mailto:lersek@redhat.com] > Sent: Tuesday, April 3, 2018 10:52 PM > To: edk2-devel-01 > Cc: Wu, Jiaxin ; Gao, Liming ;= Kinney, Michael D ; Fu, > Siyuan > Subject: [PATCH 02/13] MdePkg/Include/Protocol/Tls.h: pack structures fro= m the TLS RFC >=20 > The structures defined in RFC 5246 are not to have any padding between > fields or at the end; use the "pack" pragma as necessary. >=20 > Cc: Jiaxin Wu > Cc: Liming Gao > Cc: Michael D Kinney > Cc: Siyuan Fu > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D915 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Laszlo Ersek > --- > MdePkg/Include/Protocol/Tls.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) >=20 > diff --git a/MdePkg/Include/Protocol/Tls.h b/MdePkg/Include/Protocol/Tls.= h > index 2119f33c0f5b..dafaabcd2a8b 100644 > --- a/MdePkg/Include/Protocol/Tls.h > +++ b/MdePkg/Include/Protocol/Tls.h > @@ -138,33 +138,37 @@ typedef enum { > /// > /// EFI_TLS_CIPHER > /// Note: The definition of EFI_TLS_CIPHER definition is from "RFC 5246,= A.4.1. > /// Hello Messages". The value of EFI_TLS_CIPHER is from TLS Ciphe= r > /// Suite Registry of IANA. > /// > +#pragma pack (1) > typedef struct { > UINT8 Data1; > UINT8 Data2; > } EFI_TLS_CIPHER; > +#pragma pack () >=20 > /// > /// EFI_TLS_COMPRESSION > /// Note: The value of EFI_TLS_COMPRESSION definition is from "RFC 3749"= . > /// > typedef UINT8 EFI_TLS_COMPRESSION; >=20 > /// > /// EFI_TLS_EXTENSION > /// Note: The definition of EFI_TLS_EXTENSION if from "RFC 5246 A.4.1. > /// Hello Messages". > /// > +#pragma pack (1) > typedef struct { > UINT16 ExtensionType; > UINT16 Length; > UINT8 Data[1]; > } EFI_TLS_EXTENSION; > +#pragma pack () >=20 > /// > /// EFI_TLS_VERIFY > /// Use either EFI_TLS_VERIFY_NONE or EFI_TLS_VERIFY_PEER, the last two = options > /// are 'ORed' with EFI_TLS_VERIFY_PEER if they are desired. > /// > @@ -191,35 +195,41 @@ typedef UINT32 EFI_TLS_VERIFY; >=20 > /// > /// EFI_TLS_RANDOM > /// Note: The definition of EFI_TLS_RANDOM is from "RFC 5246 A.4.1. > /// Hello Messages". > /// > +#pragma pack (1) > typedef struct { > UINT32 GmtUnixTime; > UINT8 RandomBytes[28]; > } EFI_TLS_RANDOM; > +#pragma pack () >=20 > /// > /// EFI_TLS_MASTER_SECRET > /// Note: The definition of EFI_TLS_MASTER_SECRET is from "RFC 5246 8.1. > /// Computing the Master Secret". > /// > +#pragma pack (1) > typedef struct { > UINT8 Data[48]; > } EFI_TLS_MASTER_SECRET; > +#pragma pack () >=20 > /// > /// EFI_TLS_SESSION_ID > /// Note: The definition of EFI_TLS_SESSION_ID is from "RFC 5246 A.4.1. = Hello Messages". > /// > #define MAX_TLS_SESSION_ID_LENGTH 32 > +#pragma pack (1) > typedef struct { > UINT16 Length; > UINT8 Data[MAX_TLS_SESSION_ID_LENGTH]; > } EFI_TLS_SESSION_ID; > +#pragma pack () >=20 > /// > /// EFI_TLS_SESSION_STATE > /// > typedef enum { > /// > -- > 2.14.1.3.gb7cf6e02401b >=20