Skip to content

Commit

Permalink
Merge bitcoin-core/secp256k1#969: ci: Fixes after Debian release
Browse files Browse the repository at this point in the history
5d5c74a tests: Rewrite code to circument potential bug in clang (Tim Ruffing)
3d2f492 ci: Install libasan6 (instead of 5) after Debian upgrade (Tim Ruffing)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK 5d5c74a

Tree-SHA512: 540ede482214bf9feaa607de52a69f6d34169dd98fb14bd3d003f4c8f722c1eebed56eb9d933e742f36d8886c25bfa9fa0ebbed5b0c3b161f04dc26180f5d214
  • Loading branch information
jonasnick committed Aug 20, 2021
2 parents be8d9c2 + 5d5c74a commit d7ec49a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ci/linux-debian.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN apt-get install --no-install-recommends --no-upgrade -y \
make automake libtool pkg-config dpkg-dev valgrind qemu-user \
gcc clang llvm libc6-dbg \
g++ \
gcc-i686-linux-gnu libc6-dev-i386-cross libc6-dbg:i386 libubsan1:i386 libasan5:i386 \
gcc-i686-linux-gnu libc6-dev-i386-cross libc6-dbg:i386 libubsan1:i386 libasan6:i386 \
gcc-s390x-linux-gnu libc6-dev-s390x-cross libc6-dbg:s390x \
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross libc6-dbg:armhf \
gcc-aarch64-linux-gnu libc6-dev-arm64-cross libc6-dbg:arm64 \
Expand Down
10 changes: 6 additions & 4 deletions src/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -5262,17 +5262,19 @@ void test_ecdsa_sign_verify(void) {
secp256k1_scalar msg, key;
secp256k1_scalar sigr, sigs;
int getrec;
/* Initialize recid to suppress a false positive -Wconditional-uninitialized in clang.
VG_UNDEF ensures that valgrind will still treat the variable as uninitialized. */
int recid = -1; VG_UNDEF(&recid, sizeof(recid));
int recid;
random_scalar_order_test(&msg);
random_scalar_order_test(&key);
secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &pubj, &key);
secp256k1_ge_set_gej(&pub, &pubj);
getrec = secp256k1_testrand_bits(1);
random_sign(&sigr, &sigs, &key, &msg, getrec?&recid:NULL);
/* The specific way in which this conditional is written sidesteps a potential bug in clang.
See the commit messages of the commit that introduced this comment for details. */
if (getrec) {
random_sign(&sigr, &sigs, &key, &msg, &recid);
CHECK(recid >= 0 && recid < 4);
} else {
random_sign(&sigr, &sigs, &key, &msg, NULL);
}
CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sigr, &sigs, &pub, &msg));
secp256k1_scalar_set_int(&one, 1);
Expand Down

0 comments on commit d7ec49a

Please sign in to comment.