Remove the unused prej allocations.
This commit is contained in:
parent
e5c18892db
commit
ae7ba0f922
@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
/* The number of objects allocated on the scratch space for ecmult_multi algorithms */
|
/* The number of objects allocated on the scratch space for ecmult_multi algorithms */
|
||||||
#define PIPPENGER_SCRATCH_OBJECTS 6
|
#define PIPPENGER_SCRATCH_OBJECTS 6
|
||||||
#define STRAUSS_SCRATCH_OBJECTS 7
|
#define STRAUSS_SCRATCH_OBJECTS 6
|
||||||
|
|
||||||
#define PIPPENGER_MAX_BUCKET_WINDOW 12
|
#define PIPPENGER_MAX_BUCKET_WINDOW 12
|
||||||
|
|
||||||
@ -209,7 +209,6 @@ struct secp256k1_strauss_point_state {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct secp256k1_strauss_state {
|
struct secp256k1_strauss_state {
|
||||||
secp256k1_gej* prej;
|
|
||||||
secp256k1_fe* zr;
|
secp256k1_fe* zr;
|
||||||
secp256k1_ge* pre_a;
|
secp256k1_ge* pre_a;
|
||||||
secp256k1_ge* pre_a_lam;
|
secp256k1_ge* pre_a_lam;
|
||||||
@ -332,14 +331,12 @@ static void secp256k1_ecmult_strauss_wnaf(const struct secp256k1_strauss_state *
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void secp256k1_ecmult(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng) {
|
static void secp256k1_ecmult(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng) {
|
||||||
secp256k1_gej prej[ECMULT_TABLE_SIZE(WINDOW_A)];
|
|
||||||
secp256k1_fe zr[ECMULT_TABLE_SIZE(WINDOW_A)];
|
secp256k1_fe zr[ECMULT_TABLE_SIZE(WINDOW_A)];
|
||||||
secp256k1_ge pre_a[ECMULT_TABLE_SIZE(WINDOW_A)];
|
secp256k1_ge pre_a[ECMULT_TABLE_SIZE(WINDOW_A)];
|
||||||
struct secp256k1_strauss_point_state ps[1];
|
struct secp256k1_strauss_point_state ps[1];
|
||||||
secp256k1_ge pre_a_lam[ECMULT_TABLE_SIZE(WINDOW_A)];
|
secp256k1_ge pre_a_lam[ECMULT_TABLE_SIZE(WINDOW_A)];
|
||||||
struct secp256k1_strauss_state state;
|
struct secp256k1_strauss_state state;
|
||||||
|
|
||||||
state.prej = prej;
|
|
||||||
state.zr = zr;
|
state.zr = zr;
|
||||||
state.pre_a = pre_a;
|
state.pre_a = pre_a;
|
||||||
state.pre_a_lam = pre_a_lam;
|
state.pre_a_lam = pre_a_lam;
|
||||||
@ -348,7 +345,7 @@ static void secp256k1_ecmult(secp256k1_gej *r, const secp256k1_gej *a, const sec
|
|||||||
}
|
}
|
||||||
|
|
||||||
static size_t secp256k1_strauss_scratch_size(size_t n_points) {
|
static size_t secp256k1_strauss_scratch_size(size_t n_points) {
|
||||||
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);
|
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);
|
||||||
return n_points*point_size;
|
return n_points*point_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,13 +366,12 @@ static int secp256k1_ecmult_strauss_batch(const secp256k1_callback* error_callba
|
|||||||
* constant and strauss_scratch_size accordingly. */
|
* constant and strauss_scratch_size accordingly. */
|
||||||
points = (secp256k1_gej*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(secp256k1_gej));
|
points = (secp256k1_gej*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(secp256k1_gej));
|
||||||
scalars = (secp256k1_scalar*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(secp256k1_scalar));
|
scalars = (secp256k1_scalar*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(secp256k1_scalar));
|
||||||
state.prej = (secp256k1_gej*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_gej));
|
|
||||||
state.zr = (secp256k1_fe*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_fe));
|
state.zr = (secp256k1_fe*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_fe));
|
||||||
state.pre_a = (secp256k1_ge*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_ge));
|
state.pre_a = (secp256k1_ge*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_ge));
|
||||||
state.pre_a_lam = (secp256k1_ge*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_ge));
|
state.pre_a_lam = (secp256k1_ge*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_ge));
|
||||||
state.ps = (struct secp256k1_strauss_point_state*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(struct secp256k1_strauss_point_state));
|
state.ps = (struct secp256k1_strauss_point_state*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(struct secp256k1_strauss_point_state));
|
||||||
|
|
||||||
if (points == NULL || scalars == NULL || state.prej == NULL || state.zr == NULL || state.pre_a == NULL || state.pre_a_lam == NULL || state.ps == NULL) {
|
if (points == NULL || scalars == NULL || state.zr == NULL || state.pre_a == NULL || state.pre_a_lam == NULL || state.ps == NULL) {
|
||||||
secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
|
secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user