Files
m241Neelima/components/ip_net2-6.9/ipike/src/ipike2_payload_encrypted.h
T
2026-07-30 11:19:44 +05:30

176 lines
6.3 KiB
C

/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipike2_payload_encrypted.h,v $ $Revision: 1.5 $
* $Source: /home/interpeak/CVSRoot/ipike/src/ipike2_payload_encrypted.h,v $
* $Author: edahlber $ $Date: 2010-04-23 15:31:40 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Kenneth Jonsson <kenneth@interpeak.se>
******************************************************************************
*/
#if !defined(IPIKE2_PAYLOAD_ENCRYPTED_H) && defined(IPIKE_USE_VERSION2)
#define IPIKE2_PAYLOAD_ENCRYPTED_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/* Encrypted payload (IKE version 2) */
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "ipike_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include "ipike_payload.h"
#include "ipike2_payload_sa.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
Encryption 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 !C! RESERVED ! Payload Length !
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! Initialization Vector !
! (length is block size for encryption algorithm) !
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! Encrypted IKE payloads !
! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! ! Padding 0-255 octets !
+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
! ! Pad length !
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~ Integrity Checksum Data ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
typedef struct Ipike2_e_payload_struct
{
/* The generic ISAKMP payload header, the length includes the length
of all transforms associated with the proposal */
Ipike_payload_header header;
/* Encryption data follows */
}
Ipike2_e_payload;
typedef struct Ipike2_e_struct
{
/* Initialization vector */
Ipike_value iv;
/* Encrypted payloads */
Ipike_value data;
/* Integrity checksum */
Ipike_value checksum;
}
Ipike2_e;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipike_payload_encrypted_create
*===========================================================================
* Description: Creates a new encrypted payload from the information
* created in the exchange.
* Parameters: ie - IKE exchange information containing the SA used to
* encrypt the payloads.
* msg - IKE message containing the the original payload list
* that will be encrypted. The plaintext data will be replaced
* by the encrypted data if the call is successful.
* offset - offset to real message value.
* Returns: IPIKE_SUCCESS
* IPIKE_OUT_OF_MEMORY
*/
IP_GLOBAL Ipike_error
ipike_payload_encrypted_create(
Ipike_isakmp_exchange* ie,
Ipike_message *msg,
Ip_u32 offset);
/*
*===========================================================================
* ipike_payload_encrypted_check
*===========================================================================
* Description: Verifies that the encrypted payload is sane.
* Parameters: e - a pointer to a key exchange payload.
* Returns: IPIKE_SUCCESS
*
*
*/
IP_GLOBAL Ipike_error
ipike_payload_encrypted_check(Ipike2_e_payload* e);
/*
*===========================================================================
* ipike_payload_encrypted_print
*===========================================================================
* Description: Prints the content of the encrypted payload to the
* system log.
* Parameters: ke - a pointer to a encrypted payload.
* Returns:
*/
IP_GLOBAL void
ipike_payload_encrypted_print(Ipike2_e_payload* e);
/*
*===========================================================================
* ipike_payload_encrypted_extract
*===========================================================================
* Description: Extracts the encrypted data from the encrypted payload and
* store the decrypted data in the original encrypted buffer.
* Parameters: ie - the exchange
* data - stores encrypted data and will store decrypted data if
* call is successful.
* Returns: IPIKE_SUCCESS
*/
IP_GLOBAL Ipike_error
ipike_payload_encrypted_extract(
Ipike_isakmp_exchange* ie,
Ipike_isakmp_header* msg);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/