Encrypt INFORMATIONAL exchange if needed
This commit is contained in:
@@ -1459,9 +1459,19 @@ METHOD(message_t, generate, status_t,
|
|||||||
hash_payload->set_hash(hash_payload, hash);
|
hash_payload->set_hash(hash_payload, hash);
|
||||||
this->payloads->insert_first(this->payloads,
|
this->payloads->insert_first(this->payloads,
|
||||||
(payload_t*)hash_payload);
|
(payload_t*)hash_payload);
|
||||||
|
|
||||||
|
if (this->exchange_type == INFORMATIONAL_V1)
|
||||||
|
{
|
||||||
|
DBG3(DBG_ENC, "encrypting IKEv1 INFORMATIONAL exchange message");
|
||||||
|
this->is_encrypted = TRUE;
|
||||||
|
encrypted = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
chunk_free(&hash);
|
chunk_free(&hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!encrypted)
|
||||||
|
{
|
||||||
/* if at least one payload requires encryption, encrypt the message.
|
/* if at least one payload requires encryption, encrypt the message.
|
||||||
* if we have no key material available, the flag will be reset below */
|
* if we have no key material available, the flag will be reset below */
|
||||||
enumerator = this->payloads->create_enumerator(this->payloads);
|
enumerator = this->payloads->create_enumerator(this->payloads);
|
||||||
@@ -1478,6 +1488,7 @@ METHOD(message_t, generate, status_t,
|
|||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DBG1(DBG_ENC, "generating %s", get_string(this, str, sizeof(str)));
|
DBG1(DBG_ENC, "generating %s", get_string(this, str, sizeof(str)));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user