Skip to content
This repository was archived by the owner on Jan 26, 2026. It is now read-only.

Commit 26df4b8

Browse files
author
NIIBE Yutaka
committed
cipher: Fix rsa key generation.
* cipher/rsa.c (generate_fips): Set the least significant bit. -- Cherry-picked master commit of: 51754fa GnuPG-bug-id: 5919 Fixes-commit: 5f9b3c2 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
1 parent e073f0e commit 26df4b8

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

cipher/rsa.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ generate_fips (RSA_secret_key *sk, unsigned int nbits, unsigned long use_e,
482482
if (!testparms)
483483
{
484484
_gcry_mpi_randomize (p, pbits, random_level);
485+
mpi_set_bit (p, 0);
485486
}
486487
if (mpi_cmp (p, minp) < 0)
487488
{
@@ -514,6 +515,7 @@ generate_fips (RSA_secret_key *sk, unsigned int nbits, unsigned long use_e,
514515
if (!testparms)
515516
{
516517
_gcry_mpi_randomize (q, pbits, random_level);
518+
mpi_set_bit (q, 0);
517519
}
518520
if (mpi_cmp (q, minp) < 0)
519521
{

0 commit comments

Comments
 (0)