2 Definitions related to IPSEC_CONFIG_PROTOCOL implementations.
4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
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.
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.
16 #ifndef _IPSEC_CONFIG_IMPL_H_
17 #define _IPSEC_CONFIG_IMPL_H_
19 #include <Protocol/IpSec.h>
20 #include <Protocol/IpSecConfig.h>
22 #include <Library/BaseLib.h>
23 #include <Library/BaseMemoryLib.h>
24 #include <Library/PrintLib.h>
25 #include <Library/MemoryAllocationLib.h>
26 #include <Library/UefiRuntimeServicesTableLib.h>
27 #include <Library/UefiBootServicesTableLib.h>
28 #include <Library/DebugLib.h>
30 #include "IpSecImpl.h"
32 #define EFI_IPSEC_ANY_PROTOCOL 0xFFFF
33 #define EFI_IPSEC_ANY_PORT 0
35 #define IPSEC_VAR_ITEM_HEADER_LOGO_BIT 0x80
36 #define IPSEC_VAR_ITEM_HEADER_CONTENT_BIT 0x7F
38 #define IPSECCONFIG_VARIABLE_NAME L"IpSecConfig"
39 #define IPSECCONFIG_STATUS_NAME L"IpSecStatus"
41 #define SIZE_OF_SPD_SELECTOR(x) (UINTN) (sizeof (EFI_IPSEC_SPD_SELECTOR) \
42 + sizeof (EFI_IP_ADDRESS_INFO) * ((x)->LocalAddressCount + (x)->RemoteAddressCount))
44 #define FIX_REF_BUF_ADDR(addr, base) addr = (VOID *) ((UINTN) (addr) - (UINTN) (base))
45 #define UNFIX_REF_BUF_ADDR(addr, base) addr = (VOID *) ((UINTN) (addr) + (UINTN) (base))
48 // The data structure used to store the genernall information of IPsec configuration.
51 UINT32 VariableCount
; // the total number of the IPsecConfig variables.
52 UINT32 VariableSize
; // The total size of all IpsecConfig variables.
53 UINT32 SingleVariableSize
; // The max size of single variable
54 } IP_SEC_VARIABLE_INFO
;
57 EFI_IPSEC_CONFIG_SELECTOR
*Selector
;
60 } IPSEC_COMMON_POLICY_ENTRY
;
66 } IPSEC_VARIABLE_BUFFER
;
72 } IPSEC_VAR_ITEM_HEADER
;
76 The prototype of Copy Source Selector to the Destination Selector.
78 @param[in out] DstSel Pointer of Destination Selector. It would be
79 SPD Selector, or SAD Selector or PAD Selector.
80 @param[in] SrcSel Pointer of Source Selector. It would be
81 SPD Selector, or SAD Selector or PAD Selector.
82 @param[in out] Size The size of the Destination Selector. If it
83 is not NULL and its value is less than the size of
84 Source Selector, the value of Source Selector's
85 size will be passed to the caller by this parameter.
87 @retval EFI_INVALID_PARAMETER If the Destination or Source Selector is NULL.
88 @retval EFI_BUFFER_TOO_SMALL If the input Size is less than size of Source Selector.
89 @retval EFI_SUCCESS Copy Source Selector to the Destination
90 Selector successfully.
95 (*IPSEC_DUPLICATE_SELECTOR
) (
96 IN OUT EFI_IPSEC_CONFIG_SELECTOR
*DstSel
,
97 IN EFI_IPSEC_CONFIG_SELECTOR
*SrcSel
,
102 It is prototype of compare two Selectors. The Selector would be SPD Selector,
103 or SAD Selector, or PAD selector.
105 @param[in] Selector1 Pointer of the first Selector.
106 @param[in] Selector2 Pointer of the second Selector.
108 @retval TRUE These two Selectors have the same value in certain fields.
109 @retval FALSE Not all fields have the same value in these two Selectors.
114 (*IPSEC_COMPARE_SELECTOR
) (
115 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector1
,
116 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector2
120 The prototype of a function to check if the Selector is Zero by its certain fields.
122 @param[in] Selector Pointer of the Selector.
124 @retval TRUE If the Selector is Zero.
125 @retval FALSE If the Selector is not Zero.
130 (*IPSEC_IS_ZERO_SELECTOR
) (
131 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
135 The prototype of a function to fix the value of particular members of the Selector.
137 @param[in] Selector Pointer of Selector.
138 @param[in] Data Pointer of Data.
143 (*IPSEC_FIX_POLICY_ENTRY
) (
144 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
149 It is prototype function to define a routine function by the caller of IpSecVisitConfigData().
151 @param[in] Type A specified IPSEC_CONFIG_DATA_TYPE.
152 @param[in] Selector Points to EFI_IPSEC_CONFIG_SELECTOR to be copied
154 @param[in] Data Points to data to be copied to the buffer. The
155 Data type is related to the Type.
156 @param[in] SelectorSize The size of the Selector.
157 @param[in] DataSize The size of the Data.
158 @param[in out] Buffer The buffer to store the Selector and Data.
160 @retval EFI_SUCCESS Copied the Selector and Data to a buffer successfully.
161 @retval EFI_OUT_OF_RESOURCES The required system resource could not be allocated.
166 (*IPSEC_COPY_POLICY_ENTRY
) (
167 IN EFI_IPSEC_CONFIG_DATA_TYPE Type
,
168 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
170 IN UINTN SelectorSize
,
176 Set the security policy information for the EFI IPsec driver.
178 The IPsec configuration data has a unique selector/identifier separately to
179 identify a data entry.
181 @param[in] Selector Pointer to an entry selector on operated
182 configuration data specified by DataType.
183 A NULL Selector causes the entire specified-type
184 configuration information to be flushed.
185 @param[in] Data The data buffer to be set.
186 @param[in] Context Pointer to one entry selector that describes
187 the expected position the new data entry will
188 be added. If Context is NULL, the new entry will
189 be appended to the end of the database.
191 @retval EFI_INVALID_PARAMETER Certain Parameters are not correct. The Parameter
192 requiring a check depends on the Selector type.
193 @retval EFI_OUT_OF_RESOURCED The required system resource could not be allocated.
194 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
199 (*IPSEC_SET_POLICY_ENTRY
) (
200 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
202 IN VOID
*Context OPTIONAL
206 A prototype function definition to lookup the data entry from IPsec. Return the configuration
207 value of the specified Entry.
209 @param[in] Selector Pointer to an entry selector that is an identifier
211 @param[in, out] DataSize On output, the size of data returned in Data.
212 @param[out] Data The buffer to return the contents of the IPsec
213 configuration data. The type of the data buffer
214 is associated with the DataType.
216 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
217 @retval EFI_INVALID_PARAMETER Data is NULL and *DataSize is not zero.
218 @retval EFI_NOT_FOUND The configuration data specified by Selector is not found.
219 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. DataSize has been
220 updated with the size needed to complete the request.
225 (*IPSEC_GET_POLICY_ENTRY
) (
226 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
227 IN OUT UINTN
*DataSize
,
232 Compare two SPD Selectors.
234 Compare two SPD Selector by the fields of LocalAddressCount/RemoteAddressCount/
235 NextLayerProtocol/LocalPort/LocalPortRange/RemotePort/RemotePortRange and the
236 Local Addresses and remote Addresses.
238 @param[in] Selector1 Pointer of the first SPD Selector.
239 @param[in] Selector2 Pointer of the second SPD Selector.
241 @retval TRUE These two Selectors have the same value in above fields.
242 @retval FALSE Not all of the above fields have the same value in these two Selectors.
247 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector1
,
248 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector2
253 Visit all IPsec Configurations of specified Type and call the caller defined
256 @param[in] DataType The specified IPsec Config Data Type.
257 @param[in] Routine The function caller defined.
258 @param[in] Context The data passed to the Routine.
260 @retval EFI_OUT_OF_RESOURCES The required system resource could not be allocated.
261 @retval EFI_SUCCESS This function complete successfully.
265 IpSecVisitConfigData (
266 IN EFI_IPSEC_CONFIG_DATA_TYPE DataType
,
267 IN IPSEC_COPY_POLICY_ENTRY Routine
,
273 This function is the subfunction of the EFIIpSecConfigSetData.
275 This function call IpSecSetVaraible to set the IPsec Configuration into the firmware.
277 @retval EFI_OUT_OF_RESOURCES The required system resource could not be allocated.
278 @retval EFI_SUCCESS Saved the configration successfully.
279 @retval Others Other errors were found while obtaining the variable.
288 Initialize IPsecConfig protocol
290 @param[in, out] Private Pointer to IPSEC_PRIVATE_DATA. After this function finish,
291 the pointer of IPsecConfig Protocol implementation will copy
292 into its IPsecConfig member.
294 @retval EFI_SUCCESS Initialized the IPsecConfig Protocol successfully.
295 @retval Others Initializing the IPsecConfig Protocol failed.
299 IpSecConfigInitialize (
300 IN OUT IPSEC_PRIVATE_DATA
*Private
304 Calculate the entire size of EFI_IPSEC_SPD_DATA, which includes the buffer size pointed
305 by the pointer members.
307 @param[in] SpdData Pointer to a specified EFI_IPSEC_SPD_DATA.
309 @return The entire size of the specified EFI_IPSEC_SPD_DATA.
313 IpSecGetSizeOfEfiSpdData (
314 IN EFI_IPSEC_SPD_DATA
*SpdData
318 Calculate the a entire size of IPSEC_SPD_DATA, which includes the buffer size pointed
319 by the pointer members and the buffer size used by Sa List.
321 @param[in] SpdData Pointer to the specified IPSEC_SPD_DATA.
323 @return The entire size of IPSEC_SPD_DATA.
327 IpSecGetSizeOfSpdData (
328 IN IPSEC_SPD_DATA
*SpdData
332 Copy Source Process Policy to the Destination Process Policy.
334 @param[in] Dst Pointer to the Source Process Policy.
335 @param[in] Src Pointer to the Destination Process Policy.
339 IpSecDuplicateProcessPolicy (
340 IN EFI_IPSEC_PROCESS_POLICY
*Dst
,
341 IN EFI_IPSEC_PROCESS_POLICY
*Src
345 Compare two SPD Selectors.
347 Compare two SPD Selector by the fields of LocalAddressCount/RemoteAddressCount/
348 NextLayerProtocol/LocalPort/LocalPortRange/RemotePort/RemotePortRange and the
349 Local Addresses and remote Addresses.
351 @param[in] Selector1 Pointer of the first SPD Selector.
352 @param[in] Selector2 Pointer of the second SPD Selector.
354 @retval TRUE This two Selector have the same value in above fields.
355 @retval FALSE Not all of the above fields have the same value in these two Selectors.
360 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector1
,
361 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector2
367 @param[in] Selector1 Pointer of the first SA ID.
368 @param[in] Selector2 Pointer of the second SA ID.
370 @retval TRUE This two Selectors have the same SA ID.
371 @retval FALSE This two Selecotrs don't have the same SA ID.
376 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector1
,
377 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector2
383 @param[in] Selector1 Pointer of the first PAD ID.
384 @param[in] Selector2 Pointer of the second PAD ID.
386 @retval TRUE This two Selectors have the same PAD ID.
387 @retval FALSE This two Selecotrs don't have the same PAD ID.
392 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector1
,
393 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector2
397 Check if the SPD Selector is Zero by its LocalAddressCount and RemoteAddressCount
400 @param[in] Selector Pointer of the SPD Selector.
402 @retval TRUE If the SPD Selector is Zero.
403 @retval FALSE If the SPD Selector is not Zero.
408 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
412 Check if the SA ID is Zero by its DestAddress.
414 @param[in] Selector Pointer of the SA ID.
416 @retval TRUE If the SA ID is Zero.
417 @retval FALSE If the SA ID is not Zero.
422 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
426 Check if the PAD ID is Zero.
428 @param[in] Selector Pointer of the PAD ID.
430 @retval TRUE If the PAD ID is Zero.
431 @retval FALSE If the PAD ID is not Zero.
436 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
440 Copy Source SPD Selector to the Destination SPD Selector.
442 @param[in, out] DstSel Pointer of Destination SPD Selector.
443 @param[in] SrcSel Pointer of Source SPD Selector.
444 @param[in, out] Size The size of the Destination SPD Selector. If
445 it is not NULL and its value is less than the
446 size of Source SPD Selector, the value of
447 Source SPD Selector's size will be passed to
448 the caller by this parameter.
450 @retval EFI_INVALID_PARAMETER If the Destination or Source SPD Selector is NULL.
451 @retval EFI_BUFFER_TOO_SMALL If the input Size is less than size of Source SPD Selector.
452 @retval EFI_SUCCESS Copy Source SPD Selector to the Destination SPD
453 Selector successfully.
457 DuplicateSpdSelector (
458 IN OUT EFI_IPSEC_CONFIG_SELECTOR
*DstSel
,
459 IN EFI_IPSEC_CONFIG_SELECTOR
*SrcSel
,
464 Copy Source SA ID to the Destination SA ID.
466 @param[in, out] DstSel Pointer of the Destination SA ID.
467 @param[in] SrcSel Pointer of the Source SA ID.
468 @param[in, out] Size The size of the Destination SA ID. If it
469 not NULL, and its value is less than the size of
470 Source SA ID, the value of Source SA ID's size
471 will be passed to the caller by this parameter.
473 @retval EFI_INVALID_PARAMETER If the Destination or Source SA ID is NULL.
474 @retval EFI_BUFFER_TOO_SMALL If the input Size less than size of source SA ID.
475 @retval EFI_SUCCESS Copied Source SA ID to the Destination SA ID successfully.
480 IN OUT EFI_IPSEC_CONFIG_SELECTOR
*DstSel
,
481 IN EFI_IPSEC_CONFIG_SELECTOR
*SrcSel
,
486 Copy Source PAD ID to the Destination PAD ID.
488 @param[in, out] DstSel Pointer of Destination PAD ID.
489 @param[in] SrcSel Pointer of Source PAD ID.
490 @param[in, out] Size The size of the Destination PAD ID. If it
491 not NULL, and its value less than the size of
492 Source PAD ID, the value of Source PAD ID's size
493 will be passed to the caller by this parameter.
495 @retval EFI_INVALID_PARAMETER If the Destination or Source PAD ID is NULL.
496 @retval EFI_BUFFER_TOO_SMALL If the input Size less than size of source PAD ID.
497 @retval EFI_SUCCESS Copied Source PAD ID to the Destination PAD ID successfully.
502 IN OUT EFI_IPSEC_CONFIG_SELECTOR
*DstSel
,
503 IN EFI_IPSEC_CONFIG_SELECTOR
*SrcSel
,
508 Fix the value of some members of the SPD Selector.
510 This function is called by IpSecCopyPolicyEntry(), which copies the Policy
511 Entry into the Variable. Since some members in SPD Selector are pointers,
512 a physical address to relative address conversion is required before copying
513 this SPD entry into the variable.
515 @param[in] Selector Pointer of SPD Selector.
516 @param[in, out] Data Pointer of SPD Data.
521 IN EFI_IPSEC_SPD_SELECTOR
*Selector
,
522 IN OUT EFI_IPSEC_SPD_DATA
*Data
526 Fix the value of some members of SA ID.
528 This function is called by IpSecCopyPolicyEntry(), which copies the Policy
529 Entry into the Variable. Since some members in SA ID are pointers,
530 a physical address to relative address conversion is required before copying
531 this SAD into the variable.
533 @param[in] SaId Pointer of SA ID.
534 @param[in, out] Data Pointer of SA Data.
539 IN EFI_IPSEC_SA_ID
*SaId
,
540 IN OUT EFI_IPSEC_SA_DATA
*Data
544 Fix the value of some members of PAD ID.
546 This function is called by IpSecCopyPolicyEntry(), which copy the Policy
547 Entry into the Variable. Since some members in PAD ID are pointers,
548 a physical address to relative address conversion is required before copying
549 this PAD into the variable.
551 @param[in] PadId Pointer of PAD ID.
552 @param[in, out] Data Pointer of PAD Data.
557 IN EFI_IPSEC_PAD_ID
*PadId
,
558 IN OUT EFI_IPSEC_PAD_DATA
*Data
562 Recover the value of some members of SPD Selector.
564 This function is corresponding to FixSpdEntry(). It recovers the value of members
565 of SPD Selector which fix by the FixSpdEntry().
567 @param[in, out] Selector Pointer of SPD Selector.
568 @param[in, out] Data Pointer of SPD Data.
573 IN OUT EFI_IPSEC_SPD_SELECTOR
*Selector
,
574 IN OUT EFI_IPSEC_SPD_DATA
*Data
579 Recover the value of some members of SA ID.
581 This function is corresponding to FixSadEntry(). It recovers the value of members
582 of SAD ID which fix by the FixSadEntry().
584 @param[in, out] SaId Pointer of SAD ID
585 @param[in, out] Data Pointer of SAD Data.
590 IN OUT EFI_IPSEC_SA_ID
*SaId
,
591 IN OUT EFI_IPSEC_SA_DATA
*Data
595 Recover the value of some members of PAD ID.
597 This function is corresponding to FixPadEntry(). It recovers the value of members
598 of PAD ID which fix by the FixPadEntry().
600 @param[in] PadId Pointer of PAD ID
601 @param[in, out] Data Pointer of PAD Data.
606 IN EFI_IPSEC_PAD_ID
*PadId
,
607 IN OUT EFI_IPSEC_PAD_DATA
*Data
611 Set the security policy information for the EFI IPsec driver.
613 The IPsec configuration data has a unique selector/identifier separately to
614 identify a data entry.
616 @param[in] Selector Pointer to an entry selector on operated
617 configuration data specified by DataType.
618 A NULL Selector causes the entire specified-type
619 configuration information to be flushed.
620 @param[in] Data The data buffer to be set. The structure
621 of the data buffer should be EFI_IPSEC_SPD_DATA.
622 @param[in] Context Pointer to one entry selector that describes
623 the expected position the new data entry will
624 be added. If Context is NULL,the new entry will
625 be appended the end of database.
627 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
628 - Selector is not NULL and its LocalAddress
629 is NULL or its RemoteAddress is NULL.
630 - Data is not NULL, its Action is Protected,
631 and its policy is NULL.
632 - Data is not NULL and its Action is not protected
633 and its policy is not NULL.
634 - The Action of Data is Protected, its policy
635 mode is Tunnel, and its tunnel option is NULL.
636 - The Action of Data is protected, its policy
637 mode is not Tunnel, and it tunnel option is not NULL.
638 @retval EFI_OUT_OF_RESOURCED The required system resource could not be allocated.
639 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
644 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
646 IN VOID
*Context OPTIONAL
650 Set the security association information for the EFI IPsec driver.
652 The IPsec configuration data has a unique selector/identifier separately to
653 identify a data entry.
655 @param[in] Selector Pointer to an entry selector on operated
656 configuration data specified by DataType.
657 A NULL Selector causes the entire specified-type
658 configuration information to be flushed.
659 @param[in] Data The data buffer to be set. The structure
660 of the data buffer should be EFI_IPSEC_SA_DATA.
661 @param[in] Context Pointer to one entry selector which describes
662 the expected position the new data entry will
663 be added. If Context is NULL,the new entry will
664 be appended to the end of database.
666 @retval EFI_OUT_OF_RESOURCED The required system resource could not be allocated.
667 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
672 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
674 IN VOID
*Context OPTIONAL
678 Set the peer authorization configuration information for the EFI IPsec driver.
680 The IPsec configuration data has a unique selector/identifier separately to
681 identify a data entry.
683 @param[in] Selector Pointer to an entry selector on operated
684 configuration data specified by DataType.
685 A NULL Selector causes the entire specified-type
686 configuration information to be flushed.
687 @param[in] Data The data buffer to be set. The structure
688 of the data buffer should be EFI_IPSEC_PAD_DATA.
689 @param[in] Context Pointer to one entry selector that describes
690 the expected position where the new data entry will
691 be added. If Context is NULL, the new entry will
692 be appended the end of database.
694 @retval EFI_OUT_OF_RESOURCED The required system resource could not be allocated.
695 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
700 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
702 IN VOID
*Context OPTIONAL
706 This function looks up the data entry from IPsec SPD, and returns the configuration
707 value of the specified SPD Entry.
709 @param[in] Selector Pointer to an entry selector which is an identifier
711 @param[in, out] DataSize On output the size of data returned in Data.
712 @param[out] Data The buffer to return the contents of the IPsec
713 configuration data. The type of the data buffer
714 is associated with the DataType.
716 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
717 @retval EFI_INVALID_PARAMETER Data is NULL and *DataSize is not zero.
718 @retval EFI_NOT_FOUND The configuration data specified by Selector is not found.
719 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. DataSize has been
720 updated with the size needed to complete the request.
725 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
726 IN OUT UINTN
*DataSize
,
731 This function looks up the data entry from IPsec SAD and returns the configuration
732 value of the specified SAD Entry.
734 @param[in] Selector Pointer to an entry selector that is an identifier
736 @param[in, out] DataSize On output, the size of data returned in Data.
737 @param[out] Data The buffer to return the contents of the IPsec
738 configuration data. This type of the data buffer
739 is associated with the DataType.
741 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
742 @retval EFI_NOT_FOUND The configuration data specified by Selector is not found.
743 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. DataSize has been
744 updated with the size needed to complete the request.
749 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
750 IN OUT UINTN
*DataSize
,
755 This function looks up the data entry from IPsec PADand returns the configuration
756 value of the specified PAD Entry.
758 @param[in] Selector Pointer to an entry selector that is an identifier
760 @param[in, out] DataSize On output the size of data returned in Data.
761 @param[out] Data The buffer to return the contents of the IPsec
762 configuration data. This type of the data buffer
763 is associated with the DataType.
765 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
766 @retval EFI_NOT_FOUND The configuration data specified by Selector is not found.
767 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. DataSize has been
768 updated with the size needed to complete the request.
773 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
774 IN OUT UINTN
*DataSize
,
779 Return the configuration value for the EFI IPsec driver.
781 This function lookup the data entry from IPsec database or IKEv2 configuration
782 information. The expected data type and unique identification are described in
783 DataType and Selector parameters.
785 @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance.
786 @param[in] DataType The type of data to retrieve.
787 @param[in] Selector Pointer to an entry selector that is an identifier of the IPsec
788 configuration data entry.
789 @param[in, out] DataSize On output the size of data returned in Data.
790 @param[out] Data The buffer to return the contents of the IPsec configuration data.
791 The type of the data buffer is associated with the DataType.
793 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
794 @retval EFI_INVALID_PARAMETER One or more of the followings are TRUE:
798 - Data is NULL and *DataSize is not zero
799 @retval EFI_NOT_FOUND The configuration data specified by Selector is not found.
800 @retval EFI_UNSUPPORTED The specified DataType is not supported.
801 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. DataSize has been
802 updated with the size needed to complete the request.
807 EfiIpSecConfigGetData (
808 IN EFI_IPSEC_CONFIG_PROTOCOL
*This
,
809 IN EFI_IPSEC_CONFIG_DATA_TYPE DataType
,
810 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
811 IN OUT UINTN
*DataSize
,
816 Set the security association, security policy and peer authorization configuration
817 information for the EFI IPsec driver.
819 This function is used to set the IPsec configuration information of type DataType for
820 the EFI IPsec driver.
821 The IPsec configuration data has a unique selector/identifier separately to identify
822 a data entry. The selector structure depends on DataType's definition.
823 Using SetData() with a Data of NULL causes the IPsec configuration data entry identified
824 by DataType and Selector to be deleted.
826 @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance.
827 @param[in] DataType The type of data to be set.
828 @param[in] Selector Pointer to an entry selector on operated configuration data
829 specified by DataType. A NULL Selector causes the entire
830 specified-type configuration information to be flushed.
831 @param[in] Data The data buffer to be set. The structure of the data buffer is
832 associated with the DataType.
833 @param[in] InsertBefore Pointer to one entry selector which describes the expected
834 position the new data entry will be added. If InsertBefore is NULL,
835 the new entry will be appended the end of database.
837 @retval EFI_SUCCESS The specified configuration entry data was set successfully.
838 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
840 @retval EFI_UNSUPPORTED The specified DataType is not supported.
841 @retval EFI_OUT_OF_RESOURCED The required system resource could not be allocated.
846 EfiIpSecConfigSetData (
847 IN EFI_IPSEC_CONFIG_PROTOCOL
*This
,
848 IN EFI_IPSEC_CONFIG_DATA_TYPE DataType
,
849 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
851 IN EFI_IPSEC_CONFIG_SELECTOR
*InsertBefore OPTIONAL
855 Enumerates the current selector for IPsec configuration data entry.
857 This function is called multiple times to retrieve the entry Selector in IPsec
858 configuration database. On each call to GetNextSelector(), the next entry
859 Selector are retrieved into the output interface.
861 If the entire IPsec configuration database has been iterated, the error
862 EFI_NOT_FOUND is returned.
863 If the Selector buffer is too small for the next Selector copy, an
864 EFI_BUFFER_TOO_SMALL error is returned, and SelectorSize is updated to reflect
865 the size of buffer needed.
867 On the initial call to GetNextSelector() to start the IPsec configuration database
868 search, a pointer to the buffer with all zero value is passed in Selector. Calls
869 to SetData() between calls to GetNextSelector may produce unpredictable results.
871 @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance.
872 @param[in] DataType The type of IPsec configuration data to retrieve.
873 @param[in, out] SelectorSize The size of the Selector buffer.
874 @param[in, out] Selector On input, supplies the pointer to last Selector that was
875 returned by GetNextSelector().
876 On output, returns one copy of the current entry Selector
879 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
880 @retval EFI_INVALID_PARAMETER One or more of the followings are TRUE:
882 - SelectorSize is NULL.
884 @retval EFI_NOT_FOUND The next configuration data entry was not found.
885 @retval EFI_UNSUPPORTED The specified DataType is not supported.
886 @retval EFI_BUFFER_TOO_SMALL The SelectorSize is too small for the result. This parameter
887 has been updated with the size needed to complete the search
893 EfiIpSecConfigGetNextSelector (
894 IN EFI_IPSEC_CONFIG_PROTOCOL
*This
,
895 IN EFI_IPSEC_CONFIG_DATA_TYPE DataType
,
896 IN OUT UINTN
*SelectorSize
,
897 IN OUT EFI_IPSEC_CONFIG_SELECTOR
*Selector
901 Register an event that is to be signaled whenever a configuration process on the
902 specified IPsec configuration information is done.
904 The register function is not surpport now and always returns EFI_UNSUPPORTED.
906 @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance.
907 @param[in] DataType The type of data to be registered the event for.
908 @param[in] Event The event to be registered.
910 @retval EFI_SUCCESS The event is registered successfully.
911 @retval EFI_INVALID_PARAMETER This is NULL, or Event is NULL.
912 @retval EFI_ACCESS_DENIED The Event is already registered for the DataType.
913 @retval EFI_UNSUPPORTED The notify registration unsupported, or the specified
914 DataType is not supported.
919 EfiIpSecConfigRegisterNotify (
920 IN EFI_IPSEC_CONFIG_PROTOCOL
*This
,
921 IN EFI_IPSEC_CONFIG_DATA_TYPE DataType
,
927 Remove the specified event that was previously registered on the specified IPsec
930 This function is not supported now and always returns EFI_UNSUPPORTED.
932 @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance.
933 @param[in] DataType The configuration data type to remove the registered event for.
934 @param[in] Event The event to be unregistered.
936 @retval EFI_SUCCESS The event was removed successfully.
937 @retval EFI_NOT_FOUND The Event specified by DataType could not be found in the
939 @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL.
940 @retval EFI_UNSUPPORTED The notify registration unsupported or the specified
941 DataType is not supported.
946 EfiIpSecConfigUnregisterNotify (
947 IN EFI_IPSEC_CONFIG_PROTOCOL
*This
,
948 IN EFI_IPSEC_CONFIG_DATA_TYPE DataType
,