diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2022-04-18 10:36:01 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2022-04-18 10:36:01 +0900 |
commit | 51754fa2ed06cc41487324432dbea654642ef244 (patch) | |
tree | 1602abdb40f587638846606eb4d1af3df29dcdf8 /cipher | |
parent | 922f9957f94a24c58812db9bbabfb55a8ce211a8 (diff) | |
download | libgcrypt-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>
Diffstat (limited to 'cipher')
-rw-r--r-- | cipher/rsa.c | 2 |
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) { |