Skip to content

Commit 7ba3ffc

Browse files
Remove the unused pre_a_lam allocations.
1 parent b3b57ad commit 7ba3ffc

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/ecmult_impl.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
/* The number of objects allocated on the scratch space for ecmult_multi algorithms */
4949
#define PIPPENGER_SCRATCH_OBJECTS 6
50-
#define STRAUSS_SCRATCH_OBJECTS 6
50+
#define STRAUSS_SCRATCH_OBJECTS 5
5151

5252
#define PIPPENGER_MAX_BUCKET_WINDOW 12
5353

@@ -222,7 +222,6 @@ struct secp256k1_strauss_state {
222222
/* aux is used to hold z-ratios, and then used to hold pre_a[i].x * BETA values. */
223223
secp256k1_fe* aux;
224224
secp256k1_ge* pre_a;
225-
secp256k1_ge* pre_a_lam;
226225
struct secp256k1_strauss_point_state* ps;
227226
};
228227

@@ -345,18 +344,16 @@ static void secp256k1_ecmult(secp256k1_gej *r, const secp256k1_gej *a, const sec
345344
secp256k1_fe aux[ECMULT_TABLE_SIZE(WINDOW_A)];
346345
secp256k1_ge pre_a[ECMULT_TABLE_SIZE(WINDOW_A)];
347346
struct secp256k1_strauss_point_state ps[1];
348-
secp256k1_ge pre_a_lam[ECMULT_TABLE_SIZE(WINDOW_A)];
349347
struct secp256k1_strauss_state state;
350348

351349
state.aux = aux;
352350
state.pre_a = pre_a;
353-
state.pre_a_lam = pre_a_lam;
354351
state.ps = ps;
355352
secp256k1_ecmult_strauss_wnaf(&state, r, 1, a, na, ng);
356353
}
357354

358355
static size_t secp256k1_strauss_scratch_size(size_t n_points) {
359-
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);
356+
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);
360357
return n_points*point_size;
361358
}
362359

@@ -379,10 +376,9 @@ static int secp256k1_ecmult_strauss_batch(const secp256k1_callback* error_callba
379376
scalars = (secp256k1_scalar*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(secp256k1_scalar));
380377
state.aux = (secp256k1_fe*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_fe));
381378
state.pre_a = (secp256k1_ge*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_ge));
382-
state.pre_a_lam = (secp256k1_ge*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_ge));
383379
state.ps = (struct secp256k1_strauss_point_state*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(struct secp256k1_strauss_point_state));
384380

385-
if (points == NULL || scalars == NULL || state.aux == NULL || state.pre_a == NULL || state.pre_a_lam == NULL || state.ps == NULL) {
381+
if (points == NULL || scalars == NULL || state.aux == NULL || state.pre_a == NULL || state.ps == NULL) {
386382
secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
387383
return 0;
388384
}

0 commit comments

Comments
 (0)