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