]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/IpSecConfig.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / IpSecConfig.h
... / ...
CommitLineData
1/** @file\r
2 EFI IPsec Configuration Protocol Definition\r
3 The EFI_IPSEC_CONFIG_PROTOCOL provides the mechanism to set and retrieve security and\r
4 policy related information for the EFI IPsec protocol driver.\r
5\r
6 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
7 SPDX-License-Identifier: BSD-2-Clause-Patent\r
8\r
9 @par Revision Reference:\r
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
20 0xce5e5929, 0xc7a3, 0x4602, {0xad, 0x9e, 0xc9, 0xda, 0xf9, 0x4e, 0xbf, 0xcf } \\r
21 }\r
22\r
23typedef struct _EFI_IPSEC_CONFIG_PROTOCOL EFI_IPSEC_CONFIG_PROTOCOL;\r
24\r
25///\r
26/// EFI_IPSEC_CONFIG_DATA_TYPE\r
27///\r
28typedef enum {\r
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
40 /// EFI_IPSEC_SPD_DATA\r
41 ///\r
42 IPsecConfigDataTypeSpd,\r
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
48 /// type EFI_IPSEC_SAD_DATA.\r
49 ///\r
50 IPsecConfigDataTypeSad,\r
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
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
66typedef 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
75typedef struct _EFI_IPSEC_SPD_SELECTOR {\r
76 ///\r
77 /// Specifies the actual number of entries in LocalAddress.\r
78 ///\r
79 UINT32 LocalAddressCount;\r
80 ///\r
81 /// A list of ranges of IPv4 or IPv6 addresses, which refers to the\r
82 /// addresses being protected by IPsec policy.\r
83 ///\r
84 EFI_IP_ADDRESS_INFO *LocalAddress;\r
85 ///\r
86 /// Specifies the actual number of entries in RemoteAddress.\r
87 ///\r
88 UINT32 RemoteAddressCount;\r
89 ///\r
90 /// A list of ranges of IPv4 or IPv6 addresses, which are peer entities\r
91 /// to LocalAddress.\r
92 ///\r
93 EFI_IP_ADDRESS_INFO *RemoteAddress;\r
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
98 /// wildcard that matches any value in NextLayerProtocol field.\r
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
104 /// value in LocalPort field.\r
105 ///\r
106 UINT16 LocalPort;\r
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
113 UINT16 LocalPortRange;\r
114 ///\r
115 /// Remote Port if the Next Layer Protocol uses two ports. A zero\r
116 /// value is a wildcard that matches any value in RemotePort field.\r
117 ///\r
118 UINT16 RemotePort;\r
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
122 /// This field is ignored if NextLayerProtocol does not use ports.\r
123 ///\r
124 UINT16 RemotePortRange;\r
125} EFI_IPSEC_SPD_SELECTOR;\r
126\r
127///\r
128/// EFI_IPSEC_TRAFFIC_DIR\r
129/// represents the directionality in an SPD entry.\r
130///\r
131typedef enum {\r
132 ///\r
133 /// The EfiIPsecInBound refers to traffic entering an IPsec implementation via\r
134 /// the unprotected interface or emitted by the implementation on the unprotected\r
135 /// side of the boundary and directed towards the protected interface.\r
136 ///\r
137 EfiIPsecInBound,\r
138 ///\r
139 /// The EfiIPsecOutBound refers to traffic entering the implementation via\r
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
150typedef enum {\r
151 ///\r
152 /// Refers to traffic that is not allowed to traverse the IPsec boundary.\r
153 ///\r
154 EfiIPsecActionDiscard,\r
155 ///\r
156 /// Refers to traffic that is allowed to cross the IPsec boundary\r
157 /// without protection.\r
158 ///\r
159 EfiIPsecActionBypass,\r
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
165 ///\r
166 EfiIPsecActionProtect\r
167} EFI_IPSEC_ACTION;\r
168\r
169///\r
170/// EFI_IPSEC_SA_LIFETIME\r
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
173/// the limitation of a SA lifetime.\r
174///\r
175typedef struct _EFI_IPSEC_SA_LIFETIME {\r
176 ///\r
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
179 /// AH, this is the authentication algorithm. The ByteCount\r
180 /// includes pad bytes for cryptographic operations.\r
181 ///\r
182 UINT64 ByteCount;\r
183 ///\r
184 /// A time interval in second that warns the implementation to\r
185 /// initiate action such as setting up a replacement SA.\r
186 ///\r
187 UINT64 SoftLifetime;\r
188 ///\r
189 /// A time interval in second when the current SA ends and is\r
190 /// destroyed.\r
191 ///\r
192 UINT64 HardLifetime;\r
193} EFI_IPSEC_SA_LIFETIME;\r
194\r
195///\r
196/// EFI_IPSEC_MODE\r
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
199/// In EfiIPsecTunnel mode, AH and ESP are applied to tunneled IP packets.\r
200///\r
201typedef 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
213typedef 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
222typedef struct _EFI_IPSEC_TUNNEL_OPTION {\r
223 ///\r
224 /// Local tunnel address when IPsec mode is EfiIPsecTunnel.\r
225 ///\r
226 EFI_IP_ADDRESS LocalTunnelAddress;\r
227 ///\r
228 /// Remote tunnel address when IPsec mode is EfiIPsecTunnel.\r
229 ///\r
230 EFI_IP_ADDRESS RemoteTunnelAddress;\r
231 ///\r
232 /// The option of copying the DF bit from an outbound package\r
233 /// to the tunnel mode header that it emits, when traffic is\r
234 /// carried via a tunnel mode SA.\r
235 ///\r
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
242typedef enum {\r
243 EfiIPsecAH, ///< IP Authentication Header protocol which is specified in RFC 4302.\r
244 EfiIPsecESP ///< IP Encapsulating Security Payload which is specified in RFC 4303.\r
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
251typedef struct _EFI_IPSEC_PROCESS_POLICY {\r
252 ///\r
253 /// Extended Sequence Number. Is this SA using extended sequence\r
254 /// numbers. 64 bit counter is used if TRUE.\r
255 ///\r
256 BOOLEAN ExtSeqNum;\r
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
261 /// is permitted.\r
262 ///\r
263 BOOLEAN SeqOverflow;\r
264 ///\r
265 /// Is this SA using stateful fragment checking. TRUE represents\r
266 /// stateful fragment checking.\r
267 ///\r
268 BOOLEAN FragCheck;\r
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
273 EFI_IPSEC_SA_LIFETIME SaLifetime;\r
274 ///\r
275 /// IPsec mode: tunnel or transport.\r
276 ///\r
277 EFI_IPSEC_MODE Mode;\r
278 ///\r
279 /// Tunnel Option. TunnelOption is ignored if Mode is EfiIPsecTransport.\r
280 ///\r
281 EFI_IPSEC_TUNNEL_OPTION *TunnelOption;\r
282 ///\r
283 /// IPsec protocol: AH or ESP\r
284 ///\r
285 EFI_IPSEC_PROTOCOL_TYPE Proto;\r
286 ///\r
287 /// Cryptographic algorithm type used for authentication.\r
288 ///\r
289 UINT8 AuthAlgoId;\r
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
294 /// algorithm is used.\r
295 ///\r
296 UINT8 EncAlgoId;\r
297} EFI_IPSEC_PROCESS_POLICY;\r
298\r
299///\r
300/// EFI_IPSEC_SA_ID\r
301/// A triplet to identify an SA, consisting of the following members.\r
302///\r
303typedef struct _EFI_IPSEC_SA_ID {\r
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
307 /// package should be bound.\r
308 ///\r
309 UINT32 Spi;\r
310 ///\r
311 /// IPsec protocol: AH or ESP\r
312 ///\r
313 EFI_IPSEC_PROTOCOL_TYPE Proto;\r
314 ///\r
315 /// Destination IP address.\r
316 ///\r
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
326typedef struct _EFI_IPSEC_SPD_DATA {\r
327 ///\r
328 /// A null-terminated ASCII name string which is used as a symbolic\r
329 /// identifier for an IPsec Local or Remote address.\r
330 ///\r
331 UINT8 Name[MAX_PEERID_LEN];\r
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
338 /// corresponding selector field of EFI_IPSEC_SPD_SELECTOR:\r
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
345 /// Others: Reserved.\r
346 ///\r
347 UINT32 PackageFlag;\r
348 ///\r
349 /// The traffic direction of data gram.\r
350 ///\r
351 EFI_IPSEC_TRAFFIC_DIR TrafficDirection;\r
352 ///\r
353 /// Processing choices to indicate which action is required by this\r
354 /// policy.\r
355 ///\r
356 EFI_IPSEC_ACTION Action;\r
357 ///\r
358 /// The policy and rule information for a SPD entry.\r
359 ///\r
360 EFI_IPSEC_PROCESS_POLICY *ProcessingPolicy;\r
361 ///\r
362 /// Specifies the actual number of entries in SaId list.\r
363 ///\r
364 UINTN SaIdCount;\r
365 ///\r
366 /// The SAD entry used for the traffic processing. The\r
367 /// existed SAD entry links indicate this is the manual key case.\r
368 ///\r
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
377typedef 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
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
389/// confidentiality and authentication services.\r
390///\r
391typedef 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
403typedef 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
411typedef struct _EFI_IPSEC_SA_DATA {\r
412 ///\r
413 /// IPsec mode: tunnel or transport.\r
414 ///\r
415 EFI_IPSEC_MODE Mode;\r
416 ///\r
417 /// Sequence Number Counter. A 64-bit counter used to generate the\r
418 /// sequence number field in AH or ESP headers.\r
419 ///\r
420 UINT64 SNCount;\r
421 ///\r
422 /// Anti-Replay Window. A 64-bit counter and a bit-map used to\r
423 /// determine whether an inbound AH or ESP packet is a replay.\r
424 ///\r
425 UINT8 AntiReplayWindows;\r
426 ///\r
427 /// AH/ESP cryptographic algorithm, key and parameters.\r
428 ///\r
429 EFI_IPSEC_ALGO_INFO AlgoInfo;\r
430 ///\r
431 /// Lifetime of this SA.\r
432 ///\r
433 EFI_IPSEC_SA_LIFETIME SaLifetime;\r
434 ///\r
435 /// Any observed path MTU and aging variables. The Path MTU\r
436 /// processing is defined in section 8 of RFC 4301.\r
437 ///\r
438 UINT32 PathMTU;\r
439 ///\r
440 /// Link to one SPD entry.\r
441 ///\r
442 EFI_IPSEC_SPD_SELECTOR *SpdSelector;\r
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
446 /// IKE protocol negotiation.\r
447 ///\r
448 BOOLEAN ManualSet;\r
449} EFI_IPSEC_SA_DATA;\r
450\r
451///\r
452/// EFI_IPSEC_SA_DATA2\r
453///\r
454typedef struct _EFI_IPSEC_SA_DATA2 {\r
455 ///\r
456 /// IPsec mode: tunnel or transport\r
457 ///\r
458 EFI_IPSEC_MODE Mode;\r
459 ///\r
460 /// Sequence Number Counter. A 64-bit counter used to generate the sequence\r
461 /// number field in AH or ESP headers.\r
462 ///\r
463 UINT64 SNCount;\r
464 ///\r
465 /// Anti-Replay Window. A 64-bit counter and a bit-map used to determine\r
466 /// whether an inbound AH or ESP packet is a replay.\r
467 ///\r
468 UINT8 AntiReplayWindows;\r
469 ///\r
470 /// AH/ESP cryptographic algorithm, key and parameters.\r
471 ///\r
472 EFI_IPSEC_ALGO_INFO AlgoInfo;\r
473 ///\r
474 /// Lifetime of this SA.\r
475 ///\r
476 EFI_IPSEC_SA_LIFETIME SaLifetime;\r
477 ///\r
478 /// Any observed path MTU and aging variables. The Path MTU processing is\r
479 /// defined in section 8 of RFC 4301.\r
480 ///\r
481 UINT32 PathMTU;\r
482 ///\r
483 /// Link to one SPD entry\r
484 ///\r
485 EFI_IPSEC_SPD_SELECTOR *SpdSelector;\r
486 ///\r
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
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
500} EFI_IPSEC_SA_DATA2;\r
501\r
502\r
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
508typedef struct _EFI_IPSEC_PAD_ID {\r
509 ///\r
510 /// Flag to identify which type of PAD Id is used.\r
511 ///\r
512 BOOLEAN PeerIdValid;\r
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
519 /// Pointer to a null terminated ASCII string\r
520 /// representing the symbolic names. A PeerId can be a DNS\r
521 /// name, Distinguished Name, RFC 822 email address or Key ID\r
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
530/// describes the expected IPsec configuration data selector\r
531/// of type EFI_IPSEC_CONFIG_DATA_TYPE.\r
532///\r
533typedef 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
541/// defines the possible authentication protocol for IPsec\r
542/// security association management.\r
543///\r
544typedef 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
553typedef 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
568typedef struct _EFI_IPSEC_PAD_DATA {\r
569 ///\r
570 /// Authentication Protocol for IPsec security association management.\r
571 ///\r
572 EFI_IPSEC_AUTH_PROTOCOL_TYPE AuthProtocol;\r
573 ///\r
574 /// Authentication method used.\r
575 ///\r
576 EFI_IPSEC_AUTH_METHOD AuthMethod;\r
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
580 /// address provided in traffic selector playloads will be used.\r
581 ///\r
582 BOOLEAN IkeIdFlag;\r
583 ///\r
584 /// The size of Authentication data buffer, in bytes.\r
585 ///\r
586 UINTN AuthDataSize;\r
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
590 /// validated).\r
591 ///\r
592 VOID *AuthData;\r
593 ///\r
594 /// The size of RevocationData, in bytes\r
595 ///\r
596 UINTN RevocationDataSize;\r
597 ///\r
598 /// Pointer to CRL or OCSP data, if certificates are used for\r
599 /// authentication method.\r
600 ///\r
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
607 information for the EFI IPsec driver.\r
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
612 a data entry. The selector structure depends on DataType's definition.\r
613 Using SetData() with a Data of NULL causes the IPsec configuration data entry identified\r
614 by DataType and Selector to be deleted.\r
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
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
620 specified-type configuration information to be flushed.\r
621 @param[in] Data The data buffer to be set. The structure of the data buffer is\r
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
626\r
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
634typedef\r
635EFI_STATUS\r
636(EFIAPI *EFI_IPSEC_CONFIG_SET_DATA)(\r
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
645 Return the configuration value for the EFI IPsec driver.\r
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
649 DataType and Selector parameters.\r
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
653 @param[in] Selector Pointer to an entry selector which is an identifier of the IPsec\r
654 configuration data entry.\r
655 @param[in, out] DataSize On output the size of data returned in Data.\r
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
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
671typedef\r
672EFI_STATUS\r
673(EFIAPI *EFI_IPSEC_CONFIG_GET_DATA)(\r
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
682 Enumerates the current selector for IPsec configuration data entry.\r
683\r
684 This function is called multiple times to retrieve the entry Selector in IPsec\r
685 configuration database. On each call to GetNextSelector(), the next entry\r
686 Selector are retrieved into the output interface.\r
687\r
688 If the entire IPsec configuration database has been iterated, the error\r
689 EFI_NOT_FOUND is returned.\r
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
692 the size of buffer needed.\r
693\r
694 On the initial call to GetNextSelector() to start the IPsec configuration database\r
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
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
701 @param[in, out] Selector On input, supplies the pointer to last Selector that was\r
702 returned by GetNextSelector().\r
703 On output, returns one copy of the current entry Selector\r
704 of a given DataType.\r
705\r
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
714 has been updated with the size needed to complete the search\r
715 request.\r
716\r
717**/\r
718typedef\r
719EFI_STATUS\r
720(EFIAPI *EFI_IPSEC_CONFIG_GET_NEXT_SELECTOR)(\r
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
729 specified IPsec configuration information is done.\r
730\r
731 This function registers an event that is to be signaled whenever a configuration\r
732 process on the specified IPsec configuration data is done (e.g. IPsec security\r
733 policy database configuration is ready). An event can be registered for different\r
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
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
740\r
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
748typedef\r
749EFI_STATUS\r
750(EFIAPI *EFI_IPSEC_CONFIG_REGISTER_NOTIFY)(\r
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
758 configuration data.\r
759\r
760 This function removes a previously registered event for the specified configuration data.\r
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
765\r
766 @retval EFI_SUCCESS The event is removed successfully.\r
767 @retval EFI_NOT_FOUND The Event specified by DataType could not be found in the\r
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
774typedef\r
775EFI_STATUS\r
776(EFIAPI *EFI_IPSEC_CONFIG_UNREGISTER_NOTIFY)(\r
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
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
787/// repository of any policy-specific configuration for EFI IPsec driver.\r
788/// EFI_IPSEC_CONFIG_PROTOCOL can be bound to both IPv4 and IPv6 stack. User can use this\r
789/// protocol for IPsec configuration in both IPv4 and IPv6 environment.\r
790///\r
791struct _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
799extern EFI_GUID gEfiIpSecConfigProtocolGuid;\r
800\r
801#endif\r