From a6aef23438e96a4f233d9797afc2f5f3e348fd42 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Tue, 4 Jul 2017 10:30:01 +0200 Subject: [PATCH] dh_make_key() is now dh_generate_key() --- demos/timing.c | 2 +- src/headers/tomcrypt_pk.h | 2 +- src/pk/dh/{dh_make_key.c => dh_generate_key.c} | 2 +- tests/dh_test.c | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) rename src/pk/dh/{dh_make_key.c => dh_generate_key.c} (97%) diff --git a/demos/timing.c b/demos/timing.c index d1a17e4..746055d 100644 --- a/demos/timing.c +++ b/demos/timing.c @@ -909,7 +909,7 @@ static void time_dh(void) t_start(); t1 = t_read(); - if ((err = dh_make_key(&yarrow_prng, find_prng("yarrow"), &key)) != CRYPT_OK) { + if ((err = dh_generate_key(&yarrow_prng, find_prng("yarrow"), &key)) != CRYPT_OK) { fprintf(stderr, "\n\ndh_make_key says %s, wait...no it should say %s...damn you!\n", error_to_string(err), error_to_string(CRYPT_OK)); exit(EXIT_FAILURE); } diff --git a/src/headers/tomcrypt_pk.h b/src/headers/tomcrypt_pk.h index c24230a..c374048 100644 --- a/src/headers/tomcrypt_pk.h +++ b/src/headers/tomcrypt_pk.h @@ -227,7 +227,7 @@ int dh_set_pg_groupsize(int groupsize, dh_key *key); int dh_set_key(const unsigned char *pub, unsigned long publen, const unsigned char *priv, unsigned long privlen, dh_key *key); -int dh_make_key(prng_state *prng, int wprng, dh_key *key); +int dh_generate_key(prng_state *prng, int wprng, dh_key *key); int dh_shared_secret(dh_key *private_key, dh_key *public_key, unsigned char *out, unsigned long *outlen); diff --git a/src/pk/dh/dh_make_key.c b/src/pk/dh/dh_generate_key.c similarity index 97% rename from src/pk/dh/dh_make_key.c rename to src/pk/dh/dh_generate_key.c index f2f81ff..04db294 100644 --- a/src/pk/dh/dh_make_key.c +++ b/src/pk/dh/dh_generate_key.c @@ -42,7 +42,7 @@ static int _dh_groupsize_to_keysize(int groupsize) } } -int dh_make_key(prng_state *prng, int wprng, dh_key *key) +int dh_generate_key(prng_state *prng, int wprng, dh_key *key) { unsigned char *buf; unsigned long keysize; diff --git a/tests/dh_test.c b/tests/dh_test.c index 2558fc0..e3111c6 100644 --- a/tests/dh_test.c +++ b/tests/dh_test.c @@ -127,7 +127,7 @@ static int _dhparam_test(void) }; DO(dh_set_pg_dhparam(dhparam_der, sizeof(dhparam_der), &k)); - DO(dh_make_key(&yarrow_prng, find_prng ("yarrow"), &k)); + DO(dh_generate_key(&yarrow_prng, find_prng ("yarrow"), &k)); if (mp_unsigned_bin_size(k.prime) > sizeof(buf)) { printf("dhparam_test: short buf\n"); dh_free(&k); @@ -339,7 +339,7 @@ static int _set_test(void) dh_free(&k2); DO(dh_set_pg(test[i].p, test[i].plen, test[i].g, test[i].glen, &k3)); - DO(dh_make_key(&yarrow_prng, find_prng("yarrow"), &k3)); + DO(dh_generate_key(&yarrow_prng, find_prng("yarrow"), &k3)); len = mp_unsigned_bin_size(k3.prime); DO(mp_to_unsigned_bin(k3.prime, buf)); @@ -370,9 +370,9 @@ static int _basic_test(void) /* make up two keys */ DO(dh_set_pg_groupsize(KEYSIZE/8, &usera)); - DO(dh_make_key(&yarrow_prng, find_prng ("yarrow"), &usera)); + DO(dh_generate_key(&yarrow_prng, find_prng ("yarrow"), &usera)); DO(dh_set_pg_groupsize(KEYSIZE/8, &userb)); - DO(dh_make_key(&yarrow_prng, find_prng ("yarrow"), &userb)); + DO(dh_generate_key(&yarrow_prng, find_prng ("yarrow"), &userb)); /* make the shared secret */ x = KEYSIZE; @@ -417,7 +417,7 @@ static int _basic_test(void) for (x = 0; ltc_dh_sets[x].size != 0; x++) { DO(dh_set_pg_groupsize(ltc_dh_sets[x].size, &usera)); - DO(dh_make_key(&yarrow_prng, find_prng ("yarrow"), &usera)); + DO(dh_generate_key(&yarrow_prng, find_prng ("yarrow"), &usera)); size = dh_get_groupsize(&usera); dh_free(&usera); if (size != ltc_dh_sets[x].size) {