0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-03 09:56:38 -05:00
bitcoin-bitcoin-core/src
fanquake 0f0e36de5f
Merge bitcoin/bitcoin#29815: crypto: chacha20: always use our fallback timingsafe_bcmp rather than libc's
2d1819455c crypto: chacha20: always use our fallback timingsafe_bcmp rather than libc's (Cory Fields)

Pull request description:

  Looking at libc sources, apple and openbsd implementations match our naive fallback. Only FreeBSD (and only x86_64) seems to [implement an optimized version](https://github.com/freebsd/freebsd-src/blob/main/lib/libc/amd64/string/timingsafe_bcmp.S).

  It's not worth the hassle of using a platform-specific function for such little gain.

  Additionally, as mentioned below, this is the only case outside of sha2 that requires an autoconf check, and I have upcoming PRs to remove the sha2 ones.

  Apple's [impl is unoptimized](https://opensource.apple.com/source/Libc/Libc-1244.1.7/string/FreeBSD/timingsafe_bcmp.c.auto.html).

  As-is [OpenBSD's impl](https://github.com/openbsd/src/blob/master/lib/libc/string/timingsafe_bcmp.c).

  Relevant IRC conversation with sipa:

  > \<cfields\> sipa: chacha20poly1305.cpp uses libc's timingsafe_bcmp when possible. But looking around at apple/freebsd/openbsd, I don't see any impl that doesn't use the naive implementation that matches our fallback...
  > \<cfields\> is there any reason to belive there's an optimized impl somewhere that we're actually hitting?
  > \<cfields\> asking because after cleaning up sha2, timingsafe_bcmp is the last autoconf check that remains in all of crypto. It'd make life easy if we could just always use our internal one.
  > \<cfields\> *all of crypto/
  > \<sipa\> cfields: let's get rid of the dependency then
  > \<sipa\> it's a trivial function
  > \<sipa\> and if we need it for some platforms, no real reason not to use it on all

  After the above discusstion, I did end up finding the x86_64-optimized FreeBSD impl, but I don't think that's all that significant.

ACKs for top commit:
  sipa:
    utACK 2d1819455c
  fanquake:
    ACK 2d1819455c
  TheCharlatan:
    ACK 2d1819455c
  theStack:
    ACK 2d1819455c

Tree-SHA512: b9583e19ac2f77c5d572aa5b95bc4b53669d5717e5708babef930644980de7c5d06a9c7decd5c2b559d70b8597328ecfe513375e3d8c3ef523db80012dfe9266
2024-04-06 20:45:19 +01:00
..
bench Merge bitcoin/bitcoin#29648: Remove libbitcoinconsensus 2024-04-01 17:53:31 +02:00
common Merge bitcoin/bitcoin#29007: test: create deterministic addrman in the functional tests 2024-03-11 10:29:31 -04:00
compat netbase: refactor CreateSock() to accept sa_family_t 2024-03-01 13:13:07 -05:00
config
consensus
crc32c Update crc32c subtree to latest upstream master 2024-02-27 18:28:19 +00:00
crypto crypto: chacha20: always use our fallback timingsafe_bcmp rather than libc's 2024-04-05 15:44:21 +00:00
index Fix #29767, set m_synced = true after Commit() 2024-04-01 14:13:06 +11:00
init doc: add unconditional info loglevel following merge of PR 28318 2024-01-11 11:01:28 -06:00
interfaces Merge bitcoin/bitcoin#28890: rpc: Remove deprecated -rpcserialversion 2024-01-05 10:42:10 +00:00
ipc
kernel Merge bitcoin/bitcoin#29081: refactor: Remove gmtime* 2024-04-05 17:02:00 +01:00
leveldb
logging
minisketch
node node: Make translations of fatal errors consistent 2024-03-21 16:40:22 +01:00
policy ImprovesFeerateDiagram: Spelling fix and removal of unused diagram vectors 2024-03-26 08:05:22 -04:00
primitives [validation] Cache merkle root and witness commitment checks 2024-02-27 14:19:15 +00:00
qt Merge bitcoin/bitcoin#27375: net: support unix domain sockets for -proxy and -onion 2024-03-13 06:53:07 -04:00
rpc Merge bitcoin/bitcoin#29130: wallet: Add createwalletdescriptor and gethdkeys RPCs for adding new automatically generated descriptors 2024-03-29 06:39:57 -04:00
script Merge bitcoin/bitcoin#29648: Remove libbitcoinconsensus 2024-04-01 17:53:31 +02:00
secp256k1 Update secp256k1 subtree to latest master 2024-04-04 12:05:16 +01:00
support scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
test Merge bitcoin/bitcoin#29805: test: Fix debug recommendation in argsman_tests 2024-04-05 17:25:38 +01:00
univalue
util Merge bitcoin/bitcoin#29081: refactor: Remove gmtime* 2024-04-05 17:02:00 +01:00
wallet Merge bitcoin/bitcoin#29130: wallet: Add createwalletdescriptor and gethdkeys RPCs for adding new automatically generated descriptors 2024-03-29 06:39:57 -04:00
zmq zmq: read raw block with ReadRawBlockFromDisk 2024-03-12 12:46:46 -04:00
.bear-tidy-config
.clang-format refactor: Print verbose serialize compiler error messages 2023-12-15 15:20:54 +01:00
.clang-tidy ci: Bump TIDY_LLVM_V 2024-03-15 13:34:05 +00:00
addrdb.cpp addrman: drop /*deterministic=*/ comment 2024-03-23 15:33:47 +01:00
addrdb.h
addresstype.cpp
addresstype.h
addrman.cpp Merge bitcoin/bitcoin#29404: refactor: bitcoin-config.h includes cleanup 2024-02-20 13:07:48 +00:00
addrman.h doc, test: Test and explain service flag handling 2024-01-15 16:19:53 -05:00
addrman_impl.h
arith_uint256.cpp
arith_uint256.h
attributes.h
banman.cpp
banman.h
base58.cpp
base58.h
bech32.cpp
bech32.h
bip324.cpp
bip324.h
bitcoin-chainstate.cpp node: Make translations of fatal errors consistent 2024-03-21 16:40:22 +01:00
bitcoin-cli-res.rc
bitcoin-cli.cpp cli: improve bitcoin-cli error when not connected 2024-03-21 10:29:43 +00:00
bitcoin-tx-res.rc
bitcoin-tx.cpp doc: Update bitcoin-tx replaceable documentation 2023-12-11 13:08:46 -05:00
bitcoin-util-res.rc
bitcoin-util.cpp
bitcoin-wallet-res.rc
bitcoin-wallet.cpp
bitcoind-res.rc
bitcoind.cpp
blockencodings.cpp
blockencodings.h
blockfilter.cpp
blockfilter.h
chain.cpp
chain.h assumeutxo: Remove BLOCK_ASSUMED_VALID flag 2024-03-18 11:28:40 -05:00
chainparams.cpp
chainparams.h
chainparamsbase.cpp
chainparamsbase.h
chainparamsseeds.h seeds: Update testnet seeds 2024-03-04 19:53:30 -05:00
checkqueue.h
clientversion.cpp scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
clientversion.h
coins.cpp
coins.h
compressor.cpp
compressor.h
core_io.h Remove deprecated -rpcserialversion 2023-12-11 18:22:13 +01:00
core_memusage.h
core_read.cpp
core_write.cpp Remove deprecated -rpcserialversion 2023-12-11 18:22:13 +01:00
cuckoocache.h doc: fix some typos 2024-03-26 16:51:46 +00:00
dbwrapper.cpp
dbwrapper.h
deploymentinfo.cpp
deploymentinfo.h
deploymentstatus.cpp
deploymentstatus.h
dummywallet.cpp
external_signer.cpp
external_signer.h
flatfile.cpp scripted-diff: Replace error() with LogError() 2024-03-11 13:49:37 +01:00
flatfile.h
hash.cpp crypto, hash: replace custom rotl32 with std::rotl 2024-01-05 17:12:38 +01:00
hash.h
headerssync.cpp refactor: Fix timedata includes 2024-02-01 13:52:05 +01:00
headerssync.h
httprpc.cpp
httprpc.h
httpserver.cpp Merge bitcoin/bitcoin#28318: logging: Simplify API for level based logging 2024-01-10 14:11:32 -05:00
httpserver.h
i2p.cpp Merge bitcoin/bitcoin#27375: net: support unix domain sockets for -proxy and -onion 2024-03-13 06:53:07 -04:00
i2p.h i2p: construct Session with Proxy instead of CService 2024-03-01 14:47:29 -05:00
indirectmap.h
init.cpp init: clarify -test error 2024-03-23 15:33:50 +01:00
init.h
key.cpp refactor: Allow std::span construction from CKey 2024-01-16 15:29:18 +01:00
key.h key: Add constructor for CExtKey that takes CExtPubKey and CKey 2024-02-20 11:20:58 -05:00
key_io.cpp refactor: Allow std::span construction from CKey 2024-01-16 15:29:18 +01:00
key_io.h
logging.cpp logging: remove unused BCLog::UTIL 2024-02-11 15:25:07 +01:00
logging.h Merge bitcoin/bitcoin#29419: log: deduplicate category names and improve logging.cpp 2024-04-02 10:47:05 -04:00
Makefile.am Merge bitcoin/bitcoin#29648: Remove libbitcoinconsensus 2024-04-01 17:53:31 +02:00
Makefile.bench.include bench: basic block filter index initial sync 2024-03-12 09:30:42 -03:00
Makefile.crc32c.include
Makefile.leveldb.include
Makefile.minisketch.include
Makefile.qt.include
Makefile.qt_locale.include qt: 27.0 translations update 2024-03-04 10:02:26 +00:00
Makefile.qttest.include
Makefile.test.include Merge bitcoin/bitcoin#29648: Remove libbitcoinconsensus 2024-04-01 17:53:31 +02:00
Makefile.test_fuzz.include
Makefile.test_util.include
Makefile.univalue.include
mapport.cpp
mapport.h
memusage.h
merkleblock.cpp
merkleblock.h
net.cpp Merge bitcoin/bitcoin#27375: net: support unix domain sockets for -proxy and -onion 2024-03-13 06:53:07 -04:00
net.h Accept "in" and "out" flags to -whitelist to allow whitelisting manual connections 2024-02-28 10:05:56 -03:00
net_permissions.cpp Accept "in" and "out" flags to -whitelist to allow whitelisting manual connections 2024-02-28 10:05:56 -03:00
net_permissions.h Accept "in" and "out" flags to -whitelist to allow whitelisting manual connections 2024-02-28 10:05:56 -03:00
net_processing.cpp Merge bitcoin/bitcoin#29619: refactor: consolidate MempoolAcceptResult processing 2024-03-13 07:26:34 -04:00
net_processing.h net: move state dependent peer services flags 2024-01-15 10:28:20 -03:00
net_types.cpp
net_types.h
netaddress.cpp netbase: refactor CreateSock() to accept sa_family_t 2024-03-01 13:13:07 -05:00
netaddress.h netbase: refactor CreateSock() to accept sa_family_t 2024-03-01 13:13:07 -05:00
netbase.cpp netbase: remove unnecessary log message 2024-03-13 14:09:50 -04:00
netbase.h net: split ConnectToSocket() from ConnectDirectly() for unix sockets 2024-03-01 14:47:28 -05:00
netgroup.cpp
netgroup.h
netmessagemaker.h
noui.cpp node: Use log levels in noui_ThreadSafeMessageBox 2024-03-21 16:41:16 +01:00
noui.h
outputtype.cpp
outputtype.h
pow.cpp
pow.h
prevector.h refactor: Mark prevector iterator with std::contiguous_iterator_tag 2024-01-18 19:29:34 +01:00
protocol.cpp net: remove now unused global 'g_initial_block_download_completed' 2024-01-23 10:25:16 -03:00
protocol.h net: remove now unused global 'g_initial_block_download_completed' 2024-01-23 10:25:16 -03:00
psbt.cpp
psbt.h
pubkey.cpp
pubkey.h Add missing XOnlyPubKey::data() to get mutable data 2024-01-16 10:58:57 +01:00
random.cpp scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
random.h crypto: replace CountBits with std::bit_width 2024-02-26 16:13:12 +00:00
randomenv.cpp
randomenv.h
rest.cpp rest: read raw block in rest_block and deserialize for json 2024-03-12 12:48:04 -04:00
rest.h
reverse_iterator.h
scheduler.cpp scripted-diff: Rename SingleThreadedSchedulerClient to SerialTaskRunner 2024-02-15 14:43:14 +01:00
scheduler.h kernel: Remove dependency on CScheduler 2024-02-16 17:12:52 +01:00
serialize.h Merge bitcoin/bitcoin#29263: serialization: c++20 endian/byteswap/clz modernization 2024-03-01 11:19:58 -05:00
signet.cpp
signet.h
span.h Allow int8_t optimized vector serialization 2023-12-22 09:58:19 +01:00
streams.cpp
streams.h
sync.cpp scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
sync.h
threadsafety.h
timedata.cpp Remove GetAdjustedTime 2024-01-05 17:16:38 +00:00
timedata.h refactor: Fix timedata includes 2024-02-01 13:52:05 +01:00
tinyformat.h
torcontrol.cpp Merge bitcoin/bitcoin#28318: logging: Simplify API for level based logging 2024-01-10 14:11:32 -05:00
torcontrol.h
txdb.cpp
txdb.h
txmempool.cpp CalculateFeerateDiagramsForRBF: update misleading description of old diagram contents 2024-03-26 11:42:42 -04:00
txmempool.h Implement ImprovesFeerateDiagram 2024-03-18 10:32:00 -04:00
txorphanage.cpp fuzz: Improve fuzzing stability for txorphan harness 2023-12-08 13:14:46 +00:00
txorphanage.h fuzz: Improve fuzzing stability for txorphan harness 2023-12-08 13:14:46 +00:00
txrequest.cpp
txrequest.h
uint256.cpp
uint256.h
undo.h
validation.cpp doc: Fix typos 2024-03-26 16:51:37 +00:00
validation.h Merge bitcoin/bitcoin#29648: Remove libbitcoinconsensus 2024-04-01 17:53:31 +02:00
validationinterface.cpp kernel: Remove dependency on CScheduler 2024-02-16 17:12:52 +01:00
validationinterface.h kernel: Remove dependency on CScheduler 2024-02-16 17:12:52 +01:00
versionbits.cpp
versionbits.h
walletinitinterface.h
warnings.cpp scripted-diff: Fix bitcoin_config_h includes 2024-02-13 20:10:44 +00:00
warnings.h