[MBEDTLS] Use mbedtls as a lightweight schannel TLS/SSL back-end. This is an initial...
[reactos.git] / reactos / include / reactos / libs / gnutls / nettle / ecdsa.h
1 /* ecdsa.h */
2
3 /* nettle, low-level cryptographics library
4 *
5 * Copyright (C) 2013 Niels Möller
6 *
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.
11 *
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.
16 *
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,
20 * MA 02111-1301, USA.
21 */
22
23 /* Development of Nettle's ECC support was funded by the .SE Internet Fund. */
24
25 #ifndef NETTLE_ECDSA_H_INCLUDED
26 #define NETTLE_ECDSA_H_INCLUDED
27
28 #include "ecc.h"
29 #include "dsa.h"
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 /* Name mangling */
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
43
44 /* High level ECDSA functions.
45 *
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? */
48 void
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);
54
55 int
56 ecdsa_verify(const struct ecc_point *pub,
57 unsigned length, const uint8_t * digest,
58 const struct dsa_signature *signature);
59
60 void
61 ecdsa_generate_keypair(struct ecc_point *pub,
62 struct ecc_scalar *key,
63 void *random_ctx,
64 nettle_random_func * random);
65
66 /* Low-level ECDSA functions. */
67 mp_size_t ecc_ecdsa_sign_itch(const struct ecc_curve *ecc);
68
69 void
70 ecc_ecdsa_sign(const struct ecc_curve *ecc, const mp_limb_t * zp,
71 /* Random nonce, must be invertible mod ecc group
72 order. */
73 const mp_limb_t * kp,
74 unsigned length, const uint8_t * digest,
75 mp_limb_t * rp, mp_limb_t * sp,
76 mp_limb_t * scratch);
77
78 mp_size_t ecc_ecdsa_verify_itch(const struct ecc_curve *ecc);
79
80 int
81 ecc_ecdsa_verify(const struct ecc_curve *ecc, const mp_limb_t * pp, /* Public key */
82 unsigned length, const uint8_t * digest,
83 const mp_limb_t * rp, const mp_limb_t * sp,
84 mp_limb_t * scratch);
85
86
87 #ifdef __cplusplus
88 }
89 #endif
90 #endif /* NETTLE_ECDSA_H_INCLUDED */