1 /** @file
2   The internal structure and function declaration in IpSecConfig application.
3 
4   Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
5 
6   This program and the accompanying materials
7   are licensed and made available under the terms and conditions of the BSD License
8   which accompanies this distribution.  The full text of the license may be found at
9   http://opensource.org/licenses/bsd-license.php.
10 
11   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 
14 **/
15 
16 #ifndef _IPSEC_CONFIG_H_
17 #define _IPSEC_CONFIG_H_
18 
19 #include <Library/BaseMemoryLib.h>
20 #include <Library/UefiLib.h>
21 #include <Library/ShellLib.h>
22 #include <Library/DebugLib.h>
23 #include <Library/MemoryAllocationLib.h>
24 #include <Library/UefiBootServicesTableLib.h>
25 #include <Library/UefiHiiServicesLib.h>
26 #include <Library/NetLib.h>
27 
28 #include <Protocol/IpSecConfig.h>
29 
30 #define IPSECCONFIG_STATUS_NAME    L"IpSecStatus"
31 
32 #define BIT(x)   (UINT32) (1 << (x))
33 
34 #define IPSEC_STATUS_DISABLED    0x0
35 #define IPSEC_STATUS_ENABLED     0x1
36 
37 #define EFI_IP4_PROTO_ICMP       0x1
38 #define EFI_IP4_PROTO_TCP        0x6
39 #define EFI_IP4_PROTO_UDP        0x11
40 
41 #define EFI_IPSEC_ANY_PROTOCOL    0xFFFF
42 #define EFI_IPSEC_ANY_PORT        0
43 
44 ///
45 /// IPsec Authentication Algorithm Definition
46 ///   The number value definition is aligned to IANA assignment
47 ///
48 #define IPSEC_AALG_NONE                0x00
49 #define IPSEC_AALG_MD5HMAC             0x01
50 #define IPSEC_AALG_SHA1HMAC            0x02
51 #define IPSEC_AALG_SHA2_256HMAC        0x05
52 #define IPSEC_AALG_SHA2_384HMAC        0x06
53 #define IPSEC_AALG_SHA2_512HMAC        0x07
54 #define IPSEC_AALG_AES_XCBC_MAC        0x09
55 #define IPSEC_AALG_NULL                0xFB
56 
57 ///
58 /// IPsec Encryption Algorithm Definition
59 ///   The number value definition is aligned to IANA assignment
60 ///
61 #define IPSEC_EALG_NONE                0x00
62 #define IPSEC_EALG_DESCBC              0x02
63 #define IPSEC_EALG_3DESCBC             0x03
64 #define IPSEC_EALG_CASTCBC             0x06
65 #define IPSEC_EALG_BLOWFISHCBC         0x07
66 #define IPSEC_EALG_NULL                0x0B
67 #define IPSEC_EALG_AESCBC              0x0C
68 #define IPSEC_EALG_AESCTR              0x0D
69 #define IPSEC_EALG_AES_CCM_ICV8        0x0E
70 #define IPSEC_EALG_AES_CCM_ICV12       0x0F
71 #define IPSEC_EALG_AES_CCM_ICV16       0x10
72 #define IPSEC_EALG_AES_GCM_ICV8        0x12
73 #define IPSEC_EALG_AES_GCM_ICV12       0x13
74 #define IPSEC_EALG_AES_GCM_ICV16       0x14
75 
76 typedef struct {
77   CHAR16      *VarName;
78   UINT32      Attribute1;
79   UINT32      Attribute2;
80   UINT32      Attribute3;
81   UINT32      Attribute4;
82 } VAR_CHECK_ITEM;
83 
84 typedef struct {
85   LIST_ENTRY        Link;
86   CHAR16            *Name;
87   SHELL_PARAM_TYPE  Type;
88   CHAR16            *Value;
89   UINTN             OriginalPosition;
90 } SHELL_PARAM_PACKAGE;
91 
92 typedef struct {
93   CHAR16        *String;
94   UINT32        Integer;
95 } STR2INT;
96 
97 extern EFI_IPSEC_CONFIG_PROTOCOL    *mIpSecConfig;
98 extern EFI_HII_HANDLE               mHiiHandle;
99 extern CHAR16                       mAppName[];
100 
101 //
102 // -P
103 //
104 extern STR2INT mMapPolicy[];
105 
106 //
107 // --proto
108 //
109 extern STR2INT mMapIpProtocol[];
110 
111 //
112 // --action
113 //
114 extern STR2INT mMapIpSecAction[];
115 
116 //
117 // --mode
118 //
119 extern STR2INT mMapIpSecMode[];
120 
121 //
122 // --dont-fragment
123 //
124 extern STR2INT mMapDfOption[];
125 
126 //
127 // --ipsec-proto
128 //
129 extern STR2INT mMapIpSecProtocol[];
130 //
131 // --auth-algo
132 //
133 extern STR2INT mMapAuthAlgo[];
134 
135 //
136 // --encrypt-algo
137 //
138 extern STR2INT mMapEncAlgo[];
139 //
140 // --auth-proto
141 //
142 extern STR2INT mMapAuthProto[];
143 
144 //
145 // --auth-method
146 //
147 extern STR2INT mMapAuthMethod[];
148 
149 #endif
150