diff options
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa.h')
-rw-r--r-- | src/lib/libcrypto/dsa/dsa.h | 61 |
1 files changed, 39 insertions, 22 deletions
diff --git a/src/lib/libcrypto/dsa/dsa.h b/src/lib/libcrypto/dsa/dsa.h index 851e3f0445..3a8fe5b56b 100644 --- a/src/lib/libcrypto/dsa/dsa.h +++ b/src/lib/libcrypto/dsa/dsa.h | |||
@@ -65,6 +65,8 @@ | |||
65 | #ifndef HEADER_DSA_H | 65 | #ifndef HEADER_DSA_H |
66 | #define HEADER_DSA_H | 66 | #define HEADER_DSA_H |
67 | 67 | ||
68 | #include <openssl/e_os2.h> | ||
69 | |||
68 | #ifdef OPENSSL_NO_DSA | 70 | #ifdef OPENSSL_NO_DSA |
69 | #error DSA is disabled. | 71 | #error DSA is disabled. |
70 | #endif | 72 | #endif |
@@ -72,12 +74,19 @@ | |||
72 | #ifndef OPENSSL_NO_BIO | 74 | #ifndef OPENSSL_NO_BIO |
73 | #include <openssl/bio.h> | 75 | #include <openssl/bio.h> |
74 | #endif | 76 | #endif |
75 | #include <openssl/bn.h> | ||
76 | #include <openssl/crypto.h> | 77 | #include <openssl/crypto.h> |
77 | #include <openssl/ossl_typ.h> | 78 | #include <openssl/ossl_typ.h> |
79 | |||
80 | #ifndef OPENSSL_NO_DEPRECATED | ||
81 | #include <openssl/bn.h> | ||
78 | #ifndef OPENSSL_NO_DH | 82 | #ifndef OPENSSL_NO_DH |
79 | # include <openssl/dh.h> | 83 | # include <openssl/dh.h> |
80 | #endif | 84 | #endif |
85 | #endif | ||
86 | |||
87 | #ifndef OPENSSL_DSA_MAX_MODULUS_BITS | ||
88 | # define OPENSSL_DSA_MAX_MODULUS_BITS 10000 | ||
89 | #endif | ||
81 | 90 | ||
82 | #define DSA_FLAG_CACHE_MONT_P 0x01 | 91 | #define DSA_FLAG_CACHE_MONT_P 0x01 |
83 | #define DSA_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DSA | 92 | #define DSA_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DSA |
@@ -88,22 +97,13 @@ | |||
88 | * be used for all exponents. | 97 | * be used for all exponents. |
89 | */ | 98 | */ |
90 | 99 | ||
91 | /* If this flag is set external DSA_METHOD callbacks are allowed in FIPS mode | ||
92 | * it is then the applications responsibility to ensure the external method | ||
93 | * is compliant. | ||
94 | */ | ||
95 | |||
96 | #define DSA_FLAG_FIPS_EXTERNAL_METHOD_ALLOW 0x04 | ||
97 | |||
98 | #if defined(OPENSSL_FIPS) | ||
99 | #define FIPS_DSA_SIZE_T int | ||
100 | #endif | ||
101 | |||
102 | #ifdef __cplusplus | 100 | #ifdef __cplusplus |
103 | extern "C" { | 101 | extern "C" { |
104 | #endif | 102 | #endif |
105 | 103 | ||
106 | typedef struct dsa_st DSA; | 104 | /* Already defined in ossl_typ.h */ |
105 | /* typedef struct dsa_st DSA; */ | ||
106 | /* typedef struct dsa_method DSA_METHOD; */ | ||
107 | 107 | ||
108 | typedef struct DSA_SIG_st | 108 | typedef struct DSA_SIG_st |
109 | { | 109 | { |
@@ -111,7 +111,8 @@ typedef struct DSA_SIG_st | |||
111 | BIGNUM *s; | 111 | BIGNUM *s; |
112 | } DSA_SIG; | 112 | } DSA_SIG; |
113 | 113 | ||
114 | typedef struct dsa_method { | 114 | struct dsa_method |
115 | { | ||
115 | const char *name; | 116 | const char *name; |
116 | DSA_SIG * (*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa); | 117 | DSA_SIG * (*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa); |
117 | int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, | 118 | int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, |
@@ -128,7 +129,14 @@ typedef struct dsa_method { | |||
128 | int (*finish)(DSA *dsa); | 129 | int (*finish)(DSA *dsa); |
129 | int flags; | 130 | int flags; |
130 | char *app_data; | 131 | char *app_data; |
131 | } DSA_METHOD; | 132 | /* If this is non-NULL, it is used to generate DSA parameters */ |
133 | int (*dsa_paramgen)(DSA *dsa, int bits, | ||
134 | unsigned char *seed, int seed_len, | ||
135 | int *counter_ret, unsigned long *h_ret, | ||
136 | BN_GENCB *cb); | ||
137 | /* If this is non-NULL, it is used to generate DSA keys */ | ||
138 | int (*dsa_keygen)(DSA *dsa); | ||
139 | }; | ||
132 | 140 | ||
133 | struct dsa_st | 141 | struct dsa_st |
134 | { | 142 | { |
@@ -149,7 +157,7 @@ struct dsa_st | |||
149 | 157 | ||
150 | int flags; | 158 | int flags; |
151 | /* Normally used to cache montgomery values */ | 159 | /* Normally used to cache montgomery values */ |
152 | char *method_mont_p; | 160 | BN_MONT_CTX *method_mont_p; |
153 | int references; | 161 | int references; |
154 | CRYPTO_EX_DATA ex_data; | 162 | CRYPTO_EX_DATA ex_data; |
155 | const DSA_METHOD *meth; | 163 | const DSA_METHOD *meth; |
@@ -157,16 +165,13 @@ struct dsa_st | |||
157 | ENGINE *engine; | 165 | ENGINE *engine; |
158 | }; | 166 | }; |
159 | 167 | ||
160 | #define DSAparams_dup(x) (DSA *)ASN1_dup((int (*)())i2d_DSAparams, \ | 168 | #define DSAparams_dup(x) ASN1_dup_of_const(DSA,i2d_DSAparams,d2i_DSAparams,x) |
161 | (char *(*)())d2i_DSAparams,(char *)(x)) | ||
162 | #define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ | 169 | #define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ |
163 | (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x)) | 170 | (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x)) |
164 | #define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \ | 171 | #define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \ |
165 | (unsigned char *)(x)) | 172 | (unsigned char *)(x)) |
166 | #define d2i_DSAparams_bio(bp,x) (DSA *)ASN1_d2i_bio((char *(*)())DSA_new, \ | 173 | #define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x) |
167 | (char *(*)())d2i_DSAparams,(bp),(unsigned char **)(x)) | 174 | #define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x) |
168 | #define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio(i2d_DSAparams,(bp), \ | ||
169 | (unsigned char *)(x)) | ||
170 | 175 | ||
171 | 176 | ||
172 | DSA_SIG * DSA_SIG_new(void); | 177 | DSA_SIG * DSA_SIG_new(void); |
@@ -204,10 +209,20 @@ void *DSA_get_ex_data(DSA *d, int idx); | |||
204 | DSA * d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length); | 209 | DSA * d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length); |
205 | DSA * d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length); | 210 | DSA * d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length); |
206 | DSA * d2i_DSAparams(DSA **a, const unsigned char **pp, long length); | 211 | DSA * d2i_DSAparams(DSA **a, const unsigned char **pp, long length); |
212 | |||
213 | /* Deprecated version */ | ||
214 | #ifndef OPENSSL_NO_DEPRECATED | ||
207 | DSA * DSA_generate_parameters(int bits, | 215 | DSA * DSA_generate_parameters(int bits, |
208 | unsigned char *seed,int seed_len, | 216 | unsigned char *seed,int seed_len, |
209 | int *counter_ret, unsigned long *h_ret,void | 217 | int *counter_ret, unsigned long *h_ret,void |
210 | (*callback)(int, int, void *),void *cb_arg); | 218 | (*callback)(int, int, void *),void *cb_arg); |
219 | #endif /* !defined(OPENSSL_NO_DEPRECATED) */ | ||
220 | |||
221 | /* New version */ | ||
222 | int DSA_generate_parameters_ex(DSA *dsa, int bits, | ||
223 | unsigned char *seed,int seed_len, | ||
224 | int *counter_ret, unsigned long *h_ret, BN_GENCB *cb); | ||
225 | |||
211 | int DSA_generate_key(DSA *a); | 226 | int DSA_generate_key(DSA *a); |
212 | int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); | 227 | int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); |
213 | int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); | 228 | int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); |
@@ -259,8 +274,10 @@ void ERR_load_DSA_strings(void); | |||
259 | #define DSA_F_SIG_CB 114 | 274 | #define DSA_F_SIG_CB 114 |
260 | 275 | ||
261 | /* Reason codes. */ | 276 | /* Reason codes. */ |
277 | #define DSA_R_BAD_Q_VALUE 102 | ||
262 | #define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100 | 278 | #define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100 |
263 | #define DSA_R_MISSING_PARAMETERS 101 | 279 | #define DSA_R_MISSING_PARAMETERS 101 |
280 | #define DSA_R_MODULUS_TOO_LARGE 103 | ||
264 | 281 | ||
265 | #ifdef __cplusplus | 282 | #ifdef __cplusplus |
266 | } | 283 | } |