# HG changeset patch # User Matt Johnston # Date 1154878181 0 # Node ID cd14c94fe89cabb47e0ebf5b2140828b75e2a82f # Parent 381834084475ff43e10e8d546882933bd8c585e8 add some more copious debugging diff -r 381834084475 -r cd14c94fe89c dbutil.c --- a/dbutil.c Fri Aug 04 17:37:45 2006 +0000 +++ b/dbutil.c Sun Aug 06 15:29:41 2006 +0000 @@ -482,10 +482,6 @@ int i; - if (!debug_trace) { - return; - } - fprintf(stderr, "%s\n", label); for (i = 0; i < len; i++) { fprintf(stderr, "%02x", buf[i]); @@ -504,10 +500,6 @@ int size; char * buf = NULL; - if (!debug_trace) { - return; - } - fprintf(stderr, "mp_int %s: ", label); ret = mp_radix_size(mp, 10, &size); dropbear_assert(ret == MP_OKAY); diff -r 381834084475 -r cd14c94fe89c libtommath/bn_mp_exptmod.c --- a/libtommath/bn_mp_exptmod.c Fri Aug 04 17:37:45 2006 +0000 +++ b/libtommath/bn_mp_exptmod.c Sun Aug 06 15:29:41 2006 +0000 @@ -1,3 +1,4 @@ +#include "../dbutil.h" #include #ifdef BN_MP_EXPTMOD_C /* LibTomMath, multiple-precision integer library -- Tom St Denis diff -r 381834084475 -r cd14c94fe89c libtommath/bn_mp_exptmod_fast.c --- a/libtommath/bn_mp_exptmod_fast.c Fri Aug 04 17:37:45 2006 +0000 +++ b/libtommath/bn_mp_exptmod_fast.c Sun Aug 06 15:29:41 2006 +0000 @@ -1,3 +1,4 @@ +#include "../dbutil.h" #include #ifdef BN_MP_EXPTMOD_FAST_C /* LibTomMath, multiple-precision integer library -- Tom St Denis @@ -65,6 +66,8 @@ } #endif + dropbear_trace("mp_exptmod_fast x bits %d redmode %d", x, redmode); + /* init M array */ /* init first cell */ if ((err = mp_init(&M[1])) != MP_OKAY) { @@ -210,6 +213,8 @@ bitcnt = (int)DIGIT_BIT; } + dropbear_trace("mp_exptmod_fast digidx %d buf %u", digidx+1, buf); + /* grab the next msb from the exponent */ y = (mp_digit)(buf >> (DIGIT_BIT - 1)) & 1; buf <<= (mp_digit)1; @@ -231,6 +236,7 @@ if ((err = redux (&res, P, mp)) != MP_OKAY) { goto LBL_RES; } + print_mp_int("mp_exptmod_fast bit=0 mode=1 sq", &res); continue; } @@ -263,6 +269,7 @@ bitbuf = 0; mode = 1; } + print_mp_int("mp_exptmod_fast other way", &res); } /* if bits remain then square/multiply */ @@ -289,6 +296,7 @@ } } } + print_mp_int("mp_exptmod_fast remaining bits", &res); if (redmode == 0) { /* fixup result if Montgomery reduction is used @@ -300,6 +308,7 @@ if ((err = redux(&res, P, mp)) != MP_OKAY) { goto LBL_RES; } + print_mp_int("mp_exptmod_fast fixup", &res); } /* swap res with Y */