original files of m241
This commit is contained in:
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipike2_payload_key_exchange.h,v $ $Revision: 1.4.16.1 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipike/src/ipike2_payload_key_exchange.h,v $
|
||||
* $Author: edahlber $ $Date: 2012-02-03 08:46:46 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Kenneth Jonsson <kenneth@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#if !defined(IPIKE2_PAYLOAD_KEY_EXCHANGE_H) && defined(IPIKE_USE_VERSION2)
|
||||
#define IPIKE2_PAYLOAD_KEY_EXCHANGE_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/* Key Exchange payload (IKE version 2) */
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
#include "ipike_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#include "ipike_payload.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 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 !
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
! DH Group # ! RESERVED ! !
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
! !
|
||||
~ Key Exchange Data ~
|
||||
! !
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
typedef struct Ipike2_ke_payload_struct
|
||||
{
|
||||
/* The generic ISAKMP payload header, the length includes the length
|
||||
of all transforms associated with the proposal */
|
||||
Ipike_payload_header header;
|
||||
|
||||
/* DH Group */
|
||||
Ip_u16 dh_group;
|
||||
/* Reserved */
|
||||
Ip_u16 reserved;
|
||||
|
||||
/* Key exchange data follows */
|
||||
}
|
||||
Ipike2_ke_payload;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipike_payload_key_exchange_create
|
||||
*===========================================================================
|
||||
* Description: Creates a new key exchange payload from the information
|
||||
* created in the exchange.
|
||||
* Parameters: group - the diffie-hellman group used to generate the key
|
||||
* key - the public part of the diffie-hellman key.
|
||||
* payload - 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_payload_key_exchange_create(
|
||||
Ip_u16 group,
|
||||
Ipike_value* key,
|
||||
Ipike2_ke_payload** payload);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipike_payload_key_exchange_check
|
||||
*===========================================================================
|
||||
* 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_payload_key_exchange_check(Ipike2_ke_payload* ke);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipike_payload_key_exchange_print
|
||||
*===========================================================================
|
||||
* 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_payload_key_exchange_print(Ipike2_ke_payload* ke);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipike_payload_key_exchange_extract
|
||||
*===========================================================================
|
||||
* Description: Extracts the key exchange data from the payload.
|
||||
* Parameters: payload - a key exchange payload.
|
||||
* group - will be updated with the diffie-hellman group if the
|
||||
* call was successful.
|
||||
* key - will be updated with the public key data if the call
|
||||
* was successful.
|
||||
* Returns: IPIKE_SUCCESS
|
||||
* IPIKE_OUT_OF_MEMORY
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ipike_error
|
||||
ipike_payload_key_exchange_extract(
|
||||
Ipike2_ke_payload* payload,
|
||||
Ip_u16* group,
|
||||
Ipike_value* key);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipike_payload_key_exchange_generate
|
||||
*===========================================================================
|
||||
* Description: Generate key exchange data.
|
||||
* Parameters: group - the diffie-hellman group that should be used.
|
||||
* dh - pointer to the generated key
|
||||
* pub - the public part of the generated key.
|
||||
* Returns: IPIKE_SUCCESS
|
||||
* IPIKE_OUT_OF_MEMORY
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ipike_error
|
||||
ipike_payload_key_exchange_generate(Ip_u16 group, DH** dh, Ipike_value* pub);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
Reference in New Issue
Block a user