Skip to content

Commit

Permalink
remove warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
b-wagn committed Oct 13, 2023
1 parent 917e167 commit e92d44a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 29 deletions.
30 changes: 15 additions & 15 deletions include/secp256k1_schnorrsig.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,12 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_schnorrsig_verify(
* to the aggregate signature.
*/
SECP256K1_API int secp256k1_schnorrsig_inc_aggregate(
const secp256k1_context* ctx,
unsigned char* aggsig,
size_t* aggsig_size,
const secp256k1_context *ctx,
unsigned char *aggsig,
size_t *aggsig_size,
const secp256k1_xonly_pubkey* all_pubkeys,
const unsigned char* all_msgs32,
const unsigned char* new_sigs64,
const unsigned char *all_msgs32,
const unsigned char *new_sigs64,
size_t n_before,
size_t n_new
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(5) SECP256K1_ARG_NONNULL(6);
Expand All @@ -238,12 +238,12 @@ SECP256K1_API int secp256k1_schnorrsig_inc_aggregate(
* n: number of signatures to be aggregated.
*/
SECP256K1_API int secp256k1_schnorrsig_aggregate(
const secp256k1_context* ctx,
unsigned char* aggsig,
size_t* aggsig_size,
const secp256k1_xonly_pubkey* pubkeys,
const unsigned char* msgs32,
const unsigned char* sigs64,
const secp256k1_context *ctx,
unsigned char *aggsig,
size_t *aggsig_size,
const secp256k1_xonly_pubkey *pubkeys,
const unsigned char *msgs32,
const unsigned char *sigs64,
size_t n
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(5) SECP256K1_ARG_NONNULL(6);

Expand All @@ -263,11 +263,11 @@ SECP256K1_API int secp256k1_schnorrsig_aggregate(
* aggsig_size: Size of the aggregate signature.
*/
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_schnorrsig_aggverify(
const secp256k1_context* ctx,
const secp256k1_xonly_pubkey* pubkeys,
const unsigned char* msgs32,
const secp256k1_context *ctx,
const secp256k1_xonly_pubkey *pubkeys,
const unsigned char *msgs32,
size_t n,
const unsigned char* aggsig,
const unsigned char *aggsig,
size_t aggsig_size
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(5);

Expand Down
6 changes: 3 additions & 3 deletions src/modules/schnorrsig/main_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void secp256k1_schnorrsig_sha256_tagged_aggregation(secp256k1_sha256 *sha) {
sha->bytes = 64;
}

int secp256k1_schnorrsig_inc_aggregate(const secp256k1_context* ctx, unsigned char* aggsig, size_t* aggsig_size, const secp256k1_xonly_pubkey* all_pubkeys, const unsigned char* all_msgs32, const unsigned char* new_sigs64, size_t n_before, size_t n_new) {
int secp256k1_schnorrsig_inc_aggregate(const secp256k1_context *ctx, unsigned char *aggsig, size_t *aggsig_size, const secp256k1_xonly_pubkey *all_pubkeys, const unsigned char *all_msgs32, const unsigned char *new_sigs64, size_t n_before, size_t n_new) {
size_t i;
size_t n;
int overflow;
Expand Down Expand Up @@ -368,14 +368,14 @@ int secp256k1_schnorrsig_inc_aggregate(const secp256k1_context* ctx, unsigned ch
return 1;
}

int secp256k1_schnorrsig_aggregate(const secp256k1_context* ctx, unsigned char* aggsig, size_t* aggsig_size, const secp256k1_xonly_pubkey* pubkeys, const unsigned char* msgs32, const unsigned char* sigs64, size_t n) {
int secp256k1_schnorrsig_aggregate(const secp256k1_context *ctx, unsigned char *aggsig, size_t *aggsig_size, const secp256k1_xonly_pubkey *pubkeys, const unsigned char *msgs32, const unsigned char *sigs64, size_t n) {
if (!secp256k1_schnorrsig_inc_aggregate(ctx, aggsig, aggsig_size, pubkeys, msgs32, sigs64, 0, n)) {
return 0;
}
return 1;
}

int secp256k1_schnorrsig_aggverify(const secp256k1_context* ctx, const secp256k1_xonly_pubkey* pubkeys, const unsigned char* msgs32, size_t n, const unsigned char* aggsig, size_t aggsig_size) {
int secp256k1_schnorrsig_aggverify(const secp256k1_context *ctx, const secp256k1_xonly_pubkey *pubkeys, const unsigned char *msgs32, size_t n, const unsigned char *aggsig, size_t aggsig_size) {
size_t i;
secp256k1_gej lhs, rhs;
secp256k1_scalar s;
Expand Down
23 changes: 12 additions & 11 deletions src/modules/schnorrsig/tests_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1022,23 +1022,24 @@ void test_schnorrsig_aggregate(void) {
void test_schnorrsig_aggregate_spec_vectors(void) {
/* Test vector 0 */
{
int n, aggsig_size;
n = 0;
const secp256k1_xonly_pubkey pubkeys[0] = {};
const unsigned char msgs32[0] = {};
int n = 0;
int aggsig_size = 32;
/* setting size to 1, because C */
/* complains about zero-size arrays */
secp256k1_xonly_pubkey pubkeys[1];
const unsigned char msgs32[1] = { 0x00 };
const unsigned char aggsig[32] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
aggsig_size = 32;
CHECK(secp256k1_schnorrsig_aggverify(CTX, pubkeys, msgs32, n, aggsig, aggsig_size));
}
/* Test vector 1 */
{
int n, aggsig_size, i;
n = 1;
int n = 1;
int aggsig_size = 32+32;
const unsigned char pubkeys_ser[32] = {
0x1b, 0x84, 0xc5, 0x56, 0x7b, 0x12, 0x64, 0x40,
0x99, 0x5d, 0x3e, 0xd5, 0xaa, 0xba, 0x05, 0x65,
Expand All @@ -1061,17 +1062,17 @@ void test_schnorrsig_aggregate_spec_vectors(void) {
0xe1, 0x6e, 0x35, 0xd5, 0xf1, 0x2b, 0x69, 0x3b,
0x6b, 0xbc, 0x3d, 0x4a, 0x69, 0x82, 0xf2, 0xf6,
};
aggsig_size = 32+32;
secp256k1_xonly_pubkey pubkeys[1];
int i;
for (i = 0; i < n; ++i) {
CHECK(secp256k1_xonly_pubkey_parse(CTX, &pubkeys[i], &pubkeys_ser[i*32]));
}
CHECK(secp256k1_schnorrsig_aggverify(CTX, pubkeys, msgs32, n, aggsig, aggsig_size));
}
/* Test vector 2 */
{
int n, aggsig_size, i;
n = 2;
int n = 2;
int aggsig_size = 2*32+32;
const unsigned char pubkeys_ser[2*32] = {
0x1b, 0x84, 0xc5, 0x56, 0x7b, 0x12, 0x64, 0x40,
0x99, 0x5d, 0x3e, 0xd5, 0xaa, 0xba, 0x05, 0x65,
Expand Down Expand Up @@ -1108,8 +1109,8 @@ void test_schnorrsig_aggregate_spec_vectors(void) {
0x6a, 0x14, 0x2d, 0x57, 0x72, 0x45, 0xf4, 0x0a,
0x44, 0xf5, 0xde, 0xe4, 0x68, 0xda, 0x42, 0x44,
};
aggsig_size = 2*32+32;
secp256k1_xonly_pubkey pubkeys[2];
int i;
for (i = 0; i < n; ++i) {
CHECK(secp256k1_xonly_pubkey_parse(CTX, &pubkeys[i], &pubkeys_ser[i*32]));
}
Expand Down

0 comments on commit e92d44a

Please sign in to comment.