Eliminate na_1 and na_lam state fields from ecmult_strauss_wnaf.
This commit is contained in:
parent
7ba3ffcca0
commit
0397d00ba0
|
@ -210,7 +210,6 @@ static int secp256k1_ecmult_wnaf(int *wnaf, int len, const secp256k1_scalar *a,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct secp256k1_strauss_point_state {
|
struct secp256k1_strauss_point_state {
|
||||||
secp256k1_scalar na_1, na_lam;
|
|
||||||
int wnaf_na_1[129];
|
int wnaf_na_1[129];
|
||||||
int wnaf_na_lam[129];
|
int wnaf_na_lam[129];
|
||||||
int bits_na_1;
|
int bits_na_1;
|
||||||
|
@ -240,16 +239,17 @@ static void secp256k1_ecmult_strauss_wnaf(const struct secp256k1_strauss_state *
|
||||||
size_t no = 0;
|
size_t no = 0;
|
||||||
|
|
||||||
for (np = 0; np < num; ++np) {
|
for (np = 0; np < num; ++np) {
|
||||||
|
secp256k1_scalar na_1, na_lam;
|
||||||
if (secp256k1_scalar_is_zero(&na[np]) || secp256k1_gej_is_infinity(&a[np])) {
|
if (secp256k1_scalar_is_zero(&na[np]) || secp256k1_gej_is_infinity(&a[np])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
state->ps[no].input_pos = np;
|
state->ps[no].input_pos = np;
|
||||||
/* split na into na_1 and na_lam (where na = na_1 + na_lam*lambda, and na_1 and na_lam are ~128 bit) */
|
/* split na into na_1 and na_lam (where na = na_1 + na_lam*lambda, and na_1 and na_lam are ~128 bit) */
|
||||||
secp256k1_scalar_split_lambda(&state->ps[no].na_1, &state->ps[no].na_lam, &na[np]);
|
secp256k1_scalar_split_lambda(&na_1, &na_lam, &na[np]);
|
||||||
|
|
||||||
/* build wnaf representation for na_1 and na_lam. */
|
/* build wnaf representation for na_1 and na_lam. */
|
||||||
state->ps[no].bits_na_1 = secp256k1_ecmult_wnaf(state->ps[no].wnaf_na_1, 129, &state->ps[no].na_1, WINDOW_A);
|
state->ps[no].bits_na_1 = secp256k1_ecmult_wnaf(state->ps[no].wnaf_na_1, 129, &na_1, WINDOW_A);
|
||||||
state->ps[no].bits_na_lam = secp256k1_ecmult_wnaf(state->ps[no].wnaf_na_lam, 129, &state->ps[no].na_lam, WINDOW_A);
|
state->ps[no].bits_na_lam = secp256k1_ecmult_wnaf(state->ps[no].wnaf_na_lam, 129, &na_lam, WINDOW_A);
|
||||||
VERIFY_CHECK(state->ps[no].bits_na_1 <= 129);
|
VERIFY_CHECK(state->ps[no].bits_na_1 <= 129);
|
||||||
VERIFY_CHECK(state->ps[no].bits_na_lam <= 129);
|
VERIFY_CHECK(state->ps[no].bits_na_lam <= 129);
|
||||||
if (state->ps[no].bits_na_1 > bits) {
|
if (state->ps[no].bits_na_1 > bits) {
|
||||||
|
|
Loading…
Reference in New Issue