generator: Make pointer to length field optional

Only useful if we generate an IKE header.
This commit is contained in:
Tobias Brunner
2024-08-07 16:20:18 +02:00
parent a24993213e
commit 5c439bb8a3
2 changed files with 6 additions and 4 deletions
+4 -1
View File
@@ -430,7 +430,10 @@ METHOD(generator_t, get_chunk, chunk_t,
{
chunk_t data;
*lenpos = (uint32_t*)(this->buffer + this->header_length_offset);
if (lenpos)
{
*lenpos = (uint32_t*)(this->buffer + this->header_length_offset);
}
data = chunk_create(this->buffer, get_length(this));
if (this->debug)
{
+2 -3
View File
@@ -2090,7 +2090,6 @@ METHOD(message_t, fragment, status_t,
host_t *src, *dst;
chunk_t data;
status_t status;
uint32_t *lenpos;
size_t len;
src = this->packet->get_source(this->packet);
@@ -2123,7 +2122,7 @@ METHOD(message_t, fragment, status_t,
DESTROY_IF(generator);
return status;
}
data = generator->get_chunk(generator, &lenpos);
data = generator->get_chunk(generator, NULL);
len = data.len + (encrypted ? encrypted->get_length(encrypted) : 0);
}
@@ -2179,7 +2178,7 @@ METHOD(message_t, fragment, status_t,
}
next = encrypted->payload_interface.get_next_type((payload_t*)encrypted);
encrypted->generate_payloads(encrypted, generator);
data = generator->get_chunk(generator, &lenpos);
data = generator->get_chunk(generator, NULL);
if (!is_encoded(this))
{
encrypted->destroy(encrypted);