Accept NULL as keymat when generating a message
This commit is contained in:
@@ -1419,8 +1419,8 @@ METHOD(message_t, generate, status_t,
|
|||||||
encryption_payload_t *encryption = NULL;
|
encryption_payload_t *encryption = NULL;
|
||||||
payload_type_t next_type;
|
payload_type_t next_type;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
aead_t *aead;
|
aead_t *aead = NULL;
|
||||||
chunk_t chunk;
|
chunk_t chunk, hash = chunk_empty;
|
||||||
char str[BUF_LEN];
|
char str[BUF_LEN];
|
||||||
u_int32_t *lenpos;
|
u_int32_t *lenpos;
|
||||||
bool encrypted = FALSE, *reserved;
|
bool encrypted = FALSE, *reserved;
|
||||||
@@ -1458,7 +1458,10 @@ METHOD(message_t, generate, status_t,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* get a hash for this message, if any is required */
|
/* get a hash for this message, if any is required */
|
||||||
chunk_t hash = keymat_v1->get_hash_phase2(keymat_v1, &this->public);
|
if (keymat_v1)
|
||||||
|
{
|
||||||
|
hash = keymat_v1->get_hash_phase2(keymat_v1, &this->public);
|
||||||
|
}
|
||||||
if (hash.ptr)
|
if (hash.ptr)
|
||||||
{ /* insert a HASH payload as first payload */
|
{ /* insert a HASH payload as first payload */
|
||||||
hash_payload_t *hash_payload;
|
hash_payload_t *hash_payload;
|
||||||
@@ -1494,7 +1497,10 @@ METHOD(message_t, generate, status_t,
|
|||||||
|
|
||||||
DBG1(DBG_ENC, "generating %s", get_string(this, str, sizeof(str)));
|
DBG1(DBG_ENC, "generating %s", get_string(this, str, sizeof(str)));
|
||||||
|
|
||||||
|
if (keymat)
|
||||||
|
{
|
||||||
aead = keymat->get_aead(keymat, FALSE);
|
aead = keymat->get_aead(keymat, FALSE);
|
||||||
|
}
|
||||||
if (aead && encrypted)
|
if (aead && encrypted)
|
||||||
{
|
{
|
||||||
encryption = wrap_payloads(this);
|
encryption = wrap_payloads(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user