Skip to content

Commit ae7ba0f

Browse files
Remove the unused prej allocations.
1 parent e5c1889 commit ae7ba0f

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
@@ -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 7
50+
#define STRAUSS_SCRATCH_OBJECTS 6
5151

5252
#define PIPPENGER_MAX_BUCKET_WINDOW 12
5353

@@ -209,7 +209,6 @@ struct secp256k1_strauss_point_state {
209209
};
210210

211211
struct secp256k1_strauss_state {
212-
secp256k1_gej* prej;
213212
secp256k1_fe* zr;
214213
secp256k1_ge* pre_a;
215214
secp256k1_ge* pre_a_lam;
@@ -332,14 +331,12 @@ static void secp256k1_ecmult_strauss_wnaf(const struct secp256k1_strauss_state *
332331
}
333332

334333
static void secp256k1_ecmult(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng) {
335-
secp256k1_gej prej[ECMULT_TABLE_SIZE(WINDOW_A)];
336334
secp256k1_fe zr[ECMULT_TABLE_SIZE(WINDOW_A)];
337335
secp256k1_ge pre_a[ECMULT_TABLE_SIZE(WINDOW_A)];
338336
struct secp256k1_strauss_point_state ps[1];
339337
secp256k1_ge pre_a_lam[ECMULT_TABLE_SIZE(WINDOW_A)];
340338
struct secp256k1_strauss_state state;
341339

342-
state.prej = prej;
343340
state.zr = zr;
344341
state.pre_a = pre_a;
345342
state.pre_a_lam = pre_a_lam;
@@ -348,7 +345,7 @@ static void secp256k1_ecmult(secp256k1_gej *r, const secp256k1_gej *a, const sec
348345
}
349346

350347
static size_t secp256k1_strauss_scratch_size(size_t n_points) {
351-
static const size_t point_size = (2 * sizeof(secp256k1_ge) + sizeof(secp256k1_gej) + sizeof(secp256k1_fe)) * ECMULT_TABLE_SIZE(WINDOW_A) + sizeof(struct secp256k1_strauss_point_state) + sizeof(secp256k1_gej) + sizeof(secp256k1_scalar);
348+
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);
352349
return n_points*point_size;
353350
}
354351

@@ -369,13 +366,12 @@ static int secp256k1_ecmult_strauss_batch(const secp256k1_callback* error_callba
369366
* constant and strauss_scratch_size accordingly. */
370367
points = (secp256k1_gej*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(secp256k1_gej));
371368
scalars = (secp256k1_scalar*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(secp256k1_scalar));
372-
state.prej = (secp256k1_gej*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_gej));
373369
state.zr = (secp256k1_fe*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_fe));
374370
state.pre_a = (secp256k1_ge*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_ge));
375371
state.pre_a_lam = (secp256k1_ge*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_ge));
376372
state.ps = (struct secp256k1_strauss_point_state*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(struct secp256k1_strauss_point_state));
377373

378-
if (points == NULL || scalars == NULL || state.prej == NULL || state.zr == NULL || state.pre_a == NULL || state.pre_a_lam == NULL || state.ps == NULL) {
374+
if (points == NULL || scalars == NULL || state.zr == NULL || state.pre_a == NULL || state.pre_a_lam == NULL || state.ps == NULL) {
379375
secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
380376
return 0;
381377
}

0 commit comments

Comments
 (0)