]>
Commit | Line | Data |
---|---|---|
d2e9e320 RS |
1 | /* |
2 | * Copyright 2007-2016 The OpenSSL Project Authors. All Rights Reserved. | |
357d5de5 | 3 | * |
d2e9e320 RS |
4 | * Licensed under the OpenSSL license (the "License"). You may not use |
5 | * this file except in compliance with the License. You can obtain a copy | |
6 | * in the file LICENSE in the source distribution or at | |
7 | * https://www.openssl.org/source/license.html | |
357d5de5 NL |
8 | */ |
9 | ||
10 | #include <openssl/dsa.h> | |
11 | ||
1258396d MC |
12 | struct dsa_st { |
13 | /* | |
14 | * This first variable is used to pick up errors where a DSA is passed | |
15 | * instead of of a EVP_PKEY | |
16 | */ | |
17 | int pad; | |
18 | long version; | |
19 | BIGNUM *p; | |
20 | BIGNUM *q; /* == 20 */ | |
21 | BIGNUM *g; | |
22 | BIGNUM *pub_key; /* y public key */ | |
23 | BIGNUM *priv_key; /* x private key */ | |
24 | int flags; | |
25 | /* Normally used to cache montgomery values */ | |
26 | BN_MONT_CTX *method_mont_p; | |
27 | int references; | |
28 | CRYPTO_EX_DATA ex_data; | |
29 | const DSA_METHOD *meth; | |
30 | /* functional reference if 'meth' is ENGINE-provided */ | |
31 | ENGINE *engine; | |
32 | CRYPTO_RWLOCK *lock; | |
33 | }; | |
34 | ||
9267c11b EK |
35 | struct DSA_SIG_st { |
36 | BIGNUM *r; | |
37 | BIGNUM *s; | |
38 | }; | |
39 | ||
6e9fa57c MC |
40 | struct dsa_method { |
41 | char *name; | |
42 | DSA_SIG *(*dsa_do_sign) (const unsigned char *dgst, int dlen, DSA *dsa); | |
43 | int (*dsa_sign_setup) (DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, | |
44 | BIGNUM **rp); | |
45 | int (*dsa_do_verify) (const unsigned char *dgst, int dgst_len, | |
46 | DSA_SIG *sig, DSA *dsa); | |
47 | int (*dsa_mod_exp) (DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, | |
48 | BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx, | |
49 | BN_MONT_CTX *in_mont); | |
50 | /* Can be null */ | |
51 | int (*bn_mod_exp) (DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p, | |
52 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | |
53 | int (*init) (DSA *dsa); | |
54 | int (*finish) (DSA *dsa); | |
55 | int flags; | |
56 | void *app_data; | |
57 | /* If this is non-NULL, it is used to generate DSA parameters */ | |
58 | int (*dsa_paramgen) (DSA *dsa, int bits, | |
59 | const unsigned char *seed, int seed_len, | |
60 | int *counter_ret, unsigned long *h_ret, | |
61 | BN_GENCB *cb); | |
62 | /* If this is non-NULL, it is used to generate DSA keys */ | |
63 | int (*dsa_keygen) (DSA *dsa); | |
64 | }; | |
65 | ||
357d5de5 | 66 | int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, |
0f113f3e MC |
67 | const EVP_MD *evpmd, const unsigned char *seed_in, |
68 | size_t seed_len, unsigned char *seed_out, | |
69 | int *counter_ret, unsigned long *h_ret, | |
70 | BN_GENCB *cb); | |
3dd9b31d | 71 | |
f55f5f77 | 72 | int dsa_builtin_paramgen2(DSA *ret, size_t L, size_t N, |
0f113f3e MC |
73 | const EVP_MD *evpmd, const unsigned char *seed_in, |
74 | size_t seed_len, int idx, unsigned char *seed_out, | |
75 | int *counter_ret, unsigned long *h_ret, | |
76 | BN_GENCB *cb); |