68
68
69
69
/* The number of objects allocated on the scratch space for ecmult_multi algorithms */
70
70
#define PIPPENGER_SCRATCH_OBJECTS 6
71
- #define STRAUSS_SCRATCH_OBJECTS 6
71
+ #define STRAUSS_SCRATCH_OBJECTS 5
72
72
73
73
#define PIPPENGER_MAX_BUCKET_WINDOW 12
74
74
@@ -454,7 +454,6 @@ struct secp256k1_strauss_state {
454
454
/* aux is used to hold z-ratios, and then used to hold pre_a[i].x * BETA values. */
455
455
secp256k1_fe * aux ;
456
456
secp256k1_ge * pre_a ;
457
- secp256k1_ge * pre_a_lam ;
458
457
struct secp256k1_strauss_point_state * ps ;
459
458
};
460
459
@@ -582,18 +581,16 @@ static void secp256k1_ecmult(const secp256k1_ecmult_context *ctx, secp256k1_gej
582
581
secp256k1_fe aux [ECMULT_TABLE_SIZE (WINDOW_A )];
583
582
secp256k1_ge pre_a [ECMULT_TABLE_SIZE (WINDOW_A )];
584
583
struct secp256k1_strauss_point_state ps [1 ];
585
- secp256k1_ge pre_a_lam [ECMULT_TABLE_SIZE (WINDOW_A )];
586
584
struct secp256k1_strauss_state state ;
587
585
588
586
state .aux = aux ;
589
587
state .pre_a = pre_a ;
590
- state .pre_a_lam = pre_a_lam ;
591
588
state .ps = ps ;
592
589
secp256k1_ecmult_strauss_wnaf (ctx , & state , r , 1 , a , na , ng );
593
590
}
594
591
595
592
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 );
597
594
return n_points * point_size ;
598
595
}
599
596
@@ -613,10 +610,9 @@ static int secp256k1_ecmult_strauss_batch(const secp256k1_callback* error_callba
613
610
scalars = (secp256k1_scalar * )secp256k1_scratch_alloc (error_callback , scratch , n_points * sizeof (secp256k1_scalar ));
614
611
state .aux = (secp256k1_fe * )secp256k1_scratch_alloc (error_callback , scratch , n_points * ECMULT_TABLE_SIZE (WINDOW_A ) * sizeof (secp256k1_fe ));
615
612
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 ));
617
613
state .ps = (struct secp256k1_strauss_point_state * )secp256k1_scratch_alloc (error_callback , scratch , n_points * sizeof (struct secp256k1_strauss_point_state ));
618
614
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 ) {
620
616
secp256k1_scratch_apply_checkpoint (error_callback , scratch , scratch_checkpoint );
621
617
return 0 ;
622
618
}
0 commit comments