load-tester: Migrate NULL DH implementation to INIT/METHOD macros

This commit is contained in:
Martin Willi 2015-03-23 10:44:55 +01:00
parent a7172ddaff
commit 4909612c3b

View File

@ -15,33 +15,36 @@
#include "load_tester_diffie_hellman.h" #include "load_tester_diffie_hellman.h"
/** METHOD(diffie_hellman_t, get_my_public_value, void,
* Implementation of gmp_diffie_hellman_t.get_my_public_value. load_tester_diffie_hellman_t *this, chunk_t *value)
*/
static void get_my_public_value(load_tester_diffie_hellman_t *this,
chunk_t *value)
{ {
*value = chunk_empty; *value = chunk_empty;
} }
/** METHOD(diffie_hellman_t, set_other_public_value, void,
* Implementation of gmp_diffie_hellman_t.get_shared_secret. load_tester_diffie_hellman_t *this, chunk_t value)
*/ {
static status_t get_shared_secret(load_tester_diffie_hellman_t *this, }
chunk_t *secret)
METHOD(diffie_hellman_t, get_shared_secret, status_t,
load_tester_diffie_hellman_t *this, chunk_t *secret)
{ {
*secret = chunk_empty; *secret = chunk_empty;
return SUCCESS; return SUCCESS;
} }
/** METHOD(diffie_hellman_t, get_dh_group, diffie_hellman_group_t,
* Implementation of gmp_diffie_hellman_t.get_dh_group. load_tester_diffie_hellman_t *this)
*/
static diffie_hellman_group_t get_dh_group(load_tester_diffie_hellman_t *this)
{ {
return MODP_NULL; return MODP_NULL;
} }
METHOD(diffie_hellman_t, destroy, void,
load_tester_diffie_hellman_t *this)
{
free(this);
}
/** /**
* See header * See header
*/ */
@ -55,13 +58,15 @@ load_tester_diffie_hellman_t *load_tester_diffie_hellman_create(
return NULL; return NULL;
} }
this = malloc_thing(load_tester_diffie_hellman_t); INIT(this,
.dh = {
this->dh.get_shared_secret = (status_t (*)(diffie_hellman_t *, chunk_t *))get_shared_secret; .get_shared_secret = _get_shared_secret,
this->dh.set_other_public_value = (void (*)(diffie_hellman_t *, chunk_t ))nop; .set_other_public_value = _set_other_public_value,
this->dh.get_my_public_value = (void (*)(diffie_hellman_t *, chunk_t *))get_my_public_value; .get_my_public_value = _get_my_public_value,
this->dh.get_dh_group = (diffie_hellman_group_t (*)(diffie_hellman_t *))get_dh_group; .get_dh_group = _get_dh_group,
this->dh.destroy = (void (*)(diffie_hellman_t *))free; .destroy = _destroy,
}
);
return this; return this;
} }