summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>1999-10-16 23:20:26 +0000
committerNiels Provos <provos@cvs.openbsd.org>1999-10-16 23:20:26 +0000
commit4ef15f944825eb77e5eb0f2672ab0f999e4462d4 (patch)
tree6b975ee9b717d5ee12f3cd1892f5b5e685c70529
parent34200164498c3a0013ddea8c44a3867586dd942c (diff)
dont encrypt with public exponent < 3.
-rw-r--r--usr.bin/ssh/rsa.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/ssh/rsa.c b/usr.bin/ssh/rsa.c
index ac219a5b4e3..246e75a174e 100644
--- a/usr.bin/ssh/rsa.c
+++ b/usr.bin/ssh/rsa.c
@@ -35,7 +35,7 @@ Description of the RSA algorithm can be found e.g. from the following sources:
*/
#include "includes.h"
-RCSID("$Id: rsa.c,v 1.3 1999/09/29 18:16:20 dugsong Exp $");
+RCSID("$Id: rsa.c,v 1.4 1999/10/16 23:20:25 provos Exp $");
#include "rsa.h"
#include "ssh.h"
@@ -112,6 +112,9 @@ rsa_public_encrypt(BIGNUM *out, BIGNUM *in, RSA* key)
char *inbuf, *outbuf;
int len;
+ if (BN_num_bits(key->e) < 2)
+ fatal("rsa_public_encrypt() exponent too small");
+
len = BN_num_bytes(key->n);
outbuf = xmalloc(len);