diff options
Diffstat (limited to 'src/charon/encoding')
-rw-r--r-- | src/charon/encoding/generator.c | 52 | ||||
-rw-r--r-- | src/charon/encoding/message.c | 94 | ||||
-rw-r--r-- | src/charon/encoding/parser.c | 74 | ||||
-rw-r--r-- | src/charon/encoding/payloads/encryption_payload.c | 54 | ||||
-rw-r--r-- | src/charon/encoding/payloads/notify_payload.c | 10 | ||||
-rw-r--r-- | src/charon/encoding/payloads/proposal_substructure.c | 14 | ||||
-rw-r--r-- | src/charon/encoding/payloads/sa_payload.c | 8 | ||||
-rw-r--r-- | src/charon/encoding/payloads/transform_substructure.c | 6 |
8 files changed, 156 insertions, 156 deletions
diff --git a/src/charon/encoding/generator.c b/src/charon/encoding/generator.c index 6eb3c5d66..def14cb64 100644 --- a/src/charon/encoding/generator.c +++ b/src/charon/encoding/generator.c @@ -306,7 +306,7 @@ static void generate_u_int_type (private_generator_t *this,encoding_type_t int_t break; default: - DBG1(SIG_DBG_ENC, "U_INT Type %N is not supported", + DBG1(DBG_ENC, "U_INT Type %N is not supported", encoding_type_names, int_type); return; @@ -314,7 +314,7 @@ static void generate_u_int_type (private_generator_t *this,encoding_type_t int_t /* U_INT Types of multiple then 8 bits must be aligned */ if (((number_of_bits % 8) == 0) && (this->current_bit != 0)) { - DBG1(SIG_DBG_ENC, "U_INT Type %N is not 8 Bit aligned", + DBG1(DBG_ENC, "U_INT Type %N is not 8 Bit aligned", encoding_type_names, int_type); /* current bit has to be zero for values multiple of 8 bits */ return; @@ -335,7 +335,7 @@ static void generate_u_int_type (private_generator_t *this,encoding_type_t int_t u_int8_t low_val = *(this->out_position) & 0x0F; /* highval is set, low_val is not changed */ *(this->out_position) = high_val | low_val; - DBG3(SIG_DBG_ENC, " => %d", *(this->out_position)); + DBG3(DBG_ENC, " => %d", *(this->out_position)); /* write position is not changed, just bit position is moved */ this->current_bit = 4; } @@ -346,14 +346,14 @@ static void generate_u_int_type (private_generator_t *this,encoding_type_t int_t /* lowval of current byte in buffer has to be set to the new value*/ u_int low_val = *((u_int8_t *)(this->data_struct + offset)) & 0x0F; *(this->out_position) = high_val | low_val; - DBG3(SIG_DBG_ENC, " => %d", *(this->out_position)); + DBG3(DBG_ENC, " => %d", *(this->out_position)); this->out_position++; this->current_bit = 0; } else { - DBG1(SIG_DBG_ENC, "U_INT_4 Type is not 4 Bit aligned"); + DBG1(DBG_ENC, "U_INT_4 Type is not 4 Bit aligned"); /* 4 Bit integers must have a 4 bit alignment */ return; }; @@ -364,7 +364,7 @@ static void generate_u_int_type (private_generator_t *this,encoding_type_t int_t { /* 8 bit values are written as they are */ *this->out_position = *((u_int8_t *)(this->data_struct + offset)); - DBG3(SIG_DBG_ENC, " => %d", *(this->out_position)); + DBG3(DBG_ENC, " => %d", *(this->out_position)); this->out_position++; break; @@ -374,7 +374,7 @@ static void generate_u_int_type (private_generator_t *this,encoding_type_t int_t /* attribute type must not change first bit uf current byte ! */ if (this->current_bit != 1) { - DBG1(SIG_DBG_ENC, "ATTRIBUTE FORMAT flag is not set"); + DBG1(DBG_ENC, "ATTRIBUTE FORMAT flag is not set"); /* first bit has to be set! */ return; } @@ -386,7 +386,7 @@ static void generate_u_int_type (private_generator_t *this,encoding_type_t int_t int16_val = int16_val & 0xFF7F; int16_val = int16_val | attribute_format_flag; - DBG3(SIG_DBG_ENC, " => %d", int16_val); + DBG3(DBG_ENC, " => %d", int16_val); /* write bytes to buffer (set bit is overwritten)*/ this->write_bytes_to_buffer(this,&int16_val,sizeof(u_int16_t)); this->current_bit = 0; @@ -397,14 +397,14 @@ static void generate_u_int_type (private_generator_t *this,encoding_type_t int_t case CONFIGURATION_ATTRIBUTE_LENGTH: { u_int16_t int16_val = htons(*((u_int16_t*)(this->data_struct + offset))); - DBG3(SIG_DBG_ENC, " => %b", (void*)&int16_val, sizeof(int16_val)); + DBG3(DBG_ENC, " => %b", (void*)&int16_val, sizeof(int16_val)); this->write_bytes_to_buffer(this,&int16_val,sizeof(u_int16_t)); break; } case U_INT_32: { u_int32_t int32_val = htonl(*((u_int32_t*)(this->data_struct + offset))); - DBG3(SIG_DBG_ENC, " => %b", (void*)&int32_val, sizeof(int32_val)); + DBG3(DBG_ENC, " => %b", (void*)&int32_val, sizeof(int32_val)); this->write_bytes_to_buffer(this,&int32_val,sizeof(u_int32_t)); break; } @@ -413,7 +413,7 @@ static void generate_u_int_type (private_generator_t *this,encoding_type_t int_t /* 64 bit integers are written as two 32 bit integers */ u_int32_t int32_val_low = htonl(*((u_int32_t*)(this->data_struct + offset))); u_int32_t int32_val_high = htonl(*((u_int32_t*)(this->data_struct + offset) + 1)); - DBG3(SIG_DBG_ENC, " => %b %b", + DBG3(DBG_ENC, " => %b %b", (void*)&int32_val_low, sizeof(int32_val_low), (void*)&int32_val_high, sizeof(int32_val_high)); /* TODO add support for big endian machines */ @@ -426,12 +426,12 @@ static void generate_u_int_type (private_generator_t *this,encoding_type_t int_t { /* 64 bit are written as they come :-) */ this->write_bytes_to_buffer(this,(this->data_struct + offset),sizeof(u_int64_t)); - DBG3(SIG_DBG_ENC, " => %b", (void*)(this->data_struct + offset), sizeof(u_int64_t)); + DBG3(DBG_ENC, " => %b", (void*)(this->data_struct + offset), sizeof(u_int64_t)); break; } default: { - DBG1(SIG_DBG_ENC, "U_INT Type %N is not supported", + DBG1(DBG_ENC, "U_INT Type %N is not supported", encoding_type_names, int_type); return; } @@ -446,7 +446,7 @@ static void generate_reserved_field(private_generator_t *this,int bits) /* only one bit or 8 bit fields are supported */ if ((bits != 1) && (bits != 8)) { - DBG1(SIG_DBG_ENC, "reserved field of %d bits cannot be generated", bits); + DBG1(DBG_ENC, "reserved field of %d bits cannot be generated", bits); return ; } /* make sure enough space is available in buffer */ @@ -476,7 +476,7 @@ static void generate_reserved_field(private_generator_t *this,int bits) /* one byte processing*/ if (this->current_bit > 0) { - DBG1(SIG_DBG_ENC, "reserved field cannot be written cause " + DBG1(DBG_ENC, "reserved field cannot be written cause " "alignement of current bit is %d", this->current_bit); return; } @@ -511,7 +511,7 @@ static void generate_flag (private_generator_t *this,u_int32_t offset) *(this->out_position) = *(this->out_position) | flag; - DBG3(SIG_DBG_ENC, " => %d", *(this->out_position)); + DBG3(DBG_ENC, " => %d", *(this->out_position)); this->current_bit++; if (this->current_bit >= 8) @@ -528,14 +528,14 @@ static void generate_from_chunk (private_generator_t *this,u_int32_t offset) { if (this->current_bit != 0) { - DBG1(SIG_DBG_ENC, "can not generate a chunk at Bitpos %d", this->current_bit); + DBG1(DBG_ENC, "can not generate a chunk at Bitpos %d", this->current_bit); return ; } /* position in buffer */ chunk_t *attribute_value = (chunk_t *)(this->data_struct + offset); - DBG3(SIG_DBG_ENC, " => %B", attribute_value); + DBG3(DBG_ENC, " => %B", attribute_value); /* use write_bytes_to_buffer function to do the job */ this->write_bytes_to_buffer(this,attribute_value->ptr,attribute_value->len); @@ -553,7 +553,7 @@ static void make_space_available (private_generator_t *this, size_t bits) size_t new_buffer_size = old_buffer_size + GENERATOR_DATA_BUFFER_INCREASE_VALUE; size_t out_position_offset = ((this->out_position) - (this->buffer)); - DBG2(SIG_DBG_ENC, "increased gen buffer from %d to %d byte", + DBG2(DBG_ENC, "increased gen buffer from %d to %d byte", old_buffer_size, new_buffer_size); /* Reallocate space for new buffer */ @@ -628,7 +628,7 @@ static void write_to_chunk (private_generator_t *this,chunk_t *data) memcpy(data->ptr,this->buffer,data_length); data->len = data_length; - DBG3(SIG_DBG_ENC, "generated data of this generator %B", data); + DBG3(DBG_ENC, "generated data of this generator %B", data); } /** @@ -650,7 +650,7 @@ static void generate_payload (private_generator_t *this,payload_t *payload) payload_start = this->out_position; - DBG2(SIG_DBG_ENC, "generating payload of type %N", + DBG2(DBG_ENC, "generating payload of type %N", payload_type_names, payload_type); /* each payload has its own encoding rules */ @@ -658,7 +658,7 @@ static void generate_payload (private_generator_t *this,payload_t *payload) for (i = 0; i < rule_count;i++) { - DBG2(SIG_DBG_ENC, " generating rule %d %N", + DBG2(DBG_ENC, " generating rule %d %N", i, encoding_type_names, rules[i].type); switch (rules[i].type) { @@ -949,7 +949,7 @@ static void generate_payload (private_generator_t *this,payload_t *payload) { if (this->attribute_format == FALSE) { - DBG2(SIG_DBG_ENC, "attribute value has not fixed size"); + DBG2(DBG_ENC, "attribute value has not fixed size"); /* the attribute value is generated */ this->generate_from_chunk(this,rules[i].offset); } @@ -995,14 +995,14 @@ static void generate_payload (private_generator_t *this,payload_t *payload) break; } default: - DBG1(SIG_DBG_ENC, "field type %N is not supported", + DBG1(DBG_ENC, "field type %N is not supported", encoding_type_names, rules[i].type); return; } } - DBG2(SIG_DBG_ENC, "generating %N payload finished", + DBG2(DBG_ENC, "generating %N payload finished", payload_type_names, payload_type); - DBG3(SIG_DBG_ENC, "generated data for this payload %b", + DBG3(DBG_ENC, "generated data for this payload %b", payload_start, this->out_position-payload_start); } diff --git a/src/charon/encoding/message.c b/src/charon/encoding/message.c index 44850313c..d8f5efe7b 100644 --- a/src/charon/encoding/message.c +++ b/src/charon/encoding/message.c @@ -483,7 +483,7 @@ static void add_payload(private_message_t *this, payload_t *payload) payload->set_next_type(payload, NO_PAYLOAD); this->payloads->insert_last(this->payloads, (void*)payload); - DBG2(SIG_DBG_ENC ,"added payload of type %N to message", + DBG2(DBG_ENC ,"added payload of type %N to message", payload_type_names, payload->get_type(payload)); } @@ -619,12 +619,12 @@ static status_t encrypt_payloads (private_message_t *this,crypter_t *crypter, si if (!this->message_rule->encrypted_content) { - DBG2(SIG_DBG_ENC, "message doesn't have to be encrypted"); + DBG2(DBG_ENC, "message doesn't have to be encrypted"); /* message contains no content to encrypt */ return SUCCESS; } - DBG2(SIG_DBG_ENC, "copy all payloads to a temporary list"); + DBG2(DBG_ENC, "copy all payloads to a temporary list"); all_payloads = linked_list_create(); /* first copy all payloads in a temporary list */ @@ -637,7 +637,7 @@ static status_t encrypt_payloads (private_message_t *this,crypter_t *crypter, si encryption_payload = encryption_payload_create(); - DBG2(SIG_DBG_ENC, "check each payloads if they have to get encrypted"); + DBG2(DBG_ENC, "check each payloads if they have to get encrypted"); while (all_payloads->get_count(all_payloads) > 0) { payload_rule_t *payload_rule; @@ -652,30 +652,30 @@ static status_t encrypt_payloads (private_message_t *this,crypter_t *crypter, si * it is presumed that they don't have to be encrypted */ if ((status == SUCCESS) && (payload_rule->encrypted)) { - DBG2(SIG_DBG_ENC, "payload %N gets encrypted", + DBG2(DBG_ENC, "payload %N gets encrypted", payload_type_names, current_payload->get_type(current_payload)); to_encrypt = TRUE; } if (to_encrypt) { - DBG2(SIG_DBG_ENC, "insert payload %N to encryption payload", + DBG2(DBG_ENC, "insert payload %N to encryption payload", payload_type_names, current_payload->get_type(current_payload)); encryption_payload->add_payload(encryption_payload,current_payload); } else { - DBG2(SIG_DBG_ENC, "insert payload %N unencrypted", + DBG2(DBG_ENC, "insert payload %N unencrypted", payload_type_names ,current_payload->get_type(current_payload)); add_payload(this, (payload_t*)encryption_payload); } } status = SUCCESS; - DBG2(SIG_DBG_ENC, "encrypting encryption payload"); + DBG2(DBG_ENC, "encrypting encryption payload"); encryption_payload->set_transforms(encryption_payload, crypter,signer); status = encryption_payload->encrypt(encryption_payload); - DBG2(SIG_DBG_ENC, "add encrypted payload to payload list"); + DBG2(DBG_ENC, "add encrypted payload to payload list"); add_payload(this, (payload_t*)encryption_payload); all_payloads->destroy(all_payloads); @@ -702,18 +702,18 @@ static status_t generate(private_message_t *this, crypter_t *crypter, signer_t* return SUCCESS; } - DBG1(SIG_DBG_ENC, "generating %M", this); + DBG1(DBG_ENC, "generating %M", this); if (this->exchange_type == EXCHANGE_TYPE_UNDEFINED) { - DBG1(SIG_DBG_ENC, "exchange type is not defined"); + DBG1(DBG_ENC, "exchange type is not defined"); return INVALID_STATE; } if (this->packet->get_source(this->packet) == NULL || this->packet->get_destination(this->packet) == NULL) { - DBG1(SIG_DBG_ENC, "%s not defined", + DBG1(DBG_ENC, "%s not defined", !this->packet->get_source(this->packet) ? "source" : "destination"); return INVALID_STATE; } @@ -722,7 +722,7 @@ static status_t generate(private_message_t *this, crypter_t *crypter, signer_t* status = set_message_rule(this); if (status != SUCCESS) { - DBG1(SIG_DBG_ENC, "no message rules specified for this message type"); + DBG1(DBG_ENC, "no message rules specified for this message type"); return NOT_SUPPORTED; } @@ -730,7 +730,7 @@ static status_t generate(private_message_t *this, crypter_t *crypter, signer_t* status = encrypt_payloads(this, crypter, signer); if (status != SUCCESS) { - DBG1(SIG_DBG_ENC, "payload encryption failed"); + DBG1(DBG_ENC, "payload encryption failed"); return status; } @@ -773,7 +773,7 @@ static status_t generate(private_message_t *this, crypter_t *crypter, signer_t* /* if last payload is of type encrypted, integrity checksum if necessary */ if (payload->get_type(payload) == ENCRYPTED) { - DBG2(SIG_DBG_ENC, "build signature on whole message"); + DBG2(DBG_ENC, "build signature on whole message"); encryption_payload_t *encryption_payload = (encryption_payload_t*)payload; status = encryption_payload->build_signature(encryption_payload, packet_data); if (status != SUCCESS) @@ -787,7 +787,7 @@ static status_t generate(private_message_t *this, crypter_t *crypter, signer_t* /* clone packet for caller */ *packet = this->packet->clone(this->packet); - DBG2(SIG_DBG_ENC, "message generated successfully"); + DBG2(DBG_ENC, "message generated successfully"); return SUCCESS; } @@ -815,13 +815,13 @@ static status_t parse_header(private_message_t *this) ike_header_t *ike_header; status_t status; - DBG2(SIG_DBG_ENC, "parsing header of message"); + DBG2(DBG_ENC, "parsing header of message"); this->parser->reset_context(this->parser); status = this->parser->parse_payload(this->parser,HEADER,(payload_t **) &ike_header); if (status != SUCCESS) { - DBG1(SIG_DBG_ENC, "header could not be parsed"); + DBG1(DBG_ENC, "header could not be parsed"); return status; } @@ -830,7 +830,7 @@ static status_t parse_header(private_message_t *this) status = ike_header->payload_interface.verify(&(ike_header->payload_interface)); if (status != SUCCESS) { - DBG1(SIG_DBG_ENC, "header verification failed"); + DBG1(DBG_ENC, "header verification failed"); ike_header->destroy(ike_header); return status; } @@ -851,7 +851,7 @@ static status_t parse_header(private_message_t *this) this->minor_version = ike_header->get_min_version(ike_header); this->first_payload = ike_header->payload_interface.get_next_type(&(ike_header->payload_interface)); - DBG2(SIG_DBG_ENC, "parsed a %N %s", exchange_type_names, this->exchange_type, + DBG2(DBG_ENC, "parsed a %N %s", exchange_type_names, this->exchange_type, this->is_request ? "request" : "response"); ike_header->destroy(ike_header); @@ -860,7 +860,7 @@ static status_t parse_header(private_message_t *this) status = set_message_rule(this); if (status != SUCCESS) { - DBG1(SIG_DBG_ENC, "no message rules specified for a %N %s", + DBG1(DBG_ENC, "no message rules specified for a %N %s", exchange_type_names, this->exchange_type, this->is_request ? "request" : "response"); } @@ -891,7 +891,7 @@ static status_t decrypt_payloads(private_message_t *this,crypter_t *crypter, sig /* needed to check */ current_payload_type = current_payload->get_type(current_payload); - DBG2(SIG_DBG_ENC, "process payload of type %N", + DBG2(DBG_ENC, "process payload of type %N", payload_type_names, current_payload_type); if (current_payload_type == ENCRYPTED) @@ -901,31 +901,31 @@ static status_t decrypt_payloads(private_message_t *this,crypter_t *crypter, sig encryption_payload = (encryption_payload_t*)current_payload; - DBG2(SIG_DBG_ENC, "found an encryption payload"); + DBG2(DBG_ENC, "found an encryption payload"); if (payload_number != this->payloads->get_count(this->payloads)) { /* encrypted payload is not last one */ - DBG1(SIG_DBG_ENC, "encrypted payload is not last payload"); + DBG1(DBG_ENC, "encrypted payload is not last payload"); iterator->destroy(iterator); return VERIFY_ERROR; } /* decrypt */ encryption_payload->set_transforms(encryption_payload, crypter, signer); - DBG2(SIG_DBG_ENC, "verify signature of encryption payload"); + DBG2(DBG_ENC, "verify signature of encryption payload"); status = encryption_payload->verify_signature(encryption_payload, this->packet->get_data(this->packet)); if (status != SUCCESS) { - DBG1(SIG_DBG_ENC, "encryption payload signature invalid"); + DBG1(DBG_ENC, "encryption payload signature invalid"); iterator->destroy(iterator); return FAILED; } - DBG2(SIG_DBG_ENC, "decrypting content of encryption payload"); + DBG2(DBG_ENC, "decrypting content of encryption payload"); status = encryption_payload->decrypt(encryption_payload); if (status != SUCCESS) { - DBG1(SIG_DBG_ENC, "encrypted payload could not be decrypted and parsed"); + DBG1(DBG_ENC, "encrypted payload could not be decrypted and parsed"); iterator->destroy(iterator); return PARSE_ERROR; } @@ -936,7 +936,7 @@ static status_t decrypt_payloads(private_message_t *this,crypter_t *crypter, sig /* check if there are payloads contained in the encryption payload */ if (encryption_payload->get_payload_count(encryption_payload) == 0) { - DBG2(SIG_DBG_ENC, "encrypted payload is empty"); + DBG2(DBG_ENC, "encrypted payload is empty"); /* remove the encryption payload, is not needed anymore */ iterator->remove(iterator); /* encrypted payload contains no other payload */ @@ -966,7 +966,7 @@ static status_t decrypt_payloads(private_message_t *this,crypter_t *crypter, sig while (encryption_payload->get_payload_count(encryption_payload) > 0) { encryption_payload->remove_first_payload(encryption_payload, ¤t_encrypted_payload); - DBG2(SIG_DBG_ENC, "insert unencrypted payload of type %N at end of list", + DBG2(DBG_ENC, "insert unencrypted payload of type %N at end of list", payload_type_names, current_encrypted_payload->get_type(current_encrypted_payload)); this->payloads->insert_last(this->payloads,current_encrypted_payload); } @@ -983,7 +983,7 @@ static status_t decrypt_payloads(private_message_t *this,crypter_t *crypter, sig if (status != SUCCESS) { /* payload is not allowed */ - DBG1(SIG_DBG_ENC, "payload type %N not allowed", + DBG1(DBG_ENC, "payload type %N not allowed", payload_type_names, current_payload_type); iterator->destroy(iterator); return VERIFY_ERROR; @@ -993,7 +993,7 @@ static status_t decrypt_payloads(private_message_t *this,crypter_t *crypter, sig if (payload_rule->encrypted != current_payload_was_encrypted) { /* payload was not encrypted, but should have been. or vice-versa */ - DBG1(SIG_DBG_ENC, "payload type %N should be %s!", + DBG1(DBG_ENC, "payload type %N should be %s!", payload_type_names, current_payload_type, (payload_rule->encrypted) ? "encrypted" : "not encrypted"); iterator->destroy(iterator); @@ -1019,7 +1019,7 @@ static status_t verify(private_message_t *this) payload_t *current_payload; size_t total_found_payloads = 0; - DBG2(SIG_DBG_ENC, "verifying message structure"); + DBG2(DBG_ENC, "verifying message structure"); iterator = this->payloads->create_iterator(this->payloads,TRUE); /* check for payloads with wrong count*/ @@ -1041,7 +1041,7 @@ static status_t verify(private_message_t *this) unknown_payload_t *unknown_payload = (unknown_payload_t*)current_payload; if (unknown_payload->is_critical(unknown_payload)) { - DBG1(SIG_DBG_ENC, "%N is not supported, but its critical!", + DBG1(DBG_ENC, "%N is not supported, but its critical!", payload_type_names, current_payload_type); iterator->destroy(iterator); return NOT_SUPPORTED; @@ -1051,13 +1051,13 @@ static status_t verify(private_message_t *this) { found_payloads++; total_found_payloads++; - DBG2(SIG_DBG_ENC, "found payload of type %N", + DBG2(DBG_ENC, "found payload of type %N", payload_type_names, this->message_rule->payload_rules[i].payload_type); /* as soon as ohe payload occures more then specified, the verification fails */ if (found_payloads > this->message_rule->payload_rules[i].max_occurence) { - DBG1(SIG_DBG_ENC, "payload of type %N more than %d times (%d) occured in current message", + DBG1(DBG_ENC, "payload of type %N more than %d times (%d) occured in current message", payload_type_names, current_payload_type, this->message_rule->payload_rules[i].max_occurence, found_payloads); iterator->destroy(iterator); @@ -1068,7 +1068,7 @@ static status_t verify(private_message_t *this) if (found_payloads < this->message_rule->payload_rules[i].min_occurence) { - DBG1(SIG_DBG_ENC, "payload of type %N not occured %d times (%d)", + DBG1(DBG_ENC, "payload of type %N not occured %d times (%d)", payload_type_names, this->message_rule->payload_rules[i].payload_type, this->message_rule->payload_rules[i].min_occurence, found_payloads); iterator->destroy(iterator); @@ -1094,7 +1094,7 @@ static status_t parse_body(private_message_t *this, crypter_t *crypter, signer_t current_payload_type = this->first_payload; - DBG2(SIG_DBG_ENC, "parsing body of message, first payload is %N", + DBG2(DBG_ENC, "parsing body of message, first payload is %N", payload_type_names, current_payload_type); /* parse payload for payload, while there are more available */ @@ -1102,7 +1102,7 @@ static status_t parse_body(private_message_t *this, crypter_t *crypter, signer_t { payload_t *current_payload; - DBG2(SIG_DBG_ENC, "starting parsing a %N payload", + DBG2(DBG_ENC, "starting parsing a %N payload", payload_type_names, current_payload_type); /* parse current payload */ @@ -1110,32 +1110,32 @@ static status_t parse_body(private_message_t *this, crypter_t *crypter, signer_t if (status != SUCCESS) { - DBG1(SIG_DBG_ENC, "payload type %N could not be parsed", + DBG1(DBG_ENC, "payload type %N could not be parsed", payload_type_names, current_payload_type); return PARSE_ERROR; } - DBG2(SIG_DBG_ENC, "verifying payload of type %N", + DBG2(DBG_ENC, "verifying payload of type %N", payload_type_names, current_payload_type); /* verify it, stop parsig if its invalid */ status = current_payload->verify(current_payload); if (status != SUCCESS) { - DBG1(SIG_DBG_ENC, "%N payload verification failed", + DBG1(DBG_ENC, "%N payload verification failed", payload_type_names, current_payload_type); current_payload->destroy(current_payload); return VERIFY_ERROR; } - DBG2(SIG_DBG_ENC, "%N payload verified. Adding to payload list", + DBG2(DBG_ENC, "%N payload verified. Adding to payload list", payload_type_names, current_payload_type); this->payloads->insert_last(this->payloads,current_payload); /* an encryption payload is the last one, so STOP here. decryption is done later */ if (current_payload_type == ENCRYPTED) { - DBG2(SIG_DBG_ENC, "%N payload found. Stop parsing", + DBG2(DBG_ENC, "%N payload found. Stop parsing", payload_type_names, current_payload_type); break; } @@ -1149,7 +1149,7 @@ static status_t parse_body(private_message_t *this, crypter_t *crypter, signer_t status = decrypt_payloads(this,crypter,signer); if (status != SUCCESS) { - DBG1(SIG_DBG_ENC, "could not decrypt payloads"); + DBG1(DBG_ENC, "could not decrypt payloads"); return status; } } @@ -1157,11 +1157,11 @@ static status_t parse_body(private_message_t *this, crypter_t *crypter, signer_t status = verify(this); if (status != SUCCESS) { - DBG1(SIG_DBG_ENC, "verification of message failed"); + DBG1(DBG_ENC, "verification of message failed"); return status; } - DBG1(SIG_DBG_ENC, "parsed %M", this); + DBG1(DBG_ENC, "parsed %M", this); return SUCCESS; } diff --git a/src/charon/encoding/parser.c b/src/charon/encoding/parser.c index efa623ab3..6e8bad546 100644 --- a/src/charon/encoding/parser.c +++ b/src/charon/encoding/parser.c @@ -241,7 +241,7 @@ static status_t parse_uint4(private_parser_t *this, int rule_number, u_int8_t *o { if (this->byte_pos + sizeof(u_int8_t) > this->input_roof) { - DBG1(SIG_DBG_ENC, " not enough input to parse rule %d %N", + DBG1(DBG_ENC, " not enough input to parse rule %d %N", rule_number, encoding_type_names, this->rules[rule_number].type); return PARSE_ERROR; } @@ -265,7 +265,7 @@ static status_t parse_uint4(private_parser_t *this, int rule_number, u_int8_t *o this->byte_pos++; break; default: - DBG2(SIG_DBG_ENC, " found rule %d %N on bitpos %d", + DBG2(DBG_ENC, " found rule %d %N on bitpos %d", rule_number, encoding_type_names, this->rules[rule_number].type, this->bit_pos); return PARSE_ERROR; @@ -273,7 +273,7 @@ static status_t parse_uint4(private_parser_t *this, int rule_number, u_int8_t *o if (output_pos != NULL) { - DBG3(SIG_DBG_ENC, " => %d", *output_pos); + DBG3(DBG_ENC, " => %d", *output_pos); } return SUCCESS; @@ -286,13 +286,13 @@ static status_t parse_uint8(private_parser_t *this, int rule_number, u_int8_t *o { if (this->byte_pos + sizeof(u_int8_t) > this->input_roof) { - DBG1(SIG_DBG_ENC, " not enough input to parse rule %d %N", + DBG1(DBG_ENC, " not enough input to parse rule %d %N", rule_number, encoding_type_names, this->rules[rule_number].type); return PARSE_ERROR; } if (this->bit_pos) { - DBG1(SIG_DBG_ENC, " found rule %d %N on bitpos %d", + DBG1(DBG_ENC, " found rule %d %N on bitpos %d", rule_number, encoding_type_names, this->rules[rule_number].type, this->bit_pos); return PARSE_ERROR; @@ -302,7 +302,7 @@ static status_t parse_uint8(private_parser_t *this, int rule_number, u_int8_t *o if (output_pos != NULL) { *output_pos = *(this->byte_pos); - DBG3(SIG_DBG_ENC, " => %d", *output_pos); + DBG3(DBG_ENC, " => %d", *output_pos); } this->byte_pos++; @@ -316,13 +316,13 @@ static status_t parse_uint15(private_parser_t *this, int rule_number, u_int16_t { if (this->byte_pos + sizeof(u_int16_t) > this->input_roof) { - DBG1(SIG_DBG_ENC, " not enough input to parse rule %d %N", + DBG1(DBG_ENC, " not enough input to parse rule %d %N", rule_number, encoding_type_names, this->rules[rule_number].type); return PARSE_ERROR; } if (this->bit_pos != 1) { - DBG2(SIG_DBG_ENC, " found rule %d %N on bitpos %d", rule_number, + DBG2(DBG_ENC, " found rule %d %N on bitpos %d", rule_number, encoding_type_names, this->rules[rule_number].type, this->bit_pos); return PARSE_ERROR; } @@ -330,7 +330,7 @@ static status_t parse_uint15(private_parser_t *this, int rule_number, u_int16_t if (output_pos != NULL) { *output_pos = ntohs(*((u_int16_t*)this->byte_pos)) & ~0x8000; - DBG3(SIG_DBG_ENC, " => %d", *output_pos); + DBG3(DBG_ENC, " => %d", *output_pos); } this->byte_pos += 2; this->bit_pos = 0; @@ -345,13 +345,13 @@ static status_t parse_uint16(private_parser_t *this, int rule_number, u_int16_t { if (this->byte_pos + sizeof(u_int16_t) > this->input_roof) { - DBG1(SIG_DBG_ENC, " not enough input to parse rule %d %N", + DBG1(DBG_ENC, " not enough input to parse rule %d %N", rule_number, encoding_type_names, this->rules[rule_number].type); return PARSE_ERROR; } if (this->bit_pos) { - DBG1(SIG_DBG_ENC, " found rule %d %N on bitpos %d", rule_number, + DBG1(DBG_ENC, " found rule %d %N on bitpos %d", rule_number, encoding_type_names, this->rules[rule_number].type, this->bit_pos); return PARSE_ERROR; } @@ -360,7 +360,7 @@ static status_t parse_uint16(private_parser_t *this, int rule_number, u_int16_t { *output_pos = ntohs(*((u_int16_t*)this->byte_pos)); - DBG3(SIG_DBG_ENC, " => %d", *output_pos); + DBG3(DBG_ENC, " => %d", *output_pos); } this->byte_pos += 2; @@ -373,13 +373,13 @@ static status_t parse_uint32(private_parser_t *this, int rule_number, u_int32_t { if (this->byte_pos + sizeof(u_int32_t) > this->input_roof) { - DBG1(SIG_DBG_ENC, " not enough input to parse rule %d %N", + DBG1(DBG_ENC, " not enough input to parse rule %d %N", rule_number, encoding_type_names, this->rules[rule_number].type); return PARSE_ERROR; } if (this->bit_pos) { - DBG1(SIG_DBG_ENC, " found rule %d %N on bitpos %d", rule_number, + DBG1(DBG_ENC, " found rule %d %N on bitpos %d", rule_number, encoding_type_names, this->rules[rule_number].type, this->bit_pos); return PARSE_ERROR; } @@ -388,7 +388,7 @@ static status_t parse_uint32(private_parser_t *this, int rule_number, u_int32_t { *output_pos = ntohl(*((u_int32_t*)this->byte_pos)); - DBG3(SIG_DBG_ENC, " => %d", *output_pos); + DBG3(DBG_ENC, " => %d", *output_pos); } this->byte_pos += 4; @@ -402,13 +402,13 @@ static status_t parse_uint64(private_parser_t *this, int rule_number, u_int64_t { if (this->byte_pos + sizeof(u_int64_t) > this->input_roof) { - DBG1(SIG_DBG_ENC, " not enough input to parse rule %d %N", + DBG1(DBG_ENC, " not enough input to parse rule %d %N", rule_number, encoding_type_names, this->rules[rule_number].type); return PARSE_ERROR; } if (this->bit_pos) { - DBG1(SIG_DBG_ENC, " found rule %d %N on bitpos %d", rule_number, + DBG1(DBG_ENC, " found rule %d %N on bitpos %d", rule_number, encoding_type_names, this->rules[rule_number].type, this->bit_pos); return PARSE_ERROR; } @@ -419,7 +419,7 @@ static status_t parse_uint64(private_parser_t *this, int rule_number, u_int64_t *(output_pos + 1) = ntohl(*((u_int32_t*)this->byte_pos)); *output_pos = ntohl(*(((u_int32_t*)this->byte_pos) + 1)); - DBG3(SIG_DBG_ENC, " => %b", (void*)output_pos, sizeof(u_int64_t)); + DBG3(DBG_ENC, " => %b", (void*)output_pos, sizeof(u_int64_t)); } this->byte_pos += 8; @@ -433,13 +433,13 @@ static status_t parse_bytes (private_parser_t *this, int rule_number, u_int8_t * { if (this->byte_pos + bytes > this->input_roof) { - DBG1(SIG_DBG_ENC, " not enough input to parse rule %d %N", + DBG1(DBG_ENC, " not enough input to parse rule %d %N", rule_number, encoding_type_names, this->rules[rule_number].type); return PARSE_ERROR; } if (this->bit_pos) { - DBG1(SIG_DBG_ENC, " found rule %d %N on bitpos %d", rule_number, + DBG1(DBG_ENC, " found rule %d %N on bitpos %d", rule_number, encoding_type_names, this->rules[rule_number].type, this->bit_pos); return PARSE_ERROR; } @@ -449,7 +449,7 @@ static status_t parse_bytes (private_parser_t *this, int rule_number, u_int8_t * { memcpy(output_pos,this->byte_pos,bytes); - DBG3(SIG_DBG_ENC, " => %b", (void*)output_pos, bytes); + DBG3(DBG_ENC, " => %b", (void*)output_pos, bytes); } this->byte_pos += bytes; @@ -463,7 +463,7 @@ static status_t parse_bit(private_parser_t *this, int rule_number, bool *output_ { if (this->byte_pos + sizeof(u_int8_t) > this->input_roof) { - DBG1(SIG_DBG_ENC, " not enough input to parse rule %d %N", + DBG1(DBG_ENC, " not enough input to parse rule %d %N", rule_number, encoding_type_names, this->rules[rule_number].type); return PARSE_ERROR; } @@ -480,7 +480,7 @@ static status_t parse_bit(private_parser_t *this, int rule_number, bool *output_ *output_pos = TRUE; } - DBG3(SIG_DBG_ENC, " => %d", *output_pos); + DBG3(DBG_ENC, " => %d", *output_pos); } this->bit_pos = (this->bit_pos + 1) % 8; if (this->bit_pos == 0) @@ -500,14 +500,14 @@ static status_t parse_list(private_parser_t *this, int rule_number, linked_list_ if (length < 0) { - DBG1(SIG_DBG_ENC, " invalid length for rule %d %N", + DBG1(DBG_ENC, " invalid length for rule %d %N", rule_number, encoding_type_names, this->rules[rule_number].type); return PARSE_ERROR; } if (this->bit_pos) { - DBG1(SIG_DBG_ENC, " found rule %d %N on bitpos %d", rule_number, + DBG1(DBG_ENC, " found rule %d %N on bitpos %d", rule_number, encoding_type_names, this->rules[rule_number].type, this->bit_pos); return PARSE_ERROR; } @@ -517,14 +517,14 @@ static status_t parse_list(private_parser_t *this, int rule_number, linked_list_ u_int8_t *pos_before = this->byte_pos; payload_t *payload; status_t status; - DBG2(SIG_DBG_ENC, " %d bytes left, parsing recursively %N", + DBG2(DBG_ENC, " %d bytes left, parsing recursively %N", length, payload_type_names, payload_type); status = this->public.parse_payload((parser_t*)this, payload_type, &payload); if (status != SUCCESS) { - DBG1(SIG_DBG_ENC, " parsing of a %N substructure failed", + DBG1(DBG_ENC, " parsing of a %N substructure failed", payload_type_names, payload_type); - return status; + return status; } list->insert_last(list, payload); length -= this->byte_pos - pos_before; @@ -540,13 +540,13 @@ static status_t parse_chunk(private_parser_t *this, int rule_number, chunk_t *ou { if (this->byte_pos + length > this->input_roof) { - DBG1(SIG_DBG_ENC, " not enough input (%d bytes) to parse rule %d %N", + DBG1(DBG_ENC, " not enough input (%d bytes) to parse rule %d %N", length, rule_number, encoding_type_names, this->rules[rule_number].type); return PARSE_ERROR; } if (this->bit_pos) { - DBG1(SIG_DBG_ENC, " found rule %d %N on bitpos %d", rule_number, + DBG1(DBG_ENC, " found rule %d %N on bitpos %d", rule_number, encoding_type_names, this->rules[rule_number].type, this->bit_pos); return PARSE_ERROR; } @@ -557,7 +557,7 @@ static status_t parse_chunk(private_parser_t *this, int rule_number, chunk_t *ou memcpy(output_pos->ptr, this->byte_pos, length); } this->byte_pos += length; - DBG3(SIG_DBG_ENC, " => %b", (void*)output_pos->ptr, length); + DBG3(DBG_ENC, " => %b", (void*)output_pos->ptr, length); return SUCCESS; } @@ -578,15 +578,15 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ /* create instance of the payload to parse */ pld = payload_create(payload_type); - DBG2(SIG_DBG_ENC, "parsing %N payload, %d bytes left", + DBG2(DBG_ENC, "parsing %N payload, %d bytes left", payload_type_names, payload_type, this->input_roof - this->byte_pos); - DBG3(SIG_DBG_ENC, "parsing payload from %b", + DBG3(DBG_ENC, "parsing payload from %b", this->byte_pos, this->input_roof-this->byte_pos); if (pld->get_type(pld) == UNKNOWN_PAYLOAD) { - DBG1(SIG_DBG_ENC, " payload type %d is unknown, handling as %N", + DBG1(DBG_ENC, " payload type %d is unknown, handling as %N", payload_type, payload_type_names, UNKNOWN_PAYLOAD); } @@ -598,7 +598,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ for (rule_number = 0; rule_number < rule_count; rule_number++) { rule = &(this->rules[rule_number]); - DBG2(SIG_DBG_ENC, " parsing rule %d %N", + DBG2(DBG_ENC, " parsing rule %d %N", rule_number, encoding_type_names, rule->type); switch (rule->type) { @@ -975,7 +975,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ } default: { - DBG1(SIG_DBG_ENC, " no rule to parse rule %d %N", + DBG1(DBG_ENC, " no rule to parse rule %d %N", rule_number, encoding_type_names, rule->type); pld->destroy(pld); return PARSE_ERROR; @@ -986,7 +986,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ } *payload = pld; - DBG2(SIG_DBG_ENC, "parsing %N payload finished", + DBG2(DBG_ENC, "parsing %N payload finished", payload_type_names, payload_type); return SUCCESS; } diff --git a/src/charon/encoding/payloads/encryption_payload.c b/src/charon/encoding/payloads/encryption_payload.c index bec94d620..908de3d30 100644 --- a/src/charon/encoding/payloads/encryption_payload.c +++ b/src/charon/encoding/payloads/encryption_payload.c @@ -291,7 +291,7 @@ static void generate(private_encryption_payload_t *this) else { /* no paylads? */ - DBG2(SIG_DBG_ENC, "generating contained payloads, but none available"); + DBG2(DBG_ENC, "generating contained payloads, but none available"); free(this->decrypted.ptr); this->decrypted = CHUNK_INITIALIZER; iterator->destroy(iterator); @@ -318,7 +318,7 @@ static void generate(private_encryption_payload_t *this) generator->write_to_chunk(generator, &(this->decrypted)); generator->destroy(generator); - DBG2(SIG_DBG_ENC, "successfully generated content in encryption payload"); + DBG2(DBG_ENC, "successfully generated content in encryption payload"); } /** @@ -333,7 +333,7 @@ static status_t encrypt(private_encryption_payload_t *this) if (this->signer == NULL || this->crypter == NULL) { - DBG1(SIG_DBG_ENC, "could not encrypt, signer/crypter not set"); + DBG1(DBG_ENC, "could not encrypt, signer/crypter not set"); return INVALID_STATE; } @@ -343,8 +343,8 @@ static status_t encrypt(private_encryption_payload_t *this) /* build payload chunk */ generate(this); - DBG2(SIG_DBG_ENC, "encrypting payloads"); - DBG3(SIG_DBG_ENC, "data to encrypt %B", &this->decrypted); + DBG2(DBG_ENC, "encrypting payloads"); + DBG3(DBG_ENC, "data to encrypt %B", &this->decrypted); /* build padding */ block_size = this->crypter->get_block_size(this->crypter); @@ -375,7 +375,7 @@ static status_t encrypt(private_encryption_payload_t *this) return status; } - DBG3(SIG_DBG_ENC, "data before encryption with padding %B", &to_crypt); + DBG3(DBG_ENC, "data before encryption with padding %B", &to_crypt); /* encrypt to_crypt chunk */ free(this->encrypted.ptr); @@ -384,11 +384,11 @@ static status_t encrypt(private_encryption_payload_t *this) free(to_crypt.ptr); if (status != SUCCESS) { - DBG2(SIG_DBG_ENC, "encryption failed"); + DBG2(DBG_ENC, "encryption failed"); free(iv.ptr); return status; } - DBG3(SIG_DBG_ENC, "data after encryption %B", &result); + DBG3(DBG_ENC, "data after encryption %B", &result); /* build encrypted result with iv and signature */ this->encrypted.len = iv.len + result.len + this->signer->get_block_size(this->signer); @@ -401,7 +401,7 @@ static status_t encrypt(private_encryption_payload_t *this) free(result.ptr); free(iv.ptr); - DBG3(SIG_DBG_ENC, "data after encryption with IV and (invalid) signature %B", + DBG3(DBG_ENC, "data after encryption with IV and (invalid) signature %B", &this->encrypted); return SUCCESS; @@ -435,7 +435,7 @@ static status_t parse(private_encryption_payload_t *this) status = current_payload->verify(current_payload); if (status != SUCCESS) { - DBG1(SIG_DBG_ENC, "%N verification failed", + DBG1(DBG_ENC, "%N verification failed", payload_type_names, current_payload->get_type(current_payload)); current_payload->destroy(current_payload); parser->destroy(parser); @@ -448,7 +448,7 @@ static status_t parse(private_encryption_payload_t *this) this->payloads->insert_last(this->payloads,current_payload); } parser->destroy(parser); - DBG2(SIG_DBG_ENC, "succesfully parsed content of encryption payload"); + DBG2(DBG_ENC, "succesfully parsed content of encryption payload"); return SUCCESS; } @@ -461,13 +461,13 @@ static status_t decrypt(private_encryption_payload_t *this) u_int8_t padding_length; status_t status; - DBG2(SIG_DBG_ENC, "decrypting encryption payload"); - DBG3(SIG_DBG_ENC, "data before decryption with IV and (invalid) signature %B", + DBG2(DBG_ENC, "decrypting encryption payload"); + DBG3(DBG_ENC, "data before decryption with IV and (invalid) signature %B", &this->encrypted); if (this->signer == NULL || this->crypter == NULL) { - DBG1(SIG_DBG_ENC, "could not decrypt, no crypter/signer set"); + DBG1(DBG_ENC, "could not decrypt, no crypter/signer set"); return INVALID_STATE; } @@ -485,22 +485,22 @@ static status_t decrypt(private_encryption_payload_t *this) */ if (concatenated.len < iv.len) { - DBG1(SIG_DBG_ENC, "could not decrypt, invalid input"); + DBG1(DBG_ENC, "could not decrypt, invalid input"); return FAILED; } /* free previus data, if any */ free(this->decrypted.ptr); - DBG3(SIG_DBG_ENC, "data before decryption %B", &concatenated); + DBG3(DBG_ENC, "data before decryption %B", &concatenated); status = this->crypter->decrypt(this->crypter, concatenated, iv, &(this->decrypted)); if (status != SUCCESS) { - DBG1(SIG_DBG_ENC, "could not decrypt, decryption failed"); + DBG1(DBG_ENC, "could not decrypt, decryption failed"); return FAILED; } - DBG3(SIG_DBG_ENC, "data after decryption with padding %B", &this->decrypted); + DBG3(DBG_ENC, "data after decryption with padding %B", &this->decrypted); /* get padding length, sits just bevore signature */ @@ -512,15 +512,15 @@ static status_t decrypt(private_encryption_payload_t *this) /* check size again */ if (padding_length > concatenated.len || this->decrypted.len < 0) { - DBG1(SIG_DBG_ENC, "decryption failed, invalid padding length found. Invalid key?"); + DBG1(DBG_ENC, "decryption failed, invalid padding length found. Invalid key?"); /* decryption failed :-/ */ return FAILED; } /* free padding */ this->decrypted.ptr = realloc(this->decrypted.ptr, this->decrypted.len); - DBG3(SIG_DBG_ENC, "data after decryption without padding %B", &this->decrypted); - DBG2(SIG_DBG_ENC, "decryption successful, trying to parse content"); + DBG3(DBG_ENC, "data after decryption without padding %B", &this->decrypted); + DBG2(DBG_ENC, "decryption successful, trying to parse content"); return parse(this); } @@ -543,14 +543,14 @@ static status_t build_signature(private_encryption_payload_t *this, chunk_t data if (this->signer == NULL) { - DBG1(SIG_DBG_ENC, "unable to build signature, no signer set"); + DBG1(DBG_ENC, "unable to build signature, no signer set"); return INVALID_STATE; } sig.len = this->signer->get_block_size(this->signer); data_without_sig.len -= sig.len; sig.ptr = data.ptr + data_without_sig.len; - DBG2(SIG_DBG_ENC, "building signature"); + DBG2(DBG_ENC, "building signature"); this->signer->get_signature(this->signer, data_without_sig, sig.ptr); return SUCCESS; } @@ -565,14 +565,14 @@ static status_t verify_signature(private_encryption_payload_t *this, chunk_t dat if (this->signer == NULL) { - DBG1(SIG_DBG_ENC, "unable to verify signature, no signer set"); + DBG1(DBG_ENC, "unable to verify signature, no signer set"); return INVALID_STATE; } /* find signature in data chunk */ sig.len = this->signer->get_block_size(this->signer); if (data.len <= sig.len) { - DBG1(SIG_DBG_ENC, "unable to verify signature, invalid input"); + DBG1(DBG_ENC, "unable to verify signature, invalid input"); return FAILED; } sig.ptr = data.ptr + data.len - sig.len; @@ -584,11 +584,11 @@ static status_t verify_signature(private_encryption_payload_t *this, chunk_t dat if (!valid) { - DBG1(SIG_DBG_ENC, "signature verification failed"); + DBG1(DBG_ENC, "signature verification failed"); return FAILED; } - DBG2(SIG_DBG_ENC, "signature verification successful"); + DBG2(DBG_ENC, "signature verification successful"); return SUCCESS; } diff --git a/src/charon/encoding/payloads/notify_payload.c b/src/charon/encoding/payloads/notify_payload.c index faea6028b..d943b215c 100644 --- a/src/charon/encoding/payloads/notify_payload.c +++ b/src/charon/encoding/payloads/notify_payload.c @@ -196,13 +196,13 @@ static status_t verify(private_notify_payload_t *this) case PROTO_ESP: if (this->spi.len != 4) { - DBG1(SIG_DBG_ENC, "Invalid SPI size for %N", + DBG1(DBG_ENC, "Invalid SPI size for %N", protocol_id_names, this->protocol_id); return FAILED; } break; default: - DBG1(SIG_DBG_ENC, "Unknown protocol (%d)", this->protocol_id); + DBG1(DBG_ENC, "Unknown protocol (%d)", this->protocol_id); return FAILED; } @@ -229,7 +229,7 @@ static status_t verify(private_notify_payload_t *this) case MODP_8192_BIT: break; default: - DBG1(SIG_DBG_ENC, "Bad DH group (%d)", dh_group); + DBG1(DBG_ENC, "Bad DH group (%d)", dh_group); return FAILED; } break; @@ -239,7 +239,7 @@ static status_t verify(private_notify_payload_t *this) { if (this->notification_data.len != HASH_SIZE_SHA1) { - DBG1(SIG_DBG_ENC, "invalid %N notify length", + DBG1(DBG_ENC, "invalid %N notify length", notify_type_names, this->notify_type); return FAILED; } @@ -251,7 +251,7 @@ static status_t verify(private_notify_payload_t *this) { if (this->notification_data.len != 0) { - DBG1(SIG_DBG_ENC, "invalid %N notify", + DBG1(DBG_ENC, "invalid %N notify", notify_type_names, this->notify_type); return FAILED; } diff --git a/src/charon/encoding/payloads/proposal_substructure.c b/src/charon/encoding/payloads/proposal_substructure.c index 3351c8a14..bb18c799b 100644 --- a/src/charon/encoding/payloads/proposal_substructure.c +++ b/src/charon/encoding/payloads/proposal_substructure.c @@ -147,13 +147,13 @@ static status_t verify(private_proposal_substructure_t *this) if ((this->next_payload != NO_PAYLOAD) && (this->next_payload != 2)) { /* must be 0 or 2 */ - DBG1(SIG_DBG_ENC, "inconsistent next payload"); + DBG1(DBG_ENC, "inconsistent next payload"); return FAILED; } if (this->transforms_count != this->transforms->get_count(this->transforms)) { /* must be the same! */ - DBG1(SIG_DBG_ENC, "transform count invalid"); + DBG1(DBG_ENC, "transform count invalid"); return FAILED; } @@ -163,7 +163,7 @@ static status_t verify(private_proposal_substructure_t *this) case PROTO_ESP: if (this->spi.len != 4) { - DBG1(SIG_DBG_ENC, "invalid SPI length in %N proposal", + DBG1(DBG_ENC, "invalid SPI length in %N proposal", protocol_id_names, this->protocol_id); return FAILED; } @@ -171,18 +171,18 @@ static status_t verify(private_proposal_substructure_t *this) case PROTO_IKE: if (this->spi.len != 0 && this->spi.len != 8) { - DBG1(SIG_DBG_ENC, "invalid SPI length in IKE proposal"); + DBG1(DBG_ENC, "invalid SPI length in IKE proposal"); return FAILED; } break; default: - DBG1(SIG_DBG_ENC, "invalid proposal protocol (%d)", this->protocol_id); + DBG1(DBG_ENC, "invalid proposal protocol (%d)", this->protocol_id); return FAILED; } if ((this->protocol_id == 0) || (this->protocol_id >= 4)) { /* reserved are not supported */ - DBG1(SIG_DBG_ENC, "invalid protocol"); + DBG1(DBG_ENC, "invalid protocol"); return FAILED; } @@ -192,7 +192,7 @@ static status_t verify(private_proposal_substructure_t *this) status = current_transform->verify(current_transform); if (status != SUCCESS) { - DBG1(SIG_DBG_ENC, "TRANSFORM_SUBSTRUCTURE verification failed"); + DBG1(DBG_ENC, "TRANSFORM_SUBSTRUCTURE verification failed"); break; } } diff --git a/src/charon/encoding/payloads/sa_payload.c b/src/charon/encoding/payloads/sa_payload.c index 751e83297..7ae0f9532 100644 --- a/src/charon/encoding/payloads/sa_payload.c +++ b/src/charon/encoding/payloads/sa_payload.c @@ -123,14 +123,14 @@ static status_t verify(private_sa_payload_t *this) { if (first) { - DBG1(SIG_DBG_ENC, "first proposal is not proposal #1"); + DBG1(DBG_ENC, "first proposal is not proposal #1"); status = FAILED; break; } if (current_number != (expected_number + 1)) { - DBG1(SIG_DBG_ENC, "proposal number is %d, excepted %d or %d", + DBG1(DBG_ENC, "proposal number is %d, excepted %d or %d", current_number, expected_number, expected_number + 1); status = FAILED; break; @@ -139,7 +139,7 @@ static status_t verify(private_sa_payload_t *this) else if (current_number < expected_number) { /* must not be smaller then proceeding one */ - DBG1(SIG_DBG_ENC, "proposal number smaller than that of previous proposal"); + DBG1(DBG_ENC, "proposal number smaller than that of previous proposal"); status = FAILED; break; } @@ -147,7 +147,7 @@ static status_t verify(private_sa_payload_t *this) status = current_proposal->payload_interface.verify(&(current_proposal->payload_interface)); if (status != SUCCESS) { - DBG1(SIG_DBG_ENC, "PROPOSAL_SUBSTRUCTURE verification failed"); + DBG1(DBG_ENC, "PROPOSAL_SUBSTRUCTURE verification failed"); break; } first = FALSE; diff --git a/src/charon/encoding/payloads/transform_substructure.c b/src/charon/encoding/payloads/transform_substructure.c index f165507df..4ad1948f9 100644 --- a/src/charon/encoding/payloads/transform_substructure.c +++ b/src/charon/encoding/payloads/transform_substructure.c @@ -125,7 +125,7 @@ static status_t verify(private_transform_substructure_t *this) if ((this->next_payload != NO_PAYLOAD) && (this->next_payload != 3)) { /* must be 0 or 3 */ - DBG1(SIG_DBG_ENC, "inconsistent next payload"); + DBG1(DBG_ENC, "inconsistent next payload"); return FAILED; } @@ -141,7 +141,7 @@ static status_t verify(private_transform_substructure_t *this) break; default: { - DBG1(SIG_DBG_ENC, "invalid transform type: %d", this->transform_type); + DBG1(DBG_ENC, "invalid transform type: %d", this->transform_type); return FAILED; } } @@ -152,7 +152,7 @@ static status_t verify(private_transform_substructure_t *this) status = current_attributes->verify(current_attributes); if (status != SUCCESS) { - DBG1(SIG_DBG_ENC, "TRANSFORM_ATTRIBUTE verification failed"); + DBG1(DBG_ENC, "TRANSFORM_ATTRIBUTE verification failed"); } } iterator->destroy(iterator); |