s3-waf: Link errors3 only against needed subsystems.
[Samba/id10ts.git] / source4 / heimdal / lib / hcrypto / dsa.h
blob686d05087448b0c038193c5f71cab362b05c41b9
1 /*
2 * Copyright (c) 2006 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
4 * All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the Institute nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
35 * $Id$
38 #ifndef _HEIM_DSA_H
39 #define _HEIM_DSA_H 1
41 #include <hcrypto/bn.h>
43 /* symbol renaming */
44 #define DSA_null_method hc_DSA_null_method
45 #define DSA_new hc_DSA_new
46 #define DSA_free hc_DSA_free
47 #define DSA_up_ref hc_DSA_up_ref
48 #define DSA_set_default_method hc_DSA_set_default_method
49 #define DSA_get_default_method hc_DSA_get_default_method
50 #define DSA_set_method hc_DSA_set_method
51 #define DSA_get_method hc_DSA_get_method
52 #define DSA_set_app_data hc_DSA_set_app_data
53 #define DSA_get_app_data hc_DSA_get_app_data
54 #define DSA_size hc_DSA_size
55 #define DSA_verify hc_DSA_verify
62 typedef struct DSA DSA;
63 typedef struct DSA_METHOD DSA_METHOD;
64 typedef struct DSA_SIG DSA_SIG;
66 struct DSA_SIG {
67 BIGNUM *r;
68 BIGNUM *s;
71 struct DSA_METHOD {
72 const char *name;
73 DSA_SIG * (*dsa_do_sign)(const unsigned char *, int, DSA *);
74 int (*dsa_sign_setup)(DSA *, BN_CTX *, BIGNUM **, BIGNUM **);
75 int (*dsa_do_verify)(const unsigned char *, int, DSA_SIG *, DSA *);
76 int (*dsa_mod_exp)(DSA *, BIGNUM *, BIGNUM *, BIGNUM *,
77 BIGNUM *, BIGNUM *, BIGNUM *, BN_CTX *,
78 BN_MONT_CTX *);
79 int (*bn_mod_exp)(DSA *, BIGNUM *, BIGNUM *, const BIGNUM *,
80 const BIGNUM *, BN_CTX *,
81 BN_MONT_CTX *);
82 int (*init)(DSA *);
83 int (*finish)(DSA *);
84 int flags;
85 void *app_data;
88 struct DSA {
89 int pad;
90 long version;
91 int write_params;
92 BIGNUM *p;
93 BIGNUM *q;
94 BIGNUM *g;
96 BIGNUM *pub_key;
97 BIGNUM *priv_key;
99 BIGNUM *kinv;
100 BIGNUM *r;
101 int flags;
102 void *method_mont_p;
103 int references;
104 struct dsa_CRYPTO_EX_DATA {
105 void *sk;
106 int dummy;
107 } ex_data;
108 const DSA_METHOD *meth;
109 void *engine;
116 const DSA_METHOD *DSA_null_method(void);
122 DSA * DSA_new(void);
123 void DSA_free(DSA *);
124 int DSA_up_ref(DSA *);
126 void DSA_set_default_method(const DSA_METHOD *);
127 const DSA_METHOD * DSA_get_default_method(void);
129 const DSA_METHOD * DSA_get_method(const DSA *);
130 int DSA_set_method(DSA *, const DSA_METHOD *);
132 void DSA_set_app_data(DSA *, void *arg);
133 void * DSA_get_app_data(DSA *);
135 int DSA_size(const DSA *);
137 int DSA_verify(int, const unsigned char *, int,
138 const unsigned char *, int, DSA *);
140 #endif /* _HEIM_DSA_H */