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

* testsuite/testutils.c (test_dsa): Needs both public and private

key as arguments.

Rev: src/nettle/testsuite/testutils.c:1.15
Rev: src/nettle/testsuite/testutils.h:1.13
parent 90d4a864
...@@ -457,7 +457,8 @@ test_rsa_key(struct rsa_public_key *pub, ...@@ -457,7 +457,8 @@ test_rsa_key(struct rsa_public_key *pub,
) )
void void
test_dsa(struct dsa_private_key *key) test_dsa(const struct dsa_public_key *pub,
const struct dsa_private_key *key)
{ {
struct sha1_ctx sha1; struct sha1_ctx sha1;
struct dsa_signature signature; struct dsa_signature signature;
...@@ -468,7 +469,7 @@ test_dsa(struct dsa_private_key *key) ...@@ -468,7 +469,7 @@ test_dsa(struct dsa_private_key *key)
knuth_lfib_init(&lfib, 1111); knuth_lfib_init(&lfib, 1111);
sha1_update(&sha1, LDATA("The magic words are squeamish ossifrage")); sha1_update(&sha1, LDATA("The magic words are squeamish ossifrage"));
dsa_sign(key, dsa_sign(pub, key,
&lfib, (nettle_random_func) knuth_lfib_random, &lfib, (nettle_random_func) knuth_lfib_random,
&sha1, &signature); &sha1, &signature);
...@@ -487,19 +488,19 @@ test_dsa(struct dsa_private_key *key) ...@@ -487,19 +488,19 @@ test_dsa(struct dsa_private_key *key)
#endif #endif
/* Try bad data */ /* Try bad data */
if (DSA_VERIFY(&key->pub, &sha1, if (DSA_VERIFY(pub, &sha1,
"The magick words are squeamish ossifrage", &signature)) "The magick words are squeamish ossifrage", &signature))
FAIL(); FAIL();
/* Try correct data */ /* Try correct data */
if (!DSA_VERIFY(&key->pub, &sha1, if (!DSA_VERIFY(pub, &sha1,
"The magic words are squeamish ossifrage", &signature)) "The magic words are squeamish ossifrage", &signature))
FAIL(); FAIL();
/* Try bad signature */ /* Try bad signature */
mpz_togglebit(signature.r, 17); mpz_togglebit(signature.r, 17);
if (DSA_VERIFY(&key->pub, &sha1, if (DSA_VERIFY(pub, &sha1,
"The magic words are squeamish ossifrage", &signature)) "The magic words are squeamish ossifrage", &signature))
FAIL(); FAIL();
......
...@@ -88,7 +88,8 @@ test_rsa_key(struct rsa_public_key *pub, ...@@ -88,7 +88,8 @@ test_rsa_key(struct rsa_public_key *pub,
struct rsa_private_key *key); struct rsa_private_key *key);
void void
test_dsa(struct dsa_private_key *key); test_dsa(const struct dsa_public_key *pub,
const struct dsa_private_key *key);
#endif /* WITH_PUBLIC_KEY */ #endif /* WITH_PUBLIC_KEY */
......
Markdown is supported
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