- typedefs changed
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
|
||||
#define NUMBER_OF_WORKING_THREADS 4
|
||||
|
||||
#define IKEV2_UDP_PORT 500
|
||||
#define IKEV2_UDP_PORT 4500
|
||||
|
||||
|
||||
#endif /*DAEMON_H_*/
|
||||
|
||||
@@ -59,6 +59,22 @@
|
||||
#error "BYTE_ORDER must be defined"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Doxygen namespace support
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @addtogroup transforms
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup prfs
|
||||
*
|
||||
* @ingroup transforms
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* macro gives back larger of two values
|
||||
*/
|
||||
@@ -76,11 +92,12 @@
|
||||
*/
|
||||
#define MAPPING_END (-1)
|
||||
|
||||
typedef struct mapping_t mapping_t;
|
||||
|
||||
/**
|
||||
* @brief mapping entry, where enum-to-string mappings are stored
|
||||
* @brief mapping entry, where enum-to-string mappings are stored.
|
||||
*/
|
||||
typedef struct mapping_s mapping_t;
|
||||
struct mapping_s
|
||||
struct mapping_t
|
||||
{
|
||||
/**
|
||||
* enumeration value
|
||||
|
||||
@@ -114,13 +114,13 @@ static message_rule_t message_rules[] = {
|
||||
{IKE_SA_INIT,FALSE,(sizeof(supported_ike_sa_init_r_payloads)/sizeof(supported_payload_entry_t)),supported_ike_sa_init_r_payloads}
|
||||
};
|
||||
|
||||
typedef struct payload_entry_t payload_entry_t;
|
||||
|
||||
/**
|
||||
* Entry for a payload in the internal used linked list
|
||||
*
|
||||
*/
|
||||
typedef struct payload_entry_s payload_entry_t;
|
||||
|
||||
struct payload_entry_s {
|
||||
struct payload_entry_t {
|
||||
/**
|
||||
* Type of payload
|
||||
*/
|
||||
@@ -132,12 +132,12 @@ struct payload_entry_s {
|
||||
};
|
||||
|
||||
|
||||
typedef struct private_message_t private_message_t;
|
||||
|
||||
/**
|
||||
* Private data of an message_t object
|
||||
*/
|
||||
typedef struct private_message_s private_message_t;
|
||||
|
||||
struct private_message_s {
|
||||
struct private_message_t {
|
||||
|
||||
/**
|
||||
* Public part of a message_t object
|
||||
|
||||
@@ -333,9 +333,9 @@ extern mapping_t encoding_type_m[];
|
||||
*
|
||||
* This rules are used by parser and generator.
|
||||
*/
|
||||
typedef struct encoding_rule_s encoding_rule_t;
|
||||
typedef struct encoding_rule_t encoding_rule_t;
|
||||
|
||||
struct encoding_rule_s{
|
||||
struct encoding_rule_t {
|
||||
/**
|
||||
* Encoding type
|
||||
*/
|
||||
|
||||
@@ -41,13 +41,13 @@
|
||||
*/
|
||||
#define NONCE_SIZE 16
|
||||
|
||||
typedef struct ike_sa_t ike_sa_t;
|
||||
|
||||
/**
|
||||
* @brief This class is used to represent an IKE_SA
|
||||
*
|
||||
*/
|
||||
typedef struct ike_sa_s ike_sa_t;
|
||||
|
||||
struct ike_sa_s {
|
||||
struct ike_sa_t {
|
||||
|
||||
/**
|
||||
* @brief Processes a incoming IKEv2-Message of type message_t
|
||||
@@ -84,12 +84,12 @@ struct ike_sa_s {
|
||||
status_t (*destroy) (ike_sa_t *this);
|
||||
};
|
||||
|
||||
typedef struct protected_ike_sa_t protected_ike_sa_t;
|
||||
|
||||
/**
|
||||
* Protected data of an ike_sa_t object
|
||||
*/
|
||||
typedef struct protected_ike_sa_s protected_ike_sa_t;
|
||||
|
||||
struct protected_ike_sa_s {
|
||||
struct protected_ike_sa_t {
|
||||
|
||||
/**
|
||||
* Public part of a ike_sa_t object
|
||||
|
||||
@@ -28,12 +28,12 @@
|
||||
#include <types.h>
|
||||
#include <utils/allocator.h>
|
||||
|
||||
typedef struct private_ike_sa_id_t private_ike_sa_id_t;
|
||||
|
||||
/**
|
||||
* Private data of an ike_sa_id object
|
||||
*/
|
||||
typedef struct private_ike_sa_id_s private_ike_sa_id_t;
|
||||
|
||||
struct private_ike_sa_id_s {
|
||||
struct private_ike_sa_id_t {
|
||||
/**
|
||||
* Public part of a ike_sa_id object
|
||||
*/
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
typedef struct ike_sa_id_t ike_sa_id_t;
|
||||
|
||||
/**
|
||||
* @brief This class is used to identify an IKE_SA.
|
||||
*
|
||||
@@ -33,9 +35,7 @@
|
||||
* Additionaly it contains the role of the actual running IKEv2-Daemon
|
||||
* for the specific IKE_SA.
|
||||
*/
|
||||
typedef struct ike_sa_id_s ike_sa_id_t;
|
||||
|
||||
struct ike_sa_id_s {
|
||||
struct ike_sa_id_t {
|
||||
|
||||
/**
|
||||
* @brief Sets the SPI of the responder.
|
||||
|
||||
@@ -32,11 +32,12 @@
|
||||
#include <utils/logger_manager.h>
|
||||
#include <utils/linked_list.h>
|
||||
|
||||
typedef struct ike_sa_entry_t ike_sa_entry_t;
|
||||
|
||||
/**
|
||||
* @brief An entry in the linked list, contains IKE_SA, locking and lookup data.
|
||||
*/
|
||||
typedef struct ike_sa_entry_s ike_sa_entry_t;
|
||||
struct ike_sa_entry_s {
|
||||
struct ike_sa_entry_t {
|
||||
/**
|
||||
* destructor, also destroys ike_sa
|
||||
*/
|
||||
@@ -131,11 +132,12 @@ static ike_sa_entry_t *ike_sa_entry_create(ike_sa_id_t *ike_sa_id)
|
||||
return this;
|
||||
}
|
||||
|
||||
typedef struct private_ike_sa_manager_t private_ike_sa_manager_t;
|
||||
|
||||
/**
|
||||
* Additional private members to ike_sa_manager_t
|
||||
*/
|
||||
typedef struct private_ike_sa_manager_s private_ike_sa_manager_t;
|
||||
struct private_ike_sa_manager_s {
|
||||
struct private_ike_sa_manager_t {
|
||||
/**
|
||||
* Public members
|
||||
*/
|
||||
|
||||
@@ -27,19 +27,20 @@
|
||||
#include <sa/ike_sa.h>
|
||||
|
||||
|
||||
typedef struct ike_sa_manager_t ike_sa_manager_t;
|
||||
|
||||
/**
|
||||
* @brief The IKE_SA-Manager manages the IKE_SAs ;-).
|
||||
*
|
||||
* @brief The IKE_SA-Manager manages the IKE_SAs ;-).
|
||||
*
|
||||
* To avoid access from multiple threads, IKE_SAs must be checked out from
|
||||
* the manager, and checked back in after usage.
|
||||
* The manager also handles deletion of SAs.
|
||||
*
|
||||
*
|
||||
* @todo checking of double-checkouts from the same threads would be nice.
|
||||
* This could be by comparing thread-ids via pthread_self()...
|
||||
*
|
||||
*
|
||||
*/
|
||||
typedef struct ike_sa_manager_s ike_sa_manager_t;
|
||||
struct ike_sa_manager_s {
|
||||
struct ike_sa_manager_t {
|
||||
/**
|
||||
* @brief Checkout an IKE_SA, create it when necesarry
|
||||
*
|
||||
|
||||
@@ -24,12 +24,14 @@
|
||||
|
||||
#include <utils/allocator.h>
|
||||
|
||||
|
||||
typedef struct private_ike_auth_requested_t private_ike_auth_requested_t;
|
||||
|
||||
/**
|
||||
* Private data of a ike_auth_requested_t object.
|
||||
*
|
||||
*/
|
||||
typedef struct private_ike_auth_requested_s private_ike_auth_requested_t;
|
||||
struct private_ike_auth_requested_s {
|
||||
struct private_ike_auth_requested_t {
|
||||
/**
|
||||
* methods of the state_t interface
|
||||
*/
|
||||
|
||||
@@ -26,13 +26,14 @@
|
||||
#include <sa/states/state.h>
|
||||
#include <sa/ike_sa.h>
|
||||
|
||||
|
||||
typedef struct ike_auth_requested_t ike_auth_requested_t;
|
||||
|
||||
/**
|
||||
* @brief This class represents an IKE_SA, which has requested an IKE_AUTH.
|
||||
*
|
||||
*/
|
||||
typedef struct ike_auth_requested_s ike_auth_requested_t;
|
||||
|
||||
struct ike_auth_requested_s {
|
||||
struct ike_auth_requested_t {
|
||||
/**
|
||||
* methods of the state_t interface
|
||||
*/
|
||||
|
||||
@@ -24,12 +24,14 @@
|
||||
|
||||
#include <utils/allocator.h>
|
||||
|
||||
|
||||
typedef struct private_ike_sa_established_t private_ike_sa_established_t;
|
||||
|
||||
/**
|
||||
* Private data of a ike_sa_established_t object.
|
||||
*
|
||||
*/
|
||||
typedef struct private_ike_sa_established_s private_ike_sa_established_t;
|
||||
struct private_ike_sa_established_s {
|
||||
struct private_ike_sa_established_t {
|
||||
/**
|
||||
* methods of the state_t interface
|
||||
*/
|
||||
|
||||
@@ -26,14 +26,14 @@
|
||||
#include <sa/states/state.h>
|
||||
#include <sa/ike_sa.h>
|
||||
|
||||
typedef struct ike_sa_established_t ike_sa_established_t;
|
||||
|
||||
/**
|
||||
* @brief This class represents an the state of an established
|
||||
* @brief This class represents an the state of an established.
|
||||
* IKE_SA.
|
||||
*
|
||||
*/
|
||||
typedef struct ike_sa_established_s ike_sa_established_t;
|
||||
|
||||
struct ike_sa_established_s {
|
||||
struct ike_sa_established_t {
|
||||
/**
|
||||
* methods of the state_t interface
|
||||
*/
|
||||
|
||||
@@ -29,12 +29,14 @@
|
||||
#include <encoding/payloads/nonce_payload.h>
|
||||
#include <transforms/diffie_hellman.h>
|
||||
|
||||
|
||||
typedef struct private_ike_sa_init_requested_t private_ike_sa_init_requested_t;
|
||||
|
||||
/**
|
||||
* Private data of a ike_sa_init_requested_t object.
|
||||
*
|
||||
*/
|
||||
typedef struct private_ike_sa_init_requested_s private_ike_sa_init_requested_t;
|
||||
struct private_ike_sa_init_requested_s {
|
||||
struct private_ike_sa_init_requested_t {
|
||||
/**
|
||||
* methods of the state_t interface
|
||||
*/
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
#include <sa/states/state.h>
|
||||
#include <transforms/diffie_hellman.h>
|
||||
|
||||
typedef struct ike_sa_init_requested_t ike_sa_init_requested_t;
|
||||
|
||||
/**
|
||||
* @brief This class represents an IKE_SA state when requested an IKE_SA_INIT
|
||||
* @brief This class represents an IKE_SA state when requested an IKE_SA_INIT.
|
||||
*
|
||||
*/
|
||||
typedef struct ike_sa_init_requested_s ike_sa_init_requested_t;
|
||||
|
||||
struct ike_sa_init_requested_s {
|
||||
struct ike_sa_init_requested_t {
|
||||
/**
|
||||
* methods of the state_t interface
|
||||
*/
|
||||
|
||||
@@ -24,12 +24,14 @@
|
||||
|
||||
#include <utils/allocator.h>
|
||||
|
||||
|
||||
typedef struct private_ike_sa_init_responded_t private_ike_sa_init_responded_t;
|
||||
|
||||
/**
|
||||
* Private data of a ike_sa_init_responded_t object.
|
||||
*
|
||||
*/
|
||||
typedef struct private_ike_sa_init_responded_s private_ike_sa_init_responded_t;
|
||||
struct private_ike_sa_init_responded_s {
|
||||
struct private_ike_sa_init_responded_t {
|
||||
/**
|
||||
* methods of the state_t interface
|
||||
*/
|
||||
|
||||
@@ -26,13 +26,13 @@
|
||||
#include <sa/ike_sa.h>
|
||||
#include <sa/states/state.h>
|
||||
|
||||
typedef struct ike_sa_init_responded_t ike_sa_init_responded_t;
|
||||
|
||||
/**
|
||||
* @brief This class represents an IKE_SA state when responded to an IKE_SA_INIT request
|
||||
* @brief This class represents an IKE_SA state when responded to an IKE_SA_INIT request.
|
||||
*
|
||||
*/
|
||||
typedef struct ike_sa_init_responded_s ike_sa_init_responded_t;
|
||||
|
||||
struct ike_sa_init_responded_s {
|
||||
struct ike_sa_init_responded_t {
|
||||
/**
|
||||
* methods of the state_t interface
|
||||
*/
|
||||
|
||||
@@ -33,12 +33,13 @@
|
||||
#include <encoding/payloads/nonce_payload.h>
|
||||
|
||||
|
||||
typedef struct private_initiator_init_t private_initiator_init_t;
|
||||
|
||||
/**
|
||||
* Private data of a initiator_init_t object.
|
||||
*
|
||||
*/
|
||||
typedef struct private_initiator_init_s private_initiator_init_t;
|
||||
struct private_initiator_init_s {
|
||||
struct private_initiator_init_t {
|
||||
/**
|
||||
* Methods of the state_t interface.
|
||||
*/
|
||||
|
||||
@@ -28,14 +28,14 @@
|
||||
#include <sa/states/state.h>
|
||||
|
||||
|
||||
typedef struct initiator_init_t initiator_init_t;
|
||||
|
||||
/**
|
||||
* @brief This class represents an IKE_SA state when initializing
|
||||
* a connection as initiator
|
||||
* @brief This class represents an IKE_SA state when initializing.
|
||||
* a connection as initiator
|
||||
*
|
||||
*/
|
||||
typedef struct initiator_init_s initiator_init_t;
|
||||
|
||||
struct initiator_init_s {
|
||||
struct initiator_init_t {
|
||||
/**
|
||||
* methods of the state_t interface
|
||||
*/
|
||||
|
||||
@@ -31,12 +31,14 @@
|
||||
#include <encoding/payloads/nonce_payload.h>
|
||||
#include <transforms/diffie_hellman.h>
|
||||
|
||||
|
||||
typedef struct private_responder_init_t private_responder_init_t;
|
||||
|
||||
/**
|
||||
* Private data of a responder_init_t object.
|
||||
*
|
||||
*/
|
||||
typedef struct private_responder_init_s private_responder_init_t;
|
||||
struct private_responder_init_s {
|
||||
struct private_responder_init_t {
|
||||
/**
|
||||
* Methods of the state_t interface.
|
||||
*/
|
||||
|
||||
@@ -26,14 +26,15 @@
|
||||
#include <sa/ike_sa.h>
|
||||
#include <sa/states/state.h>
|
||||
|
||||
|
||||
typedef struct responder_init_t responder_init_t;
|
||||
|
||||
/**
|
||||
* @brief This class represents an IKE_SA state when initializing
|
||||
* a connection as responder
|
||||
* @brief This class represents an IKE_SA state when initializing.
|
||||
* a connection as responder
|
||||
*
|
||||
*/
|
||||
typedef struct responder_init_s responder_init_t;
|
||||
|
||||
struct responder_init_s {
|
||||
struct responder_init_t {
|
||||
/**
|
||||
* methods of the state_t interface
|
||||
*/
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
|
||||
extern mapping_t ike_sa_state_m[];
|
||||
|
||||
typedef enum ike_sa_state_t ike_sa_state_t;
|
||||
|
||||
/**
|
||||
* States in which a IKE_SA can actually be
|
||||
*/
|
||||
typedef enum ike_sa_state_e ike_sa_state_t;
|
||||
|
||||
enum ike_sa_state_e {
|
||||
enum ike_sa_state_t {
|
||||
|
||||
/**
|
||||
* IKE_SA is is not in a state as initiator
|
||||
@@ -75,13 +75,12 @@ enum ike_sa_state_e {
|
||||
*/
|
||||
extern mapping_t ike_sa_state_m[];
|
||||
|
||||
typedef struct state_t state_t;
|
||||
|
||||
/**
|
||||
* @brief This interface represents an IKE_SA state
|
||||
*
|
||||
*/
|
||||
typedef struct state_s state_t;
|
||||
|
||||
struct state_s {
|
||||
struct state_t {
|
||||
|
||||
/**
|
||||
* @brief Processes a incoming IKEv2-Message of type message_t
|
||||
|
||||
@@ -33,12 +33,12 @@
|
||||
#include <utils/allocator.h>
|
||||
#include <utils/logger_manager.h>
|
||||
|
||||
typedef struct private_receiver_t private_receiver_t;
|
||||
|
||||
/**
|
||||
* Private data of a receiver object
|
||||
*/
|
||||
typedef struct private_receiver_s private_receiver_t;
|
||||
|
||||
struct private_receiver_s {
|
||||
struct private_receiver_t {
|
||||
/**
|
||||
* Public part of a receiver object
|
||||
*/
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
|
||||
#include <types.h>
|
||||
|
||||
typedef struct receiver_t receiver_t;
|
||||
|
||||
/**
|
||||
* @brief A Receiver object which receives packets on the socket and adds them to the job-queue
|
||||
*/
|
||||
typedef struct receiver_s receiver_t;
|
||||
|
||||
struct receiver_s {
|
||||
struct receiver_t {
|
||||
|
||||
/**
|
||||
* @brief Destroys a receiver object
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
/**
|
||||
* Private data of a scheduler object
|
||||
*/
|
||||
typedef struct private_scheduler_s private_scheduler_t;
|
||||
typedef struct private_scheduler_t private_scheduler_t;
|
||||
|
||||
struct private_scheduler_s {
|
||||
struct private_scheduler_t {
|
||||
/**
|
||||
* Public part of a scheduler object
|
||||
*/
|
||||
|
||||
@@ -25,15 +25,15 @@
|
||||
|
||||
#include <types.h>
|
||||
|
||||
typedef struct scheduler_t scheduler_t;
|
||||
|
||||
/**
|
||||
* @brief The scheduler, looks for timed events in event-queue and adds them
|
||||
* to the job-queue.
|
||||
*
|
||||
* Starts a thread which does the work, since event-queue is blocking
|
||||
*/
|
||||
typedef struct scheduler_s scheduler_t;
|
||||
|
||||
struct scheduler_s {
|
||||
struct scheduler_t {
|
||||
|
||||
/**
|
||||
* @brief Destroys a scheduler object
|
||||
|
||||
@@ -32,12 +32,12 @@
|
||||
#include <utils/allocator.h>
|
||||
#include <utils/logger_manager.h>
|
||||
|
||||
typedef struct private_sender_t private_sender_t;
|
||||
|
||||
/**
|
||||
* Private data of a sender object
|
||||
*/
|
||||
typedef struct private_sender_s private_sender_t;
|
||||
|
||||
struct private_sender_s {
|
||||
struct private_sender_t {
|
||||
/**
|
||||
* Public part of a sender object
|
||||
*/
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
|
||||
#include <types.h>
|
||||
|
||||
typedef struct sender_t sender_t;
|
||||
|
||||
/**
|
||||
* @brief A Sender object which sends packets on the socket
|
||||
*/
|
||||
typedef struct sender_s sender_t;
|
||||
|
||||
struct sender_s {
|
||||
struct sender_t {
|
||||
|
||||
/**
|
||||
* @brief Destroys a sender object
|
||||
|
||||
@@ -35,12 +35,12 @@
|
||||
#include <utils/allocator.h>
|
||||
#include <utils/logger.h>
|
||||
|
||||
typedef struct private_thread_pool_t private_thread_pool_t;
|
||||
|
||||
/**
|
||||
* @brief structure with private members for thread_pool_t
|
||||
*/
|
||||
typedef struct private_thread_pool_s private_thread_pool_t;
|
||||
|
||||
struct private_thread_pool_s {
|
||||
struct private_thread_pool_t {
|
||||
/**
|
||||
* inclusion of public members
|
||||
*/
|
||||
|
||||
@@ -27,15 +27,16 @@
|
||||
|
||||
#include <types.h>
|
||||
|
||||
|
||||
typedef struct thread_pool_t thread_pool_t;
|
||||
|
||||
/**
|
||||
* @brief A thread_pool contains a pool of threads processing the job queue.
|
||||
*
|
||||
* Current implementation uses as many threads as specified in constructor.
|
||||
* A more improved version would dynamically increase thread count if necessary...
|
||||
*/
|
||||
typedef struct thread_pool_s thread_pool_t;
|
||||
|
||||
struct thread_pool_s {
|
||||
struct thread_pool_t {
|
||||
/**
|
||||
* @brief return currently instanciated threads
|
||||
*
|
||||
|
||||
@@ -26,12 +26,12 @@
|
||||
#include <encoding/payloads/transform_substructure.h>
|
||||
|
||||
|
||||
typedef struct crypter_t crypter_t;
|
||||
|
||||
/**
|
||||
* Object representing a crypter object
|
||||
*/
|
||||
typedef struct crypter_s crypter_t;
|
||||
|
||||
struct crypter_s {
|
||||
struct crypter_t {
|
||||
/**
|
||||
* @brief Encrypt a chunk of data and allocate space for
|
||||
* the encrypted value.
|
||||
|
||||
@@ -289,12 +289,12 @@ static u_int8_t group18_modulus[] = {
|
||||
0x60,0xC9,0x80,0xDD,0x98,0xED,0xD3,0xDF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
};
|
||||
|
||||
typedef struct modulus_info_entry_t modulus_info_entry_t;
|
||||
|
||||
/**
|
||||
* Entry of the modulus list
|
||||
*/
|
||||
typedef struct modulus_info_entry_s modulus_info_entry_t;
|
||||
|
||||
struct modulus_info_entry_s{
|
||||
struct modulus_info_entry_t {
|
||||
/**
|
||||
* Group number as it is defined in transform_substructure.h
|
||||
*/
|
||||
@@ -328,13 +328,13 @@ static modulus_info_entry_t modulus_info_entries[] = {
|
||||
{MODP_8192_BIT,group18_modulus,sizeof(group18_modulus),2},
|
||||
};
|
||||
|
||||
typedef struct private_diffie_hellman_t private_diffie_hellman_t;
|
||||
|
||||
/**
|
||||
* Private data of an diffie_hellman_t object.
|
||||
*
|
||||
*/
|
||||
typedef struct private_diffie_hellman_s private_diffie_hellman_t;
|
||||
|
||||
struct private_diffie_hellman_s {
|
||||
struct private_diffie_hellman_t {
|
||||
/**
|
||||
* public diffie_hellman_t interface
|
||||
*/
|
||||
|
||||
@@ -26,13 +26,13 @@
|
||||
#include <types.h>
|
||||
#include <encoding/payloads/transform_substructure.h>
|
||||
|
||||
typedef struct diffie_hellman_t diffie_hellman_t;
|
||||
|
||||
/**
|
||||
* Object representing a diffie hellman exchange
|
||||
*
|
||||
*/
|
||||
typedef struct diffie_hellman_s diffie_hellman_t;
|
||||
|
||||
struct diffie_hellman_s {
|
||||
struct diffie_hellman_t {
|
||||
|
||||
/**
|
||||
* @brief Returns the shared secret of this diffie hellman exchange
|
||||
|
||||
@@ -26,23 +26,23 @@
|
||||
|
||||
#include <types.h>
|
||||
|
||||
typedef enum hash_algorithm_t hash_algorithm_t;
|
||||
|
||||
/**
|
||||
* algorithms to use for hashing
|
||||
*/
|
||||
typedef enum hash_algorithm_e hash_algorithm_t;
|
||||
|
||||
enum hash_algorithm_e {
|
||||
enum hash_algorithm_t {
|
||||
HASH_SHA1,
|
||||
HASH_MD5
|
||||
};
|
||||
|
||||
|
||||
typedef struct hasher_t hasher_t;
|
||||
|
||||
/**
|
||||
* Object representing a hasher
|
||||
*/
|
||||
typedef struct hasher_s hasher_t;
|
||||
|
||||
struct hasher_s {
|
||||
struct hasher_t {
|
||||
/**
|
||||
* @brief hash data and write it in the buffer
|
||||
*
|
||||
|
||||
@@ -98,12 +98,12 @@ Rotation is separate from addition to prevent recomputation.
|
||||
|
||||
|
||||
|
||||
typedef struct private_hasher_md5_t private_hasher_md5_t;
|
||||
|
||||
/**
|
||||
* private data structure with hasing context
|
||||
*/
|
||||
typedef struct private_hasher_md5_s private_hasher_md5_t;
|
||||
|
||||
struct private_hasher_md5_s {
|
||||
struct private_hasher_md5_t {
|
||||
/**
|
||||
* public interface for this hasher
|
||||
*/
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
#include <transforms/hashers/hasher.h>
|
||||
|
||||
|
||||
typedef struct hasher_md5_t hasher_md5_t;
|
||||
|
||||
/**
|
||||
* Object representing the md5 hasher
|
||||
*
|
||||
*/
|
||||
typedef struct hasher_md5_s hasher_md5_t;
|
||||
|
||||
struct hasher_md5_s {
|
||||
struct hasher_md5_t {
|
||||
|
||||
/**
|
||||
* generic hasher_t interface for this hasher
|
||||
|
||||
@@ -53,12 +53,12 @@
|
||||
#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
|
||||
|
||||
|
||||
typedef struct private_hasher_sha1_t private_hasher_sha1_t;
|
||||
|
||||
/**
|
||||
* private data structure with hasing context
|
||||
*/
|
||||
typedef struct private_hasher_sha1_s private_hasher_sha1_t;
|
||||
|
||||
struct private_hasher_sha1_s {
|
||||
struct private_hasher_sha1_t {
|
||||
/**
|
||||
* public interface for this hasher
|
||||
*/
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
#include <transforms/hashers/hasher.h>
|
||||
|
||||
|
||||
typedef struct hasher_sha1_t hasher_sha1_t;
|
||||
|
||||
/**
|
||||
* Object representing the sha1 hasher
|
||||
*
|
||||
*/
|
||||
typedef struct hasher_sha1_s hasher_sha1_t;
|
||||
|
||||
struct hasher_sha1_s {
|
||||
struct hasher_sha1_t {
|
||||
|
||||
/**
|
||||
* generic hasher_t interface for this hasher
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
/**
|
||||
* @file hmac.c
|
||||
*
|
||||
* @brief Implementation of message authentication
|
||||
* using cryptographic hash functions (HMAC). See RFC2104.
|
||||
*
|
||||
* @brief Implementation of hmac_t
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -26,13 +24,13 @@
|
||||
|
||||
#include <utils/allocator.h>
|
||||
|
||||
typedef struct private_hmac_t private_hmac_t;
|
||||
|
||||
/**
|
||||
* Private data of an hmac_t object.
|
||||
*
|
||||
*/
|
||||
typedef struct private_hmac_s private_hmac_t;
|
||||
|
||||
struct private_hmac_s {
|
||||
struct private_hmac_t {
|
||||
/**
|
||||
* public hmac_t interface
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
/**
|
||||
* @file hmac.h
|
||||
*
|
||||
* @brief Implementation of message authentication
|
||||
* using cryptographic hash functions (HMAC). See RFC2104.
|
||||
*
|
||||
* @brief Interface of hmac_t.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -24,16 +22,25 @@
|
||||
#ifndef HMAC_H_
|
||||
#define HMAC_H_
|
||||
|
||||
|
||||
#include <transforms/hashers/hasher.h>
|
||||
#include <definitions.h>
|
||||
|
||||
|
||||
typedef struct hmac_t hmac_t;
|
||||
|
||||
|
||||
/**
|
||||
* Object representing a hmac
|
||||
* @brief Message authentication based using hash functions.
|
||||
*
|
||||
* This class implements the message authenticaion algorithm
|
||||
* described in RFC2104. It uses a hash function, wich must
|
||||
* be implemented as a hasher_t class.
|
||||
*
|
||||
* @see hasher_t, prf_hmac_t
|
||||
*
|
||||
* @ingroup transforms
|
||||
*/
|
||||
typedef struct hmac_s hmac_t;
|
||||
|
||||
struct hmac_s {
|
||||
struct hmac_t {
|
||||
/**
|
||||
* @brief Generate message authentication code.
|
||||
*
|
||||
@@ -98,13 +105,19 @@ struct hmac_s {
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new hmac_t object
|
||||
* @brief Creates a new hmac_t object.
|
||||
*
|
||||
* Creates a new hmac_t object using sing hash_algorithm to
|
||||
* create a hasher_t internally.
|
||||
*
|
||||
* @param hash_algorithm hash algorithm to use
|
||||
* @return
|
||||
* - hmac_t if successfully
|
||||
* - NULL if out of ressources or hash not supported
|
||||
*
|
||||
* @ingroup transforms
|
||||
*/
|
||||
hmac_t *hmac_create(hash_algorithm_t hash_algorithm);
|
||||
|
||||
|
||||
#endif /*HMAC_H_*/
|
||||
|
||||
@@ -26,13 +26,13 @@
|
||||
#include <utils/allocator.h>
|
||||
#include <definitions.h>
|
||||
|
||||
typedef struct private_prf_plus_t private_prf_plus_t;
|
||||
|
||||
/**
|
||||
* Private data of an prf_plus_t object.
|
||||
*
|
||||
*/
|
||||
typedef struct private_prf_plus_s private_prf_plus_t;
|
||||
|
||||
struct private_prf_plus_s {
|
||||
struct private_prf_plus_t {
|
||||
/**
|
||||
* public prf_plus_t interface
|
||||
*/
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
#include <transforms/prfs/prf.h>
|
||||
|
||||
|
||||
typedef struct prf_plus_t prf_plus_t;
|
||||
|
||||
/**
|
||||
* Object representing a prf_plus
|
||||
*/
|
||||
typedef struct prf_plus_s prf_plus_t;
|
||||
|
||||
struct prf_plus_s {
|
||||
struct prf_plus_t {
|
||||
/**
|
||||
* @brief Get pseudo random bytes.
|
||||
*
|
||||
|
||||
@@ -26,12 +26,14 @@
|
||||
#include <encoding/payloads/transform_substructure.h>
|
||||
|
||||
|
||||
typedef struct prf_t prf_t;
|
||||
|
||||
/**
|
||||
* Object representing a diffie hellman exchange
|
||||
*
|
||||
* @ingroup prfs
|
||||
*/
|
||||
typedef struct prf_s prf_t;
|
||||
|
||||
struct prf_s {
|
||||
struct prf_t {
|
||||
/**
|
||||
* @brief generates pseudo random bytes and writes them
|
||||
* in the buffer
|
||||
@@ -89,6 +91,8 @@ struct prf_s {
|
||||
* @return
|
||||
* - prf_t if successfully
|
||||
* - NULL if out of ressources or prf not supported
|
||||
*
|
||||
* @ingroup prfs
|
||||
*/
|
||||
prf_t *prf_create(pseudo_random_function_t pseudo_random_function);
|
||||
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
#include <utils/allocator.h>
|
||||
#include <transforms/hmac.h>
|
||||
|
||||
typedef struct private_prf_hmac_s private_prf_hmac_t;
|
||||
typedef struct private_prf_hmac_t private_prf_hmac_t;
|
||||
|
||||
struct private_prf_hmac_s {
|
||||
struct private_prf_hmac_t {
|
||||
/**
|
||||
* public interface for this prf
|
||||
*/
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
#include <types.h>
|
||||
#include <transforms/hashers/hasher.h>
|
||||
|
||||
typedef struct prf_hmac_t prf_hmac_t;
|
||||
|
||||
/**
|
||||
* Object representing a prf using HMAC
|
||||
*
|
||||
*/
|
||||
typedef struct prf_hmac_s prf_hmac_t;
|
||||
|
||||
struct prf_hmac_s {
|
||||
struct prf_hmac_t {
|
||||
|
||||
/**
|
||||
* generic prf_t interface for this prf
|
||||
|
||||
@@ -26,12 +26,12 @@
|
||||
#include <encoding/payloads/transform_substructure.h>
|
||||
|
||||
|
||||
typedef struct signer_t signer_t;
|
||||
|
||||
/**
|
||||
* Object representing a diffie hellman exchange
|
||||
*/
|
||||
typedef struct signer_s signer_t;
|
||||
|
||||
struct signer_s {
|
||||
struct signer_t {
|
||||
/**
|
||||
* @brief generates pseudo random bytes and writes them
|
||||
* in the buffer
|
||||
|
||||
+14
-4
@@ -30,7 +30,12 @@
|
||||
|
||||
#include <definitions.h>
|
||||
|
||||
typedef enum status_e {
|
||||
typedef enum status_t status_t;
|
||||
|
||||
/**
|
||||
* return status for function calls
|
||||
*/
|
||||
enum status_t {
|
||||
SUCCESS,
|
||||
FAILED,
|
||||
OUT_OF_RES,
|
||||
@@ -41,7 +46,7 @@ typedef enum status_e {
|
||||
PARSE_ERROR,
|
||||
VERIFY_ERROR,
|
||||
INVALID_STATE
|
||||
} status_t;
|
||||
};
|
||||
|
||||
extern mapping_t status_m[];
|
||||
|
||||
@@ -52,15 +57,20 @@ typedef struct timespec timespec_t;
|
||||
|
||||
typedef struct sockaddr sockaddr_t;
|
||||
|
||||
typedef struct chunk_t chunk_t;
|
||||
|
||||
/**
|
||||
* General purpose pointer/length abstraction
|
||||
*/
|
||||
typedef struct chunk_s chunk_t;
|
||||
struct chunk_s {
|
||||
struct chunk_t {
|
||||
u_char *ptr;
|
||||
size_t len;
|
||||
};
|
||||
|
||||
/**
|
||||
* {NULL, 0}-chunk, handy for initialization
|
||||
* of chunks.
|
||||
*/
|
||||
extern chunk_t CHUNK_INITIALIZER;
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,14 +32,14 @@
|
||||
|
||||
#ifdef LEAK_DETECTIVE
|
||||
|
||||
typedef union memory_hdr_t memory_hdr_t;
|
||||
|
||||
/**
|
||||
* Header of each allocated memory area
|
||||
*
|
||||
* Used to detect memory leaks
|
||||
*/
|
||||
typedef union memory_hdr_u memory_hdr_t;
|
||||
|
||||
union memory_hdr_u {
|
||||
union memory_hdr_t {
|
||||
struct {
|
||||
/**
|
||||
* Filename withing memory was allocated
|
||||
@@ -69,9 +69,9 @@ union memory_hdr_u {
|
||||
*
|
||||
* Contains private variables of allocator_t object.
|
||||
*/
|
||||
typedef struct private_allocator_s private_allocator_t;
|
||||
typedef struct private_allocator_t private_allocator_t;
|
||||
|
||||
struct private_allocator_s
|
||||
struct private_allocator_t
|
||||
{
|
||||
/**
|
||||
* Public part of an allocator_t object.
|
||||
|
||||
@@ -53,13 +53,13 @@
|
||||
|
||||
#ifdef LEAK_DETECTIVE
|
||||
|
||||
/**
|
||||
* @brief Allocater object use to detect memory leaks.
|
||||
*
|
||||
*/
|
||||
typedef struct allocator_s allocator_t;
|
||||
typedef struct allocator_t allocator_t;
|
||||
|
||||
struct allocator_s {
|
||||
/**
|
||||
*@brief Allocater object use to detect memory leaks.
|
||||
*
|
||||
*/
|
||||
struct allocator_t {
|
||||
|
||||
/**
|
||||
* Allocates memory with LEAK_DETECTION and
|
||||
|
||||
@@ -33,13 +33,12 @@
|
||||
*/
|
||||
#define PRIMECHECK_ROUNDS 30
|
||||
|
||||
typedef struct private_gmp_helper_t private_gmp_helper_t;
|
||||
|
||||
/**
|
||||
* Private data of an gmp_helper_t object.
|
||||
*
|
||||
*/
|
||||
typedef struct private_gmp_helper_s private_gmp_helper_t;
|
||||
|
||||
struct private_gmp_helper_s {
|
||||
struct private_gmp_helper_t {
|
||||
/**
|
||||
* public gmp_helper_t interface
|
||||
*/
|
||||
|
||||
@@ -30,13 +30,13 @@
|
||||
|
||||
#include <types.h>
|
||||
|
||||
typedef struct gmp_helper_t gmp_helper_t;
|
||||
|
||||
/**
|
||||
* Class with helper functions to manipulate gmp values
|
||||
* @brief Class with helper functions to manipulate gmp values.
|
||||
*
|
||||
*/
|
||||
typedef struct gmp_helper_s gmp_helper_t;
|
||||
|
||||
struct gmp_helper_s {
|
||||
struct gmp_helper_t {
|
||||
|
||||
/**
|
||||
* @brief initialize an mpz_t to a random prime of specified size
|
||||
|
||||
@@ -27,15 +27,14 @@
|
||||
#include <utils/allocator.h>
|
||||
|
||||
|
||||
typedef struct linked_list_element_s linked_list_element_t;
|
||||
|
||||
typedef struct linked_list_element_t linked_list_element_t;
|
||||
|
||||
/**
|
||||
* @brief Element of the linked_list.
|
||||
*
|
||||
* This element holds a pointer to the value of the list item itself.
|
||||
*/
|
||||
struct linked_list_element_s{
|
||||
struct linked_list_element_t {
|
||||
/**
|
||||
* value of a list item
|
||||
*/
|
||||
@@ -106,9 +105,9 @@ linked_list_element_t *linked_list_element_create(void *value)
|
||||
* Private variables and functions of linked list
|
||||
*
|
||||
*/
|
||||
typedef struct private_linked_list_s private_linked_list_t;
|
||||
typedef struct private_linked_list_t private_linked_list_t;
|
||||
|
||||
struct private_linked_list_s{
|
||||
struct private_linked_list_t {
|
||||
/**
|
||||
* Public part of linked list
|
||||
*/
|
||||
@@ -136,9 +135,9 @@ struct private_linked_list_s{
|
||||
* Private variables and functions of linked list iterator
|
||||
*
|
||||
*/
|
||||
typedef struct private_linked_list_iterator_s private_linked_list_iterator_t;
|
||||
typedef struct private_linked_list_iterator_t private_linked_list_iterator_t;
|
||||
|
||||
struct private_linked_list_iterator_s{
|
||||
struct private_linked_list_iterator_t {
|
||||
/**
|
||||
* Public part of linked list iterator
|
||||
*/
|
||||
|
||||
@@ -25,16 +25,16 @@
|
||||
|
||||
#include <types.h>
|
||||
|
||||
typedef struct linked_list_iterator_t linked_list_iterator_t;
|
||||
|
||||
/**
|
||||
* @brief Iterator for a linked list
|
||||
*
|
||||
* @brief Iterator for a linked list.
|
||||
*
|
||||
* This element holds a pointer to the current element in the linked list
|
||||
*
|
||||
*
|
||||
* @warning the iterator is NOT thread-save
|
||||
*/
|
||||
typedef struct linked_list_iterator_s linked_list_iterator_t;
|
||||
|
||||
struct linked_list_iterator_s {
|
||||
struct linked_list_iterator_t {
|
||||
|
||||
/**
|
||||
* @brief returns TRUE if more elements are available
|
||||
@@ -92,8 +92,11 @@ struct linked_list_iterator_s {
|
||||
status_t (*destroy) (linked_list_iterator_t *this);
|
||||
};
|
||||
|
||||
typedef struct linked_list_t linked_list_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Double Linked List (named only as linked list)
|
||||
* @brief Double Linked List (named only as linked list).
|
||||
*
|
||||
* @warning Access to an object of this type is not thread-save
|
||||
*
|
||||
@@ -101,10 +104,7 @@ struct linked_list_iterator_s {
|
||||
* @see event_queue_t
|
||||
* @see send_queue_t
|
||||
*/
|
||||
typedef struct linked_list_s linked_list_t;
|
||||
|
||||
|
||||
struct linked_list_s {
|
||||
struct linked_list_t {
|
||||
|
||||
/**
|
||||
* @brief gets the count of items in the list
|
||||
|
||||
@@ -37,11 +37,12 @@
|
||||
*/
|
||||
#define MAX_LOG 8192
|
||||
|
||||
typedef struct private_logger_t private_logger_t;
|
||||
|
||||
/**
|
||||
* @brief The logger object.
|
||||
*/
|
||||
typedef struct private_logger_s private_logger_t;
|
||||
struct private_logger_s {
|
||||
struct private_logger_t {
|
||||
/**
|
||||
* Public data
|
||||
*/
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include <types.h>
|
||||
|
||||
typedef enum logger_level_t logger_level_t;
|
||||
|
||||
/**
|
||||
* @brief Log Levels supported by the logger object
|
||||
*
|
||||
@@ -37,8 +39,7 @@
|
||||
* as CONTROL|MORE fore a detailed cotrol level, or
|
||||
* use RAW| to see all raw data dumps (except private)
|
||||
*/
|
||||
typedef enum logger_level_e logger_level_t;
|
||||
enum logger_level_e {
|
||||
enum logger_level_t {
|
||||
/**
|
||||
* control flow
|
||||
*/
|
||||
@@ -75,11 +76,12 @@ enum logger_level_e {
|
||||
FULL = ALL + CONTROL + ERROR + RAW + PRIVATE
|
||||
};
|
||||
|
||||
typedef struct logger_t logger_t;
|
||||
|
||||
/**
|
||||
* @brief The logger object
|
||||
*/
|
||||
typedef struct logger_s logger_t;
|
||||
struct logger_s {
|
||||
struct logger_t {
|
||||
|
||||
/**
|
||||
* @brief Log an entry, using printf()-like params.
|
||||
|
||||
@@ -49,8 +49,9 @@ mapping_t logger_context_t_mappings[] = {
|
||||
*/
|
||||
#define MAX_LOGGER_NAME 45
|
||||
|
||||
typedef struct private_logger_manager_s private_logger_manager_t;
|
||||
struct private_logger_manager_s {
|
||||
typedef struct private_logger_manager_t private_logger_manager_t;
|
||||
|
||||
struct private_logger_manager_t {
|
||||
/**
|
||||
* Public data.
|
||||
*/
|
||||
@@ -91,9 +92,9 @@ struct private_logger_manager_s {
|
||||
/**
|
||||
* Entry in the logger_levels linked list
|
||||
*/
|
||||
typedef struct logger_levels_entry_s logger_levels_entry_t;
|
||||
typedef struct logger_levels_entry_t logger_levels_entry_t;
|
||||
|
||||
struct logger_levels_entry_s{
|
||||
struct logger_levels_entry_t {
|
||||
logger_context_t context;
|
||||
logger_level_t level;
|
||||
};
|
||||
@@ -101,9 +102,9 @@ struct logger_levels_entry_s{
|
||||
/**
|
||||
* Entry in the loggers linked list
|
||||
*/
|
||||
typedef struct loggers_entry_s loggers_entry_t;
|
||||
typedef struct loggers_entry_t loggers_entry_t;
|
||||
|
||||
struct loggers_entry_s{
|
||||
struct loggers_entry_t {
|
||||
logger_context_t context;
|
||||
logger_t *logger;
|
||||
};
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
|
||||
#include <utils/logger.h>
|
||||
|
||||
typedef enum logger_context_t logger_context_t;
|
||||
|
||||
/**
|
||||
* @brief Context of a specific logger
|
||||
*/
|
||||
typedef enum logger_context_e logger_context_t;
|
||||
|
||||
enum logger_context_e{
|
||||
enum logger_context_t {
|
||||
PARSER,
|
||||
GENERATOR,
|
||||
IKE_SA,
|
||||
@@ -47,14 +47,14 @@ enum logger_context_e{
|
||||
TESTER,
|
||||
DAEMON,
|
||||
CONFIGURATION_MANAGER,
|
||||
};
|
||||
};
|
||||
|
||||
typedef struct logger_manager_t logger_manager_t;
|
||||
|
||||
/**
|
||||
* @brief The logger_manager_t object
|
||||
*/
|
||||
typedef struct logger_manager_s logger_manager_t;
|
||||
|
||||
struct logger_manager_s {
|
||||
struct logger_manager_t {
|
||||
|
||||
/**
|
||||
* @brief Gets a logger_t object for a specific logger context.
|
||||
|
||||
@@ -40,9 +40,9 @@
|
||||
*/
|
||||
#define DEFAULT_PSEUDO_RANDOM_DEVICE "/dev/urandom"
|
||||
|
||||
typedef struct private_randomizer_s private_randomizer_t;
|
||||
typedef struct private_randomizer_t private_randomizer_t;
|
||||
|
||||
struct private_randomizer_s {
|
||||
struct private_randomizer_t {
|
||||
/**
|
||||
* public interface
|
||||
*/
|
||||
|
||||
@@ -25,14 +25,14 @@
|
||||
|
||||
#include <types.h>
|
||||
|
||||
typedef struct randomizer_t randomizer_t;
|
||||
|
||||
/**
|
||||
* Object representing an randomizer
|
||||
* @brief Object representing an randomizer
|
||||
*
|
||||
* This class is thread save as file system read calls are thread save...
|
||||
*/
|
||||
typedef struct randomizer_s randomizer_t;
|
||||
|
||||
struct randomizer_s {
|
||||
struct randomizer_t {
|
||||
|
||||
/**
|
||||
* @brief Reads a specific number of bytes from random device.
|
||||
|
||||
@@ -32,13 +32,14 @@
|
||||
#include <utils/linked_list.h>
|
||||
#include <queues/job_queue.h>
|
||||
|
||||
|
||||
typedef struct private_tester_t private_tester_t;
|
||||
|
||||
/**
|
||||
* @brief Private Variables and Functions of tester class
|
||||
* @brief Private Variables and Functions of tester class.
|
||||
*
|
||||
*/
|
||||
typedef struct private_tester_s private_tester_t;
|
||||
|
||||
struct private_tester_s {
|
||||
struct private_tester_t {
|
||||
tester_t public;
|
||||
|
||||
|
||||
|
||||
@@ -29,22 +29,22 @@
|
||||
|
||||
|
||||
|
||||
typedef struct test_t test_t;
|
||||
|
||||
typedef struct tester_t tester_t;
|
||||
|
||||
/**
|
||||
* @brief Specifies a test
|
||||
*/
|
||||
typedef struct test_s test_t;
|
||||
|
||||
/**
|
||||
* @brief A tester object to perform tests with
|
||||
*/
|
||||
typedef struct tester_s tester_t;
|
||||
|
||||
struct test_s{
|
||||
struct test_t {
|
||||
void (*test_function) (tester_t * tester);
|
||||
char * test_name;
|
||||
};
|
||||
|
||||
struct tester_s {
|
||||
/**
|
||||
* @brief A tester object to perform tests with
|
||||
*/
|
||||
struct tester_t {
|
||||
|
||||
/**
|
||||
* @brief Tests all testcases in array tests with specific tester object
|
||||
|
||||
Reference in New Issue
Block a user