/* ****************************************************************************** * HEADER FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipike_payload_key_exchange.h,v $ $Revision: 1.3 $ * $Source: /home/interpeak/CVSRoot/ipike/src/ipike_payload_key_exchange.h,v $ * $Author: edahlber $ $Date: 2010-04-23 15:31:41 $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING * Design and implementation by Kenneth Jonsson ****************************************************************************** */ #ifndef IPIKE_PAYLOAD_KEY_EXCHANGE_H #define IPIKE_PAYLOAD_KEY_EXCHANGE_H /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** */ /* Key exchange payload (RFC 2408, chapter 3.7) */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #include "ipike_config.h" #include "ipike_payload.h" #ifdef __cplusplus extern "C" { #endif /* **************************************************************************** * 4 DEFINES **************************************************************************** */ #define IPIKE_KE_HEADER_LENGTH sizeof(Ipike_ke_payload) /* **************************************************************************** * 5 TYPES **************************************************************************** */ /* Key Exchange Payload Format 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Next Payload ! RESERVED ! Payload Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! ! ~ Key Exchange Data ~ ! ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ typedef struct Ipike_key_exchange_payload_struct { /* The generic ISAKMP payload header, the length includes the length of all transforms associated with the proposal */ Ipike_payload_header header; /* Data required to generate a session key follows. The interpretation of this data is specified by the DOI and the associated Key Exchange algorithm. This field may also contain pre-placed key indicators. */ } Ipike_ke_payload; /* **************************************************************************** * 6 FUNCTIONS **************************************************************************** */ /* *=========================================================================== * ipike_key_exchange_new *=========================================================================== * Description: Creates a new key exchange payload. * Parameters: ke_data - pointer to the local DH public value. * ke_len - the length of the DH value. * Returns: A new key exchange payload or IP_NULL if out of memory. * * */ IP_GLOBAL Ipike_ke_payload* ipike_key_exchange_new(const Ip_u8* ke_data, Ip_u16 ke_len); /* *=========================================================================== * ipike_key_exchange_create *=========================================================================== * Description: Creates a new key exchange payload from the information created * in the exchange. * Parameters: g_x - The local public DH value. * ke - will point to a new key exchange payload if the * call was successful. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY * */ IP_GLOBAL Ipike_error ipike_key_exchange_create(Ipike_value* g_x, Ipike_ke_payload** ke); /* *=========================================================================== * ipike_key_exchange_check_payload *=========================================================================== * Description: Verifies that the key exchange payload is sane. * Parameters: ke - a pointer to a key exchange payload. * Returns: IPIKE_SUCCESS * * */ IP_GLOBAL Ipike_error ipike_key_exchange_check_payload(Ipike_ke_payload* ke); /* *=========================================================================== * ipike_key_exchange_print_payload *=========================================================================== * Description: Prints the content of the key exchange payload to the * system log. * Parameters: ke - a pointer to a key exchange payload. * Returns: * * */ IP_GLOBAL void ipike_key_exchange_print_payload(Ipike_ke_payload* ke); /* *=========================================================================== * ipike_key_exchange_extract *=========================================================================== * Description: Extracts the key data from the payload. * Parameters: payload - a key exchange payload. * ke - will be updated with the key exchange data if the call * was successful. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY * */ IP_GLOBAL Ipike_error ipike_key_exchange_extract(Ipike_ke_payload* payload, Ipike_value* ke); #ifdef __cplusplus } #endif #endif /* **************************************************************************** * END OF FILE **************************************************************************** */