public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jiaxin Wu <jiaxin.wu@intel.com>
To: edk2-devel@lists.01.org
Cc: Ye Ting <ting.ye@intel.com>, Fu Siyuan <siyuan.fu@intel.com>,
	Liming Gao <liming.gao@intel.com>,
	Wu Jiaxin <jiaxin.wu@intel.com>
Subject: [Patch 1/2] MdePkg, NetworkPkg: Refine the coding style.
Date: Thu,  5 Jan 2017 11:51:34 +0800	[thread overview]
Message-ID: <1483588295-194860-2-git-send-email-jiaxin.wu@intel.com> (raw)
In-Reply-To: <1483588295-194860-1-git-send-email-jiaxin.wu@intel.com>

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
 MdePkg/Include/IndustryStandard/Tls1.h | 10 +++++-----
 NetworkPkg/HttpDxe/HttpProto.c         |  4 ++--
 NetworkPkg/HttpDxe/HttpsSupport.c      | 16 ++++++++--------
 NetworkPkg/TlsDxe/TlsImpl.c            |  6 +++---
 NetworkPkg/TlsDxe/TlsProtocol.c        |  4 ++--
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/MdePkg/Include/IndustryStandard/Tls1.h b/MdePkg/Include/IndustryStandard/Tls1.h
index 14eb265..019ff61 100644
--- a/MdePkg/Include/IndustryStandard/Tls1.h
+++ b/MdePkg/Include/IndustryStandard/Tls1.h
@@ -1,11 +1,11 @@
 /** @file
   Transport Layer Security  -- TLS 1.0/1.1/1.2 Standard definitions, from RFC 2246/4346/5246    
 
   This file contains common TLS 1.0/1.1/1.2 definitions from RFC 2246/4346/5246 
 
-  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.php
 
@@ -70,14 +70,14 @@
 
 ///
 /// TLS Content Type, refers to A.1 of rfc-2246, rfc-4346 and rfc-5246.
 ///
 typedef enum {
-  TLS_CONTENT_TYPE_CHANGE_CIPHER_SPEC = 20,
-  TLS_CONTENT_TYPE_ALERT              = 21,
-  TLS_CONTENT_TYPE_HANDSHAKE          = 22,
-  TLS_CONTENT_TYPE_APPLICATION_DATA   = 23,
+  TlsContentTypeChangeCipherSpec = 20,
+  TlsContentTypeAlert            = 21,
+  TlsContentTypeHandshake        = 22,
+  TlsContentTypeApplicationData  = 23,
 } TLS_CONTENT_TYPE;
 
 ///
 /// TLS Record Header, refers to A.1 of rfc-2246, rfc-4346 and rfc-5246.
 ///
diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c
index 2e784de..2e8c42e 100644
--- a/NetworkPkg/HttpDxe/HttpProto.c
+++ b/NetworkPkg/HttpDxe/HttpProto.c
@@ -1,9 +1,9 @@
 /** @file
   Miscellaneous routines for HttpDxe driver.
 
-Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php
@@ -1489,11 +1489,11 @@ HttpTransmitTcp (
     Buffer     = AllocateZeroPool (BufferSize);
     if (Buffer == NULL) {
       Status = EFI_OUT_OF_RESOURCES;
       return Status;
     }
-    ((TLS_RECORD_HEADER *) Buffer)->ContentType = TLS_CONTENT_TYPE_APPLICATION_DATA;
+    ((TLS_RECORD_HEADER *) Buffer)->ContentType = TlsContentTypeApplicationData;
     ((TLS_RECORD_HEADER *) Buffer)->Version.Major = HttpInstance->TlsConfigData.Version.Major;
     ((TLS_RECORD_HEADER *) Buffer)->Version.Minor = HttpInstance->TlsConfigData.Version.Minor;
     ((TLS_RECORD_HEADER *) Buffer)->Length = (UINT16) (TxStringLen);
     CopyMem (Buffer + sizeof (TLS_RECORD_HEADER), TxString, TxStringLen);
     
diff --git a/NetworkPkg/HttpDxe/HttpsSupport.c b/NetworkPkg/HttpDxe/HttpsSupport.c
index c9e6988..77e5371 100644
--- a/NetworkPkg/HttpDxe/HttpsSupport.c
+++ b/NetworkPkg/HttpDxe/HttpsSupport.c
@@ -1,9 +1,9 @@
 /** @file
   Miscellaneous routines specific to Https for HttpDxe driver.
 
-Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php
@@ -881,14 +881,14 @@ TlsReceiveOnePdu (
   if (EFI_ERROR (Status)) {
     goto ON_EXIT;
   }
 
   RecordHeader = *(TLS_RECORD_HEADER *) Header;
-  if ((RecordHeader.ContentType == TLS_CONTENT_TYPE_HANDSHAKE ||
-    RecordHeader.ContentType == TLS_CONTENT_TYPE_ALERT ||
-    RecordHeader.ContentType == TLS_CONTENT_TYPE_CHANGE_CIPHER_SPEC ||
-    RecordHeader.ContentType == TLS_CONTENT_TYPE_APPLICATION_DATA) &&
+  if ((RecordHeader.ContentType == TlsContentTypeHandshake ||
+    RecordHeader.ContentType == TlsContentTypeAlert ||
+    RecordHeader.ContentType == TlsContentTypeChangeCipherSpec ||
+    RecordHeader.ContentType == TlsContentTypeApplicationData) &&
     (RecordHeader.Version.Major == 0x03) && /// Major versions are same.
     (RecordHeader.Version.Minor == TLS10_PROTOCOL_VERSION_MINOR ||
     RecordHeader.Version.Minor ==TLS11_PROTOCOL_VERSION_MINOR ||
     RecordHeader.Version.Minor == TLS12_PROTOCOL_VERSION_MINOR)
    ) {
@@ -1495,11 +1495,11 @@ HttpsReceive (
   //
   // Handle Receive data.
   //
   RecordHeader = *(TLS_RECORD_HEADER *) BufferIn;
 
-  if ((RecordHeader.ContentType == TLS_CONTENT_TYPE_APPLICATION_DATA) &&
+  if ((RecordHeader.ContentType == TlsContentTypeApplicationData) &&
     (RecordHeader.Version.Major == 0x03) &&
     (RecordHeader.Version.Minor == TLS10_PROTOCOL_VERSION_MINOR ||
     RecordHeader.Version.Minor == TLS11_PROTOCOL_VERSION_MINOR ||
     RecordHeader.Version.Minor == TLS12_PROTOCOL_VERSION_MINOR)
   ) {
@@ -1585,11 +1585,11 @@ HttpsReceive (
     }
 
     //
     // Parsing buffer.
     //
-    ASSERT (((TLS_RECORD_HEADER *) (TempFragment.Bulk))->ContentType == TLS_CONTENT_TYPE_APPLICATION_DATA);
+    ASSERT (((TLS_RECORD_HEADER *) (TempFragment.Bulk))->ContentType == TlsContentTypeApplicationData);
 
     BufferInSize = ((TLS_RECORD_HEADER *) (TempFragment.Bulk))->Length;
     BufferIn = AllocateZeroPool (BufferInSize);
     if (BufferIn == NULL) {
       Status = EFI_OUT_OF_RESOURCES;
@@ -1601,11 +1601,11 @@ HttpsReceive (
     //
     // Free the buffer in TempFragment.
     //
     FreePool (TempFragment.Bulk);
 
-  } else if ((RecordHeader.ContentType == TLS_CONTENT_TYPE_ALERT) &&
+  } else if ((RecordHeader.ContentType == TlsContentTypeAlert) &&
     (RecordHeader.Version.Major == 0x03) &&
     (RecordHeader.Version.Minor == TLS10_PROTOCOL_VERSION_MINOR ||
     RecordHeader.Version.Minor == TLS11_PROTOCOL_VERSION_MINOR ||
     RecordHeader.Version.Minor == TLS12_PROTOCOL_VERSION_MINOR)
     ) {
diff --git a/NetworkPkg/TlsDxe/TlsImpl.c b/NetworkPkg/TlsDxe/TlsImpl.c
index bb71bd8..efdec2d 100644
--- a/NetworkPkg/TlsDxe/TlsImpl.c
+++ b/NetworkPkg/TlsDxe/TlsImpl.c
@@ -1,9 +1,9 @@
 /** @file
   The Miscellaneous Routines for TlsDxe driver.
 
-Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
 
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php
@@ -103,11 +103,11 @@ TlsEncryptPacket (
   BufferInPtr = BufferIn;
   TempRecordHeader = (TLS_RECORD_HEADER *) BufferOut;
   while ((UINTN) BufferInPtr < (UINTN) BufferIn + BufferInSize) {
     RecordHeaderIn = (TLS_RECORD_HEADER *) BufferInPtr;
     
-    if (RecordHeaderIn->ContentType != TLS_CONTENT_TYPE_APPLICATION_DATA) {
+    if (RecordHeaderIn->ContentType != TlsContentTypeApplicationData) {
       Status = EFI_INVALID_PARAMETER;
       goto ERROR;
     }
     
     ThisPlainMessageSize = RecordHeaderIn->Length;
@@ -254,11 +254,11 @@ TlsDecryptPacket (
   BufferInPtr = BufferIn;
   TempRecordHeader = (TLS_RECORD_HEADER *) BufferOut;
   while ((UINTN) BufferInPtr < (UINTN) BufferIn + BufferInSize) {
     RecordHeaderIn = (TLS_RECORD_HEADER *) BufferInPtr;
 
-    if (RecordHeaderIn->ContentType != TLS_CONTENT_TYPE_APPLICATION_DATA) {
+    if (RecordHeaderIn->ContentType != TlsContentTypeApplicationData) {
       Status = EFI_INVALID_PARAMETER;
       goto ERROR;
     }
     
     ThisCipherMessageSize = NTOHS (RecordHeaderIn->Length);
diff --git a/NetworkPkg/TlsDxe/TlsProtocol.c b/NetworkPkg/TlsDxe/TlsProtocol.c
index ee1c496..58a83c3 100644
--- a/NetworkPkg/TlsDxe/TlsProtocol.c
+++ b/NetworkPkg/TlsDxe/TlsProtocol.c
@@ -1,9 +1,9 @@
 /** @file
   Implementation of EFI TLS Protocol Interfaces.
 
-  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
   http://opensource.org/licenses/bsd-license.php.
@@ -521,11 +521,11 @@ TlsBuildResponsePacket (
       }
     } else {
       //
       // Must be alert message, Decrypt it and build the ResponsePacket.
       //
-      ASSERT (((TLS_RECORD_HEADER *) RequestBuffer)->ContentType == TLS_CONTENT_TYPE_ALERT);
+      ASSERT (((TLS_RECORD_HEADER *) RequestBuffer)->ContentType == TlsContentTypeAlert);
 
       Status = TlsHandleAlert (
                  Instance->TlsConn,
                  RequestBuffer,
                  RequestSize,
-- 
1.9.5.msysgit.1



  reply	other threads:[~2017-01-05  3:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-05  3:51 [Patch 0/2] Refine the coding style Jiaxin Wu
2017-01-05  3:51 ` Jiaxin Wu [this message]
2017-01-05  3:51 ` [Patch 2/2] CryptoPkg/TlsLib: " Jiaxin Wu
2017-01-05  5:19 ` [Patch 0/2] " Ye, Ting
2017-01-05  6:51 ` Fu, Siyuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1483588295-194860-2-git-send-email-jiaxin.wu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox