]>
Commit | Line | Data |
---|---|---|
fa05b97b | 1 | /** @file\r |
2 | EFI IPsec Configuration Protocol Definition\r | |
9095d37b | 3 | The EFI_IPSEC_CONFIG_PROTOCOL provides the mechanism to set and retrieve security and\r |
fa05b97b | 4 | policy related information for the EFI IPsec protocol driver.\r |
5 | \r | |
9095d37b | 6 | Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
fa05b97b | 8 | \r |
9095d37b | 9 | @par Revision Reference:\r |
fa05b97b | 10 | This Protocol is introduced in UEFI Specification 2.2\r |
11 | \r | |
12 | **/\r | |
13 | \r | |
14 | #ifndef __EFI_IPSE_CCONFIG_PROTOCOL_H__\r | |
15 | #define __EFI_IPSE_CCONFIG_PROTOCOL_H__\r | |
16 | \r | |
17 | \r | |
18 | #define EFI_IPSEC_CONFIG_PROTOCOL_GUID \\r | |
19 | { \\r | |
3393e291 | 20 | 0xce5e5929, 0xc7a3, 0x4602, {0xad, 0x9e, 0xc9, 0xda, 0xf9, 0x4e, 0xbf, 0xcf } \\r |
fa05b97b | 21 | }\r |
22 | \r | |
23 | typedef struct _EFI_IPSEC_CONFIG_PROTOCOL EFI_IPSEC_CONFIG_PROTOCOL;\r | |
24 | \r | |
25 | ///\r | |
26 | /// EFI_IPSEC_CONFIG_DATA_TYPE\r | |
27 | ///\r | |
28 | typedef enum {\r | |
9095d37b LG |
29 | ///\r |
30 | /// The IPsec Security Policy Database (aka SPD) setting. In IPsec,\r | |
31 | /// an essential element of Security Association (SA) processing is\r | |
32 | /// underlying SPD that specifies what services are to be offered to\r | |
33 | /// IP datagram and in what fashion. The SPD must be consulted\r | |
34 | /// during the processing of all traffic (inbound and outbound),\r | |
35 | /// including traffic not protected by IPsec, that traverses the IPsec\r | |
36 | /// boundary. With this DataType, SetData() function is to set\r | |
37 | /// the SPD entry information, which may add one new entry, delete\r | |
38 | /// one existed entry or flush the whole database according to the\r | |
39 | /// parameter values. The corresponding Data is of type\r | |
fa05b97b | 40 | /// EFI_IPSEC_SPD_DATA\r |
9095d37b | 41 | ///\r |
fa05b97b | 42 | IPsecConfigDataTypeSpd,\r |
9095d37b LG |
43 | ///\r |
44 | /// The IPsec Security Association Database (aka SAD) setting. A\r | |
45 | /// SA is a simplex connection that affords security services to the\r | |
46 | /// traffic carried by it. Security services are afforded to an SA by the\r | |
47 | /// use of AH, or ESP, but not both. The corresponding Data is of\r | |
fa05b97b | 48 | /// type EFI_IPSEC_SAD_DATA.\r |
9095d37b | 49 | ///\r |
fa05b97b | 50 | IPsecConfigDataTypeSad,\r |
9095d37b LG |
51 | ///\r |
52 | /// The IPsec Peer Authorization Database (aka PAD) setting, which\r | |
53 | /// provides the link between the SPD and a security association\r | |
54 | /// management protocol. The PAD entry specifies the\r | |
55 | /// authentication protocol (e.g. IKEv1, IKEv2) method used and the\r | |
56 | /// authentication data. The corresponding Data is of type\r | |
fa05b97b | 57 | /// EFI_IPSEC_PAD_DATA.\r |
58 | ///\r | |
59 | IPsecConfigDataTypePad,\r | |
60 | IPsecConfigDataTypeMaximum\r | |
61 | } EFI_IPSEC_CONFIG_DATA_TYPE;\r | |
62 | \r | |
63 | ///\r | |
64 | /// EFI_IP_ADDRESS_INFO\r | |
65 | ///\r | |
66 | typedef struct _EFI_IP_ADDRESS_INFO {\r | |
67 | EFI_IP_ADDRESS Address; ///< The IPv4 or IPv6 address\r | |
68 | UINT8 PrefixLength; ///< The length of the prefix associated with the Address.\r | |
69 | } EFI_IP_ADDRESS_INFO;\r | |
70 | \r | |
71 | \r | |
72 | ///\r | |
73 | /// EFI_IPSEC_SPD_SELECTOR\r | |
74 | ///\r | |
75 | typedef struct _EFI_IPSEC_SPD_SELECTOR {\r | |
9095d37b | 76 | ///\r |
fa05b97b | 77 | /// Specifies the actual number of entries in LocalAddress.\r |
9095d37b | 78 | ///\r |
fa05b97b | 79 | UINT32 LocalAddressCount;\r |
9095d37b LG |
80 | ///\r |
81 | /// A list of ranges of IPv4 or IPv6 addresses, which refers to the\r | |
fa05b97b | 82 | /// addresses being protected by IPsec policy.\r |
9095d37b | 83 | ///\r |
fa05b97b | 84 | EFI_IP_ADDRESS_INFO *LocalAddress;\r |
9095d37b | 85 | ///\r |
fa05b97b | 86 | /// Specifies the actual number of entries in RemoteAddress.\r |
9095d37b | 87 | ///\r |
fa05b97b | 88 | UINT32 RemoteAddressCount;\r |
9095d37b LG |
89 | ///\r |
90 | /// A list of ranges of IPv4 or IPv6 addresses, which are peer entities\r | |
91 | /// to LocalAddress.\r | |
92 | ///\r | |
fa05b97b | 93 | EFI_IP_ADDRESS_INFO *RemoteAddress;\r |
9095d37b LG |
94 | ///\r |
95 | /// Next layer protocol. Obtained from the IPv4 Protocol or the IPv6\r | |
96 | /// Next Header fields. The next layer protocol is whatever comes\r | |
97 | /// after any IP extension headers that are present. A zero value is a\r | |
fa05b97b | 98 | /// wildcard that matches any value in NextLayerProtocol field.\r |
9095d37b LG |
99 | ///\r |
100 | UINT16 NextLayerProtocol;\r | |
101 | ///\r | |
102 | /// Local Port if the Next Layer Protocol uses two ports (as do TCP,\r | |
103 | /// UDP, and others). A zero value is a wildcard that matches any\r | |
fa05b97b | 104 | /// value in LocalPort field.\r |
9095d37b | 105 | ///\r |
fa05b97b | 106 | UINT16 LocalPort;\r |
9095d37b LG |
107 | ///\r |
108 | /// A designed port range size. The start port is LocalPort, and\r | |
109 | /// the total number of ports is described by LocalPortRange.\r | |
110 | /// This field is ignored if NextLayerProtocol does not use\r | |
111 | /// ports.\r | |
112 | ///\r | |
fa05b97b | 113 | UINT16 LocalPortRange;\r |
9095d37b LG |
114 | ///\r |
115 | /// Remote Port if the Next Layer Protocol uses two ports. A zero\r | |
fa05b97b | 116 | /// value is a wildcard that matches any value in RemotePort field.\r |
9095d37b | 117 | ///\r |
fa05b97b | 118 | UINT16 RemotePort;\r |
9095d37b LG |
119 | ///\r |
120 | /// A designed port range size. The start port is RemotePort, and\r | |
121 | /// the total number of ports is described by RemotePortRange.\r | |
fa05b97b | 122 | /// This field is ignored if NextLayerProtocol does not use ports.\r |
9095d37b | 123 | ///\r |
fa05b97b | 124 | UINT16 RemotePortRange;\r |
125 | } EFI_IPSEC_SPD_SELECTOR;\r | |
9095d37b | 126 | \r |
fa05b97b | 127 | ///\r |
128 | /// EFI_IPSEC_TRAFFIC_DIR\r | |
129 | /// represents the directionality in an SPD entry.\r | |
130 | ///\r | |
131 | typedef enum {\r | |
132 | ///\r | |
9095d37b | 133 | /// The EfiIPsecInBound refers to traffic entering an IPsec implementation via\r |
fa05b97b | 134 | /// the unprotected interface or emitted by the implementation on the unprotected\r |
9095d37b | 135 | /// side of the boundary and directed towards the protected interface.\r |
fa05b97b | 136 | ///\r |
137 | EfiIPsecInBound,\r | |
138 | ///\r | |
9095d37b | 139 | /// The EfiIPsecOutBound refers to traffic entering the implementation via\r |
fa05b97b | 140 | /// the protected interface, or emitted by the implementation on the protected side\r |
141 | /// of the boundary and directed toward the unprotected interface.\r | |
142 | ///\r | |
143 | EfiIPsecOutBound\r | |
144 | } EFI_IPSEC_TRAFFIC_DIR;\r | |
145 | \r | |
146 | ///\r | |
147 | /// EFI_IPSEC_ACTION\r | |
148 | /// represents three possible processing choices.\r | |
149 | ///\r | |
150 | typedef enum {\r | |
9095d37b | 151 | ///\r |
fa05b97b | 152 | /// Refers to traffic that is not allowed to traverse the IPsec boundary.\r |
9095d37b | 153 | ///\r |
fa05b97b | 154 | EfiIPsecActionDiscard,\r |
9095d37b LG |
155 | ///\r |
156 | /// Refers to traffic that is allowed to cross the IPsec boundary\r | |
fa05b97b | 157 | /// without protection.\r |
9095d37b | 158 | ///\r |
fa05b97b | 159 | EfiIPsecActionBypass,\r |
9095d37b LG |
160 | ///\r |
161 | /// Refers to traffic that is afforded IPsec protection, and for such\r | |
162 | /// traffic the SPD must specify the security protocols to be\r | |
163 | /// employed, their mode, security service options, and the\r | |
164 | /// cryptographic algorithms to be used.\r | |
fa05b97b | 165 | ///\r |
166 | EfiIPsecActionProtect\r | |
167 | } EFI_IPSEC_ACTION;\r | |
168 | \r | |
169 | ///\r | |
170 | /// EFI_IPSEC_SA_LIFETIME\r | |
9095d37b LG |
171 | /// defines the lifetime of an SA, which represents when a SA must be\r |
172 | /// replaced or terminated. A value of all 0 for each field removes\r | |
fa05b97b | 173 | /// the limitation of a SA lifetime.\r |
174 | ///\r | |
175 | typedef struct _EFI_IPSEC_SA_LIFETIME {\r | |
9095d37b | 176 | ///\r |
fa05b97b | 177 | /// The number of bytes to which the IPsec cryptographic algorithm\r |
178 | /// can be applied. For ESP, this is the encryption algorithm and for\r | |
9095d37b | 179 | /// AH, this is the authentication algorithm. The ByteCount\r |
fa05b97b | 180 | /// includes pad bytes for cryptographic operations.\r |
9095d37b | 181 | ///\r |
fa05b97b | 182 | UINT64 ByteCount;\r |
9095d37b LG |
183 | ///\r |
184 | /// A time interval in second that warns the implementation to\r | |
fa05b97b | 185 | /// initiate action such as setting up a replacement SA.\r |
9095d37b | 186 | ///\r |
fa05b97b | 187 | UINT64 SoftLifetime;\r |
9095d37b LG |
188 | ///\r |
189 | /// A time interval in second when the current SA ends and is\r | |
fa05b97b | 190 | /// destroyed.\r |
9095d37b | 191 | ///\r |
fa05b97b | 192 | UINT64 HardLifetime;\r |
193 | } EFI_IPSEC_SA_LIFETIME;\r | |
194 | \r | |
195 | ///\r | |
196 | /// EFI_IPSEC_MODE\r | |
9095d37b LG |
197 | /// There are two modes of IPsec operation: transport mode and tunnel mode. In\r |
198 | /// EfiIPsecTransport mode, AH and ESP provide protection primarily for next layer protocols;\r | |
fa05b97b | 199 | /// In EfiIPsecTunnel mode, AH and ESP are applied to tunneled IP packets.\r |
200 | ///\r | |
201 | typedef enum {\r | |
202 | EfiIPsecTransport,\r | |
203 | EfiIPsecTunnel\r | |
204 | } EFI_IPSEC_MODE;\r | |
205 | \r | |
206 | ///\r | |
207 | /// EFI_IPSEC_TUNNEL_DF_OPTION\r | |
208 | /// The option of copying the DF bit from an outbound package to\r | |
209 | /// the tunnel mode header that it emits, when traffic is carried\r | |
210 | /// via a tunnel mode SA. This applies to SAs where both inner and\r | |
211 | /// outer headers are IPv4.\r | |
212 | ///\r | |
213 | typedef enum {\r | |
214 | EfiIPsecTunnelClearDf, ///< Clear DF bit from inner header.\r | |
215 | EfiIPsecTunnelSetDf, ///< Set DF bit from inner header.\r | |
216 | EfiIPsecTunnelCopyDf ///< Copy DF bit from inner header.\r | |
217 | } EFI_IPSEC_TUNNEL_DF_OPTION;\r | |
218 | \r | |
219 | ///\r | |
220 | /// EFI_IPSEC_TUNNEL_OPTION\r | |
221 | ///\r | |
222 | typedef struct _EFI_IPSEC_TUNNEL_OPTION {\r | |
9095d37b | 223 | ///\r |
fa05b97b | 224 | /// Local tunnel address when IPsec mode is EfiIPsecTunnel.\r |
9095d37b | 225 | ///\r |
fa05b97b | 226 | EFI_IP_ADDRESS LocalTunnelAddress;\r |
9095d37b | 227 | ///\r |
fa05b97b | 228 | /// Remote tunnel address when IPsec mode is EfiIPsecTunnel.\r |
9095d37b | 229 | ///\r |
fa05b97b | 230 | EFI_IP_ADDRESS RemoteTunnelAddress;\r |
9095d37b | 231 | ///\r |
fa05b97b | 232 | /// The option of copying the DF bit from an outbound package\r |
9095d37b LG |
233 | /// to the tunnel mode header that it emits, when traffic is\r |
234 | /// carried via a tunnel mode SA.\r | |
235 | ///\r | |
fa05b97b | 236 | EFI_IPSEC_TUNNEL_DF_OPTION DF;\r |
237 | } EFI_IPSEC_TUNNEL_OPTION;\r | |
238 | \r | |
239 | ///\r | |
240 | /// EFI_IPSEC_PROTOCOL_TYPE\r | |
241 | ///\r | |
242 | typedef enum {\r | |
243 | EfiIPsecAH, ///< IP Authentication Header protocol which is specified in RFC 4302.\r | |
9095d37b | 244 | EfiIPsecESP ///< IP Encapsulating Security Payload which is specified in RFC 4303.\r |
fa05b97b | 245 | } EFI_IPSEC_PROTOCOL_TYPE;\r |
246 | \r | |
247 | ///\r | |
248 | /// EFI_IPSEC_PROCESS_POLICY\r | |
249 | /// describes a policy list for traffic processing.\r | |
250 | ///\r | |
251 | typedef struct _EFI_IPSEC_PROCESS_POLICY {\r | |
9095d37b LG |
252 | ///\r |
253 | /// Extended Sequence Number. Is this SA using extended sequence\r | |
fa05b97b | 254 | /// numbers. 64 bit counter is used if TRUE.\r |
9095d37b | 255 | ///\r |
fa05b97b | 256 | BOOLEAN ExtSeqNum;\r |
9095d37b LG |
257 | ///\r |
258 | /// A flag indicating whether overflow of the sequence number\r | |
259 | /// counter should generate an auditable event and prevent\r | |
260 | /// transmission of additional packets on the SA, or whether rollover\r | |
fa05b97b | 261 | /// is permitted.\r |
9095d37b | 262 | ///\r |
fa05b97b | 263 | BOOLEAN SeqOverflow;\r |
9095d37b LG |
264 | ///\r |
265 | /// Is this SA using stateful fragment checking. TRUE represents\r | |
fa05b97b | 266 | /// stateful fragment checking.\r |
9095d37b | 267 | ///\r |
fa05b97b | 268 | BOOLEAN FragCheck;\r |
9095d37b LG |
269 | ///\r |
270 | /// A time interval after which a SA must be replaced with a new SA\r | |
271 | /// (and new SPI) or terminated.\r | |
272 | ///\r | |
fa05b97b | 273 | EFI_IPSEC_SA_LIFETIME SaLifetime;\r |
9095d37b | 274 | ///\r |
fa05b97b | 275 | /// IPsec mode: tunnel or transport.\r |
9095d37b | 276 | ///\r |
fa05b97b | 277 | EFI_IPSEC_MODE Mode;\r |
9095d37b | 278 | ///\r |
fa05b97b | 279 | /// Tunnel Option. TunnelOption is ignored if Mode is EfiIPsecTransport.\r |
9095d37b | 280 | ///\r |
fa05b97b | 281 | EFI_IPSEC_TUNNEL_OPTION *TunnelOption;\r |
9095d37b | 282 | ///\r |
fa05b97b | 283 | /// IPsec protocol: AH or ESP\r |
9095d37b | 284 | ///\r |
fa05b97b | 285 | EFI_IPSEC_PROTOCOL_TYPE Proto;\r |
9095d37b | 286 | ///\r |
fa05b97b | 287 | /// Cryptographic algorithm type used for authentication.\r |
9095d37b | 288 | ///\r |
fa05b97b | 289 | UINT8 AuthAlgoId;\r |
9095d37b LG |
290 | ///\r |
291 | /// Cryptographic algorithm type used for encryption. EncAlgo is\r | |
292 | /// NULL when IPsec protocol is AH. For ESP protocol, EncAlgo\r | |
293 | /// can also be used to describe the algorithm if a combined mode\r | |
fa05b97b | 294 | /// algorithm is used.\r |
295 | ///\r | |
296 | UINT8 EncAlgoId;\r | |
297 | } EFI_IPSEC_PROCESS_POLICY;\r | |
298 | \r | |
fa05b97b | 299 | ///\r |
300 | /// EFI_IPSEC_SA_ID\r | |
301 | /// A triplet to identify an SA, consisting of the following members.\r | |
302 | ///\r | |
303 | typedef struct _EFI_IPSEC_SA_ID {\r | |
9095d37b LG |
304 | ///\r |
305 | /// Security Parameter Index (aka SPI). An arbitrary 32-bit value\r | |
306 | /// that is used by a receiver to identity the SA to which an incoming\r | |
fa05b97b | 307 | /// package should be bound.\r |
9095d37b | 308 | ///\r |
fa05b97b | 309 | UINT32 Spi;\r |
9095d37b | 310 | ///\r |
fa05b97b | 311 | /// IPsec protocol: AH or ESP\r |
9095d37b | 312 | ///\r |
fa05b97b | 313 | EFI_IPSEC_PROTOCOL_TYPE Proto;\r |
9095d37b LG |
314 | ///\r |
315 | /// Destination IP address.\r | |
316 | ///\r | |
fa05b97b | 317 | EFI_IP_ADDRESS DestAddress;\r |
318 | } EFI_IPSEC_SA_ID;\r | |
319 | \r | |
320 | \r | |
321 | #define MAX_PEERID_LEN 128\r | |
322 | \r | |
323 | ///\r | |
324 | /// EFI_IPSEC_SPD_DATA\r | |
325 | ///\r | |
326 | typedef struct _EFI_IPSEC_SPD_DATA {\r | |
9095d37b LG |
327 | ///\r |
328 | /// A null-terminated ASCII name string which is used as a symbolic\r | |
fa05b97b | 329 | /// identifier for an IPsec Local or Remote address.\r |
9095d37b | 330 | ///\r |
fa05b97b | 331 | UINT8 Name[MAX_PEERID_LEN];\r |
9095d37b LG |
332 | ///\r |
333 | /// Bit-mapped list describing Populate from Packet flags. When\r | |
334 | /// creating a SA, if PackageFlag bit is set to TRUE, instantiate\r | |
335 | /// the selector from the corresponding field in the package that\r | |
336 | /// triggered the creation of the SA, else from the value(s) in the\r | |
337 | /// corresponding SPD entry. The PackageFlag bit setting for\r | |
fa05b97b | 338 | /// corresponding selector field of EFI_IPSEC_SPD_SELECTOR:\r |
9095d37b LG |
339 | /// Bit 0: EFI_IPSEC_SPD_SELECTOR.LocalAddress\r |
340 | /// Bit 1: EFI_IPSEC_SPD_SELECTOR.RemoteAddress\r | |
341 | /// Bit 2:\r | |
342 | /// EFI_IPSEC_SPD_SELECTOR.NextLayerProtocol\r | |
343 | /// Bit 3: EFI_IPSEC_SPD_SELECTOR.LocalPort\r | |
344 | /// Bit 4: EFI_IPSEC_SPD_SELECTOR.RemotePort\r | |
fa05b97b | 345 | /// Others: Reserved.\r |
346 | ///\r | |
347 | UINT32 PackageFlag;\r | |
9095d37b | 348 | ///\r |
fa05b97b | 349 | /// The traffic direction of data gram.\r |
9095d37b | 350 | ///\r |
fa05b97b | 351 | EFI_IPSEC_TRAFFIC_DIR TrafficDirection;\r |
9095d37b LG |
352 | ///\r |
353 | /// Processing choices to indicate which action is required by this\r | |
354 | /// policy.\r | |
355 | ///\r | |
fa05b97b | 356 | EFI_IPSEC_ACTION Action;\r |
9095d37b | 357 | ///\r |
fa05b97b | 358 | /// The policy and rule information for a SPD entry.\r |
9095d37b | 359 | ///\r |
fa05b97b | 360 | EFI_IPSEC_PROCESS_POLICY *ProcessingPolicy;\r |
9095d37b | 361 | ///\r |
fa05b97b | 362 | /// Specifies the actual number of entries in SaId list.\r |
9095d37b | 363 | ///\r |
fa05b97b | 364 | UINTN SaIdCount;\r |
9095d37b LG |
365 | ///\r |
366 | /// The SAD entry used for the traffic processing. The\r | |
fa05b97b | 367 | /// existed SAD entry links indicate this is the manual key case.\r |
9095d37b | 368 | ///\r |
fa05b97b | 369 | EFI_IPSEC_SA_ID SaId[1];\r |
370 | } EFI_IPSEC_SPD_DATA;\r | |
371 | \r | |
372 | ///\r | |
373 | /// EFI_IPSEC_AH_ALGO_INFO\r | |
374 | /// The security algorithm selection for IPsec AH authentication.\r | |
375 | /// The required authentication algorithm is specified in RFC 4305.\r | |
376 | ///\r | |
377 | typedef struct _EFI_IPSEC_AH_ALGO_INFO {\r | |
378 | UINT8 AuthAlgoId;\r | |
379 | UINTN AuthKeyLength;\r | |
380 | VOID *AuthKey;\r | |
381 | } EFI_IPSEC_AH_ALGO_INFO;\r | |
382 | \r | |
383 | ///\r | |
384 | /// EFI_IPSEC_ESP_ALGO_INFO\r | |
385 | /// The security algorithm selection for IPsec ESP encryption and authentication.\r | |
9095d37b LG |
386 | /// The required authentication algorithm is specified in RFC 4305.\r |
387 | /// EncAlgoId fields can also specify an ESP combined mode algorithm\r | |
388 | /// (e.g. AES with CCM mode, specified in RFC 4309), which provides both\r | |
fa05b97b | 389 | /// confidentiality and authentication services.\r |
390 | ///\r | |
391 | typedef struct _EFI_IPSEC_ESP_ALGO_INFO {\r | |
392 | UINT8 EncAlgoId;\r | |
393 | UINTN EncKeyLength;\r | |
394 | VOID *EncKey;\r | |
395 | UINT8 AuthAlgoId;\r | |
396 | UINTN AuthKeyLength;\r | |
397 | VOID *AuthKey;\r | |
398 | } EFI_IPSEC_ESP_ALGO_INFO;\r | |
399 | \r | |
400 | ///\r | |
401 | /// EFI_IPSEC_ALGO_INFO\r | |
402 | ///\r | |
403 | typedef union {\r | |
404 | EFI_IPSEC_AH_ALGO_INFO AhAlgoInfo;\r | |
405 | EFI_IPSEC_ESP_ALGO_INFO EspAlgoInfo;\r | |
406 | } EFI_IPSEC_ALGO_INFO;\r | |
407 | \r | |
408 | ///\r | |
409 | /// EFI_IPSEC_SA_DATA\r | |
410 | ///\r | |
411 | typedef struct _EFI_IPSEC_SA_DATA {\r | |
9095d37b | 412 | ///\r |
fa05b97b | 413 | /// IPsec mode: tunnel or transport.\r |
9095d37b | 414 | ///\r |
fa05b97b | 415 | EFI_IPSEC_MODE Mode;\r |
9095d37b LG |
416 | ///\r |
417 | /// Sequence Number Counter. A 64-bit counter used to generate the\r | |
fa05b97b | 418 | /// sequence number field in AH or ESP headers.\r |
9095d37b | 419 | ///\r |
fa05b97b | 420 | UINT64 SNCount;\r |
9095d37b LG |
421 | ///\r |
422 | /// Anti-Replay Window. A 64-bit counter and a bit-map used to\r | |
fa05b97b | 423 | /// determine whether an inbound AH or ESP packet is a replay.\r |
9095d37b | 424 | ///\r |
fa05b97b | 425 | UINT8 AntiReplayWindows;\r |
9095d37b LG |
426 | ///\r |
427 | /// AH/ESP cryptographic algorithm, key and parameters.\r | |
428 | ///\r | |
fa05b97b | 429 | EFI_IPSEC_ALGO_INFO AlgoInfo;\r |
9095d37b LG |
430 | ///\r |
431 | /// Lifetime of this SA.\r | |
432 | ///\r | |
fa05b97b | 433 | EFI_IPSEC_SA_LIFETIME SaLifetime;\r |
9095d37b LG |
434 | ///\r |
435 | /// Any observed path MTU and aging variables. The Path MTU\r | |
fa05b97b | 436 | /// processing is defined in section 8 of RFC 4301.\r |
9095d37b | 437 | ///\r |
fa05b97b | 438 | UINT32 PathMTU;\r |
9095d37b | 439 | ///\r |
fa05b97b | 440 | /// Link to one SPD entry.\r |
9095d37b | 441 | ///\r |
fa05b97b | 442 | EFI_IPSEC_SPD_SELECTOR *SpdSelector;\r |
9095d37b LG |
443 | ///\r |
444 | /// Indication of whether it's manually set or negotiated automatically.\r | |
445 | /// If ManualSet is FALSE, the corresponding SA entry is inserted through\r | |
fa05b97b | 446 | /// IKE protocol negotiation.\r |
447 | ///\r | |
448 | BOOLEAN ManualSet;\r | |
449 | } EFI_IPSEC_SA_DATA;\r | |
450 | \r | |
705f53a9 | 451 | ///\r |
452 | /// EFI_IPSEC_SA_DATA2\r | |
453 | ///\r | |
9095d37b | 454 | typedef struct _EFI_IPSEC_SA_DATA2 {\r |
705f53a9 | 455 | ///\r |
456 | /// IPsec mode: tunnel or transport\r | |
457 | ///\r | |
9095d37b | 458 | EFI_IPSEC_MODE Mode;\r |
705f53a9 | 459 | ///\r |
9095d37b LG |
460 | /// Sequence Number Counter. A 64-bit counter used to generate the sequence\r |
461 | /// number field in AH or ESP headers.\r | |
705f53a9 | 462 | ///\r |
9095d37b | 463 | UINT64 SNCount;\r |
705f53a9 | 464 | ///\r |
9095d37b | 465 | /// Anti-Replay Window. A 64-bit counter and a bit-map used to determine\r |
705f53a9 | 466 | /// whether an inbound AH or ESP packet is a replay.\r |
467 | ///\r | |
9095d37b | 468 | UINT8 AntiReplayWindows;\r |
705f53a9 | 469 | ///\r |
470 | /// AH/ESP cryptographic algorithm, key and parameters.\r | |
471 | ///\r | |
9095d37b | 472 | EFI_IPSEC_ALGO_INFO AlgoInfo;\r |
705f53a9 | 473 | ///\r |
474 | /// Lifetime of this SA.\r | |
475 | ///\r | |
9095d37b | 476 | EFI_IPSEC_SA_LIFETIME SaLifetime;\r |
705f53a9 | 477 | ///\r |
9095d37b | 478 | /// Any observed path MTU and aging variables. The Path MTU processing is\r |
705f53a9 | 479 | /// defined in section 8 of RFC 4301.\r |
480 | ///\r | |
9095d37b | 481 | UINT32 PathMTU;\r |
705f53a9 | 482 | ///\r |
483 | /// Link to one SPD entry\r | |
484 | ///\r | |
9095d37b | 485 | EFI_IPSEC_SPD_SELECTOR *SpdSelector;\r |
705f53a9 | 486 | ///\r |
9095d37b LG |
487 | /// Indication of whether it's manually set or negotiated automatically.\r |
488 | /// If ManualSet is FALSE, the corresponding SA entry is inserted through IKE\r | |
705f53a9 | 489 | /// protocol negotiation\r |
490 | ///\r | |
491 | BOOLEAN ManualSet;\r | |
492 | ///\r | |
493 | /// The tunnel header IP source address.\r | |
494 | ///\r | |
495 | EFI_IP_ADDRESS TunnelSourceAddress;\r | |
496 | ///\r | |
497 | /// The tunnel header IP destination address.\r | |
498 | ///\r | |
499 | EFI_IP_ADDRESS TunnelDestinationAddress;\r | |
9095d37b | 500 | } EFI_IPSEC_SA_DATA2;\r |
705f53a9 | 501 | \r |
502 | \r | |
fa05b97b | 503 | ///\r |
504 | /// EFI_IPSEC_PAD_ID\r | |
505 | /// specifies the identifier for PAD entry, which is also used for SPD lookup.\r | |
506 | /// IpAddress Pointer to the IPv4 or IPv6 address range.\r | |
507 | ///\r | |
508 | typedef struct _EFI_IPSEC_PAD_ID {\r | |
509 | ///\r | |
510 | /// Flag to identify which type of PAD Id is used.\r | |
9095d37b LG |
511 | ///\r |
512 | BOOLEAN PeerIdValid;\r | |
fa05b97b | 513 | union {\r |
514 | ///\r | |
515 | /// Pointer to the IPv4 or IPv6 address range.\r | |
516 | ///\r | |
517 | EFI_IP_ADDRESS_INFO IpAddress;\r | |
518 | ///\r | |
4f077902 | 519 | /// Pointer to a null terminated ASCII string\r |
9095d37b LG |
520 | /// representing the symbolic names. A PeerId can be a DNS\r |
521 | /// name, Distinguished Name, RFC 822 email address or Key ID\r | |
fa05b97b | 522 | /// (specified in section 4.4.3.1 of RFC 4301)\r |
523 | ///\r | |
524 | UINT8 PeerId[MAX_PEERID_LEN];\r | |
525 | } Id;\r | |
526 | } EFI_IPSEC_PAD_ID;\r | |
527 | \r | |
528 | ///\r | |
529 | /// EFI_IPSEC_CONFIG_SELECTOR\r | |
9095d37b | 530 | /// describes the expected IPsec configuration data selector\r |
fa05b97b | 531 | /// of type EFI_IPSEC_CONFIG_DATA_TYPE.\r |
532 | ///\r | |
533 | typedef union {\r | |
534 | EFI_IPSEC_SPD_SELECTOR SpdSelector;\r | |
535 | EFI_IPSEC_SA_ID SaId;\r | |
536 | EFI_IPSEC_PAD_ID PadId;\r | |
537 | } EFI_IPSEC_CONFIG_SELECTOR;\r | |
538 | \r | |
539 | ///\r | |
540 | /// EFI_IPSEC_AUTH_PROTOCOL_TYPE\r | |
9095d37b | 541 | /// defines the possible authentication protocol for IPsec\r |
fa05b97b | 542 | /// security association management.\r |
543 | ///\r | |
544 | typedef enum {\r | |
545 | EfiIPsecAuthProtocolIKEv1,\r | |
546 | EfiIPsecAuthProtocolIKEv2,\r | |
547 | EfiIPsecAuthProtocolMaximum\r | |
548 | } EFI_IPSEC_AUTH_PROTOCOL_TYPE;\r | |
549 | \r | |
550 | ///\r | |
551 | /// EFI_IPSEC_AUTH_METHOD\r | |
552 | ///\r | |
553 | typedef enum {\r | |
554 | ///\r | |
555 | /// Using Pre-shared Keys for manual security associations.\r | |
556 | ///\r | |
557 | EfiIPsecAuthMethodPreSharedSecret,\r | |
558 | ///\r | |
559 | /// IKE employs X.509 certificates for SA establishment.\r | |
560 | ///\r | |
561 | EfiIPsecAuthMethodCertificates,\r | |
562 | EfiIPsecAuthMethodMaximum\r | |
563 | } EFI_IPSEC_AUTH_METHOD;\r | |
564 | \r | |
565 | ///\r | |
566 | /// EFI_IPSEC_PAD_DATA\r | |
567 | ///\r | |
568 | typedef struct _EFI_IPSEC_PAD_DATA {\r | |
9095d37b | 569 | ///\r |
fa05b97b | 570 | /// Authentication Protocol for IPsec security association management.\r |
9095d37b | 571 | ///\r |
fa05b97b | 572 | EFI_IPSEC_AUTH_PROTOCOL_TYPE AuthProtocol;\r |
9095d37b | 573 | ///\r |
fa05b97b | 574 | /// Authentication method used.\r |
9095d37b | 575 | ///\r |
fa05b97b | 576 | EFI_IPSEC_AUTH_METHOD AuthMethod;\r |
9095d37b LG |
577 | ///\r |
578 | /// The IKE ID payload will be used as a symbolic name for SPD\r | |
579 | /// lookup if IkeIdFlag is TRUE. Otherwise, the remote IP\r | |
fa05b97b | 580 | /// address provided in traffic selector playloads will be used.\r |
9095d37b | 581 | ///\r |
fa05b97b | 582 | BOOLEAN IkeIdFlag;\r |
9095d37b | 583 | ///\r |
fa05b97b | 584 | /// The size of Authentication data buffer, in bytes.\r |
9095d37b | 585 | ///\r |
fa05b97b | 586 | UINTN AuthDataSize;\r |
9095d37b LG |
587 | ///\r |
588 | /// Buffer for Authentication data, (e.g., the pre-shared secret or the\r | |
589 | /// trust anchor relative to which the peer's certificate will be\r | |
fa05b97b | 590 | /// validated).\r |
9095d37b | 591 | ///\r |
fa05b97b | 592 | VOID *AuthData;\r |
9095d37b | 593 | ///\r |
fa05b97b | 594 | /// The size of RevocationData, in bytes\r |
9095d37b | 595 | ///\r |
fa05b97b | 596 | UINTN RevocationDataSize;\r |
9095d37b LG |
597 | ///\r |
598 | /// Pointer to CRL or OCSP data, if certificates are used for\r | |
fa05b97b | 599 | /// authentication method.\r |
9095d37b | 600 | ///\r |
fa05b97b | 601 | VOID *RevocationData;\r |
602 | } EFI_IPSEC_PAD_DATA;\r | |
603 | \r | |
604 | \r | |
605 | /**\r | |
606 | Set the security association, security policy and peer authorization configuration\r | |
9095d37b | 607 | information for the EFI IPsec driver.\r |
fa05b97b | 608 | \r |
609 | This function is used to set the IPsec configuration information of type DataType for\r | |
610 | the EFI IPsec driver.\r | |
611 | The IPsec configuration data has a unique selector/identifier separately to identify\r | |
3227f995 | 612 | a data entry. The selector structure depends on DataType's definition.\r |
fa05b97b | 613 | Using SetData() with a Data of NULL causes the IPsec configuration data entry identified\r |
9095d37b | 614 | by DataType and Selector to be deleted.\r |
fa05b97b | 615 | \r |
616 | @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance.\r | |
617 | @param[in] DataType The type of data to be set.\r | |
9095d37b LG |
618 | @param[in] Selector Pointer to an entry selector on operated configuration data\r |
619 | specified by DataType. A NULL Selector causes the entire\r | |
fa05b97b | 620 | specified-type configuration information to be flushed.\r |
9095d37b | 621 | @param[in] Data The data buffer to be set. The structure of the data buffer is\r |
fa05b97b | 622 | associated with the DataType.\r |
623 | @param[in] InsertBefore Pointer to one entry selector which describes the expected\r | |
624 | position the new data entry will be added. If InsertBefore is NULL,\r | |
625 | the new entry will be appended the end of database.\r | |
9095d37b | 626 | \r |
fa05b97b | 627 | @retval EFI_SUCCESS The specified configuration entry data is set successfully.\r |
628 | @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r | |
629 | - This is NULL.\r | |
630 | @retval EFI_UNSUPPORTED The specified DataType is not supported.\r | |
631 | @retval EFI_OUT_OF_RESOURCED The required system resource could not be allocated.\r | |
632 | \r | |
633 | **/\r | |
634 | typedef\r | |
635 | EFI_STATUS\r | |
a1749b80 | 636 | (EFIAPI *EFI_IPSEC_CONFIG_SET_DATA)(\r |
fa05b97b | 637 | IN EFI_IPSEC_CONFIG_PROTOCOL *This,\r |
638 | IN EFI_IPSEC_CONFIG_DATA_TYPE DataType,\r | |
639 | IN EFI_IPSEC_CONFIG_SELECTOR *Selector,\r | |
640 | IN VOID *Data,\r | |
641 | IN EFI_IPSEC_CONFIG_SELECTOR *InsertBefore OPTIONAL\r | |
642 | );\r | |
643 | \r | |
644 | /**\r | |
9095d37b | 645 | Return the configuration value for the EFI IPsec driver.\r |
fa05b97b | 646 | \r |
647 | This function lookup the data entry from IPsec database or IKEv2 configuration\r | |
648 | information. The expected data type and unique identification are described in\r | |
9095d37b | 649 | DataType and Selector parameters.\r |
fa05b97b | 650 | \r |
651 | @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance.\r | |
652 | @param[in] DataType The type of data to retrieve.\r | |
9095d37b | 653 | @param[in] Selector Pointer to an entry selector which is an identifier of the IPsec\r |
fa05b97b | 654 | configuration data entry.\r |
655 | @param[in, out] DataSize On output the size of data returned in Data.\r | |
9095d37b LG |
656 | @param[out] Data The buffer to return the contents of the IPsec configuration data.\r |
657 | The type of the data buffer is associated with the DataType.\r | |
658 | \r | |
fa05b97b | 659 | @retval EFI_SUCCESS The specified configuration data is got successfully.\r |
660 | @retval EFI_INVALID_PARAMETER One or more of the followings are TRUE:\r | |
661 | - This is NULL.\r | |
662 | - Selector is NULL.\r | |
663 | - DataSize is NULL.\r | |
664 | - Data is NULL and *DataSize is not zero\r | |
665 | @retval EFI_NOT_FOUND The configuration data specified by Selector is not found.\r | |
666 | @retval EFI_UNSUPPORTED The specified DataType is not supported.\r | |
667 | @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. DataSize has been\r | |
668 | updated with the size needed to complete the request.\r | |
669 | \r | |
670 | **/\r | |
671 | typedef\r | |
672 | EFI_STATUS\r | |
a1749b80 | 673 | (EFIAPI *EFI_IPSEC_CONFIG_GET_DATA)(\r |
fa05b97b | 674 | IN EFI_IPSEC_CONFIG_PROTOCOL *This,\r |
675 | IN EFI_IPSEC_CONFIG_DATA_TYPE DataType,\r | |
676 | IN EFI_IPSEC_CONFIG_SELECTOR *Selector,\r | |
677 | IN OUT UINTN *DataSize,\r | |
678 | OUT VOID *Data\r | |
679 | );\r | |
680 | \r | |
681 | /**\r | |
9095d37b | 682 | Enumerates the current selector for IPsec configuration data entry.\r |
fa05b97b | 683 | \r |
684 | This function is called multiple times to retrieve the entry Selector in IPsec\r | |
9095d37b | 685 | configuration database. On each call to GetNextSelector(), the next entry\r |
fa05b97b | 686 | Selector are retrieved into the output interface.\r |
9095d37b LG |
687 | \r |
688 | If the entire IPsec configuration database has been iterated, the error\r | |
fa05b97b | 689 | EFI_NOT_FOUND is returned.\r |
9095d37b LG |
690 | If the Selector buffer is too small for the next Selector copy, an\r |
691 | EFI_BUFFER_TOO_SMALL error is returned, and SelectorSize is updated to reflect\r | |
fa05b97b | 692 | the size of buffer needed.\r |
693 | \r | |
694 | On the initial call to GetNextSelector() to start the IPsec configuration database\r | |
9095d37b LG |
695 | search, a pointer to the buffer with all zero value is passed in Selector. Calls\r |
696 | to SetData() between calls to GetNextSelector may produce unpredictable results.\r | |
fa05b97b | 697 | \r |
698 | @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance.\r | |
699 | @param[in] DataType The type of IPsec configuration data to retrieve.\r | |
700 | @param[in, out] SelectorSize The size of the Selector buffer.\r | |
9095d37b | 701 | @param[in, out] Selector On input, supplies the pointer to last Selector that was\r |
fa05b97b | 702 | returned by GetNextSelector().\r |
703 | On output, returns one copy of the current entry Selector\r | |
9095d37b LG |
704 | of a given DataType.\r |
705 | \r | |
fa05b97b | 706 | @retval EFI_SUCCESS The specified configuration data is got successfully.\r |
707 | @retval EFI_INVALID_PARAMETER One or more of the followings are TRUE:\r | |
708 | - This is NULL.\r | |
709 | - SelectorSize is NULL.\r | |
710 | - Selector is NULL.\r | |
711 | @retval EFI_NOT_FOUND The next configuration data entry was not found.\r | |
712 | @retval EFI_UNSUPPORTED The specified DataType is not supported.\r | |
713 | @retval EFI_BUFFER_TOO_SMALL The SelectorSize is too small for the result. This parameter\r | |
9095d37b | 714 | has been updated with the size needed to complete the search\r |
fa05b97b | 715 | request.\r |
716 | \r | |
717 | **/\r | |
718 | typedef\r | |
719 | EFI_STATUS\r | |
a1749b80 | 720 | (EFIAPI *EFI_IPSEC_CONFIG_GET_NEXT_SELECTOR)(\r |
fa05b97b | 721 | IN EFI_IPSEC_CONFIG_PROTOCOL *This,\r |
722 | IN EFI_IPSEC_CONFIG_DATA_TYPE DataType,\r | |
723 | IN OUT UINTN *SelectorSize,\r | |
724 | IN OUT EFI_IPSEC_CONFIG_SELECTOR *Selector\r | |
725 | );\r | |
726 | \r | |
727 | /**\r | |
728 | Register an event that is to be signaled whenever a configuration process on the\r | |
9095d37b | 729 | specified IPsec configuration information is done.\r |
fa05b97b | 730 | \r |
731 | This function registers an event that is to be signaled whenever a configuration\r | |
9095d37b | 732 | process on the specified IPsec configuration data is done (e.g. IPsec security\r |
fa05b97b | 733 | policy database configuration is ready). An event can be registered for different\r |
9095d37b LG |
734 | DataType simultaneously and the caller is responsible for determining which type\r |
735 | of configuration data causes the signaling of the event in such case.\r | |
fa05b97b | 736 | \r |
737 | @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance.\r | |
738 | @param[in] DataType The type of data to be registered the event for.\r | |
739 | @param[in] Event The event to be registered.\r | |
9095d37b | 740 | \r |
fa05b97b | 741 | @retval EFI_SUCCESS The event is registered successfully.\r |
742 | @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL.\r | |
743 | @retval EFI_ACCESS_DENIED The Event is already registered for the DataType.\r | |
744 | @retval EFI_UNSUPPORTED The notify registration unsupported or the specified\r | |
745 | DataType is not supported.\r | |
746 | \r | |
747 | **/\r | |
748 | typedef\r | |
749 | EFI_STATUS\r | |
a1749b80 | 750 | (EFIAPI *EFI_IPSEC_CONFIG_REGISTER_NOTIFY)(\r |
fa05b97b | 751 | IN EFI_IPSEC_CONFIG_PROTOCOL *This,\r |
752 | IN EFI_IPSEC_CONFIG_DATA_TYPE DataType,\r | |
753 | IN EFI_EVENT Event\r | |
754 | );\r | |
755 | \r | |
756 | /**\r | |
757 | Remove the specified event that is previously registered on the specified IPsec\r | |
9095d37b | 758 | configuration data.\r |
fa05b97b | 759 | \r |
9095d37b | 760 | This function removes a previously registered event for the specified configuration data.\r |
fa05b97b | 761 | \r |
762 | @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance.\r | |
763 | @param[in] DataType The configuration data type to remove the registered event for.\r | |
764 | @param[in] Event The event to be unregistered.\r | |
9095d37b | 765 | \r |
fa05b97b | 766 | @retval EFI_SUCCESS The event is removed successfully.\r |
9095d37b | 767 | @retval EFI_NOT_FOUND The Event specified by DataType could not be found in the\r |
fa05b97b | 768 | database.\r |
769 | @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL.\r | |
770 | @retval EFI_UNSUPPORTED The notify registration unsupported or the specified\r | |
771 | DataType is not supported.\r | |
772 | \r | |
773 | **/\r | |
774 | typedef\r | |
775 | EFI_STATUS\r | |
a1749b80 | 776 | (EFIAPI *EFI_IPSEC_CONFIG_UNREGISTER_NOTIFY)(\r |
fa05b97b | 777 | IN EFI_IPSEC_CONFIG_PROTOCOL *This,\r |
778 | IN EFI_IPSEC_CONFIG_DATA_TYPE DataType,\r | |
779 | IN EFI_EVENT Event\r | |
780 | );\r | |
781 | \r | |
782 | ///\r | |
783 | /// EFI_IPSEC_CONFIG_PROTOCOL\r | |
784 | /// provides the ability to set and lookup the IPsec SAD (Security Association Database),\r | |
9095d37b LG |
785 | /// SPD (Security Policy Database) data entry and configure the security association\r |
786 | /// management protocol such as IKEv2. This protocol is used as the central\r | |
fa05b97b | 787 | /// repository of any policy-specific configuration for EFI IPsec driver.\r |
9095d37b | 788 | /// EFI_IPSEC_CONFIG_PROTOCOL can be bound to both IPv4 and IPv6 stack. User can use this\r |
fa05b97b | 789 | /// protocol for IPsec configuration in both IPv4 and IPv6 environment.\r |
9095d37b | 790 | ///\r |
fa05b97b | 791 | struct _EFI_IPSEC_CONFIG_PROTOCOL {\r |
792 | EFI_IPSEC_CONFIG_SET_DATA SetData;\r | |
793 | EFI_IPSEC_CONFIG_GET_DATA GetData;\r | |
794 | EFI_IPSEC_CONFIG_GET_NEXT_SELECTOR GetNextSelector;\r | |
795 | EFI_IPSEC_CONFIG_REGISTER_NOTIFY RegisterDataNotify;\r | |
796 | EFI_IPSEC_CONFIG_UNREGISTER_NOTIFY UnregisterDataNotify;\r | |
797 | };\r | |
798 | \r | |
799 | extern EFI_GUID gEfiIpSecConfigProtocolGuid;\r | |
800 | \r | |
801 | #endif\r |