@@ -41,9 +41,8 @@ int secp256k1_ecdsa_s2c_sign(const secp256k1_context *ctx, secp256k1_ecdsa_signa
41
41
int secp256k1_ecdsa_s2c_verify_commit (const secp256k1_context * ctx , const secp256k1_ecdsa_signature * sig , const unsigned char * data32 , const secp256k1_s2c_opening * opening ) {
42
42
secp256k1_pubkey commitment ;
43
43
secp256k1_ge commitment_ge ;
44
- unsigned char x_bytes1 [32 ];
45
- unsigned char x_bytes2 [32 ];
46
- secp256k1_scalar sigr , sigs ;
44
+ unsigned char x_bytes [32 ];
45
+ secp256k1_scalar sigr , sigs , x_scalar ;
47
46
48
47
VERIFY_CHECK (ctx != NULL );
49
48
ARG_CHECK (sig != NULL );
@@ -69,10 +68,9 @@ int secp256k1_ecdsa_s2c_verify_commit(const secp256k1_context* ctx, const secp25
69
68
return 0 ;
70
69
}
71
70
secp256k1_fe_normalize (& commitment_ge .x );
72
- secp256k1_fe_get_b32 (x_bytes1 , & commitment_ge .x );
73
- secp256k1_scalar_get_b32 (x_bytes2 , & sigr );
74
- return memcmp (x_bytes1 , x_bytes2 , 32 ) == 0 ;
75
-
71
+ secp256k1_fe_get_b32 (x_bytes , & commitment_ge .x );
72
+ secp256k1_scalar_set_b32 (& x_scalar , x_bytes , NULL );
73
+ return secp256k1_scalar_eq (& sigr , & x_scalar );
76
74
}
77
75
int secp256k1_ecdsa_s2c_anti_nonce_covert_channel_host_commit (secp256k1_context * ctx , unsigned char * rand_commitment32 , const unsigned char * rand32 ) {
78
76
secp256k1_sha256 sha ;
0 commit comments