diff options
author | Jan Hutter <jhutter@hsr.ch> | 2005-12-05 12:54:49 +0000 |
---|---|---|
committer | Jan Hutter <jhutter@hsr.ch> | 2005-12-05 12:54:49 +0000 |
commit | 7cc2ee5a3960dd556ca4dfdbf6ea640333178517 (patch) | |
tree | 1052124c9466691094df96efcb7058f6170ee639 /Source/charon/encoding/generator.c | |
parent | f6ba78c370794ea8247b33752a8dbe930b19df1e (diff) | |
download | strongswan-7cc2ee5a3960dd556ca4dfdbf6ea640333178517.tar.bz2 strongswan-7cc2ee5a3960dd556ca4dfdbf6ea640333178517.tar.xz |
- implemented and tested cert_payload_t
Diffstat (limited to 'Source/charon/encoding/generator.c')
-rw-r--r-- | Source/charon/encoding/generator.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Source/charon/encoding/generator.c b/Source/charon/encoding/generator.c index b50e7fffb..1eb286939 100644 --- a/Source/charon/encoding/generator.c +++ b/Source/charon/encoding/generator.c @@ -43,6 +43,7 @@ #include <encoding/payloads/id_payload.h> #include <encoding/payloads/auth_payload.h> #include <encoding/payloads/cert_payload.h> +#include <encoding/payloads/certreq_payload.h> #include <encoding/payloads/ts_payload.h> @@ -744,7 +745,7 @@ static void generate_payload (private_generator_t *this,payload_t *payload) u_int16_t int16_val = htons(length_of_ke_payload); this->write_bytes_to_buffer_at_offset(this,&int16_val,sizeof(u_int16_t),payload_length_position_offset); break; - } + } case NOTIFICATION_DATA: { /* the Notification Data value is generated from chunk */ @@ -800,17 +801,30 @@ static void generate_payload (private_generator_t *this,payload_t *payload) } case CERT_DATA: { - /* the AUTH Data value is generated from chunk */ + /* the CERT Data value is generated from chunk */ this->generate_from_chunk(this, rules[i].offset); u_int32_t payload_length_position_offset = this->last_payload_length_position_offset; - /* Length of nonce PAYLOAD is calculated */ + /* Length of PAYLOAD is calculated */ u_int16_t length_of_cert_payload = CERT_PAYLOAD_HEADER_LENGTH + ((chunk_t *)(this->data_struct + rules[i].offset))->len; u_int16_t int16_val = htons(length_of_cert_payload); this->write_bytes_to_buffer_at_offset(this,&int16_val,sizeof(u_int16_t),payload_length_position_offset); break; } + case CERTREQ_DATA: + { + /* the CERTREQ Data value is generated from chunk */ + this->generate_from_chunk(this, rules[i].offset); + + u_int32_t payload_length_position_offset = this->last_payload_length_position_offset; + /* Length of PAYLOAD is calculated */ + u_int16_t length_of_certreq_payload = CERTREQ_PAYLOAD_HEADER_LENGTH + ((chunk_t *)(this->data_struct + rules[i].offset))->len; + u_int16_t int16_val = htons(length_of_certreq_payload); + + this->write_bytes_to_buffer_at_offset(this,&int16_val,sizeof(u_int16_t),payload_length_position_offset); + break; + } case PROPOSALS: { /* before iterative generate the transforms, store the current payload length position */ |