2 Definitions related to IPSEC_CONFIG_PROTOCOL implementations.
4 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef _IPSEC_CONFIG_IMPL_H_
11 #define _IPSEC_CONFIG_IMPL_H_
13 #include <Protocol/IpSec.h>
14 #include <Protocol/IpSecConfig.h>
16 #include <Library/BaseLib.h>
17 #include <Library/BaseMemoryLib.h>
18 #include <Library/PrintLib.h>
19 #include <Library/MemoryAllocationLib.h>
20 #include <Library/UefiRuntimeServicesTableLib.h>
21 #include <Library/UefiBootServicesTableLib.h>
22 #include <Library/DebugLib.h>
24 #include "IpSecImpl.h"
26 #define EFI_IPSEC_ANY_PROTOCOL 0xFFFF
27 #define EFI_IPSEC_ANY_PORT 0
29 #define IPSEC_VAR_ITEM_HEADER_LOGO_BIT 0x80
30 #define IPSEC_VAR_ITEM_HEADER_CONTENT_BIT 0x7F
32 #define IPSECCONFIG_VARIABLE_NAME L"IpSecConfig"
33 #define IPSECCONFIG_STATUS_NAME L"IpSecStatus"
35 #define SIZE_OF_SPD_SELECTOR(x) (sizeof (EFI_IPSEC_SPD_SELECTOR) \
36 + sizeof (EFI_IP_ADDRESS_INFO) * ((x)->LocalAddressCount + (x)->RemoteAddressCount))
38 #define FIX_REF_BUF_ADDR(addr, base) addr = (VOID *) ((UINTN) (addr) - (UINTN) (base))
39 #define UNFIX_REF_BUF_ADDR(addr, base) addr = (VOID *) ((UINTN) (addr) + (UINTN) (base))
42 // The data structure used to store the genernall information of IPsec configuration.
45 UINT32 VariableCount
; // the total number of the IPsecConfig variables.
46 UINT32 VariableSize
; // The total size of all IpsecConfig variables.
47 UINT32 SingleVariableSize
; // The max size of single variable
48 } IP_SEC_VARIABLE_INFO
;
51 EFI_IPSEC_CONFIG_SELECTOR
*Selector
;
54 } IPSEC_COMMON_POLICY_ENTRY
;
60 } IPSEC_VARIABLE_BUFFER
;
66 } IPSEC_VAR_ITEM_HEADER
;
70 The prototype of Copy Source Selector to the Destination Selector.
72 @param[in, out] DstSel Pointer of Destination Selector. It would be
73 SPD Selector, or SAD Selector or PAD Selector.
74 @param[in] SrcSel Pointer of Source Selector. It would be
75 SPD Selector, or SAD Selector or PAD Selector.
76 @param[in, out] Size The size of the Destination Selector. If it
77 is not NULL and its value is less than the size of
78 Source Selector, the value of Source Selector's
79 size will be passed to the caller by this parameter.
81 @retval EFI_INVALID_PARAMETER If the Destination or Source Selector is NULL.
82 @retval EFI_BUFFER_TOO_SMALL If the input Size is less than size of Source Selector.
83 @retval EFI_SUCCESS Copy Source Selector to the Destination
84 Selector successfully.
89 (*IPSEC_DUPLICATE_SELECTOR
) (
90 IN OUT EFI_IPSEC_CONFIG_SELECTOR
*DstSel
,
91 IN EFI_IPSEC_CONFIG_SELECTOR
*SrcSel
,
96 It is prototype of compare two Selectors. The Selector would be SPD Selector,
97 or SAD Selector, or PAD selector.
99 @param[in] Selector1 Pointer of the first Selector.
100 @param[in] Selector2 Pointer of the second Selector.
102 @retval TRUE These two Selectors have the same value in certain fields.
103 @retval FALSE Not all fields have the same value in these two Selectors.
108 (*IPSEC_COMPARE_SELECTOR
) (
109 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector1
,
110 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector2
114 The prototype of a function to check if the Selector is Zero by its certain fields.
116 @param[in] Selector Pointer of the Selector.
118 @retval TRUE If the Selector is Zero.
119 @retval FALSE If the Selector is not Zero.
124 (*IPSEC_IS_ZERO_SELECTOR
) (
125 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
129 The prototype of a function to fix the value of particular members of the Selector.
131 @param[in] Selector Pointer of Selector.
132 @param[in] Data Pointer of Data.
137 (*IPSEC_FIX_POLICY_ENTRY
) (
138 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
143 It is prototype function to define a routine function by the caller of IpSecVisitConfigData().
145 @param[in] Type A specified IPSEC_CONFIG_DATA_TYPE.
146 @param[in] Selector Points to EFI_IPSEC_CONFIG_SELECTOR to be copied
148 @param[in] Data Points to data to be copied to the buffer. The
149 Data type is related to the Type.
150 @param[in] SelectorSize The size of the Selector.
151 @param[in] DataSize The size of the Data.
152 @param[in, out] Buffer The buffer to store the Selector and Data.
154 @retval EFI_SUCCESS Copied the Selector and Data to a buffer successfully.
155 @retval EFI_OUT_OF_RESOURCES The required system resource could not be allocated.
160 (*IPSEC_COPY_POLICY_ENTRY
) (
161 IN EFI_IPSEC_CONFIG_DATA_TYPE Type
,
162 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
164 IN UINTN SelectorSize
,
170 Set the security policy information for the EFI IPsec driver.
172 The IPsec configuration data has a unique selector/identifier separately to
173 identify a data entry.
175 @param[in] Selector Pointer to an entry selector on operated
176 configuration data specified by DataType.
177 A NULL Selector causes the entire specified-type
178 configuration information to be flushed.
179 @param[in] Data The data buffer to be set.
180 @param[in] Context Pointer to one entry selector that describes
181 the expected position the new data entry will
182 be added. If Context is NULL, the new entry will
183 be appended to the end of the database.
185 @retval EFI_INVALID_PARAMETER Certain Parameters are not correct. The Parameter
186 requiring a check depends on the Selector type.
187 @retval EFI_OUT_OF_RESOURCED The required system resource could not be allocated.
188 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
193 (*IPSEC_SET_POLICY_ENTRY
) (
194 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
196 IN VOID
*Context OPTIONAL
200 A prototype function definition to lookup the data entry from IPsec. Return the configuration
201 value of the specified Entry.
203 @param[in] Selector Pointer to an entry selector that is an identifier
205 @param[in, out] DataSize On output, the size of data returned in Data.
206 @param[out] Data The buffer to return the contents of the IPsec
207 configuration data. The type of the data buffer
208 is associated with the DataType.
210 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
211 @retval EFI_INVALID_PARAMETER Data is NULL and *DataSize is not zero.
212 @retval EFI_NOT_FOUND The configuration data specified by Selector is not found.
213 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. DataSize has been
214 updated with the size needed to complete the request.
219 (*IPSEC_GET_POLICY_ENTRY
) (
220 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
221 IN OUT UINTN
*DataSize
,
226 Compare two SPD Selectors.
228 Compare two SPD Selector by the fields of LocalAddressCount/RemoteAddressCount/
229 NextLayerProtocol/LocalPort/LocalPortRange/RemotePort/RemotePortRange and the
230 Local Addresses and remote Addresses.
232 @param[in] Selector1 Pointer of the first SPD Selector.
233 @param[in] Selector2 Pointer of the second SPD Selector.
235 @retval TRUE These two Selectors have the same value in above fields.
236 @retval FALSE Not all of the above fields have the same value in these two Selectors.
241 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector1
,
242 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector2
247 Visit all IPsec Configurations of specified Type and call the caller defined
250 @param[in] DataType The specified IPsec Config Data Type.
251 @param[in] Routine The function caller defined.
252 @param[in] Context The data passed to the Routine.
254 @retval EFI_OUT_OF_RESOURCES The required system resource could not be allocated.
255 @retval EFI_SUCCESS This function complete successfully.
259 IpSecVisitConfigData (
260 IN EFI_IPSEC_CONFIG_DATA_TYPE DataType
,
261 IN IPSEC_COPY_POLICY_ENTRY Routine
,
267 This function is the subfunction of the EFIIpSecConfigSetData.
269 This function call IpSecSetVaraible to set the IPsec Configuration into the firmware.
271 @retval EFI_OUT_OF_RESOURCES The required system resource could not be allocated.
272 @retval EFI_SUCCESS Saved the configration successfully.
273 @retval Others Other errors were found while obtaining the variable.
282 Initialize IPsecConfig protocol
284 @param[in, out] Private Pointer to IPSEC_PRIVATE_DATA. After this function finish,
285 the pointer of IPsecConfig Protocol implementation will copy
286 into its IPsecConfig member.
288 @retval EFI_SUCCESS Initialized the IPsecConfig Protocol successfully.
289 @retval Others Initializing the IPsecConfig Protocol failed.
293 IpSecConfigInitialize (
294 IN OUT IPSEC_PRIVATE_DATA
*Private
298 Calculate the entire size of EFI_IPSEC_SPD_DATA, which includes the buffer size pointed
299 by the pointer members.
301 @param[in] SpdData Pointer to a specified EFI_IPSEC_SPD_DATA.
303 @return The entire size of the specified EFI_IPSEC_SPD_DATA.
307 IpSecGetSizeOfEfiSpdData (
308 IN EFI_IPSEC_SPD_DATA
*SpdData
312 Calculate the a entire size of IPSEC_SPD_DATA, which includes the buffer size pointed
313 by the pointer members and the buffer size used by Sa List.
315 @param[in] SpdData Pointer to the specified IPSEC_SPD_DATA.
317 @return The entire size of IPSEC_SPD_DATA.
321 IpSecGetSizeOfSpdData (
322 IN IPSEC_SPD_DATA
*SpdData
326 Copy Source Process Policy to the Destination Process Policy.
328 @param[in] Dst Pointer to the Source Process Policy.
329 @param[in] Src Pointer to the Destination Process Policy.
333 IpSecDuplicateProcessPolicy (
334 IN EFI_IPSEC_PROCESS_POLICY
*Dst
,
335 IN EFI_IPSEC_PROCESS_POLICY
*Src
339 Find if the two SPD Selectors has subordinative.
341 Compare two SPD Selector by the fields of LocalAddressCount/RemoteAddressCount/
342 NextLayerProtocol/LocalPort/LocalPortRange/RemotePort/RemotePortRange and the
343 Local Addresses and remote Addresses.
345 @param[in] Selector1 Pointer of first SPD Selector.
346 @param[in] Selector2 Pointer of second SPD Selector.
348 @retval TRUE The first SPD Selector is subordinate Selector of second SPD Selector.
349 @retval FALSE The first SPD Selector is not subordinate Selector of second
355 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector1
,
356 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector2
362 @param[in] Selector1 Pointer of the first SA ID.
363 @param[in] Selector2 Pointer of the second SA ID.
365 @retval TRUE This two Selectors have the same SA ID.
366 @retval FALSE This two Selecotrs don't have the same SA ID.
371 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector1
,
372 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector2
378 @param[in] Selector1 Pointer of the first PAD ID.
379 @param[in] Selector2 Pointer of the second PAD ID.
381 @retval TRUE This two Selectors have the same PAD ID.
382 @retval FALSE This two Selecotrs don't have the same PAD ID.
387 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector1
,
388 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector2
392 Check if the SPD Selector is Zero by its LocalAddressCount and RemoteAddressCount
395 @param[in] Selector Pointer of the SPD Selector.
397 @retval TRUE If the SPD Selector is Zero.
398 @retval FALSE If the SPD Selector is not Zero.
403 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
407 Check if the SA ID is Zero by its DestAddress.
409 @param[in] Selector Pointer of the SA ID.
411 @retval TRUE If the SA ID is Zero.
412 @retval FALSE If the SA ID is not Zero.
417 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
421 Check if the PAD ID is Zero.
423 @param[in] Selector Pointer of the PAD ID.
425 @retval TRUE If the PAD ID is Zero.
426 @retval FALSE If the PAD ID is not Zero.
431 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
435 Copy Source SPD Selector to the Destination SPD Selector.
437 @param[in, out] DstSel Pointer of Destination SPD Selector.
438 @param[in] SrcSel Pointer of Source SPD Selector.
439 @param[in, out] Size The size of the Destination SPD Selector. If
440 it is not NULL and its value is less than the
441 size of Source SPD Selector, the value of
442 Source SPD Selector's size will be passed to
443 the caller by this parameter.
445 @retval EFI_INVALID_PARAMETER If the Destination or Source SPD Selector is NULL.
446 @retval EFI_BUFFER_TOO_SMALL If the input Size is less than size of Source SPD Selector.
447 @retval EFI_SUCCESS Copy Source SPD Selector to the Destination SPD
448 Selector successfully.
452 DuplicateSpdSelector (
453 IN OUT EFI_IPSEC_CONFIG_SELECTOR
*DstSel
,
454 IN EFI_IPSEC_CONFIG_SELECTOR
*SrcSel
,
459 Copy Source SA ID to the Destination SA ID.
461 @param[in, out] DstSel Pointer of the Destination SA ID.
462 @param[in] SrcSel Pointer of the Source SA ID.
463 @param[in, out] Size The size of the Destination SA ID. If it
464 not NULL, and its value is less than the size of
465 Source SA ID, the value of Source SA ID's size
466 will be passed to the caller by this parameter.
468 @retval EFI_INVALID_PARAMETER If the Destination or Source SA ID is NULL.
469 @retval EFI_BUFFER_TOO_SMALL If the input Size less than size of source SA ID.
470 @retval EFI_SUCCESS Copied Source SA ID to the Destination SA ID successfully.
475 IN OUT EFI_IPSEC_CONFIG_SELECTOR
*DstSel
,
476 IN EFI_IPSEC_CONFIG_SELECTOR
*SrcSel
,
481 Copy Source PAD ID to the Destination PAD ID.
483 @param[in, out] DstSel Pointer of Destination PAD ID.
484 @param[in] SrcSel Pointer of Source PAD ID.
485 @param[in, out] Size The size of the Destination PAD ID. If it
486 not NULL, and its value less than the size of
487 Source PAD ID, the value of Source PAD ID's size
488 will be passed to the caller by this parameter.
490 @retval EFI_INVALID_PARAMETER If the Destination or Source PAD ID is NULL.
491 @retval EFI_BUFFER_TOO_SMALL If the input Size less than size of source PAD ID.
492 @retval EFI_SUCCESS Copied Source PAD ID to the Destination PAD ID successfully.
497 IN OUT EFI_IPSEC_CONFIG_SELECTOR
*DstSel
,
498 IN EFI_IPSEC_CONFIG_SELECTOR
*SrcSel
,
503 Fix the value of some members of the SPD Selector.
505 This function is called by IpSecCopyPolicyEntry(), which copies the Policy
506 Entry into the Variable. Since some members in SPD Selector are pointers,
507 a physical address to relative address conversion is required before copying
508 this SPD entry into the variable.
510 @param[in] Selector Pointer of SPD Selector.
511 @param[in, out] Data Pointer of SPD Data.
516 IN EFI_IPSEC_SPD_SELECTOR
*Selector
,
517 IN OUT EFI_IPSEC_SPD_DATA
*Data
521 Fix the value of some members of SA ID.
523 This function is called by IpSecCopyPolicyEntry(), which copies the Policy
524 Entry into the Variable. Since some members in SA ID are pointers,
525 a physical address to relative address conversion is required before copying
526 this SAD into the variable.
528 @param[in] SaId Pointer of SA ID.
529 @param[in, out] Data Pointer of SA Data.
534 IN EFI_IPSEC_SA_ID
*SaId
,
535 IN OUT EFI_IPSEC_SA_DATA2
*Data
539 Fix the value of some members of PAD ID.
541 This function is called by IpSecCopyPolicyEntry(), which copy the Policy
542 Entry into the Variable. Since some members in PAD ID are pointers,
543 a physical address to relative address conversion is required before copying
544 this PAD into the variable.
546 @param[in] PadId Pointer of PAD ID.
547 @param[in, out] Data Pointer of PAD Data.
552 IN EFI_IPSEC_PAD_ID
*PadId
,
553 IN OUT EFI_IPSEC_PAD_DATA
*Data
557 Recover the value of some members of SPD Selector.
559 This function is corresponding to FixSpdEntry(). It recovers the value of members
560 of SPD Selector which fix by the FixSpdEntry().
562 @param[in, out] Selector Pointer of SPD Selector.
563 @param[in, out] Data Pointer of SPD Data.
568 IN OUT EFI_IPSEC_SPD_SELECTOR
*Selector
,
569 IN OUT EFI_IPSEC_SPD_DATA
*Data
574 Recover the value of some members of SA ID.
576 This function is corresponding to FixSadEntry(). It recovers the value of members
577 of SAD ID which fix by the FixSadEntry().
579 @param[in, out] SaId Pointer of SAD ID
580 @param[in, out] Data Pointer of SAD Data.
585 IN OUT EFI_IPSEC_SA_ID
*SaId
,
586 IN OUT EFI_IPSEC_SA_DATA2
*Data
590 Recover the value of some members of PAD ID.
592 This function is corresponding to FixPadEntry(). It recovers the value of members
593 of PAD ID which fix by the FixPadEntry().
595 @param[in] PadId Pointer of PAD ID
596 @param[in, out] Data Pointer of PAD Data.
601 IN EFI_IPSEC_PAD_ID
*PadId
,
602 IN OUT EFI_IPSEC_PAD_DATA
*Data
606 Set the security policy information for the EFI IPsec driver.
608 The IPsec configuration data has a unique selector/identifier separately to
609 identify a data entry.
611 @param[in] Selector Pointer to an entry selector on operated
612 configuration data specified by DataType.
613 A NULL Selector causes the entire specified-type
614 configuration information to be flushed.
615 @param[in] Data The data buffer to be set. The structure
616 of the data buffer should be EFI_IPSEC_SPD_DATA.
617 @param[in] Context Pointer to one entry selector that describes
618 the expected position the new data entry will
619 be added. If Context is NULL,the new entry will
620 be appended the end of database.
622 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
623 - Selector is not NULL and its LocalAddress
624 is NULL or its RemoteAddress is NULL.
625 - Data is not NULL, its Action is Protected,
626 and its policy is NULL.
627 - Data is not NULL and its Action is not protected
628 and its policy is not NULL.
629 - The Action of Data is Protected, its policy
630 mode is Tunnel, and its tunnel option is NULL.
631 - The Action of Data is protected, its policy
632 mode is not Tunnel, and it tunnel option is not NULL.
633 @retval EFI_OUT_OF_RESOURCED The required system resource could not be allocated.
634 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
639 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
641 IN VOID
*Context OPTIONAL
645 Set the security association information for the EFI IPsec driver.
647 The IPsec configuration data has a unique selector/identifier separately to
648 identify a data entry.
650 @param[in] Selector Pointer to an entry selector on operated
651 configuration data specified by DataType.
652 A NULL Selector causes the entire specified-type
653 configuration information to be flushed.
654 @param[in] Data The data buffer to be set. The structure
655 of the data buffer should be EFI_IPSEC_SA_DATA.
656 @param[in] Context Pointer to one entry selector which describes
657 the expected position the new data entry will
658 be added. If Context is NULL,the new entry will
659 be appended to the end of database.
661 @retval EFI_OUT_OF_RESOURCED The required system resource could not be allocated.
662 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
667 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
669 IN VOID
*Context OPTIONAL
673 Set the peer authorization configuration information for the EFI IPsec driver.
675 The IPsec configuration data has a unique selector/identifier separately to
676 identify a data entry.
678 @param[in] Selector Pointer to an entry selector on operated
679 configuration data specified by DataType.
680 A NULL Selector causes the entire specified-type
681 configuration information to be flushed.
682 @param[in] Data The data buffer to be set. The structure
683 of the data buffer should be EFI_IPSEC_PAD_DATA.
684 @param[in] Context Pointer to one entry selector that describes
685 the expected position where the new data entry will
686 be added. If Context is NULL, the new entry will
687 be appended the end of database.
689 @retval EFI_OUT_OF_RESOURCED The required system resource could not be allocated.
690 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
695 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
697 IN VOID
*Context OPTIONAL
701 This function looks up the data entry from IPsec SPD, and returns the configuration
702 value of the specified SPD Entry.
704 @param[in] Selector Pointer to an entry selector which is an identifier
706 @param[in, out] DataSize On output the size of data returned in Data.
707 @param[out] Data The buffer to return the contents of the IPsec
708 configuration data. The type of the data buffer
709 is associated with the DataType.
711 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
712 @retval EFI_INVALID_PARAMETER Data is NULL and *DataSize is not zero.
713 @retval EFI_NOT_FOUND The configuration data specified by Selector is not found.
714 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. DataSize has been
715 updated with the size needed to complete the request.
720 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
721 IN OUT UINTN
*DataSize
,
726 This function looks up the data entry from IPsec SAD and returns the configuration
727 value of the specified SAD Entry.
729 @param[in] Selector Pointer to an entry selector that is an identifier
731 @param[in, out] DataSize On output, the size of data returned in Data.
732 @param[out] Data The buffer to return the contents of the IPsec
733 configuration data. This type of the data buffer
734 is associated with the DataType.
736 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
737 @retval EFI_NOT_FOUND The configuration data specified by Selector is not found.
738 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. DataSize has been
739 updated with the size needed to complete the request.
744 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
745 IN OUT UINTN
*DataSize
,
750 This function looks up the data entry from IPsec PADand returns the configuration
751 value of the specified PAD Entry.
753 @param[in] Selector Pointer to an entry selector that is an identifier
755 @param[in, out] DataSize On output the size of data returned in Data.
756 @param[out] Data The buffer to return the contents of the IPsec
757 configuration data. This type of the data buffer
758 is associated with the DataType.
760 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
761 @retval EFI_NOT_FOUND The configuration data specified by Selector is not found.
762 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. DataSize has been
763 updated with the size needed to complete the request.
768 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
769 IN OUT UINTN
*DataSize
,
774 Return the configuration value for the EFI IPsec driver.
776 This function lookup the data entry from IPsec database or IKEv2 configuration
777 information. The expected data type and unique identification are described in
778 DataType and Selector parameters.
780 @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance.
781 @param[in] DataType The type of data to retrieve.
782 @param[in] Selector Pointer to an entry selector that is an identifier of the IPsec
783 configuration data entry.
784 @param[in, out] DataSize On output the size of data returned in Data.
785 @param[out] Data The buffer to return the contents of the IPsec configuration data.
786 The type of the data buffer is associated with the DataType.
788 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
789 @retval EFI_INVALID_PARAMETER One or more of the followings are TRUE:
793 - Data is NULL and *DataSize is not zero
794 @retval EFI_NOT_FOUND The configuration data specified by Selector is not found.
795 @retval EFI_UNSUPPORTED The specified DataType is not supported.
796 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. DataSize has been
797 updated with the size needed to complete the request.
802 EfiIpSecConfigGetData (
803 IN EFI_IPSEC_CONFIG_PROTOCOL
*This
,
804 IN EFI_IPSEC_CONFIG_DATA_TYPE DataType
,
805 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
806 IN OUT UINTN
*DataSize
,
811 Set the security association, security policy and peer authorization configuration
812 information for the EFI IPsec driver.
814 This function is used to set the IPsec configuration information of type DataType for
815 the EFI IPsec driver.
816 The IPsec configuration data has a unique selector/identifier separately to identify
817 a data entry. The selector structure depends on DataType's definition.
818 Using SetData() with a Data of NULL causes the IPsec configuration data entry identified
819 by DataType and Selector to be deleted.
821 @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance.
822 @param[in] DataType The type of data to be set.
823 @param[in] Selector Pointer to an entry selector on operated configuration data
824 specified by DataType. A NULL Selector causes the entire
825 specified-type configuration information to be flushed.
826 @param[in] Data The data buffer to be set. The structure of the data buffer is
827 associated with the DataType.
828 @param[in] InsertBefore Pointer to one entry selector which describes the expected
829 position the new data entry will be added. If InsertBefore is NULL,
830 the new entry will be appended the end of database.
832 @retval EFI_SUCCESS The specified configuration entry data was set successfully.
833 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
835 @retval EFI_UNSUPPORTED The specified DataType is not supported.
836 @retval EFI_OUT_OF_RESOURCED The required system resource could not be allocated.
841 EfiIpSecConfigSetData (
842 IN EFI_IPSEC_CONFIG_PROTOCOL
*This
,
843 IN EFI_IPSEC_CONFIG_DATA_TYPE DataType
,
844 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
846 IN EFI_IPSEC_CONFIG_SELECTOR
*InsertBefore OPTIONAL
850 Enumerates the current selector for IPsec configuration data entry.
852 This function is called multiple times to retrieve the entry Selector in IPsec
853 configuration database. On each call to GetNextSelector(), the next entry
854 Selector are retrieved into the output interface.
856 If the entire IPsec configuration database has been iterated, the error
857 EFI_NOT_FOUND is returned.
858 If the Selector buffer is too small for the next Selector copy, an
859 EFI_BUFFER_TOO_SMALL error is returned, and SelectorSize is updated to reflect
860 the size of buffer needed.
862 On the initial call to GetNextSelector() to start the IPsec configuration database
863 search, a pointer to the buffer with all zero value is passed in Selector. Calls
864 to SetData() between calls to GetNextSelector may produce unpredictable results.
866 @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance.
867 @param[in] DataType The type of IPsec configuration data to retrieve.
868 @param[in, out] SelectorSize The size of the Selector buffer.
869 @param[in, out] Selector On input, supplies the pointer to last Selector that was
870 returned by GetNextSelector().
871 On output, returns one copy of the current entry Selector
874 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
875 @retval EFI_INVALID_PARAMETER One or more of the followings are TRUE:
877 - SelectorSize is NULL.
879 @retval EFI_NOT_FOUND The next configuration data entry was not found.
880 @retval EFI_UNSUPPORTED The specified DataType is not supported.
881 @retval EFI_BUFFER_TOO_SMALL The SelectorSize is too small for the result. This parameter
882 has been updated with the size needed to complete the search
888 EfiIpSecConfigGetNextSelector (
889 IN EFI_IPSEC_CONFIG_PROTOCOL
*This
,
890 IN EFI_IPSEC_CONFIG_DATA_TYPE DataType
,
891 IN OUT UINTN
*SelectorSize
,
892 IN OUT EFI_IPSEC_CONFIG_SELECTOR
*Selector
896 Register an event that is to be signaled whenever a configuration process on the
897 specified IPsec configuration information is done.
899 The register function is not surpport now and always returns EFI_UNSUPPORTED.
901 @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance.
902 @param[in] DataType The type of data to be registered the event for.
903 @param[in] Event The event to be registered.
905 @retval EFI_SUCCESS The event is registered successfully.
906 @retval EFI_INVALID_PARAMETER This is NULL, or Event is NULL.
907 @retval EFI_ACCESS_DENIED The Event is already registered for the DataType.
908 @retval EFI_UNSUPPORTED The notify registration unsupported, or the specified
909 DataType is not supported.
914 EfiIpSecConfigRegisterNotify (
915 IN EFI_IPSEC_CONFIG_PROTOCOL
*This
,
916 IN EFI_IPSEC_CONFIG_DATA_TYPE DataType
,
922 Remove the specified event that was previously registered on the specified IPsec
925 This function is not supported now and always returns EFI_UNSUPPORTED.
927 @param[in] This Pointer to the EFI_IPSEC_CONFIG_PROTOCOL instance.
928 @param[in] DataType The configuration data type to remove the registered event for.
929 @param[in] Event The event to be unregistered.
931 @retval EFI_SUCCESS The event was removed successfully.
932 @retval EFI_NOT_FOUND The Event specified by DataType could not be found in the
934 @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL.
935 @retval EFI_UNSUPPORTED The notify registration unsupported or the specified
936 DataType is not supported.
941 EfiIpSecConfigUnregisterNotify (
942 IN EFI_IPSEC_CONFIG_PROTOCOL
*This
,
943 IN EFI_IPSEC_CONFIG_DATA_TYPE DataType
,
947 extern LIST_ENTRY mConfigData
[IPsecConfigDataTypeMaximum
];