Skip to content

Commit 408cb4c

Browse files
committed
Change default RSA, DSA and DH size to 2048 bit
Fixes: #8737 Reviewed-by: Bernd Edlinger <[email protected]> Reviewed-by: Richard Levitte <[email protected]> GH: #8741 (cherry picked from commit 70b0b97)
1 parent 3ae3c38 commit 408cb4c

5 files changed

Lines changed: 15 additions & 11 deletions

File tree

CHANGES

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99

1010
Changes between 1.1.1b and 1.1.1c [xx XXX xxxx]
1111

12-
*)
12+
*) Change the default RSA, DSA and DH size to 2048 bit instead of 1024.
13+
This changes the size when using the genpkey app when no size is given. It
14+
fixes an omission in earlier changes that changed all RSA, DSA and DH
15+
generation apps to use 2048 bits by default.
16+
[Kurt Roeckx]
1317

1418
Changes between 1.1.1a and 1.1.1b [26 Feb 2019]
1519

crypto/dh/dh_pmeth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static int pkey_dh_init(EVP_PKEY_CTX *ctx)
5454
DHerr(DH_F_PKEY_DH_INIT, ERR_R_MALLOC_FAILURE);
5555
return 0;
5656
}
57-
dctx->prime_len = 1024;
57+
dctx->prime_len = 2048;
5858
dctx->subprime_len = -1;
5959
dctx->generator = 2;
6060
dctx->kdf_type = EVP_PKEY_DH_KDF_NONE;

crypto/dsa/dsa_pmeth.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
typedef struct {
2222
/* Parameter gen parameters */
23-
int nbits; /* size of p in bits (default: 1024) */
24-
int qbits; /* size of q in bits (default: 160) */
23+
int nbits; /* size of p in bits (default: 2048) */
24+
int qbits; /* size of q in bits (default: 224) */
2525
const EVP_MD *pmd; /* MD for parameter generation */
2626
/* Keygen callback info */
2727
int gentmp[2];
@@ -35,8 +35,8 @@ static int pkey_dsa_init(EVP_PKEY_CTX *ctx)
3535

3636
if (dctx == NULL)
3737
return 0;
38-
dctx->nbits = 1024;
39-
dctx->qbits = 160;
38+
dctx->nbits = 2048;
39+
dctx->qbits = 224;
4040
dctx->pmd = NULL;
4141
dctx->md = NULL;
4242

crypto/rsa/rsa_pmeth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static int pkey_rsa_init(EVP_PKEY_CTX *ctx)
5656

5757
if (rctx == NULL)
5858
return 0;
59-
rctx->nbits = 1024;
59+
rctx->nbits = 2048;
6060
rctx->primes = RSA_DEFAULT_PRIME_NUM;
6161
if (pkey_ctx_is_pss(ctx))
6262
rctx->pad_mode = RSA_PKCS1_PSS_PADDING;

doc/man1/genpkey.pod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ or ED448 algorithms.
118118

119119
=item B<rsa_keygen_bits:numbits>
120120

121-
The number of bits in the generated key. If not specified 1024 is used.
121+
The number of bits in the generated key. If not specified 2048 is used.
122122

123123
=item B<rsa_keygen_primes:numprimes>
124124

@@ -185,12 +185,12 @@ below.
185185

186186
=item B<dsa_paramgen_bits:numbits>
187187

188-
The number of bits in the generated prime. If not specified 1024 is used.
188+
The number of bits in the generated prime. If not specified 2048 is used.
189189

190190
=item B<dsa_paramgen_q_bits:numbits>
191191

192192
The number of bits in the q parameter. Must be one of 160, 224 or 256. If not
193-
specified 160 is used.
193+
specified 224 is used.
194194

195195
=item B<dsa_paramgen_md:digest>
196196

@@ -209,7 +209,7 @@ or B<sha256> if it is 256.
209209

210210
=item B<dh_paramgen_prime_len:numbits>
211211

212-
The number of bits in the prime parameter B<p>. The default is 1024.
212+
The number of bits in the prime parameter B<p>. The default is 2048.
213213

214214
=item B<dh_paramgen_subprime_len:numbits>
215215

0 commit comments

Comments
 (0)