Skip to content

Commit 7050dda

Browse files
Remove the unused pre_a_lam allocations.
1 parent c6523ff commit 7050dda

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/ecmult_impl.h

+3-7
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868

6969
/* The number of objects allocated on the scratch space for ecmult_multi algorithms */
7070
#define PIPPENGER_SCRATCH_OBJECTS 6
71-
#define STRAUSS_SCRATCH_OBJECTS 6
71+
#define STRAUSS_SCRATCH_OBJECTS 5
7272

7373
#define PIPPENGER_MAX_BUCKET_WINDOW 12
7474

@@ -454,7 +454,6 @@ struct secp256k1_strauss_state {
454454
/* aux is used to hold z-ratios, and then used to hold pre_a[i].x * BETA values. */
455455
secp256k1_fe* aux;
456456
secp256k1_ge* pre_a;
457-
secp256k1_ge* pre_a_lam;
458457
struct secp256k1_strauss_point_state* ps;
459458
};
460459

@@ -582,18 +581,16 @@ static void secp256k1_ecmult(const secp256k1_ecmult_context *ctx, secp256k1_gej
582581
secp256k1_fe aux[ECMULT_TABLE_SIZE(WINDOW_A)];
583582
secp256k1_ge pre_a[ECMULT_TABLE_SIZE(WINDOW_A)];
584583
struct secp256k1_strauss_point_state ps[1];
585-
secp256k1_ge pre_a_lam[ECMULT_TABLE_SIZE(WINDOW_A)];
586584
struct secp256k1_strauss_state state;
587585

588586
state.aux = aux;
589587
state.pre_a = pre_a;
590-
state.pre_a_lam = pre_a_lam;
591588
state.ps = ps;
592589
secp256k1_ecmult_strauss_wnaf(ctx, &state, r, 1, a, na, ng);
593590
}
594591

595592
static size_t secp256k1_strauss_scratch_size(size_t n_points) {
596-
static const size_t point_size = (2 * sizeof(secp256k1_ge) + sizeof(secp256k1_fe)) * ECMULT_TABLE_SIZE(WINDOW_A) + sizeof(struct secp256k1_strauss_point_state) + sizeof(secp256k1_gej) + sizeof(secp256k1_scalar);
593+
static const size_t point_size = (sizeof(secp256k1_ge) + sizeof(secp256k1_fe)) * ECMULT_TABLE_SIZE(WINDOW_A) + sizeof(struct secp256k1_strauss_point_state) + sizeof(secp256k1_gej) + sizeof(secp256k1_scalar);
597594
return n_points*point_size;
598595
}
599596

@@ -613,10 +610,9 @@ static int secp256k1_ecmult_strauss_batch(const secp256k1_callback* error_callba
613610
scalars = (secp256k1_scalar*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(secp256k1_scalar));
614611
state.aux = (secp256k1_fe*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_fe));
615612
state.pre_a = (secp256k1_ge*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_ge));
616-
state.pre_a_lam = (secp256k1_ge*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_ge));
617613
state.ps = (struct secp256k1_strauss_point_state*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(struct secp256k1_strauss_point_state));
618614

619-
if (points == NULL || scalars == NULL || state.aux == NULL || state.pre_a == NULL || state.pre_a_lam == NULL || state.ps == NULL) {
615+
if (points == NULL || scalars == NULL || state.aux == NULL || state.pre_a == NULL || state.ps == NULL) {
620616
secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
621617
return 0;
622618
}

0 commit comments

Comments
 (0)