Tiny bug in bn_power_2() - didn't work with powers that were a
[sgt/putty] / sshbn.c
diff --git a/sshbn.c b/sshbn.c
index 3a5ddc0..1bd3f43 100644 (file)
--- a/sshbn.c
+++ b/sshbn.c
@@ -68,7 +68,7 @@ void freebn(Bignum b) {
 }
 
 Bignum bn_power_2(int n) {
-    Bignum ret = newbn((n+15)/16);
+    Bignum ret = newbn(n/16+1);
     bignum_set_bit(ret, n, 1);
     return ret;
 }