Skip to content

Commit

Permalink
dh_make_key() is now dh_generate_key()
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaeckel committed Jul 4, 2017
1 parent e647f9a commit a6aef23
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion demos/timing.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/headers/tomcrypt_pk.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/pk/dh/dh_make_key.c → src/pk/dh/dh_generate_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions tests/dh_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit a6aef23

Please sign in to comment.