NetworkPkg/IpSecDxe/IkeService.c File Reference


Functions

IKE_UDP_SERVICEIkeLookupUdp (IN IPSEC_PRIVATE_DATA *Private, IN EFI_HANDLE Handle, IN UINT8 IpVersion)
EFI_STATUS EFIAPI IkeConfigUdp4 (IN UDP_IO *UdpIo, IN VOID *Context)
EFI_STATUS EFIAPI IkeConfigUdp6 (IN UDP_IO *UdpIo, IN VOID *Context)
EFI_STATUS IkeOpenOutputUdp (IN IKE_UDP_SERVICE *UdpService, IN EFI_IP_ADDRESS *RemoteIp)
EFI_STATUS IkeOpenInputUdp4 (IN IPSEC_PRIVATE_DATA *Private, IN EFI_HANDLE Controller, IN EFI_HANDLE ImageHandle)
EFI_STATUS IkeOpenInputUdp6 (IN IPSEC_PRIVATE_DATA *Private, IN EFI_HANDLE Controller, IN EFI_HANDLE ImageHandle)
EFI_STATUS IkeNegotiate (IN IKE_UDP_SERVICE *UdpService, IN IPSEC_SPD_ENTRY *SpdEntry, IN EFI_IP_ADDRESS *RemoteIp)
VOID EFIAPI IkeDispatch (IN NET_BUF *Packet, IN UDP_END_POINT *EndPoint, IN EFI_STATUS IoStatus, IN VOID *Context)
VOID IkeDeleteAllSas (IN IPSEC_PRIVATE_DATA *Private, IN BOOLEAN IsDisableIpsec)

Variables

IKE_EXCHANGE_INTERFACEmIkeExchange []
EFI_UDP4_CONFIG_DATA mUdp4Conf
EFI_UDP6_CONFIG_DATA mUdp6Conf

Detailed Description

Provide IPsec Key Exchange (IKE) service general interfaces.

Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.

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 http://opensource.org/licenses/bsd-license.php.

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.


Function Documentation

EFI_STATUS EFIAPI IkeConfigUdp4 ( IN UDP_IO *  UdpIo,
IN VOID *  Context 
)

Configure a UDPIO's UDP4 instance.

This fuction is called by the UdpIoCreateIo() to configures a UDP4 instance.

Parameters:
[in] UdpIo The UDP_IO to be configured.
[in] Context User-defined data when calling UdpIoCreateIo().
Return values:
EFI_SUCCESS The configuration succeeded.
Others The UDP4 instance fails to configure.

References mUdp4Conf.

Referenced by IkeOpenInputUdp4(), and IkeOpenOutputUdp().

EFI_STATUS EFIAPI IkeConfigUdp6 ( IN UDP_IO *  UdpIo,
IN VOID *  Context 
)

Configure a UDPIO's UDP6 instance.

This fuction is called by the UdpIoCreateIo()to configure a UDP6 instance.

Parameters:
[in] UdpIo The UDP_IO to be configured.
[in] Context User-defined data when calling UdpIoCreateIo().
Return values:
EFI_SUCCESS The configuration succeeded.
Others The configuration fails.

References mUdp6Conf.

Referenced by IkeOpenInputUdp6(), and IkeOpenOutputUdp().

VOID IkeDeleteAllSas ( IN IPSEC_PRIVATE_DATA Private,
IN BOOLEAN  IsDisableIpsec 
)

Delete all established IKE SAs and related Child SAs.

This function is the subfunction of the IpSecCleanupAllSa(). It first calls IkeDeleteChildSa() to delete all Child SAs then send out the related Information packet.

Parameters:
[in] Private Pointer of the IPSEC_PRIVATE_DATA
[in] IsDisableIpsec Indicate whether needs to disable IPsec.

References IkeGetVersionFromSession(), IkeStateSaDeleting, IKEV2_SA_SESSION_BY_SESSION, Ikev2SaSessionFree(), IPSEC_STATUS_DISABLED, IPSECCONFIG_STATUS_NAME, _IKE_EXCHANGE_INTERFACE::NegotiateInfo, IKEV2_SA_SESSION::SessionCommon, and IKEV2_SESSION_COMMON::State.

Referenced by IpSecCleanupAllSa().

VOID EFIAPI IkeDispatch ( IN NET_BUF *  Packet,
IN UDP_END_POINT *  EndPoint,
IN EFI_STATUS  IoStatus,
IN VOID *  Context 
)

The generic interface when receive a IKE packet.

This function is called when UDP IO receives a IKE packet.

Parameters:
[in] Packet Point to received IKE packet.
[in] EndPoint Point to UDP_END_POINT which contains the information of Remote IP and Port.
[in] IoStatus The Status of Recieve Token.
[in] Context Point to data passed from the caller.

References IKE_HEADER::ExchangeType, _IKE_EXCHANGE_INTERFACE::HandleChildSa, _IKE_EXCHANGE_INTERFACE::HandleInfo, _IKE_EXCHANGE_INTERFACE::HandleSa, IKE_PACKET::Header, IKE_DEFAULT_PORT, IKE_MAJOR_VERSION, IKE_XCG_TYPE_AUTH, IKE_XCG_TYPE_CREATE_CHILD_SA, IKE_XCG_TYPE_IDENTITY_PROTECT, IKE_XCG_TYPE_INFO, IKE_XCG_TYPE_INFO2, IKE_XCG_TYPE_QM, IKE_XCG_TYPE_SA_INIT, IkeDispatch(), IkeOpenOutputUdp(), IkePacketFree(), IkePacketFromNetbuf(), IKE_UDP_SERVICE::Input, _IPSEC_PRIVATE_DATA::IpSec, IPSEC_PRIVATE_DATA_FROM_UDP4LIST, IPSEC_PRIVATE_DATA_FROM_UDP6LIST, IKE_UDP_SERVICE::IpVersion, IKE_UDP_SERVICE::ListHead, IKE_PACKET::RemotePeerIp, and IKE_HEADER::Version.

Referenced by IkeDispatch(), IkeOpenInputUdp4(), and IkeOpenInputUdp6().

IKE_UDP_SERVICE* IkeLookupUdp ( IN IPSEC_PRIVATE_DATA Private,
IN EFI_HANDLE  Handle,
IN UINT8  IpVersion 
)

Check if the NIC handle is binded to a Udp service.

Parameters:
[in] Private Pointer of IPSEC_PRIVATE_DATA.
[in] Handle The Handle of the NIC card.
[in] IpVersion The version of the IP stack.
Returns:
a pointer of IKE_UDP_SERVICE.

References IPSEC_UDP_SERVICE_FROM_LIST, and IKE_UDP_SERVICE::NicHandle.

Referenced by IkeOpenInputUdp4(), IkeOpenInputUdp6(), and IpSecLookupSadEntry().

EFI_STATUS IkeNegotiate ( IN IKE_UDP_SERVICE UdpService,
IN IPSEC_SPD_ENTRY SpdEntry,
IN EFI_IP_ADDRESS *  RemoteIp 
)

The general interface of starting IPsec Key Exchange.

This function is called when a IKE negotiation to start getting a Key.

Parameters:
[in] UdpService Point to IKE_UDP_SERVICE which will be used for IKE packet sending.
[in] SpdEntry Point to the SPD entry related to the IKE negotiation.
[in] RemoteIp Point to EFI_IP_ADDRESS related to the IKE negotiation.
Return values:
EFI_SUCCESS The Operation is successful.
EFI_ACCESS_DENIED No related PAD entry was found.
EFI_INVALID_PARAMETER The IKE version is not supported.

References _IPSEC_PAD_ENTRY::Data, IkeGetVersionFromSession(), IkeOpenOutputUdp(), _IPSEC_PRIVATE_DATA::Ikev2EstablishedList, Ikev2SaSessionLookup(), IPSEC_PRIVATE_DATA_FROM_UDP4LIST, IPSEC_PRIVATE_DATA_FROM_UDP6LIST, IpSecLookupPadEntry(), _IKE_EXCHANGE_INTERFACE::NegotiateChildSa, and _IKE_EXCHANGE_INTERFACE::NegotiateSa.

Referenced by IpSecLookupSadEntry().

EFI_STATUS IkeOpenInputUdp4 ( IN IPSEC_PRIVATE_DATA Private,
IN EFI_HANDLE  Controller,
IN EFI_HANDLE  ImageHandle 
)

Open and configure a UDPIO of Udp4 for IKE packet receiving.

This function is called at the IPsecDriverBinding start. IPsec create a UDP4 and UDP4 IO for each NIC handle.

Parameters:
[in] Private Point to IPSEC_PRIVATE_DATA
[in] Controller Handler for NIC card.
[in] ImageHandle The handle that contains the EFI_DRIVER_BINDING_PROTOCOL instance.
Return values:
EFI_SUCCESS The Operation is successful.
EFI_OUT_OF_RESOURCE The required system resource can't be allocated.

References IKE_UDP_SERVICE::DefaultAddress, IkeConfigUdp4(), IkeDispatch(), IkeLookupUdp(), IKE_UDP_SERVICE::ImageHandle, IKE_UDP_SERVICE::Input, IKE_UDP_SERVICE::IpVersion, IKE_UDP_SERVICE::IsConfigured, IKE_UDP_SERVICE::List, IKE_UDP_SERVICE::ListHead, and IKE_UDP_SERVICE::NicHandle.

Referenced by IpSecStart().

EFI_STATUS IkeOpenInputUdp6 ( IN IPSEC_PRIVATE_DATA Private,
IN EFI_HANDLE  Controller,
IN EFI_HANDLE  ImageHandle 
)

Open and configure a UDPIO of Udp6 for IKE packet receiving.

This function is called at the IPsecDriverBinding start. IPsec create a UDP6 and UDP6 IO for each NIC handle.

Parameters:
[in] Private Point to IPSEC_PRIVATE_DATA
[in] Controller Handler for NIC card.
[in] ImageHandle The handle that contains the EFI_DRIVER_BINDING_PROTOCOL instance.
Return values:
EFI_SUCCESS The Operation is successful.
EFI_OUT_OF_RESOURCE The required system resource can't be allocated.

References IKE_UDP_SERVICE::DefaultAddress, IkeConfigUdp6(), IkeDispatch(), IkeLookupUdp(), IKE_UDP_SERVICE::ImageHandle, IKE_UDP_SERVICE::Input, IKE_UDP_SERVICE::IpVersion, IKE_UDP_SERVICE::IsConfigured, IKE_UDP_SERVICE::List, IKE_UDP_SERVICE::ListHead, and IKE_UDP_SERVICE::NicHandle.

Referenced by IpSecStart().

EFI_STATUS IkeOpenOutputUdp ( IN IKE_UDP_SERVICE UdpService,
IN EFI_IP_ADDRESS *  RemoteIp 
)

Open and configure the related output UDPIO for IKE packet sending.

If the UdpService is not configured, this fuction calls UdpIoCreatIo() to create UDPIO to bind this UdpService for IKE packet sending. If the UdpService has already been configured, then return.

Parameters:
[in] UdpService The UDP_IO to be configured.
[in] RemoteIp User-defined data when calling UdpIoCreateIo().
Return values:
EFI_SUCCESS The configuration is successful.
Others The configuration fails.

References IkeConfigUdp4(), and IkeConfigUdp6().

Referenced by IkeDispatch(), and IkeNegotiate().


Variable Documentation

Initial value:

EFI_UDP4_CONFIG_DATA mUdp4Conf

Initial value:

 {
  FALSE,
  FALSE,
  FALSE,
  TRUE,
  
  
  
  0,
  64,
  FALSE,
  0,
  1000000,
  FALSE,
  {{0,0,0,0}},
  {{0,0,0,0}},
  IKE_DEFAULT_PORT,
  {{0,0,0,0}},
  0
}

Referenced by IkeConfigUdp4().

EFI_UDP6_CONFIG_DATA mUdp6Conf

Initial value:

 {
  FALSE,
  FALSE,
  TRUE,
  
  
  
  0,
  128,
  0,
  1000000,
  
  {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}},
  IKE_DEFAULT_PORT,
  {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}},
  0
}

Referenced by IkeConfigUdp6().


Generated on Mon Sep 28 08:49:06 2015 for NetworkPkg[ALL] by  doxygen 1.5.7.1