@@ -434,17 +434,17 @@ static void secp256k1_scalar_split_lambda(secp256k1_scalar *r1, secp256k1_scalar
434434 * Q.E.D.
435435 */
436436
437+ static const secp256k1_scalar secp256k1_const_lambda = SECP256K1_SCALAR_CONST (
438+ 0x5363AD4CUL , 0xC05C30E0UL , 0xA5261C02UL , 0x8812645AUL ,
439+ 0x122E22EAUL , 0x20816678UL , 0xDF02967CUL , 0x1B23BD72UL
440+ );
441+
437442#ifdef VERIFY
438443static void secp256k1_scalar_split_lambda_verify (const secp256k1_scalar * r1 , const secp256k1_scalar * r2 , const secp256k1_scalar * k ) {
439444 secp256k1_scalar s ;
440445 unsigned char buf1 [32 ];
441446 unsigned char buf2 [32 ];
442447
443- static const secp256k1_scalar lambda = SECP256K1_SCALAR_CONST (
444- 0x5363AD4CUL , 0xC05C30E0UL , 0xA5261C02UL , 0x8812645AUL ,
445- 0x122E22EAUL , 0x20816678UL , 0xDF02967CUL , 0x1B23BD72UL
446- );
447-
448448 /* (a1 + a2 + 1)/2 is 0xa2a8918ca85bafe22016d0b917e4dd77 */
449449 static const unsigned char k1_bound [32 ] = {
450450 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
457457 0x8a , 0x65 , 0x28 , 0x7b , 0xd4 , 0x71 , 0x79 , 0xfb , 0x2b , 0xe0 , 0x88 , 0x46 , 0xce , 0xa2 , 0x67 , 0xed
458458 };
459459
460- secp256k1_scalar_mul (& s , & lambda , r2 );
460+ secp256k1_scalar_mul (& s , & secp256k1_const_lambda , r2 );
461461 secp256k1_scalar_add (& s , & s , r1 );
462462 VERIFY_CHECK (secp256k1_scalar_eq (& s , k ));
463463
@@ -475,10 +475,6 @@ static void secp256k1_scalar_split_lambda_verify(const secp256k1_scalar *r1, con
475475
476476static void secp256k1_scalar_split_lambda (secp256k1_scalar * r1 , secp256k1_scalar * r2 , const secp256k1_scalar * k ) {
477477 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- );
482478 static const secp256k1_scalar minus_b1 = SECP256K1_SCALAR_CONST (
483479 0x00000000UL , 0x00000000UL , 0x00000000UL , 0x00000000UL ,
484480 0xE4437ED6UL , 0x010E8828UL , 0x6F547FA9UL , 0x0ABFE4C3UL
@@ -503,7 +499,8 @@ static void secp256k1_scalar_split_lambda(secp256k1_scalar *r1, secp256k1_scalar
503499 secp256k1_scalar_mul (& c1 , & c1 , & minus_b1 );
504500 secp256k1_scalar_mul (& c2 , & c2 , & minus_b2 );
505501 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 );
507504 secp256k1_scalar_add (r1 , r1 , k );
508505
509506#ifdef VERIFY
0 commit comments