summaryrefslogtreecommitdiffstats
path: root/crypto/openssh/rsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/openssh/rsa.c')
-rw-r--r--crypto/openssh/rsa.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/crypto/openssh/rsa.c b/crypto/openssh/rsa.c
index 5cab804..6f9c7cd 100644
--- a/crypto/openssh/rsa.c
+++ b/crypto/openssh/rsa.c
@@ -31,6 +31,8 @@
* below:
*
* [gone - had to be deleted - what a pity]
+ *
+ * $FreeBSD$
*
*/
@@ -125,7 +127,10 @@ rsa_public_encrypt(BIGNUM *out, BIGNUM *in, RSA *key)
if ((len = RSA_public_encrypt(ilen, inbuf, outbuf, key,
RSA_PKCS1_PADDING)) <= 0)
- fatal("rsa_public_encrypt() failed");
+ if (BN_num_bits(key->n) > 1024 && RSA_libversion() == RSALIB_RSAREF)
+ fatal("rsa_private_encrypt() failed: RSAREF cannot handle keys larger than 1024 bits.");
+ else
+ fatal("rsa_private_encrypt() failed.");
BN_bin2bn(outbuf, len, out);
@@ -150,7 +155,10 @@ rsa_private_decrypt(BIGNUM *out, BIGNUM *in, RSA *key)
if ((len = RSA_private_decrypt(ilen, inbuf, outbuf, key,
RSA_PKCS1_PADDING)) <= 0)
- fatal("rsa_private_decrypt() failed");
+ if (BN_num_bits(key->n) > 1024 && RSA_libversion() == RSALIB_RSAREF)
+ fatal("rsa_private_decrypt() failed: RSAREF cannot handle keys larger than 1024 bits.");
+ else
+ fatal("rsa_private_decrypt() failed.");
BN_bin2bn(outbuf, len, out);
OpenPOWER on IntegriCloud