aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2022-06-10 11:14:49 +0100
committerfanquake <fanquake@gmail.com>2022-06-10 12:39:08 +0100
commit491bb14c0c9cf040154d57e246206ffb2f86a7e5 (patch)
tree196a12d1159b9d54c525e5eb223f22aec4191202
parente3c08eb620a2f317fc09fdf20969fa26f02afb91 (diff)
downloadbitcoin-491bb14c0c9cf040154d57e246206ffb2f86a7e5.tar.xz
build: test for timingsafe_bcmp
Code introduced in #15649 added usage of `timingsafe_bcmp()`, if available, otherwise falling back to our own implementation. However the relevant build system check was never added, so currently, we'll always just use our implementation, as HAVE_TIMINGSAFE_BCMP will never be defined. Add the check for timingsafe_bcmp. Note that as far as I'm aware, it's only available on OpenBSD.
-rw-r--r--configure.ac2
-rw-r--r--src/crypto/chacha_poly_aead.cpp4
2 files changed, 6 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index f6d00d0283..003d76989b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -998,6 +998,8 @@ AC_CHECK_DECLS([setsid])
AC_CHECK_DECLS([pipe2])
+AC_CHECK_FUNCS([timingsafe_bcmp])
+
AC_CHECK_DECLS([le16toh, le32toh, le64toh, htole16, htole32, htole64, be16toh, be32toh, be64toh, htobe16, htobe32, htobe64],,,
[#if HAVE_ENDIAN_H
#include <endian.h>
diff --git a/src/crypto/chacha_poly_aead.cpp b/src/crypto/chacha_poly_aead.cpp
index 4f3e6f7fa3..f736b2d867 100644
--- a/src/crypto/chacha_poly_aead.cpp
+++ b/src/crypto/chacha_poly_aead.cpp
@@ -2,6 +2,10 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#if defined(HAVE_CONFIG_H)
+#include <config/bitcoin-config.h>
+#endif
+
#include <crypto/chacha_poly_aead.h>
#include <crypto/poly1305.h>