265 lines
9.6 KiB
C
265 lines
9.6 KiB
C
/*
|
|
******************************************************************************
|
|
* HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipike2_exchange_sa_init.h,v $ $Revision: 1.5.16.2 $
|
|
* $Source: /home/interpeak/CVSRoot/ipike/src/ipike2_exchange_sa_init.h,v $
|
|
* $Author: edahlber $ $Date: 2011-12-06 15:25:27 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Kenneth Jonsson <kenneth@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
#if !defined(IPIKE_EXCHANGE_SA_INIT_H) && defined(IPIKE_USE_VERSION2)
|
|
#define IPIKE_EXCHANGE_SA_INIT_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/* IKE SA INIT and AUTH exchange (IKE version 2) */
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
#include "ipike_config.h"
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#include "ipike.h"
|
|
#include "ipike_isakmp.h"
|
|
#include "ipike_sadb.h"
|
|
#include "ipike_payload.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_exchange_sa_init_print_keys
|
|
*===========================================================================
|
|
* Description:
|
|
* Parameters:
|
|
* Returns:
|
|
*/
|
|
IP_GLOBAL void
|
|
ipike_exchange_sa_init_print_keys(Ipike_keys *keys);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_exchange_sa_init_on_new_initiator
|
|
*===========================================================================
|
|
* Description: Creates a new IKE SA and creates a initiator cookie.
|
|
* Parameters: ie - the state of this exchange (this pointer).
|
|
* ike_sa - IKE SA (optional)
|
|
* not_used1 - parameter not used.
|
|
* not_used2 - parameter not used.
|
|
* Returns: Ipike standard error code.
|
|
*/
|
|
IP_PUBLIC Ipike_error
|
|
ipike_exchange_sa_init_on_new_initiator(
|
|
Ipike_isakmp_exchange* ie,
|
|
Ipike_sadb_entry* ike_sa,
|
|
const void* not_used1,
|
|
const void* not_used2);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_exchange_sa_init_on_new_responder
|
|
*===========================================================================
|
|
* Description: Creates a new IKE SA.
|
|
* Parameters: ie - the state of this exchange (this pointer).
|
|
* first_isakmp - the first message that was/will be sent in
|
|
* this exchange.
|
|
* local_addr - The local address the peer send messages to.
|
|
* peer_addr - The address of the peer IKE daemon.
|
|
* Returns: Ipike standard error code.
|
|
*/
|
|
IP_PUBLIC Ipike_error
|
|
ipike_exchange_sa_init_on_new_responder(
|
|
Ipike_isakmp_exchange* ie,
|
|
Ipike_isakmp_header* first_isakmp,
|
|
union Ip_sockaddr_union* local_addr,
|
|
union Ip_sockaddr_union* peer_addr);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_exchange_sa_init_on_delete
|
|
*===========================================================================
|
|
* Description: Updates the base initialization vector if the exchange
|
|
* was compleated successfully.
|
|
* Parameters: ie - the state of this exchange (this pointer).
|
|
* Returns:
|
|
*/
|
|
IP_PUBLIC void
|
|
ipike_exchange_sa_init_on_delete(Ipike_isakmp_exchange* ie);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_exchange_sa_init_get_payload_order
|
|
*===========================================================================
|
|
* Description: Returns a IPIKE_PAYLOAD_NONE terminated array of payload
|
|
* id:s that the ike sa init exchange message must contain.
|
|
* Parameters: ie - the state of this exchange.
|
|
* Returns: An array containing the payload IDs in the low byte
|
|
* and flags in the high byte.
|
|
*/
|
|
IP_PUBLIC const Ip_u16*
|
|
ipike_exchange_sa_init_get_payload_order(Ipike_isakmp_exchange* ie);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_exchange_sa_init_select_param
|
|
*===========================================================================
|
|
* Description:
|
|
* Parameters:
|
|
* Returns:
|
|
*/
|
|
IP_GLOBAL Ipike_error
|
|
ipike_exchange_sa_init_select_param(Ipike_isakmp_exchange *ie, struct Ipike_sadb_entry_struct *ike_sa);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_exchange_sa_init_process_payloads
|
|
*===========================================================================
|
|
* Description: Updates the SA structure bound to this exchange.
|
|
* Parameters: ie - the state of this exchange.
|
|
* isakmp - the ISAKMP message.
|
|
* Returns: IPIKE_SUCCESS
|
|
* IPIKE_OUT_OF_MEMORY
|
|
*/
|
|
IP_PUBLIC Ipike_error
|
|
ipike_exchange_sa_init_process_payloads(
|
|
Ipike_isakmp_exchange* ie,
|
|
Ipike_isakmp_header* isakmp);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_exchange_sa_init_add_reply_payloads
|
|
*===========================================================================
|
|
* Description: Adds all payloads that should part of the response.
|
|
* Parameters: ie - the state of this exchange (this pointer).
|
|
* reply_payloads - pointer to an array of payload pointers.
|
|
* The array will be allocated by this function.
|
|
* Returns: IPIKE_SUCCESS
|
|
* IPIKE_OUT_OF_MEMORY
|
|
* IPIKE_ISAKMP_UNSUPPORTED_PAYLOAD
|
|
*/
|
|
IP_PUBLIC Ipike_error
|
|
ipike_exchange_sa_init_add_reply_payloads(
|
|
Ipike_isakmp_exchange* ie,
|
|
Ipike_payload_header*** reply_payloads);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_exchange_sa_init_cleartext_outgoing_message
|
|
*===========================================================================
|
|
* Description: Does nothing (not needed in main mode)
|
|
* Parameters: ie - the state of this exchange.
|
|
* isakmp - the outgoing ISAKMP message.
|
|
* Returns: IPIKE_SUCCESS
|
|
*/
|
|
IP_PUBLIC Ipike_error
|
|
ipike_exchange_sa_init_cleartext_outgoing_message(
|
|
Ipike_isakmp_exchange* ie,
|
|
Ipike_isakmp_header** isakmp);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_exchange_sa_init_done
|
|
*===========================================================================
|
|
* Description: Stores the final IV.
|
|
* Parameters: ie - the parameters for the finished exchange.
|
|
* Returns: IPIKE_SUCCESS
|
|
* OUT_OF_MEMORY
|
|
*/
|
|
IP_PUBLIC Ipike_error
|
|
ipike_exchange_sa_init_done(Ipike_isakmp_exchange* ie);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_exchange_handle_error
|
|
*===========================================================================
|
|
* Description: Handle error codes for exchanges. The SA will be updated with
|
|
* the error if it may be handled.
|
|
* Parameters: ie - the state of this exchange.
|
|
* sa - the security association.
|
|
* err - the error code.
|
|
* Returns: IPIKE_SUCCESS
|
|
* err (same as input)
|
|
*/
|
|
IP_PUBLIC Ipike_error
|
|
ipike_exchange_handle_error(
|
|
Ipike_isakmp_exchange* ie,
|
|
Ipike_sadb_entry* sa,
|
|
Ipike_error err);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_exchange_generate_dh_key
|
|
*===========================================================================
|
|
* Description: Generate a diffie hellman key for the exchange.
|
|
* Parameters: ie - the state of this exchange.
|
|
* group - the diffie hellman group.
|
|
* Returns: IPIKE_SUCCESS
|
|
* IPIKE_ISAKMP_NO_PROPOSAL_CHOSEN
|
|
*/
|
|
IP_PUBLIC Ipike_error
|
|
ipike_exchange_generate_dh_key(
|
|
Ipike_isakmp_exchange *ie,
|
|
Ipike_sadb_entry *sa,
|
|
Ip_u16 group);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_exchange_merge_traffic_selectors
|
|
*===========================================================================
|
|
* Description: Merge initiator and responder traffic selectors.
|
|
* Parameters: ie - the state of this exchange.
|
|
* Returns:
|
|
*/
|
|
IP_GLOBAL Ipike_error
|
|
ipike_exchange_merge_traffic_selectors(Ipike_isakmp_exchange* ie);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|