diffie-hellman: Add a bool return value to set_other_public_value()

This commit is contained in:
Martin Willi
2015-03-23 17:54:03 +01:00
parent 42431690e0
commit a777155ffe
19 changed files with 123 additions and 55 deletions
+2 -4
View File
@@ -70,16 +70,14 @@ METHOD(diffie_hellman_t, get_shared_secret, bool,
}
METHOD(diffie_hellman_t, set_other_public_value, void,
METHOD(diffie_hellman_t, set_other_public_value, bool,
private_tkm_diffie_hellman_t *this, chunk_t value)
{
// TODO: unvoid this function
dh_pubvalue_type othervalue;
othervalue.size = value.len;
memcpy(&othervalue.data, value.ptr, value.len);
ike_dh_generate_key(this->context_id, othervalue);
return ike_dh_generate_key(this->context_id, othervalue) == TKM_OK;
}
METHOD(diffie_hellman_t, get_dh_group, diffie_hellman_group_t,
+1 -1
View File
@@ -54,7 +54,7 @@ START_TEST(test_derive_ike_keys)
/* Use the same pubvalue for both sides */
chunk_t pubvalue;
ck_assert(dh->dh.get_my_public_value(&dh->dh, &pubvalue));
dh->dh.set_other_public_value(&dh->dh, pubvalue);
ck_assert(dh->dh.set_other_public_value(&dh->dh, pubvalue));
fail_unless(keymat->keymat_v2.derive_ike_keys(&keymat->keymat_v2, proposal,
&dh->dh, nonce, nonce, ike_sa_id, PRF_UNDEFINED, chunk_empty),