47
47
48
48
/* The number of objects allocated on the scratch space for ecmult_multi algorithms */
49
49
#define PIPPENGER_SCRATCH_OBJECTS 6
50
- #define STRAUSS_SCRATCH_OBJECTS 6
50
+ #define STRAUSS_SCRATCH_OBJECTS 5
51
51
52
52
#define PIPPENGER_MAX_BUCKET_WINDOW 12
53
53
@@ -228,7 +228,6 @@ struct secp256k1_strauss_state {
228
228
/* aux is used to hold z-ratios, and then used to hold pre_a[i].x * BETA values. */
229
229
secp256k1_fe * aux ;
230
230
secp256k1_ge * pre_a ;
231
- secp256k1_ge * pre_a_lam ;
232
231
struct secp256k1_strauss_point_state * ps ;
233
232
};
234
233
@@ -356,18 +355,16 @@ static void secp256k1_ecmult(secp256k1_gej *r, const secp256k1_gej *a, const sec
356
355
secp256k1_fe aux [ECMULT_TABLE_SIZE (WINDOW_A )];
357
356
secp256k1_ge pre_a [ECMULT_TABLE_SIZE (WINDOW_A )];
358
357
struct secp256k1_strauss_point_state ps [1 ];
359
- secp256k1_ge pre_a_lam [ECMULT_TABLE_SIZE (WINDOW_A )];
360
358
struct secp256k1_strauss_state state ;
361
359
362
360
state .aux = aux ;
363
361
state .pre_a = pre_a ;
364
- state .pre_a_lam = pre_a_lam ;
365
362
state .ps = ps ;
366
363
secp256k1_ecmult_strauss_wnaf (& state , r , 1 , a , na , ng );
367
364
}
368
365
369
366
static size_t secp256k1_strauss_scratch_size (size_t n_points ) {
370
- 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 );
367
+ 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 );
371
368
return n_points * point_size ;
372
369
}
373
370
@@ -387,10 +384,9 @@ static int secp256k1_ecmult_strauss_batch(const secp256k1_callback* error_callba
387
384
scalars = (secp256k1_scalar * )secp256k1_scratch_alloc (error_callback , scratch , n_points * sizeof (secp256k1_scalar ));
388
385
state .aux = (secp256k1_fe * )secp256k1_scratch_alloc (error_callback , scratch , n_points * ECMULT_TABLE_SIZE (WINDOW_A ) * sizeof (secp256k1_fe ));
389
386
state .pre_a = (secp256k1_ge * )secp256k1_scratch_alloc (error_callback , scratch , n_points * ECMULT_TABLE_SIZE (WINDOW_A ) * sizeof (secp256k1_ge ));
390
- state .pre_a_lam = (secp256k1_ge * )secp256k1_scratch_alloc (error_callback , scratch , n_points * ECMULT_TABLE_SIZE (WINDOW_A ) * sizeof (secp256k1_ge ));
391
387
state .ps = (struct secp256k1_strauss_point_state * )secp256k1_scratch_alloc (error_callback , scratch , n_points * sizeof (struct secp256k1_strauss_point_state ));
392
388
393
- if (points == NULL || scalars == NULL || state .aux == NULL || state .pre_a == NULL || state .pre_a_lam == NULL || state . ps == NULL ) {
389
+ if (points == NULL || scalars == NULL || state .aux == NULL || state .pre_a == NULL || state .ps == NULL ) {
394
390
secp256k1_scratch_apply_checkpoint (error_callback , scratch , scratch_checkpoint );
395
391
return 0 ;
396
392
}
0 commit comments