gmp: Reject public keys with public exponent e < 3

This ensures that we don't load a key with e=1, which basically renders
RSA into a no-op.  Since keys are universally generated with e=65537 and
no reputable CA will sign keys with e=1, allowing this before didn't have
any real world impact.
This commit is contained in:
Tobias Brunner
2026-03-13 09:28:32 +01:00
parent 8fd2c3a3bc
commit 358653d06a
@@ -496,7 +496,7 @@ gmp_rsa_public_key_t *gmp_rsa_public_key_load(key_type_t type, va_list args)
this->k = (mpz_sizeinbase(this->n, 2) + 7) / BITS_PER_BYTE;
if (!mpz_sgn(this->e))
if (!mpz_sgn(this->e) || mpz_cmp_ui(this->e, 3) < 0)
{
destroy(this);
return NULL;