aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJack Lloyd <jack@randombit.net>2019-05-20 15:22:07 -0400
committerJack Lloyd <jack@randombit.net>2019-05-20 15:26:37 -0400
commit81ea951957a133fcb7c8a6645312edf7904b26e9 (patch)
tree70e33c878cdd59d9af8ad79f6d5067dbd4c42a50 /src/lib
parentd3de77765b2f3e871a5686d7b6b338865c904254 (diff)
Don't artificially limit very small RSA keys.
Keys smaller than 384 bits are trivially breakable, but that's true for 512 as well so no reason to draw the line there. Just do 5 bits since the smallest legal RSA key is 3*5 and that handles the integer overflow warning from Coverity which was the original reason for it. GH #1953
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/pubkey/rsa/rsa.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/pubkey/rsa/rsa.cpp b/src/lib/pubkey/rsa/rsa.cpp
index 0cd8bbdf4..9bb03dff8 100644
--- a/src/lib/pubkey/rsa/rsa.cpp
+++ b/src/lib/pubkey/rsa/rsa.cpp
@@ -397,7 +397,12 @@ class RSA_Public_Operation
size_t get_max_input_bits() const
{
const size_t n_bits = m_n.bits();
- BOTAN_ASSERT_NOMSG(n_bits >= 384);
+ /*
+ Make Coverity happy that n_bits - 1 won't underflow
+
+ 5 bit minimum: smallest possible RSA key is 3*5
+ */
+ BOTAN_ASSERT_NOMSG(n_bits >= 5);
return n_bits - 1;
}