Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / nettle / ecdsa.h
blob17267a92686dff85b446b6967038c24cfe4e204c
1 /* ecdsa.h */
3 /* nettle, low-level cryptographics library
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.
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,
20 * MA 02111-1301, USA.
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
28 #include "ecc.h"
29 #include "dsa.h"
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
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
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? */
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);
55 int
56 ecdsa_verify (const struct ecc_point *pub,
57 unsigned length, const uint8_t *digest,
58 const struct dsa_signature *signature);
60 void
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. */
66 mp_size_t
67 ecc_ecdsa_sign_itch (const struct ecc_curve *ecc);
69 void
70 ecc_ecdsa_sign (const struct ecc_curve *ecc,
71 const mp_limb_t *zp,
72 /* Random nonce, must be invertible mod ecc group
73 order. */
74 const mp_limb_t *kp,
75 unsigned length, const uint8_t *digest,
76 mp_limb_t *rp, mp_limb_t *sp,
77 mp_limb_t *scratch);
79 mp_size_t
80 ecc_ecdsa_verify_itch (const struct ecc_curve *ecc);
82 int
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,
87 mp_limb_t *scratch);
90 #ifdef __cplusplus
92 #endif
94 #endif /* NETTLE_ECDSA_H_INCLUDED */