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

Rename, _dsa_sign --> dsa_sign, _dsa_verify --> dsa_verify.

parent ade5dd2b
2013-11-25 Niels Möller <nisse@lysator.liu.se>
* dsa-verify.c (dsa_verify): Renamed, from _dsa_verify.
* dsa-sign.c (dsa_sign): Renamed, from _dsa_sign.
2013-11-24 Niels Möller <nisse@lysator.liu.se> 2013-11-24 Niels Möller <nisse@lysator.liu.se>
* testsuite/dsa-keygen-test.c (test_main): Test generating a * testsuite/dsa-keygen-test.c (test_main): Test generating a
......
...@@ -36,8 +36,8 @@ dsa_sha1_sign_digest(const struct dsa_public_key *pub, ...@@ -36,8 +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(pub, key, random_ctx, random,
SHA1_DIGEST_SIZE, digest, signature); SHA1_DIGEST_SIZE, digest, signature);
} }
...@@ -51,6 +51,6 @@ dsa_sha1_sign(const struct dsa_public_key *pub, ...@@ -51,6 +51,6 @@ 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(pub, key, random_ctx, random,
sizeof(digest), digest, signature); sizeof(digest), digest, signature);
} }
...@@ -36,7 +36,7 @@ dsa_sha1_verify_digest(const struct dsa_public_key *key, ...@@ -36,7 +36,7 @@ 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(key, SHA1_DIGEST_SIZE, digest, signature);
} }
int int
...@@ -47,5 +47,5 @@ dsa_sha1_verify(const struct dsa_public_key *key, ...@@ -47,5 +47,5 @@ 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(key, sizeof(digest), digest, signature);
} }
...@@ -36,8 +36,8 @@ dsa_sha256_sign_digest(const struct dsa_public_key *pub, ...@@ -36,8 +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(pub, key, random_ctx, random,
SHA256_DIGEST_SIZE, digest, signature); SHA256_DIGEST_SIZE, digest, signature);
} }
int int
...@@ -50,6 +50,6 @@ dsa_sha256_sign(const struct dsa_public_key *pub, ...@@ -50,6 +50,6 @@ 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(pub, key, random_ctx, random,
sizeof(digest), digest, signature); sizeof(digest), digest, signature);
} }
...@@ -36,7 +36,7 @@ dsa_sha256_verify_digest(const struct dsa_public_key *key, ...@@ -36,7 +36,7 @@ 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(key, SHA256_DIGEST_SIZE, digest, signature);
} }
int int
...@@ -47,5 +47,5 @@ dsa_sha256_verify(const struct dsa_public_key *key, ...@@ -47,5 +47,5 @@ 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(key, sizeof(digest), digest, signature);
} }
...@@ -36,12 +36,12 @@ ...@@ -36,12 +36,12 @@
int int
_dsa_sign(const struct dsa_public_key *pub, dsa_sign(const struct dsa_public_key *pub,
const struct dsa_private_key *key, const struct dsa_private_key *key,
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)
{ {
mpz_t k; mpz_t k;
mpz_t h; mpz_t h;
......
...@@ -34,10 +34,10 @@ ...@@ -34,10 +34,10 @@
#include "bignum.h" #include "bignum.h"
int int
_dsa_verify(const struct dsa_public_key *key, dsa_verify(const struct dsa_public_key *key,
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)
{ {
mpz_t w; mpz_t w;
mpz_t tmp; mpz_t tmp;
......
...@@ -48,6 +48,8 @@ extern "C" { ...@@ -48,6 +48,8 @@ extern "C" {
#define dsa_sha1_verify nettle_dsa_sha1_verify #define dsa_sha1_verify nettle_dsa_sha1_verify
#define dsa_sha256_sign nettle_dsa_sha256_sign #define dsa_sha256_sign nettle_dsa_sha256_sign
#define dsa_sha256_verify nettle_dsa_sha256_verify #define dsa_sha256_verify nettle_dsa_sha256_verify
#define dsa_sign nettle_dsa_sign
#define dsa_verify nettle_dsa_verify
#define dsa_sha1_sign_digest nettle_dsa_sha1_sign_digest #define dsa_sha1_sign_digest nettle_dsa_sha1_sign_digest
#define dsa_sha1_verify_digest nettle_dsa_sha1_verify_digest #define dsa_sha1_verify_digest nettle_dsa_sha1_verify_digest
#define dsa_sha256_sign_digest nettle_dsa_sha256_sign_digest #define dsa_sha256_sign_digest nettle_dsa_sha256_sign_digest
...@@ -63,8 +65,6 @@ extern "C" { ...@@ -63,8 +65,6 @@ extern "C" {
#define dsa_openssl_private_key_from_der_iterator nettle_dsa_openssl_private_key_from_der_iterator #define dsa_openssl_private_key_from_der_iterator nettle_dsa_openssl_private_key_from_der_iterator
#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
#define _dsa_sign _nettle_dsa_sign
#define _dsa_verify _nettle_dsa_verify
#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
...@@ -173,6 +173,22 @@ dsa_sha256_verify(const struct dsa_public_key *key, ...@@ -173,6 +173,22 @@ 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,
const struct dsa_private_key *key,
void *random_ctx, nettle_random_func *random,
size_t digest_size,
const uint8_t *digest,
struct dsa_signature *signature);
int
dsa_verify(const struct dsa_public_key *key,
size_t digest_size,
const uint8_t *digest,
const struct dsa_signature *signature);
/* Maybe obsolete these functions? One can just as well call dsa_sign
and dsa_verify directly, all that matters is the digest size. */
int
dsa_sha1_sign_digest(const struct dsa_public_key *pub, dsa_sha1_sign_digest(const struct dsa_public_key *pub,
const struct dsa_private_key *key, const struct dsa_private_key *key,
void *random_ctx, nettle_random_func *random, void *random_ctx, nettle_random_func *random,
...@@ -277,20 +293,6 @@ void ...@@ -277,20 +293,6 @@ void
_dsa_hash (mpz_t h, unsigned bit_size, _dsa_hash (mpz_t h, unsigned bit_size,
size_t length, const uint8_t *digest); size_t length, const uint8_t *digest);
int
_dsa_sign(const struct dsa_public_key *pub,
const struct dsa_private_key *key,
void *random_ctx, nettle_random_func *random,
size_t digest_size,
const uint8_t *digest,
struct dsa_signature *signature);
int
_dsa_verify(const struct dsa_public_key *key,
size_t digest_size,
const uint8_t *digest,
const struct dsa_signature *signature);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
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