diff options
author | Jakub Jelen <jjelen@redhat.com> | 2021-08-16 14:17:16 +0200 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2021-08-17 11:20:55 +0900 |
commit | 034055ffdca28602a40c4d0b5997173e8597af18 (patch) | |
tree | e2c77b11432ee775140880a01127464d6b403e15 /cipher | |
parent | 588b8bb6ef091db299ff2eade295d3119b62283a (diff) | |
download | libgcrypt-034055ffdca28602a40c4d0b5997173e8597af18.tar.gz |
rsa: Do not allow 1024 RSA keys in FIPS mode
Previously, the condition was in generate_std, which is never called in
FIPS mode.
* cipher/rsa.c (generate_std): Remove dead code as FIPS is using
'generate_fips'
(generate_fips): Do not allow 1024 bit key generation
--
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Diffstat (limited to 'cipher')
-rw-r--r-- | cipher/rsa.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/cipher/rsa.c b/cipher/rsa.c index d97746a2..cdb355fa 100644 --- a/cipher/rsa.c +++ b/cipher/rsa.c @@ -220,14 +220,6 @@ generate_std (RSA_secret_key *sk, unsigned int nbits, unsigned long use_e, gcry_mpi_t f; gcry_random_level_t random_level; - if (fips_mode ()) - { - if (nbits < 1024) - return GPG_ERR_INV_VALUE; - if (transient_key) - return GPG_ERR_INV_VALUE; - } - /* The random quality depends on the transient_key flag. */ random_level = transient_key ? GCRY_STRONG_RANDOM : GCRY_VERY_STRONG_RANDOM; @@ -387,7 +379,7 @@ generate_fips (RSA_secret_key *sk, unsigned int nbits, unsigned long use_e, int pqswitch; gpg_err_code_t ec = GPG_ERR_NO_PRIME; - if (nbits < 1024 || (nbits & 0x1FF)) + if (nbits <= 1024 || (nbits & 0x1FF)) return GPG_ERR_INV_VALUE; if (_gcry_enforced_fips_mode() && nbits != 2048 && nbits != 3072) return GPG_ERR_INV_VALUE; |