3 /* nettle, low-level cryptographics library
5 * Copyright (C) 2013 Niels Möller
7 * The nettle library is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 2.1 of the License, or (at your
10 * option) any later version.
12 * The nettle library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 * License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with the nettle library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23 /* Development of Nettle's ECC support was funded by the .SE Internet Fund. */
25 #ifndef NETTLE_ECDSA_H_INCLUDED
26 #define NETTLE_ECDSA_H_INCLUDED
36 #define ecdsa_sign nettle_ecdsa_sign
37 #define ecdsa_verify nettle_ecdsa_verify
38 #define ecdsa_generate_keypair nettle_ecdsa_generate_keypair
39 #define ecc_ecdsa_sign nettle_ecc_ecdsa_sign
40 #define ecc_ecdsa_sign_itch nettle_ecc_ecdsa_sign_itch
41 #define ecc_ecdsa_verify nettle_ecc_ecdsa_verify
42 #define ecc_ecdsa_verify_itch nettle_ecc_ecdsa_verify_itch
44 /* High level ECDSA functions.
46 * A public key is represented as a struct ecc_point, and a private
47 * key as a struct ecc_scalar. FIXME: Introduce some aliases? */
49 ecdsa_sign (const struct ecc_scalar
*key
,
50 void *random_ctx
, nettle_random_func
*random
,
51 unsigned digest_length
,
52 const uint8_t *digest
,
53 struct dsa_signature
*signature
);
56 ecdsa_verify (const struct ecc_point
*pub
,
57 unsigned length
, const uint8_t *digest
,
58 const struct dsa_signature
*signature
);
61 ecdsa_generate_keypair (struct ecc_point
*pub
,
62 struct ecc_scalar
*key
,
63 void *random_ctx
, nettle_random_func
*random
);
65 /* Low-level ECDSA functions. */
67 ecc_ecdsa_sign_itch (const struct ecc_curve
*ecc
);
70 ecc_ecdsa_sign (const struct ecc_curve
*ecc
,
72 /* Random nonce, must be invertible mod ecc group
75 unsigned length
, const uint8_t *digest
,
76 mp_limb_t
*rp
, mp_limb_t
*sp
,
80 ecc_ecdsa_verify_itch (const struct ecc_curve
*ecc
);
83 ecc_ecdsa_verify (const struct ecc_curve
*ecc
,
84 const mp_limb_t
*pp
, /* Public key */
85 unsigned length
, const uint8_t *digest
,
86 const mp_limb_t
*rp
, const mp_limb_t
*sp
,
94 #endif /* NETTLE_ECDSA_H_INCLUDED */