summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dsa/dsa_gen.c
diff options
context:
space:
mode:
authortb <>2024-12-05 19:34:46 +0000
committertb <>2024-12-05 19:34:46 +0000
commit3af9f1dd8cf5840a4914ba14a8494cd82a9de2b1 (patch)
tree27104488bc44817b52bb2c24a8cc8e3ee11161c1 /src/lib/libcrypto/dsa/dsa_gen.c
parent2c6c75b481334453752e3edee7f8fac54d80abfa (diff)
downloadopenbsd-3af9f1dd8cf5840a4914ba14a8494cd82a9de2b1.tar.gz
openbsd-3af9f1dd8cf5840a4914ba14a8494cd82a9de2b1.tar.bz2
openbsd-3af9f1dd8cf5840a4914ba14a8494cd82a9de2b1.zip
Make the DSS_prime_checks macro internal
Rename it to DSA_prime_checks and add an XXX comment mentioning that we could reduce the number of rounds thanks to BPSW. There are no plans of changing that as DSA is on its way out. discussed with miod
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa_gen.c')
-rw-r--r--src/lib/libcrypto/dsa/dsa_gen.c14
1 files changed, 11 insertions, 3 deletions
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
74int 82int
75DSA_generate_parameters_ex(DSA *ret, int bits, const unsigned char *seed_in, 83DSA_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 */