diff --git a/ci/linux-debian.Dockerfile b/ci/linux-debian.Dockerfile index 2c02ed69d03f8..fdba12aa00b47 100644 --- a/ci/linux-debian.Dockerfile +++ b/ci/linux-debian.Dockerfile @@ -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 \ diff --git a/src/tests.c b/src/tests.c index 99d9468e2987c..ce8df45a2965e 100644 --- a/src/tests.c +++ b/src/tests.c @@ -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);