Commit fa14f30e authored by Niels Möller's avatar Niels Möller
Browse files

* dsa-keygen.c: Call the progress callback only if it's non-NULL.

Rev: src/nettle/dsa-keygen.c:1.2
parent 761cb986
...@@ -85,7 +85,8 @@ dsa_nist_gen(mpz_t p, mpz_t q, ...@@ -85,7 +85,8 @@ dsa_nist_gen(mpz_t p, mpz_t q,
uint8_t h1[SHA1_DIGEST_SIZE]; uint8_t h1[SHA1_DIGEST_SIZE];
uint8_t h2[SHA1_DIGEST_SIZE]; uint8_t h2[SHA1_DIGEST_SIZE];
progress(progress_ctx, '.'); if (progress)
progress(progress_ctx, '.');
nettle_mpz_random_size(s, random_ctx, random, SEED_BITS); nettle_mpz_random_size(s, random_ctx, random, SEED_BITS);
...@@ -122,7 +123,8 @@ dsa_nist_gen(mpz_t p, mpz_t q, ...@@ -122,7 +123,8 @@ dsa_nist_gen(mpz_t p, mpz_t q,
{ {
unsigned k; unsigned k;
progress(progress_ctx, ','); if (progress)
progress(progress_ctx, ',');
for (k = 0; k<=n ; k++) for (k = 0; k<=n ; k++)
{ {
mpz_set(t, s); mpz_set(t, s);
...@@ -153,7 +155,8 @@ dsa_nist_gen(mpz_t p, mpz_t q, ...@@ -153,7 +155,8 @@ dsa_nist_gen(mpz_t p, mpz_t q,
return; return;
} }
} }
progress(progress_ctx, '+'); if (progress)
progress(progress_ctx, '+');
} }
} }
} }
...@@ -181,7 +184,8 @@ dsa_find_generator(mpz_t g, ...@@ -181,7 +184,8 @@ dsa_find_generator(mpz_t g,
nettle_mpz_random(g, random_ctx, random, n); nettle_mpz_random(g, random_ctx, random, n);
mpz_add_ui(g, g, 2); mpz_add_ui(g, g, 2);
progress(progress_ctx, 'g'); if (progress)
progress(progress_ctx, 'g');
mpz_powm(g, g, e, p); mpz_powm(g, g, e, p);
if (mpz_cmp_ui(g, 1)) if (mpz_cmp_ui(g, 1))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment