Rename diffie_hellman_t to key_exchange_t and change the interface etc.

This makes it more generic so we can use it for QSKE methods.
This commit is contained in:
Tobias Brunner
2022-06-29 10:28:50 +02:00
parent ec95fd9b93
commit 3af7c6db87
130 changed files with 1379 additions and 1384 deletions
@@ -16,33 +16,33 @@
#include "load_tester_diffie_hellman.h"
METHOD(diffie_hellman_t, get_my_public_value, bool,
METHOD(key_exchange_t, get_public_key, bool,
load_tester_diffie_hellman_t *this, chunk_t *value)
{
*value = chunk_empty;
return TRUE;
}
METHOD(diffie_hellman_t, set_other_public_value, bool,
METHOD(key_exchange_t, set_public_key, bool,
load_tester_diffie_hellman_t *this, chunk_t value)
{
return TRUE;
}
METHOD(diffie_hellman_t, get_shared_secret, bool,
METHOD(key_exchange_t, get_shared_secret, bool,
load_tester_diffie_hellman_t *this, chunk_t *secret)
{
*secret = chunk_empty;
return TRUE;
}
METHOD(diffie_hellman_t, get_dh_group, diffie_hellman_group_t,
METHOD(key_exchange_t, get_method, key_exchange_method_t,
load_tester_diffie_hellman_t *this)
{
return MODP_NULL;
}
METHOD(diffie_hellman_t, destroy, void,
METHOD(key_exchange_t, destroy, void,
load_tester_diffie_hellman_t *this)
{
free(this);
@@ -52,7 +52,7 @@ METHOD(diffie_hellman_t, destroy, void,
* See header
*/
load_tester_diffie_hellman_t *load_tester_diffie_hellman_create(
diffie_hellman_group_t group)
key_exchange_method_t group)
{
load_tester_diffie_hellman_t *this;
@@ -62,11 +62,11 @@ load_tester_diffie_hellman_t *load_tester_diffie_hellman_create(
}
INIT(this,
.dh = {
.ke = {
.get_shared_secret = _get_shared_secret,
.set_other_public_value = _set_other_public_value,
.get_my_public_value = _get_my_public_value,
.get_dh_group = _get_dh_group,
.set_public_key = _set_public_key,
.get_public_key = _get_public_key,
.get_method = _get_method,
.destroy = _destroy,
}
);
@@ -22,7 +22,7 @@
#ifndef LOAD_TESTER_DIFFIE_HELLMAN_H_
#define LOAD_TESTER_DIFFIE_HELLMAN_H_
#include <crypto/diffie_hellman.h>
#include <crypto/key_exchange.h>
typedef struct load_tester_diffie_hellman_t load_tester_diffie_hellman_t;
@@ -32,18 +32,18 @@ typedef struct load_tester_diffie_hellman_t load_tester_diffie_hellman_t;
struct load_tester_diffie_hellman_t {
/**
* Implements diffie_hellman_t interface.
* Implements key_exchange_t interface.
*/
diffie_hellman_t dh;
key_exchange_t ke;
};
/**
* Creates a new gmp_diffie_hellman_t object.
* Creates a new load_tester_diffie_hellman_t object.
*
* @param group Diffie Hellman group, supports MODP_NULL only
* @return gmp_diffie_hellman_t object
* @return load_tester_diffie_hellman_t object
*/
load_tester_diffie_hellman_t *load_tester_diffie_hellman_create(
diffie_hellman_group_t group);
key_exchange_method_t group);
#endif /** LOAD_TESTER_DIFFIE_HELLMAN_H_ @}*/
@@ -231,8 +231,8 @@ METHOD(plugin_t, get_features, int,
private_load_tester_plugin_t *this, plugin_feature_t *features[])
{
static plugin_feature_t f[] = {
PLUGIN_REGISTER(DH, load_tester_diffie_hellman_create),
PLUGIN_PROVIDE(DH, MODP_NULL),
PLUGIN_REGISTER(KE, load_tester_diffie_hellman_create),
PLUGIN_PROVIDE(KE, MODP_NULL),
PLUGIN_DEPENDS(CUSTOM, "load-tester"),
PLUGIN_CALLBACK((plugin_feature_callback_t)register_load_tester, NULL),
PLUGIN_PROVIDE(CUSTOM, "load-tester"),