summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2022-04-18 10:36:01 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2022-04-18 10:36:01 +0900
commit51754fa2ed06cc41487324432dbea654642ef244 (patch)
tree1602abdb40f587638846606eb4d1af3df29dcdf8
parent922f9957f94a24c58812db9bbabfb55a8ce211a8 (diff)
downloadlibgcrypt-51754fa2ed06cc41487324432dbea654642ef244.tar.gz
cipher: Fix rsa key generation.
* cipher/rsa.c (generate_fips): Set the least significant bit. -- GnuPG-bug-id: 5919 Fixes-commit: 5f9b3c2e220ca6d0eaff32324a973ef67933a844 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
-rw-r--r--cipher/rsa.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/cipher/rsa.c b/cipher/rsa.c
index 3f1cd722..486a34f0 100644
--- a/cipher/rsa.c
+++ b/cipher/rsa.c
@@ -482,6 +482,7 @@ generate_fips (RSA_secret_key *sk, unsigned int nbits, unsigned long use_e,
if (!testparms)
{
_gcry_mpi_randomize (p, pbits, random_level);
+ mpi_set_bit (p, 0);
}
if (mpi_cmp (p, minp) < 0)
{
@@ -514,6 +515,7 @@ generate_fips (RSA_secret_key *sk, unsigned int nbits, unsigned long use_e,
if (!testparms)
{
_gcry_mpi_randomize (q, pbits, random_level);
+ mpi_set_bit (q, 0);
}
if (mpi_cmp (q, minp) < 0)
{