3 Copyright (C) 2013 Niels Möller
5 This file is part of GNU Nettle.
7 GNU Nettle is free software: you can redistribute it and/or
8 modify it under the terms of either:
10 * the GNU Lesser General Public License as published by the Free
11 Software Foundation; either version 3 of the License, or (at your
12 option) any later version.
16 * the GNU General Public License as published by the Free
17 Software Foundation; either version 2 of the License, or (at your
18 option) any later version.
20 or both in parallel, as here.
22 GNU Nettle is distributed in the hope that it will be useful,
23 but WITHOUT ANY WARRANTY; without even the implied warranty of
24 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 General Public License for more details.
27 You should have received copies of the GNU General Public License and
28 the GNU Lesser General Public License along with this program. If
29 not, see http://www.gnu.org/licenses/.
32 /* Development of Nettle's ECC support was funded by the .SE Internet Fund. */
34 #ifndef NETTLE_ECDSA_H_INCLUDED
35 #define NETTLE_ECDSA_H_INCLUDED
45 #define ecdsa_sign nettle_ecdsa_sign
46 #define ecdsa_verify nettle_ecdsa_verify
47 #define ecdsa_generate_keypair nettle_ecdsa_generate_keypair
48 #define ecc_ecdsa_sign nettle_ecc_ecdsa_sign
49 #define ecc_ecdsa_sign_itch nettle_ecc_ecdsa_sign_itch
50 #define ecc_ecdsa_verify nettle_ecc_ecdsa_verify
51 #define ecc_ecdsa_verify_itch nettle_ecc_ecdsa_verify_itch
53 /* High level ECDSA functions.
55 * A public key is represented as a struct ecc_point, and a private
56 * key as a struct ecc_scalar. FIXME: Introduce some aliases? */
58 ecdsa_sign (const struct ecc_scalar *key,
59 void *random_ctx, nettle_random_func *random,
61 const uint8_t *digest,
62 struct dsa_signature *signature);
65 ecdsa_verify (const struct ecc_point *pub,
66 size_t length, const uint8_t *digest,
67 const struct dsa_signature *signature);
70 ecdsa_generate_keypair (struct ecc_point *pub,
71 struct ecc_scalar *key,
72 void *random_ctx, nettle_random_func *random);
74 /* Low-level ECDSA functions. */
76 ecc_ecdsa_sign_itch (const struct ecc_curve *ecc);
79 ecc_ecdsa_sign (const struct ecc_curve *ecc,
81 /* Random nonce, must be invertible mod ecc group
84 size_t length, const uint8_t *digest,
85 mp_limb_t *rp, mp_limb_t *sp,
89 ecc_ecdsa_verify_itch (const struct ecc_curve *ecc);
92 ecc_ecdsa_verify (const struct ecc_curve *ecc,
93 const mp_limb_t *pp, /* Public key */
94 size_t length, const uint8_t *digest,
95 const mp_limb_t *rp, const mp_limb_t *sp,
103 #endif /* NETTLE_ECDSA_H_INCLUDED */