address peer review: make C89-compatible refactors in sakke_pairing() and sakke_modexp_loop(); add explanatory comment for WOLF_ENUM_DUMMY_LAST_ELEMENT() in types.h.
This commit is contained in:
parent
ac85cfa3d5
commit
1bed740710
@ -2228,19 +2228,13 @@ static int sakke_pairing(SakkeKey* key, ecc_point* p, ecc_point* q, mp_int* r,
|
||||
mp_proj* t2 = key->tmp.p3;
|
||||
mp_int* t3 = &key->tmp.m2;
|
||||
mp_int* prime = &key->params.prime;
|
||||
mp_int* t[]
|
||||
#ifndef WOLF_C89
|
||||
= { &key->tmp.m1, t3 }
|
||||
#endif
|
||||
;
|
||||
mp_int* t[2];
|
||||
int i;
|
||||
mp_digit mp = 0;
|
||||
SakkeKeyParams* params = &key->params;
|
||||
|
||||
#ifdef WOLF_C89
|
||||
t[0] = &key->tmp.m1;
|
||||
t[1] = t3;
|
||||
#endif
|
||||
|
||||
(void)table;
|
||||
(void)len;
|
||||
@ -2584,25 +2578,16 @@ static int sakke_modexp_loop(SakkeKey* key, mp_int* b, mp_int* e, mp_proj* r,
|
||||
{
|
||||
int err;
|
||||
#ifdef WC_NO_CACHE_RESISTANT
|
||||
mp_proj* c[2]
|
||||
#ifndef WOLF_C89
|
||||
= { r, key->tmp.p2 }
|
||||
#endif
|
||||
;
|
||||
mp_proj* c[2];
|
||||
#else
|
||||
mp_proj* c[3]
|
||||
#ifndef WOLF_C89
|
||||
= { r, key->tmp.p3, key->tmp.p2 }
|
||||
mp_proj* c[3];
|
||||
#endif
|
||||
;
|
||||
#endif /* WC_NO_CACHE_RESISTANT */
|
||||
mp_int* t1 = &key->tmp.m1;
|
||||
mp_int* t2 = &key->tmp.m2;
|
||||
mp_int* by = key->tmp.p1->z;
|
||||
mp_int* prime = &key->params.prime;
|
||||
int i;
|
||||
|
||||
#ifdef WOLF_C89
|
||||
#ifdef WC_NO_CACHE_RESISTANT
|
||||
c[0] = r;
|
||||
c[1] = key->tmp.p2;
|
||||
@ -2610,8 +2595,7 @@ static int sakke_modexp_loop(SakkeKey* key, mp_int* b, mp_int* e, mp_proj* r,
|
||||
c[0] = r;
|
||||
c[1] = key->tmp.p3;
|
||||
c[2] = key->tmp.p2;
|
||||
#endif /* WC_NO_CACHE_RESISTANT */
|
||||
#endif /* WOLF_C89 */
|
||||
#endif
|
||||
|
||||
/* Set the working value to the base in PF_p[q] */
|
||||
err = mp_montgomery_calc_normalization(c[0]->x, prime);
|
||||
|
@ -122,6 +122,12 @@ decouple library dependencies with standard string, memory and so on.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* With a true C89-dialect compiler (simulate with gcc -std=c89 -Wall
|
||||
* -Wextra -pedantic), a trailing comma on the last value in an enum
|
||||
* definition is a syntax error. We use this macro to accommodate that
|
||||
* without disrupting clean flow/syntax when some enum values are
|
||||
* preprocessor-gated.
|
||||
*/
|
||||
#if defined(WOLF_C89) || defined(WOLF_NO_TRAILING_ENUM_COMMAS)
|
||||
#define WOLF_ENUM_DUMMY_LAST_ELEMENT(prefix) _wolf_ ## prefix ## _enum_dummy_last_element
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user