/*
* Burn the evidence, just in case.
*/
- memset(b, 0, sizeof(b[0]) * (b[0] + 1));
+ smemclr(b, sizeof(b[0]) * (b[0] + 1));
sfree(b);
}
int toplen = len/2, botlen = len - toplen; /* botlen is the bigger */
int midlen = botlen + 1;
BignumDblInt carry;
-#ifdef KARA_DEBUG
- int i;
-#endif
/*
* The coefficients a_1 b_1 and a_0 b_0 just avoid overlapping
pqlen = (p[0] > q[0] ? p[0] : q[0]);
+ /* Make sure that we're allowing enough space. The shifting below will
+ * underflow the vectors we allocate if `pqlen' is too small.
+ */
+ if (2*pqlen <= mlen)
+ pqlen = mlen/2 + 1;
+
/* Allocate n of size pqlen, copy p to n */
n = snewn(pqlen, BignumInt);
i = pqlen - p[0];
#include <ctype.h>
/*
- * gcc -g -O0 -DTESTBN -o testbn sshbn.c misc.c -I unix -I charset
+ * gcc -Wall -g -O0 -DTESTBN -o testbn sshbn.c misc.c conf.c tree234.c unix/uxmisc.c -I. -I unix -I charset
*
* Then feed to this program's standard input the output of
* testdata/bignum.py .
Bignum a, b, c, p;
if (ptrnum != 3) {
- printf("%d: mul with %d parameters, expected 3\n", line);
+ printf("%d: mul with %d parameters, expected 3\n", line, ptrnum);
exit(1);
}
a = bignum_from_bytes(ptrs[0], ptrs[1]-ptrs[0]);
Bignum base, expt, modulus, expected, answer;
if (ptrnum != 4) {
- printf("%d: mul with %d parameters, expected 3\n", line);
+ printf("%d: mul with %d parameters, expected 4\n", line, ptrnum);
exit(1);
}