@@ -434,17 +434,17 @@ static void secp256k1_scalar_split_lambda(secp256k1_scalar *r1, secp256k1_scalar
434
434
* Q.E.D.
435
435
*/
436
436
437
+ static const secp256k1_scalar secp256k1_const_lambda = SECP256K1_SCALAR_CONST (
438
+ 0x5363AD4CUL , 0xC05C30E0UL , 0xA5261C02UL , 0x8812645AUL ,
439
+ 0x122E22EAUL , 0x20816678UL , 0xDF02967CUL , 0x1B23BD72UL
440
+ );
441
+
437
442
#ifdef VERIFY
438
443
static void secp256k1_scalar_split_lambda_verify (const secp256k1_scalar * r1 , const secp256k1_scalar * r2 , const secp256k1_scalar * k ) {
439
444
secp256k1_scalar s ;
440
445
unsigned char buf1 [32 ];
441
446
unsigned char buf2 [32 ];
442
447
443
- static const secp256k1_scalar lambda = SECP256K1_SCALAR_CONST (
444
- 0x5363AD4CUL , 0xC05C30E0UL , 0xA5261C02UL , 0x8812645AUL ,
445
- 0x122E22EAUL , 0x20816678UL , 0xDF02967CUL , 0x1B23BD72UL
446
- );
447
-
448
448
/* (a1 + a2 + 1)/2 is 0xa2a8918ca85bafe22016d0b917e4dd77 */
449
449
static const unsigned char k1_bound [32 ] = {
450
450
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
@@ -457,7 +457,7 @@ static void secp256k1_scalar_split_lambda_verify(const secp256k1_scalar *r1, con
457
457
0x8a , 0x65 , 0x28 , 0x7b , 0xd4 , 0x71 , 0x79 , 0xfb , 0x2b , 0xe0 , 0x88 , 0x46 , 0xce , 0xa2 , 0x67 , 0xed
458
458
};
459
459
460
- secp256k1_scalar_mul (& s , & lambda , r2 );
460
+ secp256k1_scalar_mul (& s , & secp256k1_const_lambda , r2 );
461
461
secp256k1_scalar_add (& s , & s , r1 );
462
462
VERIFY_CHECK (secp256k1_scalar_eq (& s , k ));
463
463
@@ -475,10 +475,6 @@ static void secp256k1_scalar_split_lambda_verify(const secp256k1_scalar *r1, con
475
475
476
476
static void secp256k1_scalar_split_lambda (secp256k1_scalar * r1 , secp256k1_scalar * r2 , const secp256k1_scalar * k ) {
477
477
secp256k1_scalar c1 , c2 ;
478
- static const secp256k1_scalar minus_lambda = SECP256K1_SCALAR_CONST (
479
- 0xAC9C52B3UL , 0x3FA3CF1FUL , 0x5AD9E3FDUL , 0x77ED9BA4UL ,
480
- 0xA880B9FCUL , 0x8EC739C2UL , 0xE0CFC810UL , 0xB51283CFUL
481
- );
482
478
static const secp256k1_scalar minus_b1 = SECP256K1_SCALAR_CONST (
483
479
0x00000000UL , 0x00000000UL , 0x00000000UL , 0x00000000UL ,
484
480
0xE4437ED6UL , 0x010E8828UL , 0x6F547FA9UL , 0x0ABFE4C3UL
@@ -503,7 +499,8 @@ static void secp256k1_scalar_split_lambda(secp256k1_scalar *r1, secp256k1_scalar
503
499
secp256k1_scalar_mul (& c1 , & c1 , & minus_b1 );
504
500
secp256k1_scalar_mul (& c2 , & c2 , & minus_b2 );
505
501
secp256k1_scalar_add (r2 , & c1 , & c2 );
506
- secp256k1_scalar_mul (r1 , r2 , & minus_lambda );
502
+ secp256k1_scalar_mul (r1 , r2 , & secp256k1_const_lambda );
503
+ secp256k1_scalar_negate (r1 , r1 );
507
504
secp256k1_scalar_add (r1 , r1 , k );
508
505
509
506
#ifdef VERIFY
0 commit comments