1 /** @file
2   Transport Layer Security  -- TLS 1.0/1.1/1.2 Standard definitions, from RFC 2246/4346/5246
3 
4   This file contains common TLS 1.0/1.1/1.2 definitions from RFC 2246/4346/5246
5 
6   Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
7   This program and the accompanying materials
8   are licensed and made available under the terms and conditions of the BSD License
9   which accompanies this distribution.  The full text of the license may be found at
10   http://opensource.org/licenses/bsd-license.php
11 
12   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 **/
15 
16 #ifndef __TLS_1_H__
17 #define __TLS_1_H__
18 
19 #pragma pack(1)
20 
21 ///
22 /// TLS Cipher Suite, refers to A.5 of rfc-2246, rfc-4346 and rfc-5246.
23 ///
24 #define TLS_RSA_WITH_NULL_MD5                    {0x00, 0x01}
25 #define TLS_RSA_WITH_NULL_SHA                    {0x00, 0x02}
26 #define TLS_RSA_WITH_RC4_128_MD5                 {0x00, 0x04}
27 #define TLS_RSA_WITH_RC4_128_SHA                 {0x00, 0x05}
28 #define TLS_RSA_WITH_IDEA_CBC_SHA                {0x00, 0x07}
29 #define TLS_RSA_WITH_DES_CBC_SHA                 {0x00, 0x09}
30 #define TLS_RSA_WITH_3DES_EDE_CBC_SHA            {0x00, 0x0A}
31 #define TLS_DH_DSS_WITH_DES_CBC_SHA              {0x00, 0x0C}
32 #define TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA         {0x00, 0x0D}
33 #define TLS_DH_RSA_WITH_DES_CBC_SHA              {0x00, 0x0F}
34 #define TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA         {0x00, 0x10}
35 #define TLS_DHE_DSS_WITH_DES_CBC_SHA             {0x00, 0x12}
36 #define TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA        {0x00, 0x13}
37 #define TLS_DHE_RSA_WITH_DES_CBC_SHA             {0x00, 0x15}
38 #define TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA        {0x00, 0x16}
39 #define TLS_RSA_WITH_AES_128_CBC_SHA             {0x00, 0x2F}
40 #define TLS_DH_DSS_WITH_AES_128_CBC_SHA          {0x00, 0x30}
41 #define TLS_DH_RSA_WITH_AES_128_CBC_SHA          {0x00, 0x31}
42 #define TLS_DHE_DSS_WITH_AES_128_CBC_SHA         {0x00, 0x32}
43 #define TLS_DHE_RSA_WITH_AES_128_CBC_SHA         {0x00, 0x33}
44 #define TLS_RSA_WITH_AES_256_CBC_SHA             {0x00, 0x35}
45 #define TLS_DH_DSS_WITH_AES_256_CBC_SHA          {0x00, 0x36}
46 #define TLS_DH_RSA_WITH_AES_256_CBC_SHA          {0x00, 0x37}
47 #define TLS_DHE_DSS_WITH_AES_256_CBC_SHA         {0x00, 0x38}
48 #define TLS_DHE_RSA_WITH_AES_256_CBC_SHA         {0x00, 0x39}
49 #define TLS_RSA_WITH_NULL_SHA256                 {0x00, 0x3B}
50 #define TLS_RSA_WITH_AES_128_CBC_SHA256          {0x00, 0x3C}
51 #define TLS_RSA_WITH_AES_256_CBC_SHA256          {0x00, 0x3D}
52 #define TLS_DH_DSS_WITH_AES_128_CBC_SHA256       {0x00, 0x3E}
53 #define TLS_DH_RSA_WITH_AES_128_CBC_SHA256       {0x00, 0x3F}
54 #define TLS_DHE_DSS_WITH_AES_128_CBC_SHA256      {0x00, 0x40}
55 #define TLS_DHE_RSA_WITH_AES_128_CBC_SHA256      {0x00, 0x67}
56 #define TLS_DH_DSS_WITH_AES_256_CBC_SHA256       {0x00, 0x68}
57 #define TLS_DH_RSA_WITH_AES_256_CBC_SHA256       {0x00, 0x69}
58 #define TLS_DHE_DSS_WITH_AES_256_CBC_SHA256      {0x00, 0x6A}
59 #define TLS_DHE_RSA_WITH_AES_256_CBC_SHA256      {0x00, 0x6B}
60 
61 ///
62 /// TLS Version, refers to A.1 of rfc-2246, rfc-4346 and rfc-5246.
63 ///
64 #define TLS10_PROTOCOL_VERSION_MAJOR  0x03
65 #define TLS10_PROTOCOL_VERSION_MINOR  0x01
66 #define TLS11_PROTOCOL_VERSION_MAJOR  0x03
67 #define TLS11_PROTOCOL_VERSION_MINOR  0x02
68 #define TLS12_PROTOCOL_VERSION_MAJOR  0x03
69 #define TLS12_PROTOCOL_VERSION_MINOR  0x03
70 
71 ///
72 /// TLS Content Type, refers to A.1 of rfc-2246, rfc-4346 and rfc-5246.
73 ///
74 typedef enum {
75   TLS_CONTENT_TYPE_CHANGE_CIPHER_SPEC = 20,
76   TLS_CONTENT_TYPE_ALERT              = 21,
77   TLS_CONTENT_TYPE_HANDSHAKE          = 22,
78   TLS_CONTENT_TYPE_APPLICATION_DATA   = 23,
79 } TLS_CONTENT_TYPE;
80 
81 ///
82 /// TLS Record Header, refers to A.1 of rfc-2246, rfc-4346 and rfc-5246.
83 ///
84 typedef struct {
85   UINT8                   ContentType;
86   EFI_TLS_VERSION         Version;
87   UINT16                  Length;
88 } TLS_RECORD_HEADER;
89 
90 #pragma pack()
91 
92 #endif
93 
94