@@ -486,8 +486,8 @@ int secp256k1_ecdsa_sign(const secp256k1_context* ctx, secp256k1_ecdsa_signature
486
486
}
487
487
488
488
/* Compute an ec commitment tweak as hash(pubkey, data). */
489
- static int secp256k1_ec_commit_tweak (const secp256k1_context * ctx , unsigned char * tweak32 , const secp256k1_pubkey * pubkey , const unsigned char * data , size_t data_size ) {
490
- secp256k1_ge p ;
489
+ static int secp256k1_ec_commit_tweak (unsigned char * tweak32 , const secp256k1_ge * pubkey , const unsigned char * data , size_t data_size ) {
490
+ secp256k1_ge p = * pubkey ;
491
491
unsigned char rbuf [33 ];
492
492
size_t rbuf_size = sizeof (rbuf );
493
493
secp256k1_sha256 sha ;
@@ -496,9 +496,6 @@ static int secp256k1_ec_commit_tweak(const secp256k1_context *ctx, unsigned char
496
496
/* That's probably not what the caller wanted */
497
497
return 0 ;
498
498
}
499
- if (!secp256k1_pubkey_load (ctx , & p , pubkey )) {
500
- return 0 ;
501
- }
502
499
secp256k1_eckey_pubkey_serialize (& p , rbuf , & rbuf_size , 1 );
503
500
504
501
secp256k1_sha256_initialize (& sha );
@@ -517,11 +514,9 @@ static int secp256k1_ec_commit_tweak_from_seckey(
517
514
size_t data_size ) {
518
515
secp256k1_gej rp ;
519
516
secp256k1_ge r ;
520
- secp256k1_pubkey pubkey_tmp ;
521
517
secp256k1_ecmult_gen (& ctx -> ecmult_gen_ctx , & rp , seckey );
522
518
secp256k1_ge_set_gej (& r , & rp );
523
- secp256k1_pubkey_save (& pubkey_tmp , & r );
524
- return secp256k1_ec_commit_tweak (ctx , tweak32 , & pubkey_tmp , data , data_size );
519
+ return secp256k1_ec_commit_tweak (tweak32 , & r , data , data_size );
525
520
}
526
521
527
522
int secp256k1_ecdsa_sign_to_contract (const secp256k1_context * ctx , secp256k1_ecdsa_signature * signature , const unsigned char * msg32 , const unsigned char * seckey , secp256k1_nonce_function noncefp , const void * noncedata , const unsigned char * s2c_data32 ) {
0 commit comments