Commit 39ea0d27 authored by Niels Möller's avatar Niels Möller

New struct dsa_params. Use for dsa_sign and dsa_verify. Updated users.

parent 5c232aa8
2014-03-26 Niels Möller <nisse@lysator.liu.se> 2014-03-26 Niels Möller <nisse@lysator.liu.se>
* dsa.h (struct dsa_params): New struct.
* dsa-sign.c (dsa_sign): Use struct dsa_params, with key as a
separate mpz_t.
* dsa-verify.c (dsa_verify): Likewise.
* dsa-sha1-verify.c (dsa_sha1_verify_digest, dsa_sha1_verify): Use
dsa_verify, cast the struct dsa_public_key * input to a struct
dsa_params *
* dsa-sha256-verify.c (dsa_sha256_verify_digest)
(dsa_sha256_verify): Likewise.
* dsa-sha1-sign.c (dsa_sha1_sign_digest, dsa_sha1_sign): Likewise
use dsa_sign, with a cast from struct dsa_public_key * to struct
dsa_params *.
* dsa-sha256-sign.c (dsa_sha256_sign_digest, dsa_sha256_sign):
Likewise.
* testsuite/testutils.c (test_dsa_verify): Use struct dsa_params.
(test_dsa_key): Likewise.
* testsuite/dsa-test.c (test_main): Adapt to test_dsa_key and
test_dsa_verify changes.
* testsuite/dsa-keygen-test.c (test_main): Adapt to
test_dsa_key change.
* testsuite/testutils.c (test_dsa_sign): #if out, currently * testsuite/testutils.c (test_dsa_sign): #if out, currently
unused. unused.
......
...@@ -36,7 +36,8 @@ dsa_sha1_sign_digest(const struct dsa_public_key *pub, ...@@ -36,7 +36,8 @@ dsa_sha1_sign_digest(const struct dsa_public_key *pub,
const uint8_t *digest, const uint8_t *digest,
struct dsa_signature *signature) struct dsa_signature *signature)
{ {
return dsa_sign(pub, key, random_ctx, random, return dsa_sign((const struct dsa_params *) pub, key->x,
random_ctx, random,
SHA1_DIGEST_SIZE, digest, signature); SHA1_DIGEST_SIZE, digest, signature);
} }
...@@ -50,7 +51,8 @@ dsa_sha1_sign(const struct dsa_public_key *pub, ...@@ -50,7 +51,8 @@ dsa_sha1_sign(const struct dsa_public_key *pub,
{ {
uint8_t digest[SHA1_DIGEST_SIZE]; uint8_t digest[SHA1_DIGEST_SIZE];
sha1_digest(hash, sizeof(digest), digest); sha1_digest(hash, sizeof(digest), digest);
return dsa_sign(pub, key, random_ctx, random, return dsa_sign((const struct dsa_params *) pub, key->x,
random_ctx, random,
sizeof(digest), digest, signature); sizeof(digest), digest, signature);
} }
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
# include "config.h" # include "config.h"
#endif #endif
#include <stdlib.h>
#include "dsa.h" #include "dsa.h"
int int
...@@ -36,7 +34,8 @@ dsa_sha1_verify_digest(const struct dsa_public_key *key, ...@@ -36,7 +34,8 @@ dsa_sha1_verify_digest(const struct dsa_public_key *key,
const uint8_t *digest, const uint8_t *digest,
const struct dsa_signature *signature) const struct dsa_signature *signature)
{ {
return dsa_verify(key, SHA1_DIGEST_SIZE, digest, signature); return dsa_verify((const struct dsa_params *) key, key->y,
SHA1_DIGEST_SIZE, digest, signature);
} }
int int
...@@ -47,5 +46,6 @@ dsa_sha1_verify(const struct dsa_public_key *key, ...@@ -47,5 +46,6 @@ dsa_sha1_verify(const struct dsa_public_key *key,
uint8_t digest[SHA1_DIGEST_SIZE]; uint8_t digest[SHA1_DIGEST_SIZE];
sha1_digest(hash, sizeof(digest), digest); sha1_digest(hash, sizeof(digest), digest);
return dsa_verify(key, sizeof(digest), digest, signature); return dsa_verify((const struct dsa_params *) key, key->y,
sizeof(digest), digest, signature);
} }
...@@ -36,7 +36,8 @@ dsa_sha256_sign_digest(const struct dsa_public_key *pub, ...@@ -36,7 +36,8 @@ dsa_sha256_sign_digest(const struct dsa_public_key *pub,
const uint8_t *digest, const uint8_t *digest,
struct dsa_signature *signature) struct dsa_signature *signature)
{ {
return dsa_sign(pub, key, random_ctx, random, return dsa_sign((const struct dsa_params *) pub, key->x,
random_ctx, random,
SHA256_DIGEST_SIZE, digest, signature); SHA256_DIGEST_SIZE, digest, signature);
} }
...@@ -50,6 +51,7 @@ dsa_sha256_sign(const struct dsa_public_key *pub, ...@@ -50,6 +51,7 @@ dsa_sha256_sign(const struct dsa_public_key *pub,
uint8_t digest[SHA256_DIGEST_SIZE]; uint8_t digest[SHA256_DIGEST_SIZE];
sha256_digest(hash, sizeof(digest), digest); sha256_digest(hash, sizeof(digest), digest);
return dsa_sign(pub, key, random_ctx, random, return dsa_sign((const struct dsa_params *) pub, key->x,
random_ctx, random,
sizeof(digest), digest, signature); sizeof(digest), digest, signature);
} }
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
# include "config.h" # include "config.h"
#endif #endif
#include <stdlib.h>
#include "dsa.h" #include "dsa.h"
int int
...@@ -36,7 +34,8 @@ dsa_sha256_verify_digest(const struct dsa_public_key *key, ...@@ -36,7 +34,8 @@ dsa_sha256_verify_digest(const struct dsa_public_key *key,
const uint8_t *digest, const uint8_t *digest,
const struct dsa_signature *signature) const struct dsa_signature *signature)
{ {
return dsa_verify(key, SHA256_DIGEST_SIZE, digest, signature); return dsa_verify((const struct dsa_params *) key, key->y,
SHA256_DIGEST_SIZE, digest, signature);
} }
int int
...@@ -47,5 +46,6 @@ dsa_sha256_verify(const struct dsa_public_key *key, ...@@ -47,5 +46,6 @@ dsa_sha256_verify(const struct dsa_public_key *key,
uint8_t digest[SHA256_DIGEST_SIZE]; uint8_t digest[SHA256_DIGEST_SIZE];
sha256_digest(hash, sizeof(digest), digest); sha256_digest(hash, sizeof(digest), digest);
return dsa_verify(key, sizeof(digest), digest, signature); return dsa_verify((const struct dsa_params *) key, key->y,
sizeof(digest), digest, signature);
} }
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
int int
dsa_sign(const struct dsa_public_key *pub, dsa_sign(const struct dsa_params *params,
const struct dsa_private_key *key, const mpz_t x,
void *random_ctx, nettle_random_func *random, void *random_ctx, nettle_random_func *random,
size_t digest_size, size_t digest_size,
const uint8_t *digest, const uint8_t *digest,
...@@ -49,7 +49,7 @@ dsa_sign(const struct dsa_public_key *pub, ...@@ -49,7 +49,7 @@ dsa_sign(const struct dsa_public_key *pub,
int res; int res;
/* Select k, 0<k<q, randomly */ /* Select k, 0<k<q, randomly */
mpz_init_set(tmp, pub->q); mpz_init_set(tmp, params->q);
mpz_sub_ui(tmp, tmp, 1); mpz_sub_ui(tmp, tmp, 1);
mpz_init(k); mpz_init(k);
...@@ -57,22 +57,22 @@ dsa_sign(const struct dsa_public_key *pub, ...@@ -57,22 +57,22 @@ dsa_sign(const struct dsa_public_key *pub,
mpz_add_ui(k, k, 1); mpz_add_ui(k, k, 1);
/* Compute r = (g^k (mod p)) (mod q) */ /* Compute r = (g^k (mod p)) (mod q) */
mpz_powm(tmp, pub->g, k, pub->p); mpz_powm(tmp, params->g, k, params->p);
mpz_fdiv_r(signature->r, tmp, pub->q); mpz_fdiv_r(signature->r, tmp, params->q);
/* Compute hash */ /* Compute hash */
mpz_init(h); mpz_init(h);
_dsa_hash (h, mpz_sizeinbase(pub->q, 2), digest_size, digest); _dsa_hash (h, mpz_sizeinbase(params->q, 2), digest_size, digest);
/* Compute k^-1 (mod q) */ /* Compute k^-1 (mod q) */
if (mpz_invert(k, k, pub->q)) if (mpz_invert(k, k, params->q))
{ {
/* Compute signature s = k^-1 (h + xr) (mod q) */ /* Compute signature s = k^-1 (h + xr) (mod q) */
mpz_mul(tmp, signature->r, key->x); mpz_mul(tmp, signature->r, x);
mpz_fdiv_r(tmp, tmp, pub->q); mpz_fdiv_r(tmp, tmp, params->q);
mpz_add(tmp, tmp, h); mpz_add(tmp, tmp, h);
mpz_mul(tmp, tmp, k); mpz_mul(tmp, tmp, k);
mpz_fdiv_r(signature->s, tmp, pub->q); mpz_fdiv_r(signature->s, tmp, params->q);
res = 1; res = 1;
} }
else else
......
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
#include "bignum.h" #include "bignum.h"
int int
dsa_verify(const struct dsa_public_key *key, dsa_verify(const struct dsa_params *params,
const mpz_t y,
size_t digest_size, size_t digest_size,
const uint8_t *digest, const uint8_t *digest,
const struct dsa_signature *signature) const struct dsa_signature *signature)
...@@ -46,10 +47,10 @@ dsa_verify(const struct dsa_public_key *key, ...@@ -46,10 +47,10 @@ dsa_verify(const struct dsa_public_key *key,
int res; int res;
/* Check that r and s are in the proper range */ /* Check that r and s are in the proper range */
if (mpz_sgn(signature->r) <= 0 || mpz_cmp(signature->r, key->q) >= 0) if (mpz_sgn(signature->r) <= 0 || mpz_cmp(signature->r, params->q) >= 0)
return 0; return 0;
if (mpz_sgn(signature->s) <= 0 || mpz_cmp(signature->s, key->q) >= 0) if (mpz_sgn(signature->s) <= 0 || mpz_cmp(signature->s, params->q) >= 0)
return 0; return 0;
mpz_init(w); mpz_init(w);
...@@ -58,7 +59,7 @@ dsa_verify(const struct dsa_public_key *key, ...@@ -58,7 +59,7 @@ dsa_verify(const struct dsa_public_key *key,
/* NOTE: In gmp-2, mpz_invert sometimes generates negative inverses, /* NOTE: In gmp-2, mpz_invert sometimes generates negative inverses,
* so we need gmp-3 or better. */ * so we need gmp-3 or better. */
if (!mpz_invert(w, signature->s, key->q)) if (!mpz_invert(w, signature->s, params->q))
{ {
mpz_clear(w); mpz_clear(w);
return 0; return 0;
...@@ -68,25 +69,25 @@ dsa_verify(const struct dsa_public_key *key, ...@@ -68,25 +69,25 @@ dsa_verify(const struct dsa_public_key *key,
mpz_init(v); mpz_init(v);
/* The message digest */ /* The message digest */
_dsa_hash (tmp, mpz_sizeinbase (key->q, 2), digest_size, digest); _dsa_hash (tmp, mpz_sizeinbase (params->q, 2), digest_size, digest);
/* v = g^{w * h (mod q)} (mod p) */ /* v = g^{w * h (mod q)} (mod p) */
mpz_mul(tmp, tmp, w); mpz_mul(tmp, tmp, w);
mpz_fdiv_r(tmp, tmp, key->q); mpz_fdiv_r(tmp, tmp, params->q);
mpz_powm(v, key->g, tmp, key->p); mpz_powm(v, params->g, tmp, params->p);
/* y^{w * r (mod q) } (mod p) */ /* y^{w * r (mod q) } (mod p) */
mpz_mul(tmp, signature->r, w); mpz_mul(tmp, signature->r, w);
mpz_fdiv_r(tmp, tmp, key->q); mpz_fdiv_r(tmp, tmp, params->q);
mpz_powm(tmp, key->y, tmp, key->p); mpz_powm(tmp, y, tmp, params->p);
/* v = (g^{w * h} * y^{w * r} (mod p) ) (mod q) */ /* v = (g^{w * h} * y^{w * r} (mod p) ) (mod q) */
mpz_mul(v, v, tmp); mpz_mul(v, v, tmp);
mpz_fdiv_r(v, v, key->p); mpz_fdiv_r(v, v, params->p);
mpz_fdiv_r(v, v, key->q); mpz_fdiv_r(v, v, params->q);
res = !mpz_cmp(v, signature->r); res = !mpz_cmp(v, signature->r);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
/* nettle, low-level cryptographics library /* nettle, low-level cryptographics library
* *
* Copyright (C) 2002 Niels Möller * Copyright (C) 2002, 2013, 2014 Niels Möller
* *
* The nettle library is free software; you can redistribute it and/or modify * The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
...@@ -66,6 +66,7 @@ extern "C" { ...@@ -66,6 +66,7 @@ extern "C" {
#define dsa_openssl_private_key_from_der nettle_openssl_provate_key_from_der #define dsa_openssl_private_key_from_der nettle_openssl_provate_key_from_der
#define _dsa_hash _nettle_dsa_hash #define _dsa_hash _nettle_dsa_hash
/* For FIPS approved parameters */
#define DSA_SHA1_MIN_P_BITS 512 #define DSA_SHA1_MIN_P_BITS 512
#define DSA_SHA1_Q_OCTETS 20 #define DSA_SHA1_Q_OCTETS 20
#define DSA_SHA1_Q_BITS 160 #define DSA_SHA1_Q_BITS 160
...@@ -73,7 +74,19 @@ extern "C" { ...@@ -73,7 +74,19 @@ extern "C" {
#define DSA_SHA256_MIN_P_BITS 1024 #define DSA_SHA256_MIN_P_BITS 1024
#define DSA_SHA256_Q_OCTETS 32 #define DSA_SHA256_Q_OCTETS 32
#define DSA_SHA256_Q_BITS 256 #define DSA_SHA256_Q_BITS 256
struct dsa_params
{
/* Modulo */
mpz_t p;
/* Group order */
mpz_t q;
/* Generator */
mpz_t g;
};
struct dsa_public_key struct dsa_public_key
{ {
/* Modulo */ /* Modulo */
...@@ -173,15 +186,16 @@ dsa_sha256_verify(const struct dsa_public_key *key, ...@@ -173,15 +186,16 @@ dsa_sha256_verify(const struct dsa_public_key *key,
const struct dsa_signature *signature); const struct dsa_signature *signature);
int int
dsa_sign(const struct dsa_public_key *pub, dsa_sign(const struct dsa_params *params,
const struct dsa_private_key *key, const mpz_t x,
void *random_ctx, nettle_random_func *random, void *random_ctx, nettle_random_func *random,
size_t digest_size, size_t digest_size,
const uint8_t *digest, const uint8_t *digest,
struct dsa_signature *signature); struct dsa_signature *signature);
int int
dsa_verify(const struct dsa_public_key *key, dsa_verify(const struct dsa_params *params,
const mpz_t y,
size_t digest_size, size_t digest_size,
const uint8_t *digest, const uint8_t *digest,
const struct dsa_signature *signature); const struct dsa_signature *signature);
......
...@@ -13,7 +13,8 @@ test_main(void) ...@@ -13,7 +13,8 @@ test_main(void)
{ {
struct dsa_public_key pub; struct dsa_public_key pub;
struct dsa_private_key key; struct dsa_private_key key;
struct dsa_params *params;
struct knuth_lfib_ctx lfib; struct knuth_lfib_ctx lfib;
dsa_private_key_init(&key); dsa_private_key_init(&key);
...@@ -21,13 +22,14 @@ test_main(void) ...@@ -21,13 +22,14 @@ test_main(void)
knuth_lfib_init(&lfib, 13); knuth_lfib_init(&lfib, 13);
params = (struct dsa_params *) &pub;
ASSERT (dsa_generate_keypair(&pub, &key, ASSERT (dsa_generate_keypair(&pub, &key,
&lfib, &lfib,
(nettle_random_func *) knuth_lfib_random, (nettle_random_func *) knuth_lfib_random,
NULL, verbose ? progress : NULL, NULL, verbose ? progress : NULL,
1024, 160)); 1024, 160));
test_dsa_key(&pub, &key, 160); test_dsa_key(params, pub.y, key.x, 160);
test_dsa160(&pub, &key, NULL); test_dsa160(&pub, &key, NULL);
ASSERT (dsa_generate_keypair(&pub, &key, ASSERT (dsa_generate_keypair(&pub, &key,
...@@ -36,7 +38,7 @@ test_main(void) ...@@ -36,7 +38,7 @@ test_main(void)
NULL, verbose ? progress : NULL, NULL, verbose ? progress : NULL,
2048, 256)); 2048, 256));
test_dsa_key(&pub, &key, 256); test_dsa_key(params, pub.y, key.x, 256);
test_dsa256(&pub, &key, NULL); test_dsa256(&pub, &key, NULL);
ASSERT (dsa_generate_keypair(&pub, &key, ASSERT (dsa_generate_keypair(&pub, &key,
...@@ -45,7 +47,7 @@ test_main(void) ...@@ -45,7 +47,7 @@ test_main(void)
NULL, verbose ? progress : NULL, NULL, verbose ? progress : NULL,
2048, 224)); 2048, 224));
test_dsa_key(&pub, &key, 224); test_dsa_key(params, pub.y, key.x, 224);
test_dsa256(&pub, &key, NULL); test_dsa256(&pub, &key, NULL);
dsa_public_key_clear(&pub); dsa_public_key_clear(&pub);
......
...@@ -6,7 +6,8 @@ test_main(void) ...@@ -6,7 +6,8 @@ test_main(void)
struct dsa_public_key pub; struct dsa_public_key pub;
struct dsa_private_key key; struct dsa_private_key key;
struct dsa_signature signature; struct dsa_signature signature;
struct dsa_params *params = (struct dsa_params *) &pub;
dsa_public_key_init(&pub); dsa_public_key_init(&pub);
dsa_private_key_init(&key); dsa_private_key_init(&key);
dsa_signature_init(&signature); dsa_signature_init(&signature);
...@@ -37,7 +38,7 @@ test_main(void) ...@@ -37,7 +38,7 @@ test_main(void)
mpz_set_str(key.x, mpz_set_str(key.x,
"56c6efaf878d06eef21dc070fab71da6ec1e30a6", 16); "56c6efaf878d06eef21dc070fab71da6ec1e30a6", 16);
test_dsa_key(&pub, &key, 160); test_dsa_key(params, pub.y, key.x, 160);
mpz_set_str(signature.r, "180342f8d4fb5bd0311ebf205bdee6e556014eaf", 16); mpz_set_str(signature.r, "180342f8d4fb5bd0311ebf205bdee6e556014eaf", 16);
mpz_set_str(signature.s, "392dc6566b2735531a8460966171464ef7ddfe12", 16); mpz_set_str(signature.s, "392dc6566b2735531a8460966171464ef7ddfe12", 16);
...@@ -87,7 +88,7 @@ test_main(void) ...@@ -87,7 +88,7 @@ test_main(void)
"39f84f88569da55c6bee7e18175b539ea9b7ee24fabd85a7" "39f84f88569da55c6bee7e18175b539ea9b7ee24fabd85a7"
"1fa8c93b7181545b", 16); "1fa8c93b7181545b", 16);
test_dsa_key(&pub, &key, 256); test_dsa_key(params, pub.y, key.x, 256);
mpz_set_str(signature.r, mpz_set_str(signature.r,
"03fe95c9dbbe1be019d7914e45c37c70" "03fe95c9dbbe1be019d7914e45c37c70"
...@@ -127,7 +128,7 @@ test_main(void) ...@@ -127,7 +128,7 @@ test_main(void)
mpz_set_str(signature.r, "50ed0e810e3f1c7cb6ac62332058448bd8b284c0", 16); mpz_set_str(signature.r, "50ed0e810e3f1c7cb6ac62332058448bd8b284c0", 16);
mpz_set_str(signature.s, "c6aded17216b46b7e4b6f2a97c1ad7cc3da83fde", 16); mpz_set_str(signature.s, "c6aded17216b46b7e4b6f2a97c1ad7cc3da83fde", 16);
test_dsa_verify(&pub, &nettle_sha1, test_dsa_verify(params, pub.y, &nettle_sha1,
SHEX("3b46736d559bd4e0c2c1b2553a33ad3c6cf23cac998d3d0c" SHEX("3b46736d559bd4e0c2c1b2553a33ad3c6cf23cac998d3d0c"
"0e8fa4b19bca06f2f386db2dcff9dca4f40ad8f561ffc308" "0e8fa4b19bca06f2f386db2dcff9dca4f40ad8f561ffc308"
"b46c5f31a7735b5fa7e0f9e6cb512e63d7eea05538d66a75" "b46c5f31a7735b5fa7e0f9e6cb512e63d7eea05538d66a75"
...@@ -146,7 +147,7 @@ test_main(void) ...@@ -146,7 +147,7 @@ test_main(void)
mpz_set_str(signature.r, "a26c00b5750a2d27fe7435b93476b35438b4d8ab", 16); mpz_set_str(signature.r, "a26c00b5750a2d27fe7435b93476b35438b4d8ab", 16);
mpz_set_str(signature.s, "61c9bfcb2938755afa7dad1d1e07c6288617bf70", 16); mpz_set_str(signature.s, "61c9bfcb2938755afa7dad1d1e07c6288617bf70", 16);
test_dsa_verify(&pub, &nettle_sha1, test_dsa_verify(params, pub.y, &nettle_sha1,
SHEX("d2bcb53b044b3e2e4b61ba2f91c0995fb83a6a97525e6644" SHEX("d2bcb53b044b3e2e4b61ba2f91c0995fb83a6a97525e6644"
"1a3b489d9594238bc740bdeea0f718a769c977e2de003877" "1a3b489d9594238bc740bdeea0f718a769c977e2de003877"
"b5d7dc25b182ae533db33e78f2c3ff0645f2137abc137d4e" "b5d7dc25b182ae533db33e78f2c3ff0645f2137abc137d4e"
...@@ -180,7 +181,7 @@ test_main(void) ...@@ -180,7 +181,7 @@ test_main(void)
"7011f2285f794557", 16); "7011f2285f794557", 16);
mpz_set_str(signature.r, "afee719e7f848b54349ccc3b4fb26065833a4d8e", 16); mpz_set_str(signature.r, "afee719e7f848b54349ccc3b4fb26065833a4d8e", 16);
mpz_set_str(signature.s, "734efe992256f31325e749bc32a24a1f957b3a1b", 16); mpz_set_str(signature.s, "734efe992256f31325e749bc32a24a1f957b3a1b", 16);
test_dsa_verify(&pub, &nettle_sha224, test_dsa_verify(params, pub.y, &nettle_sha224,
SHEX("fb2128052509488cad0745ed3e6312850dd96ddaf791f1e6" SHEX("fb2128052509488cad0745ed3e6312850dd96ddaf791f1e6"
"24e22a6b9beaa65319c325c78ef59cacba0ccfa722259f24" "24e22a6b9beaa65319c325c78ef59cacba0ccfa722259f24"
"f92c17b77a8f6d8e97c93d880d2d8dbbbedcf6acefa06b0e" "f92c17b77a8f6d8e97c93d880d2d8dbbbedcf6acefa06b0e"
...@@ -214,7 +215,7 @@ test_main(void) ...@@ -214,7 +215,7 @@ test_main(void)
"85183889205591e8", 16); "85183889205591e8", 16);
mpz_set_str(signature.r, "76683a085d6742eadf95a61af75f881276cfd26a", 16); mpz_set_str(signature.r, "76683a085d6742eadf95a61af75f881276cfd26a", 16);
mpz_set_str(signature.s, "3b9da7f9926eaaad0bebd4845c67fcdb64d12453", 16); mpz_set_str(signature.s, "3b9da7f9926eaaad0bebd4845c67fcdb64d12453", 16);
test_dsa_verify(&pub, &nettle_sha256, test_dsa_verify(params, pub.y, &nettle_sha256,
SHEX("812172f09cbae62517804885754125fc6066e9a902f9db20" SHEX("812172f09cbae62517804885754125fc6066e9a902f9db20"
"41eeddd7e8da67e4a2e65d0029c45ecacea6002f9540eb10" "41eeddd7e8da67e4a2e65d0029c45ecacea6002f9540eb10"
"04c883a8f900fd84a98b5c449ac49c56f3a91d8bed3f08f4" "04c883a8f900fd84a98b5c449ac49c56f3a91d8bed3f08f4"
...@@ -266,7 +267,7 @@ test_main(void) ...@@ -266,7 +267,7 @@ test_main(void)
"45df2f423e94bf155dd4e1d9e63f315ea606dd38527d4cf6328738c8", 16); "45df2f423e94bf155dd4e1d9e63f315ea606dd38527d4cf6328738c8", 16);
mpz_set_str(signature.s, mpz_set_str(signature.s,
"59b3e8efa5bc0ccbf4a3cbb6515c4b9bf784cfacdcc101dc9f81d31f", 16); "59b3e8efa5bc0ccbf4a3cbb6515c4b9bf784cfacdcc101dc9f81d31f", 16);
test_dsa_verify(&pub, &nettle_sha1, test_dsa_verify(params, pub.y, &nettle_sha1,
SHEX("edc6fd9b6c6e8a59f283016f7f29ee16deeaa609b5737927" SHEX("edc6fd9b6c6e8a59f283016f7f29ee16deeaa609b5737927"
"162aef34fed985d0bcb550275637ba67831a2d4efccb3529" "162aef34fed985d0bcb550275637ba67831a2d4efccb3529"
"6dfe730f4a0b4f4728d1d7d1bb8f4a36238a5c94311fa113" "6dfe730f4a0b4f4728d1d7d1bb8f4a36238a5c94311fa113"
...@@ -317,7 +318,7 @@ test_main(void) ...@@ -317,7 +318,7 @@ test_main(void)
"65102e8f64ecb11f06017b1a0c0def3c29897c277c4a948b1f4da6b9", 16); "65102e8f64ecb11f06017b1a0c0def3c29897c277c4a948b1f4da6b9", 16);
mpz_set_str(signature.s, mpz_set_str(signature.s,
"21ad0abb27bd3c21166cb96aef70c0dbd5f3079cab0dd543d4125bd1", 16); "21ad0abb27bd3c21166cb96aef70c0dbd5f3079cab0dd543d4125bd1", 16);
test_dsa_verify(&pub, &nettle_sha224, test_dsa_verify(params, pub.y, &nettle_sha224,
SHEX("e920fc1610718f2b0213d301c0092a51f3c6b0107bbbd824" SHEX("e920fc1610718f2b0213d301c0092a51f3c6b0107bbbd824"
"3a9689c044e2d142f202d9d195a5faef4be5acadc9ff6f7d" "3a9689c044e2d142f202d9d195a5faef4be5acadc9ff6f7d"
"2261e58b517139bcb9489b110423c2e59eb181294ffdae8a" "2261e58b517139bcb9489b110423c2e59eb181294ffdae8a"
...@@ -369,7 +370,7 @@ test_main(void) ...@@ -369,7 +370,7 @@ test_main(void)
"9c5fa46879ddaf5c14f07dfb5320715f67a6fec179e3ad53342fb6d1", 16); "9c5fa46879ddaf5c14f07dfb5320715f67a6fec179e3ad53342fb6d1", 16);
mpz_set_str(signature.s, mpz_set_str(signature.s,
"c3e17e7b3c4d0ac8d49f4dd0f04c16a094f42da0afcc6c90f5f1bbc8", 16); "c3e17e7b3c4d0ac8d49f4dd0f04c16a094f42da0afcc6c90f5f1bbc8", 16);
test_dsa_verify(&pub, &nettle_sha256, test_dsa_verify(params, pub.y, &nettle_sha256,
SHEX("cec8d2843dee7cb5f9119b75562585e05c5ce2f4e6457e9b" SHEX("cec8d2843dee7cb5f9119b75562585e05c5ce2f4e6457e9b"
"cc3c1c781ccd2c0442b6282aea610f7161dcede176e77486" "cc3c1c781ccd2c0442b6282aea610f7161dcede176e77486"
"1f7d2691be6c894ac3ebf80c0fab21e52a3e63ae0b350257" "1f7d2691be6c894ac3ebf80c0fab21e52a3e63ae0b350257"
...@@ -424,7 +425,7 @@ test_main(void) ...@@ -424,7 +425,7 @@ test_main(void)
mpz_set_str(signature.s, mpz_set_str(signature.s,
"4916d91b2927294e429d537c06dd2463d1845018cca2873e" "4916d91b2927294e429d537c06dd2463d1845018cca2873e"
"90a6c837b445fdde", 16); "90a6c837b445fdde", 16);
test_dsa_verify(&pub, &nettle_sha1, test_dsa_verify(params, pub.y, &nettle_sha1,
SHEX("de3605dbefde353cbe05e0d6098647b6d041460dfd4c0003" SHEX("de3605dbefde353cbe05e0d6098647b6d041460dfd4c0003"
"12be1afe7551fd3b93fed76a9763c34e004564b8f7dcacbd" "12be1afe7551fd3b93fed76a9763c34e004564b8f7dcacbd"
"99e85030632c94e9b0a032046523b7aacdf934a2dbbdcfce" "99e85030632c94e9b0a032046523b7aacdf934a2dbbdcfce"
...@@ -479,7 +480,7 @@ test_main(void) ...@@ -479,7 +480,7 @@ test_main(void)
mpz_set_str(signature.s, mpz_set_str(signature.s,
"4bd41c84a724cc86e4f0194ec0fbf379e654d0d7f6a1f08b" "4bd41c84a724cc86e4f0194ec0fbf379e654d0d7f6a1f08b"
"d468139422a5c353", 16); "d468139422a5c353", 16);
test_dsa_verify(&pub, &nettle_sha224, test_dsa_verify(params, pub.y, &