From: simon Date: Sat, 3 Mar 2001 11:53:07 +0000 (+0000) Subject: More options for bignum debugging X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/98ba26b92452911f8f6b9cfccd134a4836218904 More options for bignum debugging git-svn-id: svn://svn.tartarus.org/sgt/putty@972 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/sshbn.c b/sshbn.c index 587fc8f3..3a5ddc03 100644 --- a/sshbn.c +++ b/sshbn.c @@ -6,6 +6,14 @@ #include #include +#if 0 // use PuTTY main debugging for diagbn() +#include +#include "putty.h" +#define debugprint debug +#else +#define debugprint(x) printf x +#endif + #define BIGNUM_INTERNAL typedef unsigned short *Bignum; @@ -714,15 +722,15 @@ void diagbn(char *prefix, Bignum md) { int i, nibbles, morenibbles; static const char hex[] = "0123456789ABCDEF"; - printf("%s0x", prefix ? prefix : ""); + debugprint(("%s0x", prefix ? prefix : "")); nibbles = (3 + ssh1_bignum_bitcount(md))/4; if (nibbles<1) nibbles=1; morenibbles = 4*md[0] - nibbles; - for (i=0; i> (4*(i%2))) & 0xF]); + debugprint(("%c",hex[(bignum_byte(md, i/2) >> (4*(i%2))) & 0xF])); - if (prefix) putchar('\n'); + if (prefix) debugprint(("\n")); } /*