Skip to content

Commit e28b61c

Browse files
committed
f const casting
1 parent 84fe427 commit e28b61c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/modules/schnorrsig/main_impl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static int secp256k1_schnorrsig_real_verify(const secp256k1_context* ctx, secp25
132132

133133
secp256k1_scalar_negate(&nege, e);
134134

135-
if (!secp256k1_pubkey_load(ctx, &pkp, (secp256k1_pubkey *) pk)) {
135+
if (!secp256k1_pubkey_load(ctx, &pkp, (const secp256k1_pubkey *) pk)) {
136136
return 0;
137137
}
138138
secp256k1_gej_set_ge(&pkj, &pkp);
@@ -238,7 +238,7 @@ static int secp256k1_schnorrsig_verify_batch_ecmult_callback(secp256k1_scalar *s
238238
secp256k1_scalar_set_b32(sc, buf, NULL);
239239
secp256k1_scalar_mul(sc, sc, &ecmult_context->randomizer_cache[(idx / 2) % 2]);
240240

241-
if (!secp256k1_pubkey_load(ecmult_context->ctx, pt, (secp256k1_pubkey *) ecmult_context->pk[idx / 2])) {
241+
if (!secp256k1_pubkey_load(ecmult_context->ctx, pt, (const secp256k1_pubkey *) ecmult_context->pk[idx / 2])) {
242242
return 0;
243243
}
244244
}
@@ -277,7 +277,7 @@ static int secp256k1_schnorrsig_verify_batch_init_randomizer(const secp256k1_con
277277
* xonly_pubkey serialization and a user would wrongly memcpy
278278
* normal secp256k1_pubkeys into xonly_pubkeys then the randomizer
279279
* would be the same for two different pubkeys. */
280-
secp256k1_ec_pubkey_serialize(ctx, buf, &buflen, (secp256k1_pubkey *) pk[i], SECP256K1_EC_COMPRESSED);
280+
secp256k1_ec_pubkey_serialize(ctx, buf, &buflen, (const secp256k1_pubkey *) pk[i], SECP256K1_EC_COMPRESSED);
281281
secp256k1_sha256_write(sha, buf, buflen);
282282
}
283283
ecmult_context->ctx = ctx;

src/secp256k1.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ int secp256k1_xonly_pubkey_serialize(const secp256k1_context* ctx, unsigned char
785785
ARG_CHECK(pubkey != NULL);
786786
ARG_CHECK(output32 != NULL);
787787

788-
if (!secp256k1_ec_pubkey_serialize(ctx, buf, &outputlen, (secp256k1_pubkey *) pubkey, SECP256K1_EC_COMPRESSED)) {
788+
if (!secp256k1_ec_pubkey_serialize(ctx, buf, &outputlen, (const secp256k1_pubkey *) pubkey, SECP256K1_EC_COMPRESSED)) {
789789
return 0;
790790
}
791791
memcpy(output32, &buf[1], 32);
@@ -797,7 +797,7 @@ int secp256k1_xonly_pubkey_from_pubkey(const secp256k1_context* ctx, secp256k1_x
797797
ARG_CHECK(xonly_pubkey != NULL);
798798
ARG_CHECK(pubkey != NULL);
799799

800-
*xonly_pubkey = *(secp256k1_xonly_pubkey *) pubkey;
800+
*xonly_pubkey = *(const secp256k1_xonly_pubkey *) pubkey;
801801

802802
secp256k1_ec_pubkey_absolute(ctx, (secp256k1_pubkey *) xonly_pubkey, sign);
803803
return 1;
@@ -808,7 +808,7 @@ int secp256k1_xonly_pubkey_to_pubkey(const secp256k1_context* ctx, secp256k1_pub
808808
ARG_CHECK(pubkey != NULL);
809809
ARG_CHECK(xonly_pubkey != NULL);
810810

811-
*pubkey = *(secp256k1_pubkey *) xonly_pubkey;
811+
*pubkey = *(const secp256k1_pubkey *) xonly_pubkey;
812812
if (sign) {
813813
return secp256k1_ec_pubkey_negate(ctx, pubkey);
814814
}
@@ -842,7 +842,7 @@ int secp256k1_xonly_pubkey_tweak_add(const secp256k1_context* ctx, secp256k1_pub
842842
ARG_CHECK(output_pubkey != NULL);
843843
ARG_CHECK(tweak32 != NULL);
844844

845-
*output_pubkey = *(secp256k1_pubkey *)internal_pubkey;
845+
*output_pubkey = *(const secp256k1_pubkey *)internal_pubkey;
846846
return secp256k1_ec_pubkey_tweak_add(ctx, output_pubkey, tweak32);
847847
}
848848

0 commit comments

Comments
 (0)