3 Copyright (C) 2014 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 #ifndef NETTLE_EDDSA_H
33 #define NETTLE_EDDSA_H
35 #include "nettle-types.h"
44 #define ed25519_sha512_set_private_key nettle_ed25519_sha512_set_private_key
45 #define ed25519_sha512_public_key nettle_ed25519_sha512_public_key
46 #define ed25519_sha512_sign nettle_ed25519_sha512_sign
47 #define ed25519_sha512_verify nettle_ed25519_sha512_verify
49 #define _eddsa_compress _nettle_eddsa_compress
50 #define _eddsa_compress_itch _nettle_eddsa_compress_itch
51 #define _eddsa_decompress _nettle_eddsa_decompress
52 #define _eddsa_decompress_itch _nettle_eddsa_decompress_itch
53 #define _eddsa_hash _nettle_eddsa_hash
54 #define _eddsa_expand_key _nettle_eddsa_expand_key
55 #define _eddsa_sign _nettle_eddsa_sign
56 #define _eddsa_sign_itch _nettle_eddsa_sign_itch
57 #define _eddsa_verify _nettle_eddsa_verify
58 #define _eddsa_verify_itch _nettle_eddsa_verify_itch
59 #define _eddsa_public_key_itch _nettle_eddsa_public_key_itch
60 #define _eddsa_public_key _nettle_eddsa_public_key
62 #define ED25519_KEY_SIZE 32
63 #define ED25519_SIGNATURE_SIZE 64
66 ed25519_sha512_public_key (uint8_t *pub, const uint8_t *priv);
69 ed25519_sha512_sign (const uint8_t *pub,
71 size_t length, const uint8_t *msg,
75 ed25519_sha512_verify (const uint8_t *pub,
76 size_t length, const uint8_t *msg,
77 const uint8_t *signature);
79 /* Low-level internal functions */
85 _eddsa_compress_itch (const struct ecc_curve *ecc);
87 _eddsa_compress (const struct ecc_curve *ecc, uint8_t *r, mp_limb_t *p,
91 _eddsa_decompress_itch (const struct ecc_curve *ecc);
93 _eddsa_decompress (const struct ecc_curve *ecc, mp_limb_t *p,
98 _eddsa_hash (const struct ecc_modulo *m,
99 mp_limb_t *rp, const uint8_t *digest);
102 _eddsa_sign_itch (const struct ecc_curve *ecc);
105 _eddsa_sign (const struct ecc_curve *ecc,
106 const struct nettle_hash *H,
116 _eddsa_verify_itch (const struct ecc_curve *ecc);
119 _eddsa_verify (const struct ecc_curve *ecc,
120 const struct nettle_hash *H,
126 const uint8_t *signature,
130 _eddsa_expand_key (const struct ecc_curve *ecc,
131 const struct nettle_hash *H,
138 _eddsa_public_key_itch (const struct ecc_curve *ecc);
141 _eddsa_public_key (const struct ecc_curve *ecc,
142 const mp_limb_t *k, uint8_t *pub, mp_limb_t *scratch);
149 #endif /* NETTLE_EDDSA_H */