- reworked configuration framework completly
- configuration is now split up in: connections, policies, credentials and daemon config - further alloc/free fixes needed!
This commit is contained in:
@@ -540,7 +540,7 @@ static void generate_from_chunk (private_generator_t *this,u_int32_t offset)
|
||||
/* position in buffer */
|
||||
chunk_t *attribute_value = (chunk_t *)(this->data_struct + offset);
|
||||
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, " =>", attribute_value);
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, " =>", *attribute_value);
|
||||
|
||||
/* use write_bytes_to_buffer function to do the job */
|
||||
this->write_bytes_to_buffer(this,attribute_value->ptr,attribute_value->len);
|
||||
@@ -633,7 +633,7 @@ static void write_to_chunk (private_generator_t *this,chunk_t *data)
|
||||
memcpy(data->ptr,this->buffer,data_length);
|
||||
data->len = data_length;
|
||||
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL3, "generated data of this generator", data);
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL3, "generated data of this generator", *data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -652,7 +652,7 @@ static status_t generate(private_message_t *this, crypter_t *crypter, signer_t*
|
||||
/* clone packet for caller */
|
||||
*packet = this->packet->clone(this->packet);
|
||||
|
||||
this->logger->log(this->logger, CONTROL, "Message of type %s generated successfully",
|
||||
this->logger->log(this->logger, CONTROL|LEVEL1, "Message of type %s generated successfully",
|
||||
mapping_find(exchange_type_m,this->exchange_type));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -25,16 +25,6 @@
|
||||
#include <encoding/payloads/encodings.h>
|
||||
#include <utils/allocator.h>
|
||||
|
||||
/**
|
||||
* String mappings for auth_method_t.
|
||||
*/
|
||||
mapping_t auth_method_m[] = {
|
||||
{RSA_DIGITAL_SIGNATURE, "RSA_DIGITAL_SIGNATURE"},
|
||||
{SHARED_KEY_MESSAGE_INTEGRITY_CODE, "SHARED_KEY_MESSAGE_INTEGRITY_CODE"},
|
||||
{DSS_DIGITAL_SIGNATURE, "DSS_DIGITAL_SIGNATURE"},
|
||||
{MAPPING_END, NULL}
|
||||
};
|
||||
|
||||
|
||||
typedef struct private_auth_payload_t private_auth_payload_t;
|
||||
|
||||
|
||||
@@ -21,11 +21,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _AUTH_PAYLOAD_H_
|
||||
#define _AUTH_PAYLOAD_H_
|
||||
#ifndef AUTH_PAYLOAD_H_
|
||||
#define AUTH_PAYLOAD_H_
|
||||
|
||||
#include <types.h>
|
||||
#include <encoding/payloads/payload.h>
|
||||
#include <config/connection.h>
|
||||
|
||||
/**
|
||||
* Length of a auth payload without the auth data in bytes.
|
||||
@@ -35,40 +36,6 @@
|
||||
#define AUTH_PAYLOAD_HEADER_LENGTH 8
|
||||
|
||||
|
||||
typedef enum auth_method_t auth_method_t;
|
||||
|
||||
/**
|
||||
* AUTH Method of a AUTH payload.
|
||||
*
|
||||
* @ingroup payloads
|
||||
*/
|
||||
enum auth_method_t {
|
||||
/**
|
||||
* Computed as specified in section 2.15 of RFC using
|
||||
* an RSA private key over a PKCS#1 padded hash.
|
||||
*/
|
||||
RSA_DIGITAL_SIGNATURE = 1,
|
||||
|
||||
/* Computed as specified in
|
||||
* section 2.15 of RFC using the shared key associated with the identity
|
||||
* in the ID payload and the negotiated prf function
|
||||
*/
|
||||
SHARED_KEY_MESSAGE_INTEGRITY_CODE = 2,
|
||||
|
||||
/* Computed as specified in section
|
||||
* 2.15 of RFC using a DSS private key over a SHA-1 hash.
|
||||
*/
|
||||
DSS_DIGITAL_SIGNATURE = 3,
|
||||
};
|
||||
|
||||
/**
|
||||
* string mappings for auth method.
|
||||
*
|
||||
* @ingroup payloads
|
||||
*/
|
||||
extern mapping_t auth_method_m[];
|
||||
|
||||
|
||||
typedef struct auth_payload_t auth_payload_t;
|
||||
|
||||
/**
|
||||
@@ -152,4 +119,4 @@ struct auth_payload_t {
|
||||
auth_payload_t *auth_payload_create();
|
||||
|
||||
|
||||
#endif //_AUTH_PAYLOAD_H_
|
||||
#endif /* AUTH_PAYLOAD_H_ */
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef _CERT_PAYLOAD_H_
|
||||
#define _CERT_PAYLOAD_H_
|
||||
#ifndef CERT_PAYLOAD_H_
|
||||
#define CERT_PAYLOAD_H_
|
||||
|
||||
#include <types.h>
|
||||
#include <encoding/payloads/payload.h>
|
||||
@@ -152,4 +152,4 @@ struct cert_payload_t {
|
||||
cert_payload_t *cert_payload_create();
|
||||
|
||||
|
||||
#endif //_CERT_PAYLOAD_H_
|
||||
#endif /* CERT_PAYLOAD_H_ */
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef _CERTREQ_PAYLOAD_H_
|
||||
#define _CERTREQ_PAYLOAD_H_
|
||||
#ifndef CERTREQ_PAYLOAD_H_
|
||||
#define CERTREQ_PAYLOAD_H_
|
||||
|
||||
#include <types.h>
|
||||
#include <encoding/payloads/payload.h>
|
||||
@@ -122,4 +122,4 @@ struct certreq_payload_t {
|
||||
certreq_payload_t *certreq_payload_create();
|
||||
|
||||
|
||||
#endif //_CERTREQ_PAYLOAD_H_
|
||||
#endif /* CERTREQ_PAYLOAD_H_ */
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef _CONFIGURATION_ATTRIBUTE_H_
|
||||
#define _CONFIGURATION_ATTRIBUTE_H_
|
||||
#ifndef CONFIGURATION_ATTRIBUTE_H_
|
||||
#define CONFIGURATION_ATTRIBUTE_H_
|
||||
|
||||
#include <types.h>
|
||||
#include <encoding/payloads/payload.h>
|
||||
@@ -146,4 +146,4 @@ struct configuration_attribute_t {
|
||||
*/
|
||||
configuration_attribute_t *configuration_attribute_create();
|
||||
|
||||
#endif /*_CONFIGURATION_ATTRIBUTE_H_*/
|
||||
#endif /* CONFIGURATION_ATTRIBUTE_H_*/
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <encoding/payloads/payload.h>
|
||||
#include <encoding/payloads/configuration_attribute.h>
|
||||
#include <utils/linked_list.h>
|
||||
#include <config/init_config.h>
|
||||
|
||||
/**
|
||||
* CP_PAYLOAD length in bytes without any proposal substructure.
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef _DELETE_PAYLOAD_H_
|
||||
#define _DELETE_PAYLOAD_H_
|
||||
#ifndef DELETE_PAYLOAD_H_
|
||||
#define DELETE_PAYLOAD_H_
|
||||
|
||||
#include <types.h>
|
||||
#include <encoding/payloads/payload.h>
|
||||
@@ -153,4 +153,4 @@ struct delete_payload_t {
|
||||
delete_payload_t *delete_payload_create();
|
||||
|
||||
|
||||
#endif //_DELETE_PAYLOAD_H_
|
||||
#endif /* DELETE_PAYLOAD_H_ */
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef _EAP_PAYLOAD_H_
|
||||
#define _EAP_PAYLOAD_H_
|
||||
#ifndef EAP_PAYLOAD_H_
|
||||
#define EAP_PAYLOAD_H_
|
||||
|
||||
#include <types.h>
|
||||
#include <encoding/payloads/payload.h>
|
||||
@@ -102,4 +102,4 @@ struct eap_payload_t {
|
||||
eap_payload_t *eap_payload_create();
|
||||
|
||||
|
||||
#endif //_EAP_PAYLOAD_H_
|
||||
#endif /* EAP_PAYLOAD_H_ */
|
||||
|
||||
@@ -289,7 +289,7 @@ static status_t encrypt(private_encryption_payload_t *this)
|
||||
this->generate(this);
|
||||
|
||||
this->logger->log(this->logger, CONTROL|LEVEL2, "encrypting payloads");
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data to encrypt", &this->decrypted);
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data to encrypt", this->decrypted);
|
||||
|
||||
/* build padding */
|
||||
block_size = this->crypter->get_block_size(this->crypter);
|
||||
@@ -309,7 +309,7 @@ static status_t encrypt(private_encryption_payload_t *this)
|
||||
randomizer->allocate_pseudo_random_bytes(randomizer, iv.len, &iv);
|
||||
randomizer->destroy(randomizer);
|
||||
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data before encryption with padding", &to_crypt);
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data before encryption with padding", to_crypt);
|
||||
|
||||
/* encrypt to_crypt chunk */
|
||||
allocator_free(this->encrypted.ptr);
|
||||
@@ -322,7 +322,7 @@ static status_t encrypt(private_encryption_payload_t *this)
|
||||
allocator_free(iv.ptr);
|
||||
return status;
|
||||
}
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data after encryption", &result);
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data after encryption", result);
|
||||
|
||||
|
||||
/* build encrypted result with iv and signature */
|
||||
@@ -336,7 +336,7 @@ static status_t encrypt(private_encryption_payload_t *this)
|
||||
|
||||
allocator_free(result.ptr);
|
||||
allocator_free(iv.ptr);
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data after encryption with IV and (invalid) signature", &this->encrypted);
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data after encryption with IV and (invalid) signature", this->encrypted);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -352,7 +352,7 @@ static status_t decrypt(private_encryption_payload_t *this)
|
||||
|
||||
|
||||
this->logger->log(this->logger, CONTROL|LEVEL2, "decrypting encryption payload");
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data before decryption with IV and (invalid) signature", &this->encrypted);
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data before decryption with IV and (invalid) signature", this->encrypted);
|
||||
|
||||
|
||||
if (this->signer == NULL || this->crypter == NULL)
|
||||
@@ -382,7 +382,7 @@ static status_t decrypt(private_encryption_payload_t *this)
|
||||
/* free previus data, if any */
|
||||
allocator_free(this->decrypted.ptr);
|
||||
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data before decryption", &concatenated);
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data before decryption", concatenated);
|
||||
|
||||
status = this->crypter->decrypt(this->crypter, concatenated, iv, &(this->decrypted));
|
||||
if (status != SUCCESS)
|
||||
@@ -390,7 +390,7 @@ static status_t decrypt(private_encryption_payload_t *this)
|
||||
this->logger->log(this->logger, ERROR|LEVEL1, "could not decrypt, decryption failed");
|
||||
return FAILED;
|
||||
}
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data after decryption with padding", &this->decrypted);
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data after decryption with padding", this->decrypted);
|
||||
|
||||
|
||||
/* get padding length, sits just bevore signature */
|
||||
@@ -409,7 +409,7 @@ static status_t decrypt(private_encryption_payload_t *this)
|
||||
|
||||
/* free padding */
|
||||
this->decrypted.ptr = allocator_realloc(this->decrypted.ptr, this->decrypted.len);
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data after decryption without padding", &this->decrypted);
|
||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data after decryption without padding", this->decrypted);
|
||||
this->logger->log(this->logger, CONTROL|LEVEL2, "decryption successful, trying to parse content");
|
||||
return (this->parse(this));
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ID_PAYLOAD_H_
|
||||
#define _ID_PAYLOAD_H_
|
||||
#ifndef ID_PAYLOAD_H_
|
||||
#define ID_PAYLOAD_H_
|
||||
|
||||
#include <types.h>
|
||||
#include <utils/identification.h>
|
||||
@@ -169,4 +169,4 @@ id_payload_t *id_payload_create_from_identification(bool is_initiator,identifica
|
||||
|
||||
|
||||
|
||||
#endif //_ID_PAYLOAD_H_
|
||||
#endif /* ID_PAYLOAD_H_ */
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
#include <encoding/payloads/payload.h>
|
||||
#include <encoding/payloads/proposal_substructure.h>
|
||||
#include <utils/linked_list.h>
|
||||
#include <config/init_config.h>
|
||||
#include <config/sa_config.h>
|
||||
|
||||
/**
|
||||
* Critical flag must not be set.
|
||||
|
||||
@@ -168,4 +168,4 @@ traffic_selector_substructure_t *traffic_selector_substructure_create();
|
||||
traffic_selector_substructure_t *traffic_selector_substructure_create_from_traffic_selector(traffic_selector_t *traffic_selector);
|
||||
|
||||
|
||||
#endif //TRAFFIC_SELECTOR_SUBSTRUCTURE_H_
|
||||
#endif /* /TRAFFIC_SELECTOR_SUBSTRUCTURE_H_ */
|
||||
|
||||
@@ -149,4 +149,4 @@ ts_payload_t *ts_payload_create(bool is_initiator);
|
||||
ts_payload_t *ts_payload_create_from_traffic_selectors(bool is_initiator, linked_list_t *traffic_selectors);
|
||||
|
||||
|
||||
#endif //TS_PAYLOAD_H_
|
||||
#endif /* TS_PAYLOAD_H_ */
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef _UNKNOWN_PAYLOAD_H_
|
||||
#define _UNKNOWN_PAYLOAD_H_
|
||||
#ifndef UNKNOWN_PAYLOAD_H_
|
||||
#define UNKNOWN_PAYLOAD_H_
|
||||
|
||||
#include <types.h>
|
||||
#include <encoding/payloads/payload.h>
|
||||
@@ -92,4 +92,4 @@ struct unknown_payload_t {
|
||||
unknown_payload_t *unknown_payload_create();
|
||||
|
||||
|
||||
#endif //_UNKNOWN_PAYLOAD_H_
|
||||
#endif /* UNKNOWN_PAYLOAD_H_ */
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef _VENDOR_ID_PAYLOAD_H_
|
||||
#define _VENDOR_ID_PAYLOAD_H_
|
||||
#ifndef VENDOR_ID_PAYLOAD_H_
|
||||
#define VENDOR_ID_PAYLOAD_H_
|
||||
|
||||
#include <types.h>
|
||||
#include <encoding/payloads/payload.h>
|
||||
@@ -100,4 +100,4 @@ struct vendor_id_payload_t {
|
||||
vendor_id_payload_t *vendor_id_payload_create();
|
||||
|
||||
|
||||
#endif //_VENDOR_ID_PAYLOAD_H_
|
||||
#endif /* VENDOR_ID_PAYLOAD_H_ */
|
||||
|
||||
Reference in New Issue
Block a user