Implemented EdDSA for IKEv2 using a pro forma Identity hash function

This commit is contained in:
Andreas Steffen
2016-12-14 11:15:48 +01:00
committed by Tobias Brunner
parent d47ad3d67e
commit f2eb367adc
6 changed files with 140 additions and 17 deletions
+32
View File
@@ -159,6 +159,10 @@ static void send_supported_hash_algorithms(private_ike_init_t *this,
auth_cfg_t *auth;
auth_rule_t rule;
uintptr_t config;
int written;
size_t len = BUF_LEN;
char buf[len];
char *pos = buf;
char *plugin_name;
algos = hash_algorithm_set_create();
@@ -205,11 +209,23 @@ static void send_supported_hash_algorithms(private_ike_init_t *this,
while (enumerator->enumerate(enumerator, &hash))
{
writer->write_uint16(writer, hash);
/* generate debug output */
written = snprintf(pos, len, " %N", hash_algorithm_short_names,
hash);
if (written > 0 && written < len)
{
pos += written;
len -= written;
}
}
enumerator->destroy(enumerator);
message->add_notify(message, FALSE, SIGNATURE_HASH_ALGORITHMS,
writer->get_buf(writer));
writer->destroy(writer);
*pos = '\0';
DBG2(DBG_CFG, "sending supported signature hash algorithms:%s", buf);
}
algos->destroy(algos);
}
@@ -222,6 +238,10 @@ static void handle_supported_hash_algorithms(private_ike_init_t *this,
{
bio_reader_t *reader;
uint16_t algo;
int written;
size_t len = BUF_LEN;
char buf[len];
char *pos = buf;
bool added = FALSE;
reader = bio_reader_create(notify->get_notification_data(notify));
@@ -231,10 +251,22 @@ static void handle_supported_hash_algorithms(private_ike_init_t *this,
{
this->keymat->add_hash_algorithm(this->keymat, algo);
added = TRUE;
/* generate debug output */
written = snprintf(pos, len, " %N", hash_algorithm_short_names,
algo);
if (written > 0 && written < len)
{
pos += written;
len -= written;
}
}
}
reader->destroy(reader);
*pos = '\0';
DBG2(DBG_CFG, "received supported signature hash algorithms:%s", buf);
if (added)
{
this->ike_sa->enable_extension(this->ike_sa, EXT_SIGNATURE_AUTH);