/** @file
The implementation of policy entry operation function in IpSecConfig application.
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "IpSecConfig.h"
#include "Indexer.h"
#include "Match.h"
#include "Helper.h"
#include "ForEach.h"
#include "PolicyEntryOperation.h"
/**
Fill in EFI_IPSEC_SPD_SELECTOR through ParamPackage list.
@param[out] Selector The pointer to the EFI_IPSEC_SPD_SELECTOR structure.
@param[in] ParamPackage The pointer to the ParamPackage list.
@param[in, out] Mask The pointer to the Mask.
@retval EFI_SUCCESS Fill in EFI_IPSEC_SPD_SELECTOR successfully.
@retval EFI_INVALID_PARAMETER Invalid user input parameter.
**/
)
{
//
// Convert user imput from string to integer, and fill in the member in EFI_IPSEC_SPD_SELECTOR.
//
-1,
-1,
NULL,
L"--local",
);
} else {
}
}
//
// Convert user imput from string to integer, and fill in the member in EFI_IPSEC_SPD_SELECTOR.
//
-1,
-1,
NULL,
L"--remote",
);
} else {
}
}
//
// Convert user imput from string to integer, and fill in the member in EFI_IPSEC_SPD_SELECTOR.
//
L"--proto",
(UINT16) -1,
sizeof (UINT16),
);
}
if (Status == EFI_INVALID_PARAMETER) {
}
//
// Convert user imput from string to integer, and fill in the member in EFI_IPSEC_SPD_SELECTOR.
//
-1,
-1,
NULL,
L"--local-port",
);
} else {
*Mask |= LOCAL_PORT;
}
}
//
// Convert user imput from string to integer, and fill in the member in EFI_IPSEC_SPD_SELECTOR.
//
-1,
-1,
NULL,
L"--remote-port",
);
} else {
*Mask |= REMOTE_PORT;
}
}
//
// Convert user imput from string to integer, and fill in the member in EFI_IPSEC_SPD_SELECTOR.
//
L"--icmp-type",
(UINT8) -1,
sizeof (UINT16),
NULL,
);
}
if (Status == EFI_INVALID_PARAMETER) {
}
//
// Convert user imput from string to integer, and fill in the member in EFI_IPSEC_SPD_SELECTOR.
//
L"--icmp-code",
(UINT8) -1,
sizeof (UINT16),
NULL,
);
}
if (Status == EFI_INVALID_PARAMETER) {
}
return ReturnStatus;
}
/**
Fill in EFI_IPSEC_SPD_SELECTOR and EFI_IPSEC_SPD_DATA through ParamPackage list.
@param[out] Selector The pointer to the EFI_IPSEC_SPD_SELECTOR structure.
@param[out] Data The pointer to the EFI_IPSEC_SPD_DATA structure.
@param[in] ParamPackage The pointer to the ParamPackage list.
@param[out] Mask The pointer to the Mask.
@param[in] CreateNew The switch to create new.
@retval EFI_SUCCESS Fill in EFI_IPSEC_SPD_SELECTOR and EFI_IPSEC_SPD_DATA successfully.
@retval EFI_INVALID_PARAMETER Invalid user input parameter.
**/
)
{
*Mask = 0;
//
// SPD DATA
// NOTE: Allocate enough memory and add padding for different arch.
//
DataSize += sizeof (EFI_IPSEC_TUNNEL_OPTION);
(*Data + 1),
sizeof (UINTN)
);
sizeof (UINTN)
);
//
// Convert user imput from string to integer, and fill in the Name in EFI_IPSEC_SPD_DATA.
//
}
//
// Convert user imput from string to integer, and fill in the PackageFlag in EFI_IPSEC_SPD_DATA.
//
L"--packet-flag",
(UINT8) -1,
&(*Data)->PackageFlag,
sizeof (UINT32),
NULL,
);
*Mask |= PACKET_FLAG;
}
if (Status == EFI_INVALID_PARAMETER) {
}
//
// Convert user imput from string to integer, and fill in the Action in EFI_IPSEC_SPD_DATA.
//
L"--action",
(UINT8) -1,
sizeof (UINT32),
);
}
if (Status == EFI_INVALID_PARAMETER) {
}
//
// Convert user imput from string to integer, and fill in the ExtSeqNum in EFI_IPSEC_SPD_DATA.
//
*Mask |= EXT_SEQUENCE;
*Mask |= EXT_SEQUENCE;
}
//
// Convert user imput from string to integer, and fill in the SeqOverflow in EFI_IPSEC_SPD_DATA.
//
*Mask |= SEQUENCE_OVERFLOW;
*Mask |= SEQUENCE_OVERFLOW;
}
//
// Convert user imput from string to integer, and fill in the FragCheck in EFI_IPSEC_SPD_DATA.
//
*Mask |= FRAGMENT_CHECK;
*Mask |= FRAGMENT_CHECK;
}
//
// Convert user imput from string to integer, and fill in the ProcessingPolicy in EFI_IPSEC_SPD_DATA.
//
L"--lifebyte",
(UINT64) -1,
sizeof (UINT64),
NULL,
);
}
if (Status == EFI_INVALID_PARAMETER) {
}
L"--lifetime",
(UINT64) -1,
sizeof (UINT64),
NULL,
);
}
if (Status == EFI_INVALID_PARAMETER) {
}
L"--lifetime-soft",
(UINT64) -1,
sizeof (UINT64),
NULL,
);
*Mask |= LIFETIME_SOFT;
}
if (Status == EFI_INVALID_PARAMETER) {
}
L"--mode",
0,
sizeof (UINT32),
);
}
if (Status == EFI_INVALID_PARAMETER) {
}
Status = EfiInetAddr2 ((CHAR16 *) ValueStr, &(*Data)->ProcessingPolicy->TunnelOption->LocalTunnelAddress);
-1,
-1,
NULL,
L"--tunnel-local",
);
} else {
*Mask |= TUNNEL_LOCAL;
}
}
Status = EfiInetAddr2 ((CHAR16 *) ValueStr, &(*Data)->ProcessingPolicy->TunnelOption->RemoteTunnelAddress);
-1,
-1,
NULL,
L"--tunnel-remote",
);
} else {
*Mask |= TUNNEL_REMOTE;
}
}
L"--dont-fragment",
0,
sizeof (UINT32),
);
*Mask |= DONT_FRAGMENT;
}
if (Status == EFI_INVALID_PARAMETER) {
}
L"--ipsec-proto",
0,
sizeof (UINT32),
);
*Mask |= IPSEC_PROTO;
}
if (Status == EFI_INVALID_PARAMETER) {
}
L"--encrypt-algo",
0,
sizeof (UINT8),
);
*Mask |= ENCRYPT_ALGO;
}
if (Status == EFI_INVALID_PARAMETER) {
}
L"--auth-algo",
0,
sizeof (UINT8),
);
}
if (Status == EFI_INVALID_PARAMETER) {
}
//
// Cannot check Mode against EfiIPsecTunnel, because user may want to change tunnel_remote only so the Mode is not set.
//
}
//
// User may not provide additional parameter for Protect action, so we cannot simply set ProcessingPolicy to NULL.
//
}
}
if (CreateNew) {
-1,
-1,
NULL,
L"--local --remote --proto --action"
);
-1,
-1,
NULL,
L"--tunnel-local --tunnel-remote"
);
}
}
return ReturnStatus;
}
/**
Fill in EFI_IPSEC_SA_ID and EFI_IPSEC_SA_DATA2 through ParamPackage list.
@param[out] SaId The pointer to the EFI_IPSEC_SA_ID structure.
@param[out] Data The pointer to the EFI_IPSEC_SA_DATA2 structure.
@param[in] ParamPackage The pointer to the ParamPackage list.
@param[out] Mask The pointer to the Mask.
@param[in] CreateNew The switch to create new.
@retval EFI_SUCCESS Fill in EFI_IPSEC_SA_ID and EFI_IPSEC_SA_DATA2 successfully.
@retval EFI_INVALID_PARAMETER Invalid user input parameter.
**/
)
{
*Mask = 0;
AuthKeyLength = 0;
EncKeyLength = 0;
//
// Convert user imput from string to integer, and fill in the Spi in EFI_IPSEC_SA_ID.
//
Status = GetNumber (L"--spi", (UINT32) -1, &(*SaId)->Spi, sizeof (UINT32), NULL, ParamPackage, FORMAT_NUMBER);
}
if (Status == EFI_INVALID_PARAMETER) {
}
//
// Convert user imput from string to integer, and fill in the Proto in EFI_IPSEC_SA_ID.
//
L"--ipsec-proto",
0,
sizeof (EFI_IPSEC_PROTOCOL_TYPE),
);
*Mask |= IPSEC_PROTO;
}
if (Status == EFI_INVALID_PARAMETER) {
}
//
// Convert user imput from string to integer, and fill in EFI_IPSEC_SA_DATA2.
//
}
}
//
// EFI_IPSEC_SA_DATA2:
// +------------
// | EFI_IPSEC_SA_DATA2
// +-----------------------
// | AuthKey
// +-------------------------
// | EncKey
// +-------------------------
// | SpdSelector
//
// Notes: To make sure the address alignment add padding after each data if needed.
//
DataSize += sizeof (EFI_IP_ADDRESS_INFO);
sizeof (UINTN)
);
sizeof (UINTN)
);
sizeof (UINTN));
sizeof (UINTN)
);
L"--mode",
0,
sizeof (EFI_IPSEC_MODE),
);
}
if (Status == EFI_INVALID_PARAMETER) {
}
//
// According to RFC 4303-3.3.3. The first packet sent using a given SA
// will contain a sequence number of 1.
//
L"--sequence-number",
(UINT64) -1,
sizeof (UINT64),
NULL,
);
*Mask |= SEQUENCE_NUMBER;
}
if (Status == EFI_INVALID_PARAMETER) {
}
(*Data)->AntiReplayWindows = 0;
L"--antireplay-window",
(UINT8) -1,
&(*Data)->AntiReplayWindows,
sizeof (UINT8),
NULL,
);
*Mask |= SEQUENCE_NUMBER;
}
if (Status == EFI_INVALID_PARAMETER) {
}
L"--encrypt-algo",
0,
sizeof (UINT8),
);
*Mask |= ENCRYPT_ALGO;
}
if (Status == EFI_INVALID_PARAMETER) {
}
*Mask |= ENCRYPT_KEY;
} else {
}
L"--auth-algo",
0,
sizeof (UINT8),
);
}
if (Status == EFI_INVALID_PARAMETER) {
}
} else {
}
L"--lifebyte",
(UINT64) -1,
sizeof (UINT64),
NULL,
);
}
if (Status == EFI_INVALID_PARAMETER) {
}
L"--lifetime",
(UINT64) -1,
sizeof (UINT64),
NULL,
);
}
if (Status == EFI_INVALID_PARAMETER) {
}
L"--lifetime-soft",
(UINT64) -1,
sizeof (UINT64),
NULL,
);
*Mask |= LIFETIME_SOFT;
}
if (Status == EFI_INVALID_PARAMETER) {
}
L"--path-mtu",
(UINT32) -1,
sizeof (UINT32),
NULL,
);
}
if (Status == EFI_INVALID_PARAMETER) {
}
//
// Convert user imput from string to integer, and fill in the DestAddress in EFI_IPSEC_SA_ID.
//
-1,
-1,
NULL,
L"--tunnel-dest",
);
} else {
}
}
//
// Convert user input from string to integer, and fill in the DestAddress in EFI_IPSEC_SA_ID.
//
-1,
-1,
NULL,
L"--tunnel-source",
);
} else {
}
}
//
// If it is TunnelMode, then check if the tunnel-source and --tunnel-dest are set
//
-1,
-1,
NULL,
L"--tunnel-source --tunnel-dest"
);
}
}
if (CreateNew) {
-1,
-1,
NULL,
L"--spi --ipsec-proto --local --remote"
);
} else {
-1,
-1,
NULL,
L"--auth-algo"
);
} else if ((*Data)->AlgoInfo.EspAlgoInfo.AuthAlgoId != IPSEC_AALG_NONE && (*Mask & AUTH_KEY) == 0) {
-1,
-1,
NULL,
L"--auth-key"
);
}
} else {
-1,
-1,
NULL,
L"--encrypt-algo --auth-algo"
);
} else if ((*Data)->AlgoInfo.EspAlgoInfo.EncAlgoId != IPSEC_EALG_NONE && (*Mask & ENCRYPT_KEY) == 0) {
-1,
-1,
NULL,
L"--encrypt-key"
);
} else if ((*Data)->AlgoInfo.EspAlgoInfo.AuthAlgoId != IPSEC_AALG_NONE && (*Mask & AUTH_KEY) == 0) {
-1,
-1,
NULL,
L"--auth-key"
);
}
}
}
}
return ReturnStatus;
}
/**
Fill in EFI_IPSEC_PAD_ID and EFI_IPSEC_PAD_DATA through ParamPackage list.
@param[out] PadId The pointer to the EFI_IPSEC_PAD_ID structure.
@param[out] Data The pointer to the EFI_IPSEC_PAD_DATA structure.
@param[in] ParamPackage The pointer to the ParamPackage list.
@param[out] Mask The pointer to the Mask.
@param[in] CreateNew The switch to create new.
@retval EFI_SUCCESS Fill in EFI_IPSEC_PAD_ID and EFI_IPSEC_PAD_DATA successfully.
@retval EFI_INVALID_PARAMETER Invalid user input parameter.
**/
)
{
*Mask = 0;
AuthDataLength = 0;
RevocationDataLength = 0;
//
// Convert user imput from string to integer, and fill in EFI_IPSEC_PAD_ID.
//
-1,
-1,
NULL,
L"--peer-address",
);
} else {
*Mask |= PEER_ADDRESS;
}
}
}
if (ValueStr[0] == L'@') {
//
// Input is a file: --auth-data "@fs1:\My Certificates\tom.dat"
//
-1,
-1,
NULL,
&ValueStr[1]
);
} else {
-1,
-1,
NULL,
&ValueStr[1]
);
} else {
}
}
} else {
}
}
}
//
// Allocate Buffer for Data. Add padding after each struct to make sure the alignment
// in different Arch.
//
(*Data)->RevocationData = (VOID *) ALIGN_POINTER (((UINT8 *) (*Data + 1) + AuthDataLength), sizeof (UINTN));
//
// Convert user imput from string to integer, and fill in EFI_IPSEC_PAD_DATA.
//
L"--auth-proto",
0,
&(*Data)->AuthProtocol,
sizeof (EFI_IPSEC_AUTH_PROTOCOL_TYPE),
);
*Mask |= AUTH_PROTO;
}
if (Status == EFI_INVALID_PARAMETER) {
}
L"--auth-method",
0,
&(*Data)->AuthMethod,
sizeof (EFI_IPSEC_AUTH_METHOD),
);
*Mask |= AUTH_METHOD;
}
if (Status == EFI_INVALID_PARAMETER) {
}
}
}
if (ValueStr[0] == L'@') {
//
// Input is a file: --auth-data "@fs1:\My Certificates\tom.dat"
//
-1,
-1,
NULL,
&ValueStr[1]
);
} else {
-1,
-1,
NULL,
&ValueStr[1]
);
} else {
}
}
} else {
}
}
}
*Mask |= REVOCATION_DATA;
} else {
}
if (CreateNew) {
-1,
-1,
NULL,
L"--peer-id --peer-address"
);
-1,
-1,
NULL,
L"--auth-method --auth-data"
);
}
}
return ReturnStatus;
}
};
/**
Combine old SPD entry with new SPD entry.
@param[in, out] OldSelector The pointer to the EFI_IPSEC_SPD_SELECTOR structure.
@param[in, out] OldData The pointer to the EFI_IPSEC_SPD_DATA structure.
@param[in] NewSelector The pointer to the EFI_IPSEC_SPD_SELECTOR structure.
@param[in] NewData The pointer to the EFI_IPSEC_SPD_DATA structure.
@param[in] Mask The pointer to the Mask.
@param[out] CreateNew The switch to create new.
@retval EFI_SUCCESS Combined successfully.
@retval EFI_INVALID_PARAMETER Invalid user input parameter.
**/
)
{
//
// Process Selector
//
(CompareMem (NewSelector->LocalAddress, OldSelector->LocalAddress, NewSelector->LocalAddressCount * sizeof (EFI_IP_ADDRESS_INFO)) != 0)) {
}
(CompareMem (NewSelector->RemoteAddress, OldSelector->RemoteAddress, NewSelector->RemoteAddressCount * sizeof (EFI_IP_ADDRESS_INFO)) != 0)) {
}
}
switch (NewSelector->NextLayerProtocol) {
case EFI_IP4_PROTO_TCP:
case EFI_IP4_PROTO_UDP:
if ((Mask & LOCAL_PORT) == 0) {
}
if ((Mask & REMOTE_PORT) == 0) {
}
break;
case EFI_IP4_PROTO_ICMP:
}
}
break;
}
//
// Process Data
//
}
if ((Mask & PACKET_FLAG) != 0) {
}
}
} else {
//
// Protect
//
//
// Just point to new data if originally NULL.
//
) {
//
//
-1,
-1,
NULL,
L"--tunnel-local --tunnel-remote"
);
return EFI_INVALID_PARAMETER;
}
} else {
//
// Modify some of the data.
//
if ((Mask & EXT_SEQUENCE) != 0) {
}
if ((Mask & SEQUENCE_OVERFLOW) != 0) {
}
if ((Mask & FRAGMENT_CHECK) != 0) {
}
}
if ((Mask & LIFETIME_SOFT) != 0) {
OldData->ProcessingPolicy->SaLifetime.SoftLifetime = NewData->ProcessingPolicy->SaLifetime.SoftLifetime;
}
OldData->ProcessingPolicy->SaLifetime.HardLifetime = NewData->ProcessingPolicy->SaLifetime.HardLifetime;
}
}
if ((Mask & IPSEC_PROTO) != 0) {
}
}
if ((Mask & ENCRYPT_ALGO) != 0) {
}
} else {
//
// Set from Transport mode to Tunnel mode, should ensure TUNNEL_LOCAL & TUNNEL_REMOTE both exists.
//
-1,
-1,
NULL,
L"--tunnel-local --tunnel-remote"
);
return EFI_INVALID_PARAMETER;
}
} else {
if ((Mask & TUNNEL_LOCAL) != 0) {
CopyMem (
sizeof (EFI_IP_ADDRESS)
);
}
if ((Mask & TUNNEL_REMOTE) != 0) {
CopyMem (
sizeof (EFI_IP_ADDRESS)
);
}
if ((Mask & DONT_FRAGMENT) != 0) {
}
}
}
}
}
return EFI_SUCCESS;
}
/**
Combine old SAD entry with new SAD entry.
@param[in, out] OldSaId The pointer to the EFI_IPSEC_SA_ID structure.
@param[in, out] OldData The pointer to the EFI_IPSEC_SA_DATA2 structure.
@param[in] NewSaId The pointer to the EFI_IPSEC_SA_ID structure.
@param[in] NewData The pointer to the EFI_IPSEC_SA_DATA2 structure.
@param[in] Mask The pointer to the Mask.
@param[out] CreateNew The switch to create new.
@retval EFI_SUCCESS Combined successfully.
@retval EFI_INVALID_PARAMETER Invalid user input parameter.
**/
)
{
}
if ((Mask & IPSEC_PROTO) == 0) {
}
CopyMem (&NewData->TunnelDestinationAddress, &OldData->TunnelDestinationAddress, sizeof (EFI_IP_ADDRESS));
} else if (CompareMem (&NewData->TunnelDestinationAddress, &OldData->TunnelDestinationAddress, sizeof (EFI_IP_ADDRESS)) != 0) {
}
} else if (CompareMem (&NewData->TunnelSourceAddress, &OldData->TunnelSourceAddress, sizeof (EFI_IP_ADDRESS)) != 0) {
}
//
// Process SA_DATA.
//
}
if ((Mask & SEQUENCE_NUMBER) != 0) {
}
if ((Mask & ANTIREPLAY_WINDOW) != 0) {
}
}
}
if ((Mask & ENCRYPT_ALGO) != 0) {
}
if ((Mask & ENCRYPT_KEY) != 0) {
}
//
// Should not provide encrypt_* if AH.
//
-1,
-1,
NULL,
L"--encrypt-algo --encrypt-key"
);
return EFI_INVALID_PARAMETER;
}
}
//
// AH -> ESP
// Should provide encrypt_algo at least.
//
if ((Mask & ENCRYPT_ALGO) == 0) {
-1,
-1,
NULL,
L"--encrypt-algo"
);
return EFI_INVALID_PARAMETER;
}
//
// Encrypt_key should be provided if algorithm is not NONE.
//
-1,
-1,
NULL,
L"--encrypt-algo"
);
return EFI_INVALID_PARAMETER;
}
}
}
if ((Mask & LIFETIME_SOFT) != 0) {
}
}
}
//
// Process SpdSelector.
//
-1,
-1,
NULL,
L"--local --remote --proto"
);
return EFI_INVALID_PARAMETER;
}
}
} else {
}
}
}
case EFI_IP4_PROTO_TCP:
case EFI_IP4_PROTO_UDP:
if ((Mask & LOCAL_PORT) != 0) {
}
if ((Mask & REMOTE_PORT) != 0) {
}
break;
case EFI_IP4_PROTO_ICMP:
}
}
break;
}
}
}
return EFI_SUCCESS;
}
/**
Combine old PAD entry with new PAD entry.
@param[in, out] OldPadId The pointer to the EFI_IPSEC_PAD_ID structure.
@param[in, out] OldData The pointer to the EFI_IPSEC_PAD_DATA structure.
@param[in] NewPadId The pointer to the EFI_IPSEC_PAD_ID structure.
@param[in] NewData The pointer to the EFI_IPSEC_PAD_DATA structure.
@param[in] Mask The pointer to the Mask.
@param[out] CreateNew The switch to create new.
@retval EFI_SUCCESS Combined successfully.
@retval EFI_INVALID_PARAMETER Invalid user input parameter.
**/
)
{
} else {
if (OldPadId->PeerIdValid) {
}
} else {
}
} else {
//
// MASK & PEER_ADDRESS
//
if (OldPadId->PeerIdValid) {
} else {
if ((CompareMem (&OldPadId->Id.IpAddress.Address, &NewPadId->Id.IpAddress.Address, sizeof (EFI_IP_ADDRESS)) != 0) ||
}
}
}
}
if ((Mask & AUTH_PROTO) != 0) {
}
if ((Mask & AUTH_METHOD) != 0) {
}
}
}
if ((Mask & REVOCATION_DATA) != 0) {
}
return EFI_SUCCESS;
}
};
/**
Edit entry information in the database.
@param[in] Selector The pointer to the EFI_IPSEC_CONFIG_SELECTOR structure.
@param[in] Data The pointer to the data.
@param[in] Context The pointer to the INSERT_POLICY_ENTRY_CONTEXT structure.
@retval EFI_SUCCESS Continue the iteration.
@retval EFI_ABORTED Abort the iteration.
**/
)
{
Data,
);
if (CreateNew) {
//
// Insert new entry before old entry
//
Data,
);
//
// Delete old entry
//
NULL,
);
} else {
Data,
);
}
}
return EFI_ABORTED;
}
return EFI_SUCCESS;
}
/**
Edit entry information in database according to datatype.
@param[in] DataType The value of EFI_IPSEC_CONFIG_DATA_TYPE.
@param[in] ParamPackage The pointer to the ParamPackage list.
@retval EFI_SUCCESS Edit entry information successfully.
@retval EFI_NOT_FOUND Can't find the specified entry.
@retval Others Some mistaken case.
**/
)
{
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_INDEX_NOT_SPECIFIED), mHiiHandle, mAppName, ValueStr);
return EFI_NOT_FOUND;
}
Status = mCreatePolicyEntry[DataType] (&Context.Selector, &Context.Data, ParamPackage, &Context.Mask, FALSE);
}
}
}
}
if (Status == EFI_NOT_FOUND) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_INDEX_NOT_FOUND), mHiiHandle, mAppName, ValueStr);
}
return Status;
}
/**
Insert entry information in database.
@param[in] Selector The pointer to the EFI_IPSEC_CONFIG_SELECTOR structure.
@param[in] Data The pointer to the data.
@param[in] Context The pointer to the INSERT_POLICY_ENTRY_CONTEXT structure.
@retval EFI_SUCCESS Continue the iteration.
@retval EFI_ABORTED Abort the iteration.
**/
)
{
//
// Found the entry which we want to insert before.
//
);
//
// Abort the iteration after the insertion.
//
return EFI_ABORTED;
}
return EFI_SUCCESS;
}
/**
Insert or add entry information in database according to datatype.
@param[in] DataType The value of EFI_IPSEC_CONFIG_DATA_TYPE.
@param[in] ParamPackage The pointer to the ParamPackage list.
@retval EFI_SUCCESS Insert or add entry information successfully.
@retval EFI_NOT_FOUND Can't find the specified entry.
@retval EFI_BUFFER_TOO_SMALL The entry already existed.
@retval EFI_UNSUPPORTED The operation is not supported.
@retval Others Some mistaken case.
**/
)
{
//
// Find if the Selector to be inserted already exists.
//
DataSize = 0;
&DataSize,
);
if (Status == EFI_BUFFER_TOO_SMALL) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_ALREADY_EXISTS), mHiiHandle, mAppName);
Data,
);
} else {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_INDEX_NOT_SPECIFIED), mHiiHandle, mAppName, ValueStr);
return EFI_NOT_FOUND;
}
if (Status == EFI_NOT_FOUND) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_INDEX_NOT_FOUND), mHiiHandle, mAppName, ValueStr);
}
}
}
}
if (Status == EFI_UNSUPPORTED) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_INSERT_UNSUPPORT), mHiiHandle, mAppName);
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_INSERT_FAILED), mHiiHandle, mAppName);
}
return Status;
}