3 The original DSA publickey algorithm, using SHA-1.
5 Copyright (C) 2010 Niels Möller
7 This file is part of GNU Nettle.
9 GNU Nettle is free software: you can redistribute it and/or
10 modify it under the terms of either:
12 * the GNU Lesser General Public License as published by the Free
13 Software Foundation; either version 3 of the License, or (at your
14 option) any later version.
18 * the GNU General Public License as published by the Free
19 Software Foundation; either version 2 of the License, or (at your
20 option) any later version.
22 or both in parallel, as here.
24 GNU Nettle is distributed in the hope that it will be useful,
25 but WITHOUT ANY WARRANTY; without even the implied warranty of
26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 General Public License for more details.
29 You should have received copies of the GNU General Public License and
30 the GNU Lesser General Public License along with this program. If
31 not, see http://www.gnu.org/licenses/.
38 #include "dsa-compat.h"
41 dsa_sha1_sign_digest(const struct dsa_public_key *pub,
42 const struct dsa_private_key *key,
43 void *random_ctx, nettle_random_func *random,
44 const uint8_t *digest,
45 struct dsa_signature *signature)
47 return dsa_sign((const struct dsa_params *) pub, key->x,
49 SHA1_DIGEST_SIZE, digest, signature);
54 dsa_sha1_sign(const struct dsa_public_key *pub,
55 const struct dsa_private_key *key,
56 void *random_ctx, nettle_random_func *random,
57 struct sha1_ctx *hash,
58 struct dsa_signature *signature)
60 uint8_t digest[SHA1_DIGEST_SIZE];
61 sha1_digest(hash, sizeof(digest), digest);
63 return dsa_sign((const struct dsa_params *) pub, key->x,
65 sizeof(digest), digest, signature);