diff options
Diffstat (limited to 'schnorr.h')
-rw-r--r-- | schnorr.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/schnorr.h b/schnorr.h new file mode 100644 index 000000000..9730b47ce --- /dev/null +++ b/schnorr.h | |||
@@ -0,0 +1,60 @@ | |||
1 | /* $OpenBSD: schnorr.h,v 1.1 2009/03/05 07:18:19 djm Exp $ */ | ||
2 | /* | ||
3 | * Copyright (c) 2009 Damien Miller. All rights reserved. | ||
4 | * | ||
5 | * Permission to use, copy, modify, and distribute this software for any | ||
6 | * purpose with or without fee is hereby granted, provided that the above | ||
7 | * copyright notice and this permission notice appear in all copies. | ||
8 | * | ||
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | */ | ||
17 | |||
18 | #ifndef SCHNORR_H | ||
19 | #define SCHNORR_H | ||
20 | |||
21 | #include <sys/types.h> | ||
22 | |||
23 | #include <openssl/bn.h> | ||
24 | |||
25 | struct modp_group { | ||
26 | BIGNUM *p, *q, *g; | ||
27 | }; | ||
28 | |||
29 | BIGNUM *bn_rand_range_gt_one(const BIGNUM *high); | ||
30 | int hash_buffer(const u_char *, u_int, const EVP_MD *, u_char **, u_int *); | ||
31 | void debug3_bn(const BIGNUM *, const char *, ...) | ||
32 | __attribute__((__nonnull__ (2))) | ||
33 | __attribute__((format(printf, 2, 3))); | ||
34 | void debug3_buf(const u_char *, u_int, const char *, ...) | ||
35 | __attribute__((__nonnull__ (3))) | ||
36 | __attribute__((format(printf, 3, 4))); | ||
37 | struct modp_group *modp_group_from_g_and_safe_p(const char *, const char *); | ||
38 | void modp_group_free(struct modp_group *); | ||
39 | |||
40 | /* Signature and verification functions */ | ||
41 | int | ||
42 | schnorr_sign(const BIGNUM *grp_p, const BIGNUM *grp_q, const BIGNUM *grp_g, | ||
43 | const EVP_MD *evp_md, const BIGNUM *x, const BIGNUM *g_x, | ||
44 | const u_char *id, u_int idlen, BIGNUM **r_p, BIGNUM **e_p); | ||
45 | int | ||
46 | schnorr_sign_buf(const BIGNUM *grp_p, const BIGNUM *grp_q, const BIGNUM *grp_g, | ||
47 | const BIGNUM *x, const BIGNUM *g_x, const u_char *id, u_int idlen, | ||
48 | u_char **sig, u_int *siglen); | ||
49 | int | ||
50 | schnorr_verify(const BIGNUM *grp_p, const BIGNUM *grp_q, const BIGNUM *grp_g, | ||
51 | const EVP_MD *evp_md, const BIGNUM *g_x, const u_char *id, u_int idlen, | ||
52 | const BIGNUM *r, const BIGNUM *e); | ||
53 | int | ||
54 | schnorr_verify_buf(const BIGNUM *grp_p, const BIGNUM *grp_q, | ||
55 | const BIGNUM *grp_g, | ||
56 | const BIGNUM *g_x, const u_char *id, u_int idlen, | ||
57 | const u_char *sig, u_int siglen); | ||
58 | |||
59 | #endif /* JPAKE_H */ | ||
60 | |||