bitcoin/src/crypto
Pieter Wuille 655937ebcb
Merge #19845: net: CNetAddr: add support to (un)serialize as ADDRv2
7be6ff6187 net: recognize TORv3/I2P/CJDNS networks (Vasil Dimov)
e0d73573a3 net: CNetAddr: add support to (un)serialize as ADDRv2 (Vasil Dimov)
fe42411b4b test: move HasReason so it can be reused (Vasil Dimov)
d2bb681f96 util: move HasPrefix() so it can be reused (Vasil Dimov)

Pull request description:

  (chopped off from #19031 to ease review)

  Add an optional support to serialize/unserialize `CNetAddr` in ADDRv2 format (BIP155). The new serialization is engaged by ORing a flag into the stream version.

  So far this is only used in tests to ensure the new code works as expected.

ACKs for top commit:
  Sjors:
    re-tACK 7be6ff6187
  sipa:
    re-utACK 7be6ff6187
  eriknylund:
    ACK 7be6ff6187 I built the PR on macOS Catalina 10.15.6, ran both tests and functional tests. I've reviewed the code and think the changes look good and according to BIP155. I verified that the added Base32 encoding test looks as proposed and working. I've run a node for a week only with Onion addresses `-onlynet=onion` without issues and I can connect to other peer reviewers running TorV3 on their nodes and I can connect both of my test nodes to each other.
  jonatack:
    re-ACK 7be6ff6187 per `git diff b9c46e0 7be6ff6`, debug build, ran/running bitcoind with this change and observed the log and `-netinfo` peer connections while connected as a tor v2 service to both tor v2 peers and also five tor v3 peers.
  hebasto:
    ACK 7be6ff6187, tested on Linux Mint 20 (x86_64): on top of this pull and #19031 I'm able to connect to onion v3 addresses, and jonatack is able to connect to my created onion v3 address.

Tree-SHA512: dc621411ac4393993aa3ccad10991717ec5f9f2643cae46a24a89802df0a33d6042994fc8ff2f0f397a3dbcd1c0e58fe4724305a2f9eb64d9342c3bdf784d9be
2020-09-28 12:27:08 -07:00
..
ctaes
aes.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
aes.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
chacha20.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
chacha20.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
chacha_poly_aead.cpp Remove unused includes 2019-10-15 22:56:43 +00:00
chacha_poly_aead.h Add ChaCha20Poly1305@Bitcoin AEAD implementation 2019-06-25 15:13:02 +02:00
common.h net: recognize TORv3/I2P/CJDNS networks 2020-09-21 10:13:34 +02:00
hkdf_sha256_32.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
hkdf_sha256_32.h Add HKDF HMAC_SHA256 L=32 implementations 2019-05-11 09:14:07 +02:00
hmac_sha256.cpp
hmac_sha256.h
hmac_sha512.cpp
hmac_sha512.h
poly1305.cpp Add Poly1305 implementation 2019-03-26 18:12:29 +01:00
poly1305.h Add Poly1305 implementation 2019-03-26 18:12:29 +01:00
ripemd160.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
ripemd160.h
sha1.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
sha1.h
sha3.cpp Unroll Keccak-f implementation 2020-09-06 18:35:23 -07:00
sha3.h Implement keccak-f[1600] and SHA3-256 2020-09-06 18:35:18 -07:00
sha256_avx2.cpp scripted-diff: Add missed copyright headers 2020-01-04 20:18:28 +02:00
sha256_shani.cpp Avoid non-trivial global constants in SHA-NI code 2020-04-07 13:57:34 -07:00
sha256_sse4.cpp
sha256_sse41.cpp scripted-diff: Add missed copyright headers 2020-01-04 20:18:28 +02:00
sha256.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
sha256.h
sha512.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
sha512.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
siphash.cpp Change CSipHasher's count variable to uint8_t 2020-09-10 09:04:53 -07:00
siphash.h Change CSipHasher's count variable to uint8_t 2020-09-10 09:04:53 -07:00