Skip to content

Commit

Permalink
Merge 1c96e20 into cfbd7f8
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaeckel committed Oct 24, 2020
2 parents cfbd7f8 + 1c96e20 commit 713c05d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/pk/dsa/dsa_generate_pqg.c
Expand Up @@ -26,6 +26,7 @@ static int s_dsa_make_params(prng_state *prng, int wprng, int group_size, int mo
int err, res, mr_tests_q, mr_tests_p, found_p, found_q, hash;
unsigned char *wbuf, *sbuf, digest[MAXBLOCKSIZE];
void *t2L1, *t2N1, *t2q, *t2seedlen, *U, *W, *X, *c, *h, *e, *seedinc;
const char *accepted_hashes[] = { "sha3-512", "sha512", "sha3-384", "sha384", "sha3-256", "sha256" };

/* check size */
if (group_size >= LTC_MDSA_MAX_GROUP || group_size < 1 || group_size >= modulus_size) {
Expand Down Expand Up @@ -87,16 +88,15 @@ static int s_dsa_make_params(prng_state *prng, int wprng, int group_size, int mo
else { mr_tests_q = 64; }
#endif

if (N <= 256) {
hash = register_hash(&sha256_desc);
hash = -1;
for (i = 0; i < sizeof(accepted_hashes)/sizeof(accepted_hashes[0]); ++i) {
hash = find_hash(accepted_hashes[i]);
if (hash != -1) break;
}
else if (N <= 384) {
hash = register_hash(&sha384_desc);
if (hash == -1) {
return CRYPT_INVALID_ARG; /* no appropriate hash function found */
}
else if (N <= 512) {
hash = register_hash(&sha512_desc);
}
else {
if (N > hash_descriptor[hash].hashsize * 8) {
return CRYPT_INVALID_ARG; /* group_size too big */
}

Expand Down

0 comments on commit 713c05d

Please sign in to comment.