Skip to content

Commit a00afbc

Browse files
committed
libsecp256k1: remove secp256k1_scalar_get_bits
This was removed upstream in bitcoin-core/secp256k1#1058, and is causing build failures downstream: ```bash clang++ -O1 -fno-omit-frame-pointer -gline-tables-only -Wno-error=enum-constexpr-conversion -Wno-error=incompatible-function-pointer-types -Wno-error=int-conversion -Wno-error=deprecated-declarations -Wno-error=implicit-function-declaration -Wno-error=implicit-int -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fprofile-instr-generate -fcoverage-mapping -pthread -Wl,--no-as-needed -Wl,-ldl -Wl,-lm -Wno-unused-command-line-argument -stdlib=libc++ -DCRYPTOFUZZ_NO_OPENSSL -I /src/boost_1_84_0/ -DCRYPTOFUZZ_SECP256K1 -DCRYPTOFUZZ_TREZOR_FIRMWARE -DCRYPTOFUZZ_BOTAN -DCRYPTOFUZZ_BOTAN_IS_ORACLE -DCRYPTOFUZZ_BITCOIN -Wall -Wextra -std=c++17 -I include/ -I . -I fuzzing-headers/include -DFUZZING_HEADERS_NO_IMPL bignum_fuzzer_importer.o botan_importer.o builtin_tests_importer.o components.o crypto.o datasource.o driver.o ecc_diff_fuzzer_exporter.o ecc_diff_fuzzer_importer.o entry.o executor.o expmod.o mutator.o mutatorpool.o numbers.o openssl_importer.o operation.o options.o repository.o tests.o util.o wycheproof.o z3.o modules/trezor/module.a modules/secp256k1/module.a modules/botan/module.a modules/bitcoin/module.a -fsanitize=fuzzer third_party/cpu_features/build/libcpu_features.a -o cryptofuzz /usr/bin/ld: modules/secp256k1/module.a(secp256k1_api.o): in function `cryptofuzz_secp256k1_scalar_get_bits': /src/cryptofuzz/modules/secp256k1/secp256k1_api.c:75:(.text+0xfdf): undefined reference to `secp256k1_scalar_get_bits' clang++: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Makefile:33: cryptofuzz] Error 1 ERROR:__main__:Building fuzzers failed. ```
1 parent 87e09d1 commit a00afbc

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

modules/secp256k1/module.cpp

+3-12
Original file line numberDiff line numberDiff line change
@@ -1416,18 +1416,9 @@ namespace secp256k1_detail {
14161416
const auto offset = bin->data()[0];
14171417
CF_CHECK_LT(offset, 32);
14181418

1419-
bool var = false;
1420-
try { var = ds.Get<bool>(); } catch ( ... ) { }
1421-
1422-
if ( var == false ) {
1423-
CF_NORET(cryptofuzz_secp256k1_scalar_set_int(
1424-
res,
1425-
cryptofuzz_secp256k1_scalar_get_bits(a, offset, 1)));
1426-
} else {
1427-
CF_NORET(cryptofuzz_secp256k1_scalar_set_int(
1428-
res,
1429-
cryptofuzz_secp256k1_scalar_get_bits_var(a, offset, 1)));
1430-
}
1419+
CF_NORET(cryptofuzz_secp256k1_scalar_set_int(
1420+
res,
1421+
cryptofuzz_secp256k1_scalar_get_bits_var(a, offset, 1)));
14311422
}
14321423
break;
14331424
case CF_CALCOP("Set(A)"):

modules/secp256k1/secp256k1_api.c

-4
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ void cryptofuzz_secp256k1_scalar_cmov(secp256k1_scalar *r, const secp256k1_scala
7171
}
7272
#endif
7373

74-
unsigned int cryptofuzz_secp256k1_scalar_get_bits(const void *a, unsigned int offset, unsigned int count) {
75-
return secp256k1_scalar_get_bits(a, offset, count);
76-
}
77-
7874
unsigned int cryptofuzz_secp256k1_scalar_get_bits_var(const void *a, unsigned int offset, unsigned int count) {
7975
return secp256k1_scalar_get_bits_var(a, offset, count);
8076
}

modules/secp256k1/secp256k1_api.h

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ void cryptofuzz_secp256k1_scalar_inverse_var(void *r, const void *x);
2222
!defined(SECP255K1_COMMIT_9d560f992db26612ce2630b194aef5f44d63a530)
2323
void cryptofuzz_secp256k1_scalar_cmov(void *r, const void *a, int flag);
2424
#endif
25-
unsigned int cryptofuzz_secp256k1_scalar_get_bits(const void *a, unsigned int offset, unsigned int count);
2625
unsigned int cryptofuzz_secp256k1_scalar_get_bits_var(const void *a, unsigned int offset, unsigned int count);
2726

2827
size_t cryptofuzz_secp256k1_fe_size(void);

0 commit comments

Comments
 (0)