Skip to content

Commit

Permalink
build: test for timingsafe_bcmp
Browse files Browse the repository at this point in the history
Code introduced in bitcoin#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.
  • Loading branch information
fanquake committed Jun 10, 2022
1 parent e3c08eb commit 491bb14
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 4 additions & 0 deletions src/crypto/chacha_poly_aead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 491bb14

Please sign in to comment.