Skip to content

Commit e726610

Browse files
committed
f address some of tim's comments
1 parent 6b4e4c8 commit e726610

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

include/secp256k1.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ typedef struct {
8686
* secp256k1_s2c_commit_context_create the context can be given to a signing
8787
* algorithm via the nonce data argument.
8888
*
89-
* This structure is not opaque, but it is strongly discouraged to copy it or read
90-
* or write to it directly. Use the secp256k1_s2c_commit_* instead to access a
91-
* sign-to-contract context.
89+
* This structure is not opaque, but it is strongly discouraged to read or write to
90+
* it directly. Use the secp256k1_s2c_commit_* instead to access a sign-to-contract
91+
* context.
9292
*
9393
* The exact representation of data inside is implementation defined and not
9494
* guaranteed to be portable between different platforms or versions. It is however

src/modules/schnorrsig/tests_impl.h

+2
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ void test_schnorrsig_s2c_commit_verify(void) {
763763

764764
CHECK(secp256k1_s2c_commit_get_original_nonce(ctx, &s2c_original_nonce, &s2c_ctx) == 1);
765765
CHECK(secp256k1_schnorrsig_verify_s2c_commit(ctx, &sig, data32, &s2c_original_nonce, nonce_is_negated) == 1);
766+
/* verify_s2c_commit fails if nonce_is_negated is wrong */
767+
CHECK(secp256k1_schnorrsig_verify_s2c_commit(ctx, &sig, data32, &s2c_original_nonce, !nonce_is_negated) == 0);
766768

767769
{
768770
/* verify_s2c_commit fails if given data does not match committed data */

src/tests.c

+3-7
Original file line numberDiff line numberDiff line change
@@ -2352,15 +2352,11 @@ void test_ec_commit(void) {
23522352
secp256k1_pubkey commitment;
23532353
unsigned char data[32];
23542354

2355-
/* Create random keypair */
2355+
/* Create random keypair and data */
23562356
secp256k1_rand256(seckey);
23572357
CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, seckey));
2358-
/* Create random data */
2359-
{
2360-
secp256k1_scalar d;
2361-
random_scalar_order_test(&d);
2362-
secp256k1_scalar_get_b32(data, &d);
2363-
}
2358+
secp256k1_rand256_test(data);
2359+
23642360
/* Commit to data and verify */
23652361
CHECK(secp256k1_ec_commit(ctx, &commitment, &pubkey, data, 32));
23662362
CHECK(secp256k1_ec_commit_verify(ctx, &commitment, &pubkey, data, 32));

0 commit comments

Comments
 (0)