2005-11-15 15:02:46 +00:00
|
|
|
/*
|
2006-07-07 08:49:06 +00:00
|
|
|
* Copyright (C) 2005-2006 Martin Willi
|
|
|
|
* Copyright (C) 2005 Jan Hutter
|
2005-11-15 15:02:46 +00:00
|
|
|
* Hochschule fuer Technik Rapperswil
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
2008-03-13 14:14:44 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup ke_payload ke_payload
|
|
|
|
* @{ @ingroup payloads
|
2005-11-15 15:02:46 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KE_PAYLOAD_H_
|
|
|
|
#define KE_PAYLOAD_H_
|
|
|
|
|
2006-10-30 14:07:05 +00:00
|
|
|
typedef struct ke_payload_t ke_payload_t;
|
|
|
|
|
2006-10-31 12:27:59 +00:00
|
|
|
#include <library.h>
|
2005-11-23 09:57:18 +00:00
|
|
|
#include <encoding/payloads/payload.h>
|
|
|
|
#include <encoding/payloads/transform_substructure.h>
|
2012-10-16 12:54:16 +00:00
|
|
|
#include <collections/linked_list.h>
|
2006-07-05 10:53:20 +00:00
|
|
|
#include <crypto/diffie_hellman.h>
|
|
|
|
|
2011-11-17 10:16:02 +00:00
|
|
|
/**
|
|
|
|
* Class representing an IKEv1 or IKEv2 key exchange payload.
|
2005-11-15 15:02:46 +00:00
|
|
|
*/
|
2005-11-24 09:17:51 +00:00
|
|
|
struct ke_payload_t {
|
2011-11-17 10:16:02 +00:00
|
|
|
|
2005-11-15 15:02:46 +00:00
|
|
|
/**
|
2005-11-28 18:24:10 +00:00
|
|
|
* The payload_t interface.
|
2005-11-15 15:02:46 +00:00
|
|
|
*/
|
|
|
|
payload_t payload_interface;
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2005-11-15 15:02:46 +00:00
|
|
|
/**
|
2010-11-24 10:37:34 +00:00
|
|
|
* Returns the key exchange data of this KE payload.
|
2009-09-04 11:46:09 +00:00
|
|
|
*
|
2010-11-24 10:37:34 +00:00
|
|
|
* @return chunk_t pointing to internal data
|
2005-11-15 15:02:46 +00:00
|
|
|
*/
|
|
|
|
chunk_t (*get_key_exchange_data) (ke_payload_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2005-11-15 15:02:46 +00:00
|
|
|
/**
|
2011-11-17 10:16:02 +00:00
|
|
|
* Gets the Diffie-Hellman Group Number of this KE payload (IKEv2 only).
|
2009-09-04 11:46:09 +00:00
|
|
|
*
|
2008-03-13 14:14:44 +00:00
|
|
|
* @return DH Group Number of this payload
|
2005-11-15 15:02:46 +00:00
|
|
|
*/
|
2005-11-18 14:43:06 +00:00
|
|
|
diffie_hellman_group_t (*get_dh_group_number) (ke_payload_t *this);
|
2005-11-15 15:02:46 +00:00
|
|
|
|
|
|
|
/**
|
2011-11-17 10:16:02 +00:00
|
|
|
* Destroys a ke_payload_t object.
|
2005-11-15 15:02:46 +00:00
|
|
|
*/
|
2005-11-28 18:24:10 +00:00
|
|
|
void (*destroy) (ke_payload_t *this);
|
2005-11-15 15:02:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2011-11-17 10:16:02 +00:00
|
|
|
* Creates an empty ke_payload_t object.
|
2009-09-04 11:46:09 +00:00
|
|
|
*
|
2011-11-17 10:16:02 +00:00
|
|
|
* @param type KEY_EXCHANGE or KEY_EXCHANGE_V1
|
|
|
|
* @return ke_payload_t object
|
2005-11-15 15:02:46 +00:00
|
|
|
*/
|
2011-11-17 10:16:02 +00:00
|
|
|
ke_payload_t *ke_payload_create(payload_type_t type);
|
2005-11-15 15:02:46 +00:00
|
|
|
|
2006-07-05 10:53:20 +00:00
|
|
|
/**
|
2011-11-17 10:16:02 +00:00
|
|
|
* Creates a ke_payload_t from a diffie_hellman_t.
|
2009-09-04 11:46:09 +00:00
|
|
|
*
|
2011-11-17 10:16:02 +00:00
|
|
|
* @param type KEY_EXCHANGE or KEY_EXCHANGE_V1
|
|
|
|
* @param dh diffie hellman object containing group and key
|
|
|
|
* @return ke_payload_t object
|
2006-07-05 10:53:20 +00:00
|
|
|
*/
|
2011-11-17 10:16:02 +00:00
|
|
|
ke_payload_t *ke_payload_create_from_diffie_hellman(payload_type_t type,
|
|
|
|
diffie_hellman_t *dh);
|
2005-11-15 15:02:46 +00:00
|
|
|
|
2009-03-24 17:43:01 +00:00
|
|
|
#endif /** KE_PAYLOAD_H_ @}*/
|