From f9ca6e850165600356636f6c853cbd9942a690dd Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 28 Jun 2003 14:10:06 +0000 Subject: [PATCH] bignum_mod_short shouldn't be depending on a fixed place value in the bignum data! This wasn't actually causing puttygen-zero-div (its unwarranted assumption was still correct under Windows) but it would have caused the same symptoms under Unix when I got round to porting PuTTYgen. [originally from svn r3315] --- sshbn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sshbn.c b/sshbn.c index 37422271..2d8359e3 100644 --- a/sshbn.c +++ b/sshbn.c @@ -814,7 +814,7 @@ unsigned short bignum_mod_short(Bignum number, unsigned short modulus) r = 0; mod = modulus; for (i = number[0]; i > 0; i--) - r = (r * 65536 + number[i]) % mod; + r = (r * (BIGNUM_TOP_BIT % mod) * 2 + number[i] % mod) % mod; return (unsigned short) r; }