|
@@ -19,7 +19,7 @@
|
|
/**
|
|
/**
|
|
@file ltc_ecc_mulmod_timing.c
|
|
@file ltc_ecc_mulmod_timing.c
|
|
ECC Crypto, Tom St Denis
|
|
ECC Crypto, Tom St Denis
|
|
-*/
|
|
|
|
|
|
+*/
|
|
|
|
|
|
#ifdef LTC_MECC
|
|
#ifdef LTC_MECC
|
|
|
|
|
|
@@ -40,7 +40,7 @@ int ltc_ecc_mulmod(void *k, ecc_point *G, ecc_point *R, void *modulus, int map)
|
|
int i, j, err;
|
|
int i, j, err;
|
|
void *mu, *mp;
|
|
void *mu, *mp;
|
|
unsigned long buf;
|
|
unsigned long buf;
|
|
- int first, bitbuf, bitcpy, bitcnt, mode, digidx;
|
|
|
|
|
|
+ int bitcnt, mode, digidx;
|
|
|
|
|
|
LTC_ARGCHK(k != NULL);
|
|
LTC_ARGCHK(k != NULL);
|
|
LTC_ARGCHK(G != NULL);
|
|
LTC_ARGCHK(G != NULL);
|
|
@@ -84,7 +84,7 @@ int ltc_ecc_mulmod(void *k, ecc_point *G, ecc_point *R, void *modulus, int map)
|
|
if ((err = mp_mulmod(G->z, mu, modulus, tG->z)) != CRYPT_OK) { goto done; }
|
|
if ((err = mp_mulmod(G->z, mu, modulus, tG->z)) != CRYPT_OK) { goto done; }
|
|
mp_clear(mu);
|
|
mp_clear(mu);
|
|
mu = NULL;
|
|
mu = NULL;
|
|
-
|
|
|
|
|
|
+
|
|
/* calc the M tab */
|
|
/* calc the M tab */
|
|
/* M[0] == G */
|
|
/* M[0] == G */
|
|
if ((err = mp_copy(tG->x, M[0]->x)) != CRYPT_OK) { goto done; }
|
|
if ((err = mp_copy(tG->x, M[0]->x)) != CRYPT_OK) { goto done; }
|
|
@@ -98,8 +98,6 @@ int ltc_ecc_mulmod(void *k, ecc_point *G, ecc_point *R, void *modulus, int map)
|
|
bitcnt = 1;
|
|
bitcnt = 1;
|
|
buf = 0;
|
|
buf = 0;
|
|
digidx = mp_get_digit_count(k) - 1;
|
|
digidx = mp_get_digit_count(k) - 1;
|
|
- bitcpy = bitbuf = 0;
|
|
|
|
- first = 1;
|
|
|
|
|
|
|
|
/* perform ops */
|
|
/* perform ops */
|
|
for (;;) {
|
|
for (;;) {
|