From: bg Date: Thu, 24 Feb 2011 01:13:25 +0000 (+0100) Subject: bigint looks good but needs more testing X-Git-Url: https://git.cryptolib.org/?a=commitdiff_plain;h=8fa939d627fb6230610a38e6468cbc55d006216d;p=arm-crypto-lib.git bigint looks good but needs more testing --- diff --git a/bigint/bigint.c b/bigint/bigint.c index d7ee059..c133faa 100644 --- a/bigint/bigint.c +++ b/bigint/bigint.c @@ -675,9 +675,9 @@ void bigint_expmod_u(bigint_t* dest, const bigint_t* a, const bigint_t* exp, con } bigint_t res, base; - bigint_word_t base_b[MAX(a->length_B,r->length_B*2)], res_b[r->length_B*2]; + bigint_word_t t, base_b[MAX(a->length_B,r->length_B*2)], res_b[r->length_B*2]; uint16_t i; - uint8_t j, t; + uint8_t j; res.wordv = res_b; base.wordv = base_b; bigint_copy(&base, a); @@ -688,7 +688,7 @@ void bigint_expmod_u(bigint_t* dest, const bigint_t* a, const bigint_t* exp, con bigint_adjust(&res); for(i=0; i+1length_B; ++i){ t=exp->wordv[i]; - for(j=0; j<8; ++j){ + for(j=0; jlength_B-i; y_.length_B = y->length_B-i; - memcpy(x_.wordv, x->wordv+i, x_.length_B); - memcpy(y_.wordv, y->wordv+i, y_.length_B); + memcpy(x_.wordv, x->wordv+i, x_.length_B*sizeof(bigint_word_t)); + memcpy(y_.wordv, y->wordv+i, y_.length_B*sizeof(bigint_word_t)); for(i=0; (x_.wordv[0]&(1<