diff options
author | beck <> | 2000-03-19 11:13:58 +0000 |
---|---|---|
committer | beck <> | 2000-03-19 11:13:58 +0000 |
commit | 796d609550df3a33fc11468741c5d2f6d3df4c11 (patch) | |
tree | 6c6d539061caa20372dad0ac4ddb1dfae2fbe7fe /src/lib/libcrypto/dsa/dsa.h | |
parent | 5be3114c1fd7e0dfea1e38d3abb4cbba75244419 (diff) | |
download | openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.tar.gz openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.tar.bz2 openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.zip |
OpenSSL 0.9.5 merge
*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa.h')
-rw-r--r-- | src/lib/libcrypto/dsa/dsa.h | 61 |
1 files changed, 49 insertions, 12 deletions
diff --git a/src/lib/libcrypto/dsa/dsa.h b/src/lib/libcrypto/dsa/dsa.h index 20b3f8d90a..68d9912cbc 100644 --- a/src/lib/libcrypto/dsa/dsa.h +++ b/src/lib/libcrypto/dsa/dsa.h | |||
@@ -74,13 +74,41 @@ extern "C" { | |||
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | #include <openssl/bn.h> | 76 | #include <openssl/bn.h> |
77 | #include <openssl/crypto.h> | ||
77 | #ifndef NO_DH | 78 | #ifndef NO_DH |
78 | # include <openssl/dh.h> | 79 | # include <openssl/dh.h> |
79 | #endif | 80 | #endif |
80 | 81 | ||
81 | #define DSA_FLAG_CACHE_MONT_P 0x01 | 82 | #define DSA_FLAG_CACHE_MONT_P 0x01 |
82 | 83 | ||
83 | typedef struct dsa_st | 84 | typedef struct dsa_st DSA; |
85 | |||
86 | typedef struct DSA_SIG_st | ||
87 | { | ||
88 | BIGNUM *r; | ||
89 | BIGNUM *s; | ||
90 | } DSA_SIG; | ||
91 | |||
92 | typedef struct dsa_method { | ||
93 | const char *name; | ||
94 | DSA_SIG * (*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa); | ||
95 | int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, | ||
96 | BIGNUM **rp); | ||
97 | int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len, | ||
98 | DSA_SIG *sig, DSA *dsa); | ||
99 | int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, | ||
100 | BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx, | ||
101 | BN_MONT_CTX *in_mont); | ||
102 | int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p, | ||
103 | const BIGNUM *m, BN_CTX *ctx, | ||
104 | BN_MONT_CTX *m_ctx); /* Can be null */ | ||
105 | int (*init)(DSA *dsa); | ||
106 | int (*finish)(DSA *dsa); | ||
107 | int flags; | ||
108 | char *app_data; | ||
109 | } DSA_METHOD; | ||
110 | |||
111 | struct dsa_st | ||
84 | { | 112 | { |
85 | /* This first variable is used to pick up errors where | 113 | /* This first variable is used to pick up errors where |
86 | * a DSA is passed instead of of a EVP_PKEY */ | 114 | * a DSA is passed instead of of a EVP_PKEY */ |
@@ -100,15 +128,10 @@ typedef struct dsa_st | |||
100 | int flags; | 128 | int flags; |
101 | /* Normally used to cache montgomery values */ | 129 | /* Normally used to cache montgomery values */ |
102 | char *method_mont_p; | 130 | char *method_mont_p; |
103 | |||
104 | int references; | 131 | int references; |
105 | } DSA; | 132 | CRYPTO_EX_DATA ex_data; |
106 | 133 | DSA_METHOD *meth; | |
107 | typedef struct DSA_SIG_st | 134 | }; |
108 | { | ||
109 | BIGNUM *r; | ||
110 | BIGNUM *s; | ||
111 | } DSA_SIG; | ||
112 | 135 | ||
113 | #define DSAparams_dup(x) (DSA *)ASN1_dup((int (*)())i2d_DSAparams, \ | 136 | #define DSAparams_dup(x) (DSA *)ASN1_dup((int (*)())i2d_DSAparams, \ |
114 | (char *(*)())d2i_DSAparams,(char *)(x)) | 137 | (char *(*)())d2i_DSAparams,(char *)(x)) |
@@ -131,7 +154,14 @@ DSA_SIG * DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa); | |||
131 | int DSA_do_verify(const unsigned char *dgst,int dgst_len, | 154 | int DSA_do_verify(const unsigned char *dgst,int dgst_len, |
132 | DSA_SIG *sig,DSA *dsa); | 155 | DSA_SIG *sig,DSA *dsa); |
133 | 156 | ||
157 | DSA_METHOD *DSA_OpenSSL(void); | ||
158 | |||
159 | void DSA_set_default_method(DSA_METHOD *); | ||
160 | DSA_METHOD *DSA_get_default_method(void); | ||
161 | DSA_METHOD *DSA_set_method(DSA *dsa, DSA_METHOD *); | ||
162 | |||
134 | DSA * DSA_new(void); | 163 | DSA * DSA_new(void); |
164 | DSA * DSA_new_method(DSA_METHOD *meth); | ||
135 | int DSA_size(DSA *); | 165 | int DSA_size(DSA *); |
136 | /* next 4 return -1 on error */ | 166 | /* next 4 return -1 on error */ |
137 | int DSA_sign_setup( DSA *dsa,BN_CTX *ctx_in,BIGNUM **kinvp,BIGNUM **rp); | 167 | int DSA_sign_setup( DSA *dsa,BN_CTX *ctx_in,BIGNUM **kinvp,BIGNUM **rp); |
@@ -140,6 +170,10 @@ int DSA_sign(int type,const unsigned char *dgst,int dlen, | |||
140 | int DSA_verify(int type,const unsigned char *dgst,int dgst_len, | 170 | int DSA_verify(int type,const unsigned char *dgst,int dgst_len, |
141 | unsigned char *sigbuf, int siglen, DSA *dsa); | 171 | unsigned char *sigbuf, int siglen, DSA *dsa); |
142 | void DSA_free (DSA *r); | 172 | void DSA_free (DSA *r); |
173 | int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | ||
174 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); | ||
175 | int DSA_set_ex_data(DSA *d, int idx, void *arg); | ||
176 | void *DSA_get_ex_data(DSA *d, int idx); | ||
143 | 177 | ||
144 | void ERR_load_DSA_strings(void ); | 178 | void ERR_load_DSA_strings(void ); |
145 | 179 | ||
@@ -148,7 +182,7 @@ DSA * d2i_DSAPrivateKey(DSA **a, unsigned char **pp, long length); | |||
148 | DSA * d2i_DSAparams(DSA **a, unsigned char **pp, long length); | 182 | DSA * d2i_DSAparams(DSA **a, unsigned char **pp, long length); |
149 | DSA * DSA_generate_parameters(int bits, unsigned char *seed,int seed_len, | 183 | DSA * DSA_generate_parameters(int bits, unsigned char *seed,int seed_len, |
150 | int *counter_ret, unsigned long *h_ret,void | 184 | int *counter_ret, unsigned long *h_ret,void |
151 | (*callback)(),char *cb_arg); | 185 | (*callback)(int, int, void *),void *cb_arg); |
152 | int DSA_generate_key(DSA *a); | 186 | int DSA_generate_key(DSA *a); |
153 | int i2d_DSAPublicKey(DSA *a, unsigned char **pp); | 187 | int i2d_DSAPublicKey(DSA *a, unsigned char **pp); |
154 | int i2d_DSAPrivateKey(DSA *a, unsigned char **pp); | 188 | int i2d_DSAPrivateKey(DSA *a, unsigned char **pp); |
@@ -163,7 +197,11 @@ int DSAparams_print_fp(FILE *fp, DSA *x); | |||
163 | int DSA_print_fp(FILE *bp, DSA *x, int off); | 197 | int DSA_print_fp(FILE *bp, DSA *x, int off); |
164 | #endif | 198 | #endif |
165 | 199 | ||
166 | int DSA_is_prime(BIGNUM *q,void (*callback)(),char *cb_arg); | 200 | #define DSS_prime_checks 50 |
201 | /* Primality test according to FIPS PUB 186[-1], Appendix 2.1: | ||
202 | * 50 rounds of Rabin-Miller */ | ||
203 | #define DSA_is_prime(n, callback, cb_arg) \ | ||
204 | BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg) | ||
167 | 205 | ||
168 | #ifndef NO_DH | 206 | #ifndef NO_DH |
169 | /* Convert DSA structure (key or just parameters) into DH structure | 207 | /* Convert DSA structure (key or just parameters) into DH structure |
@@ -184,7 +222,6 @@ DH *DSA_dup_DH(DSA *r); | |||
184 | #define DSA_F_DSAPARAMS_PRINT_FP 101 | 222 | #define DSA_F_DSAPARAMS_PRINT_FP 101 |
185 | #define DSA_F_DSA_DO_SIGN 112 | 223 | #define DSA_F_DSA_DO_SIGN 112 |
186 | #define DSA_F_DSA_DO_VERIFY 113 | 224 | #define DSA_F_DSA_DO_VERIFY 113 |
187 | #define DSA_F_DSA_IS_PRIME 102 | ||
188 | #define DSA_F_DSA_NEW 103 | 225 | #define DSA_F_DSA_NEW 103 |
189 | #define DSA_F_DSA_PRINT 104 | 226 | #define DSA_F_DSA_PRINT 104 |
190 | #define DSA_F_DSA_PRINT_FP 105 | 227 | #define DSA_F_DSA_PRINT_FP 105 |