summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorprovos <provos@openbsd.org>1999-10-16 23:20:25 +0000
committerprovos <provos@openbsd.org>1999-10-16 23:20:25 +0000
commit8f1e804249a1a18e97c886129c777c788e5cbf01 (patch)
treebd545cbfa7d1ab44730ea9e32e6d281105436252
parentrefuse to talk to protocol < 1.3 (diff)
downloadwireguard-openbsd-8f1e804249a1a18e97c886129c777c788e5cbf01.tar.xz
wireguard-openbsd-8f1e804249a1a18e97c886129c777c788e5cbf01.zip
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);