diff options
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa.h')
-rw-r--r-- | src/lib/libcrypto/dsa/dsa.h | 69 |
1 files changed, 26 insertions, 43 deletions
diff --git a/src/lib/libcrypto/dsa/dsa.h b/src/lib/libcrypto/dsa/dsa.h index 702c50d6dc..ac50a5c846 100644 --- a/src/lib/libcrypto/dsa/dsa.h +++ b/src/lib/libcrypto/dsa/dsa.h | |||
@@ -88,8 +88,6 @@ | |||
88 | # define OPENSSL_DSA_MAX_MODULUS_BITS 10000 | 88 | # define OPENSSL_DSA_MAX_MODULUS_BITS 10000 |
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | #define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024 | ||
92 | |||
93 | #define DSA_FLAG_CACHE_MONT_P 0x01 | 91 | #define DSA_FLAG_CACHE_MONT_P 0x01 |
94 | #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 |
95 | * implementation now uses constant time | 93 | * implementation now uses constant time |
@@ -99,25 +97,6 @@ | |||
99 | * be used for all exponents. | 97 | * be used for all exponents. |
100 | */ | 98 | */ |
101 | 99 | ||
102 | /* If this flag is set the DSA method is FIPS compliant and can be used | ||
103 | * in FIPS mode. This is set in the validated module method. If an | ||
104 | * application sets this flag in its own methods it is its reposibility | ||
105 | * to ensure the result is compliant. | ||
106 | */ | ||
107 | |||
108 | #define DSA_FLAG_FIPS_METHOD 0x0400 | ||
109 | |||
110 | /* If this flag is set the operations normally disabled in FIPS mode are | ||
111 | * permitted it is then the applications responsibility to ensure that the | ||
112 | * usage is compliant. | ||
113 | */ | ||
114 | |||
115 | #define DSA_FLAG_NON_FIPS_ALLOW 0x0400 | ||
116 | |||
117 | #ifdef OPENSSL_FIPS | ||
118 | #define FIPS_DSA_SIZE_T int | ||
119 | #endif | ||
120 | |||
121 | #ifdef __cplusplus | 100 | #ifdef __cplusplus |
122 | extern "C" { | 101 | extern "C" { |
123 | #endif | 102 | #endif |
@@ -139,7 +118,7 @@ struct dsa_method | |||
139 | 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, |
140 | BIGNUM **rp); | 119 | BIGNUM **rp); |
141 | int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len, | 120 | int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len, |
142 | DSA_SIG *sig, DSA *dsa); | 121 | DSA_SIG *sig, DSA *dsa); |
143 | int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, | 122 | int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, |
144 | BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx, | 123 | BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx, |
145 | BN_MONT_CTX *in_mont); | 124 | BN_MONT_CTX *in_mont); |
@@ -152,7 +131,7 @@ struct dsa_method | |||
152 | char *app_data; | 131 | char *app_data; |
153 | /* If this is non-NULL, it is used to generate DSA parameters */ | 132 | /* If this is non-NULL, it is used to generate DSA parameters */ |
154 | int (*dsa_paramgen)(DSA *dsa, int bits, | 133 | int (*dsa_paramgen)(DSA *dsa, int bits, |
155 | unsigned char *seed, int seed_len, | 134 | const unsigned char *seed, int seed_len, |
156 | int *counter_ret, unsigned long *h_ret, | 135 | int *counter_ret, unsigned long *h_ret, |
157 | BN_GENCB *cb); | 136 | BN_GENCB *cb); |
158 | /* If this is non-NULL, it is used to generate DSA keys */ | 137 | /* If this is non-NULL, it is used to generate DSA keys */ |
@@ -186,7 +165,6 @@ struct dsa_st | |||
186 | ENGINE *engine; | 165 | ENGINE *engine; |
187 | }; | 166 | }; |
188 | 167 | ||
189 | #define DSAparams_dup(x) ASN1_dup_of_const(DSA,i2d_DSAparams,d2i_DSAparams,x) | ||
190 | #define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ | 168 | #define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ |
191 | (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x)) | 169 | (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x)) |
192 | #define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \ | 170 | #define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \ |
@@ -195,6 +173,7 @@ struct dsa_st | |||
195 | #define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x) | 173 | #define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x) |
196 | 174 | ||
197 | 175 | ||
176 | DSA *DSAparams_dup(DSA *x); | ||
198 | DSA_SIG * DSA_SIG_new(void); | 177 | DSA_SIG * DSA_SIG_new(void); |
199 | void DSA_SIG_free(DSA_SIG *a); | 178 | void DSA_SIG_free(DSA_SIG *a); |
200 | int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); | 179 | int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); |
@@ -210,11 +189,6 @@ void DSA_set_default_method(const DSA_METHOD *); | |||
210 | const DSA_METHOD *DSA_get_default_method(void); | 189 | const DSA_METHOD *DSA_get_default_method(void); |
211 | int DSA_set_method(DSA *dsa, const DSA_METHOD *); | 190 | int DSA_set_method(DSA *dsa, const DSA_METHOD *); |
212 | 191 | ||
213 | #ifdef OPENSSL_FIPS | ||
214 | DSA * FIPS_dsa_new(void); | ||
215 | void FIPS_dsa_free (DSA *r); | ||
216 | #endif | ||
217 | |||
218 | DSA * DSA_new(void); | 192 | DSA * DSA_new(void); |
219 | DSA * DSA_new_method(ENGINE *engine); | 193 | DSA * DSA_new_method(ENGINE *engine); |
220 | void DSA_free (DSA *r); | 194 | void DSA_free (DSA *r); |
@@ -246,7 +220,7 @@ DSA * DSA_generate_parameters(int bits, | |||
246 | 220 | ||
247 | /* New version */ | 221 | /* New version */ |
248 | int DSA_generate_parameters_ex(DSA *dsa, int bits, | 222 | int DSA_generate_parameters_ex(DSA *dsa, int bits, |
249 | unsigned char *seed,int seed_len, | 223 | const unsigned char *seed,int seed_len, |
250 | int *counter_ret, unsigned long *h_ret, BN_GENCB *cb); | 224 | int *counter_ret, unsigned long *h_ret, BN_GENCB *cb); |
251 | 225 | ||
252 | int DSA_generate_key(DSA *a); | 226 | int DSA_generate_key(DSA *a); |
@@ -275,10 +249,13 @@ int DSA_print_fp(FILE *bp, const DSA *x, int off); | |||
275 | DH *DSA_dup_DH(const DSA *r); | 249 | DH *DSA_dup_DH(const DSA *r); |
276 | #endif | 250 | #endif |
277 | 251 | ||
278 | #ifdef OPENSSL_FIPS | 252 | #define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \ |
279 | int FIPS_dsa_sig_encode(unsigned char *out, DSA_SIG *sig); | 253 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ |
280 | int FIPS_dsa_sig_decode(DSA_SIG *sig, const unsigned char *in, int inlen); | 254 | EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL) |
281 | #endif | 255 | |
256 | #define EVP_PKEY_CTRL_DSA_PARAMGEN_BITS (EVP_PKEY_ALG_CTRL + 1) | ||
257 | #define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS (EVP_PKEY_ALG_CTRL + 2) | ||
258 | #define EVP_PKEY_CTRL_DSA_PARAMGEN_MD (EVP_PKEY_ALG_CTRL + 3) | ||
282 | 259 | ||
283 | /* BEGIN ERROR CODES */ | 260 | /* BEGIN ERROR CODES */ |
284 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 261 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
@@ -290,33 +267,39 @@ void ERR_load_DSA_strings(void); | |||
290 | 267 | ||
291 | /* Function codes. */ | 268 | /* Function codes. */ |
292 | #define DSA_F_D2I_DSA_SIG 110 | 269 | #define DSA_F_D2I_DSA_SIG 110 |
270 | #define DSA_F_DO_DSA_PRINT 104 | ||
293 | #define DSA_F_DSAPARAMS_PRINT 100 | 271 | #define DSA_F_DSAPARAMS_PRINT 100 |
294 | #define DSA_F_DSAPARAMS_PRINT_FP 101 | 272 | #define DSA_F_DSAPARAMS_PRINT_FP 101 |
295 | #define DSA_F_DSA_BUILTIN_KEYGEN 119 | ||
296 | #define DSA_F_DSA_BUILTIN_PARAMGEN 118 | ||
297 | #define DSA_F_DSA_DO_SIGN 112 | 273 | #define DSA_F_DSA_DO_SIGN 112 |
298 | #define DSA_F_DSA_DO_VERIFY 113 | 274 | #define DSA_F_DSA_DO_VERIFY 113 |
299 | #define DSA_F_DSA_GENERATE_PARAMETERS 117 | ||
300 | #define DSA_F_DSA_NEW_METHOD 103 | 275 | #define DSA_F_DSA_NEW_METHOD 103 |
301 | #define DSA_F_DSA_PRINT 104 | 276 | #define DSA_F_DSA_PARAM_DECODE 119 |
302 | #define DSA_F_DSA_PRINT_FP 105 | 277 | #define DSA_F_DSA_PRINT_FP 105 |
303 | #define DSA_F_DSA_SET_DEFAULT_METHOD 115 | 278 | #define DSA_F_DSA_PRIV_DECODE 115 |
304 | #define DSA_F_DSA_SET_METHOD 116 | 279 | #define DSA_F_DSA_PRIV_ENCODE 116 |
280 | #define DSA_F_DSA_PUB_DECODE 117 | ||
281 | #define DSA_F_DSA_PUB_ENCODE 118 | ||
305 | #define DSA_F_DSA_SIGN 106 | 282 | #define DSA_F_DSA_SIGN 106 |
306 | #define DSA_F_DSA_SIGN_SETUP 107 | 283 | #define DSA_F_DSA_SIGN_SETUP 107 |
307 | #define DSA_F_DSA_SIG_NEW 109 | 284 | #define DSA_F_DSA_SIG_NEW 109 |
308 | #define DSA_F_DSA_VERIFY 108 | 285 | #define DSA_F_DSA_VERIFY 108 |
309 | #define DSA_F_I2D_DSA_SIG 111 | 286 | #define DSA_F_I2D_DSA_SIG 111 |
287 | #define DSA_F_OLD_DSA_PRIV_DECODE 122 | ||
288 | #define DSA_F_PKEY_DSA_CTRL 120 | ||
289 | #define DSA_F_PKEY_DSA_KEYGEN 121 | ||
310 | #define DSA_F_SIG_CB 114 | 290 | #define DSA_F_SIG_CB 114 |
311 | 291 | ||
312 | /* Reason codes. */ | 292 | /* Reason codes. */ |
313 | #define DSA_R_BAD_Q_VALUE 102 | 293 | #define DSA_R_BAD_Q_VALUE 102 |
294 | #define DSA_R_BN_DECODE_ERROR 108 | ||
295 | #define DSA_R_BN_ERROR 109 | ||
314 | #define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100 | 296 | #define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100 |
315 | #define DSA_R_KEY_SIZE_TOO_SMALL 106 | 297 | #define DSA_R_DECODE_ERROR 104 |
298 | #define DSA_R_INVALID_DIGEST_TYPE 106 | ||
316 | #define DSA_R_MISSING_PARAMETERS 101 | 299 | #define DSA_R_MISSING_PARAMETERS 101 |
317 | #define DSA_R_MODULUS_TOO_LARGE 103 | 300 | #define DSA_R_MODULUS_TOO_LARGE 103 |
318 | #define DSA_R_NON_FIPS_METHOD 104 | 301 | #define DSA_R_NO_PARAMETERS_SET 107 |
319 | #define DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE 105 | 302 | #define DSA_R_PARAMETER_ENCODING_ERROR 105 |
320 | 303 | ||
321 | #ifdef __cplusplus | 304 | #ifdef __cplusplus |
322 | } | 305 | } |