The bignum code has two representations of zero, since
[u/mdw/putty] / sshbn.c
diff --git a/sshbn.c b/sshbn.c
index cbd710d..1c5c46a 100644 (file)
--- a/sshbn.c
+++ b/sshbn.c
@@ -1322,6 +1322,12 @@ int bignum_cmp(Bignum a, Bignum b)
     int amax = a[0], bmax = b[0];
     int i;
 
+    /* Annoyingly we have two representations of zero */
+    if (amax == 1 && a[amax] == 0)
+        amax = 0;
+    if (bmax == 1 && b[bmax] == 0)
+        bmax = 0;
+
     assert(amax == 0 || a[amax] != 0);
     assert(bmax == 0 || b[bmax] != 0);