Commit 70434af4 authored by Niels Möller's avatar Niels Möller

Update libspki for nettle-3.

parent 5bb9d9b0
2016-02-06 Niels Möller <nisse@lysator.liu.se>
* verify.c (spki_verify_dsa_sha1, spki_verify_dsa_sha256): Update
for nettle-3.
2012-07-13 Niels Möller <nisse@lysator.liu.se>
Always use the installed nettle library, don't look for it in the
......
......@@ -70,22 +70,26 @@ spki_verify_dsa_sha1(const uint8_t *digest,
struct spki_iterator *key,
struct spki_iterator *signature)
{
struct dsa_public_key dsa;
struct dsa_params dsa_params;
mpz_t dsa_pub;
struct dsa_signature rs;
int res;
dsa_public_key_init(&dsa);
dsa_params_init(&dsa_params);
mpz_init(dsa_pub);
dsa_signature_init(&rs);
res = (dsa_keypair_from_sexp_alist(&dsa, NULL,
res = (dsa_keypair_from_sexp_alist(&dsa_params, dsa_pub, NULL,
DSA_SHA1_KEYSIZE_LIMIT,
DSA_SHA1_Q_BITS, &key->sexp)
&& spki_parse_end(key)
&& dsa_signature_from_sexp(&rs, &signature->sexp, DSA_SHA1_Q_BITS)
&& dsa_sha1_verify_digest(&dsa, digest, &rs));
&& dsa_verify(&dsa_params, dsa_pub,
SHA1_DIGEST_SIZE, digest, &rs));
dsa_signature_clear(&rs);
dsa_public_key_clear(&dsa);
mpz_clear(dsa_pub);
dsa_params_clear(&dsa_params);
return res;
}
......@@ -95,23 +99,27 @@ spki_verify_dsa_sha256(const uint8_t *digest,
struct spki_iterator *key,
struct spki_iterator *signature)
{
struct dsa_public_key dsa;
struct dsa_params dsa_params;
mpz_t dsa_pub;
struct dsa_signature rs;
int res;
dsa_public_key_init(&dsa);
dsa_params_init(&dsa_params);
mpz_init(dsa_pub);
dsa_signature_init(&rs);
res = (dsa_keypair_from_sexp_alist(&dsa, NULL,
res = (dsa_keypair_from_sexp_alist(&dsa_params, dsa_pub, NULL,
DSA_SHA256_KEYSIZE_LIMIT,
DSA_SHA256_Q_BITS, &key->sexp)
&& spki_parse_end(key)
&& dsa_signature_from_sexp(&rs, &signature->sexp,
DSA_SHA256_Q_BITS)
&& dsa_sha256_verify_digest(&dsa, digest, &rs));
&& dsa_verify(&dsa_params, dsa_pub,
SHA256_DIGEST_SIZE, digest, &rs));
dsa_signature_clear(&rs);
dsa_public_key_clear(&dsa);
mpz_clear(dsa_pub);
dsa_params_clear(&dsa_params);
return res;
}
......
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