diff options
-rw-r--r-- | src/lib/libcrypto/dsa/dsa.h | 9 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_gen.c | 14 |
2 files changed, 12 insertions, 11 deletions
diff --git a/src/lib/libcrypto/dsa/dsa.h b/src/lib/libcrypto/dsa/dsa.h index 63e5cedb1c..9f3d561239 100644 --- a/src/lib/libcrypto/dsa/dsa.h +++ b/src/lib/libcrypto/dsa/dsa.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dsa.h,v 1.45 2024/12/05 19:29:08 tb Exp $ */ | 1 | /* $OpenBSD: dsa.h,v 1.46 2024/12/05 19:34:46 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -177,13 +177,6 @@ int DSA_print(BIO *bp, const DSA *x, int off); | |||
177 | int DSAparams_print_fp(FILE *fp, const DSA *x); | 177 | int DSAparams_print_fp(FILE *fp, const DSA *x); |
178 | int DSA_print_fp(FILE *bp, const DSA *x, int off); | 178 | int DSA_print_fp(FILE *bp, const DSA *x, int off); |
179 | 179 | ||
180 | /* | ||
181 | * Primality test according to FIPS PUB 186-4, Appendix C.3. Set the number | ||
182 | * to 64 rounds of Miller-Rabin, which corresponds to 128 bits of security. | ||
183 | * This is necessary for keys of size >= 3072. | ||
184 | */ | ||
185 | #define DSS_prime_checks 64 | ||
186 | |||
187 | #ifndef OPENSSL_NO_DH | 180 | #ifndef OPENSSL_NO_DH |
188 | /* Convert DSA structure (key or just parameters) into DH structure | 181 | /* Convert DSA structure (key or just parameters) into DH structure |
189 | * (be careful to avoid small subgroup attacks when using this!) */ | 182 | * (be careful to avoid small subgroup attacks when using this!) */ |
diff --git a/src/lib/libcrypto/dsa/dsa_gen.c b/src/lib/libcrypto/dsa/dsa_gen.c index dc04eba032..a79d0f9e20 100644 --- a/src/lib/libcrypto/dsa/dsa_gen.c +++ b/src/lib/libcrypto/dsa/dsa_gen.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dsa_gen.c,v 1.32 2024/05/11 06:43:50 tb Exp $ */ | 1 | /* $OpenBSD: dsa_gen.c,v 1.33 2024/12/05 19:34:46 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -71,6 +71,14 @@ | |||
71 | #include "bn_local.h" | 71 | #include "bn_local.h" |
72 | #include "dsa_local.h" | 72 | #include "dsa_local.h" |
73 | 73 | ||
74 | /* | ||
75 | * Primality test according to FIPS PUB 186-4, Appendix C.3. Set the number | ||
76 | * to 64 rounds of Miller-Rabin, which corresponds to 128 bits of security. | ||
77 | * This is necessary for keys of size >= 3072. | ||
78 | * XXX - now that we do BPSW the recommendation is to do 2 for p and 27 for q. | ||
79 | */ | ||
80 | #define DSA_prime_checks 64 | ||
81 | |||
74 | int | 82 | int |
75 | DSA_generate_parameters_ex(DSA *ret, int bits, const unsigned char *seed_in, | 83 | DSA_generate_parameters_ex(DSA *ret, int bits, const unsigned char *seed_in, |
76 | int seed_len, int *counter_ret, unsigned long *h_ret, BN_GENCB *cb) | 84 | int seed_len, int *counter_ret, unsigned long *h_ret, BN_GENCB *cb) |
@@ -207,7 +215,7 @@ dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, const EVP_MD *evpmd, | |||
207 | goto err; | 215 | goto err; |
208 | 216 | ||
209 | /* step 4 */ | 217 | /* step 4 */ |
210 | r = BN_is_prime_fasttest_ex(q, DSS_prime_checks, ctx, | 218 | r = BN_is_prime_fasttest_ex(q, DSA_prime_checks, ctx, |
211 | seed_is_random, cb); | 219 | seed_is_random, cb); |
212 | if (r > 0) | 220 | if (r > 0) |
213 | break; | 221 | break; |
@@ -278,7 +286,7 @@ dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, const EVP_MD *evpmd, | |||
278 | /* step 10 */ | 286 | /* step 10 */ |
279 | if (BN_cmp(p, test) >= 0) { | 287 | if (BN_cmp(p, test) >= 0) { |
280 | /* step 11 */ | 288 | /* step 11 */ |
281 | r = BN_is_prime_fasttest_ex(p, DSS_prime_checks, | 289 | r = BN_is_prime_fasttest_ex(p, DSA_prime_checks, |
282 | ctx, 1, cb); | 290 | ctx, 1, cb); |
283 | if (r > 0) | 291 | if (r > 0) |
284 | goto end; /* found it */ | 292 | goto end; /* found it */ |