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