Add p2p layer encryption with ECDH/ChaCha20Poly1305 #14032

pull jonasschnelli wants to merge 21 commits into bitcoin:master from jonasschnelli:2018/08/bip151 changing 23 files +1764 −184
  1. jonasschnelli commented at 3:11 pm on August 23, 2018: contributor

    This PR adds encryption to the p2p communication after a slightly overhauled version of BIP151 defined here (there is the plan to change BIP151 or to propose this protocol in a new BIP)

    The encryption is optional and by default disabled (-netencryption).

    If enabled, a peer connecting to another peer signalling NODE_ENCRYPTED (or added via -connect=) will try to do the proposed key handshake and continue with encrypted communication.

    If enabled, peers can request (and perform) encrypted communications by sending a handshake request.

    Peers not supporting encryption are still accepted (no option to enforce encrypted communication).

    There is a plan to make the handshake quantum resistance by adding NewHope to the key handshake (https://newhopecrypto.org). But since this PR is already very large, it’s unclear wether this should be an independent patch (probably another ~600 lines of code).

    Out of scope:

    • optimized ChaCha20 implementation (for review and security reasons, the implementation is extracted from openssh)
    • benchmarks added to bench (I have done comparison against the v1 protocol with dbl-SHA256 the performance seems very similar)
    • Please no discussion about the used crypto scheme or the proposal itself (better place would be the mailing list)

    TODO:

    • add option to -connect= RPC addnode where it is possible to specify the expected service flags (currently -connect= will always try for encrypted coms).
  2. jonasschnelli added the label P2P on Aug 23, 2018
  3. in src/net.cpp:770 in e654fd60d8 outdated
    771-            vRecvMsg.push_back(CNetMessage(Params().MessageStart(), SER_NETWORK, INIT_PROTO_VERSION));
    772-
    773-        CNetMessage& msg = vRecvMsg.back();
    774+        if (vRecvMsg.empty() || vRecvMsg.back()->complete()) {
    775+            if (m_encryption_handler && m_encryption_handler->shouldCryptMsg()) {
    776+                vRecvMsg.emplace_back(std::make_shared<NetCryptedMessageEnvelop>(m_encryption_handler, Params().MessageStart(), SER_NETWORK, INIT_PROTO_VERSION));
    


    practicalswift commented at 6:03 pm on August 23, 2018:
    Nit: Should this be ”envelope” instead of ”envelop”? If so, change applies throughout this PR and also the BIP.
  4. in src/init.cpp:481 in e654fd60d8 outdated
    477@@ -477,6 +478,7 @@ void SetupServerArgs()
    478     gArgs.AddArg("-maxtipage=<n>", strprintf("Maximum tip age in seconds to consider node in initial block download (default: %u)", DEFAULT_MAX_TIP_AGE), true, OptionsCategory::DEBUG_TEST);
    479     gArgs.AddArg("-maxtxfee=<amt>", strprintf("Maximum total fees (in %s) to use in a single wallet transaction or raw transaction; setting this too low may abort large transactions (default: %s)",
    480         CURRENCY_UNIT, FormatMoney(DEFAULT_TRANSACTION_MAXFEE)), false, OptionsCategory::DEBUG_TEST);
    481+    gArgs.AddArg("-netencryptionfastrekey", "Rekeys every 10 seconds and after 10kb of data", true, OptionsCategory::DEBUG_TEST);
    


    practicalswift commented at 6:07 pm on August 23, 2018:
    If I’m reading the logic correct then this should be ”every 10 seconds or after 10kb of data”?
  5. in src/net.cpp:799 in e654fd60d8 outdated
    807-        if (msg.complete()) {
    808+        if (msg->complete()) {
    809+            msg->nTime = nTimeMicros;
    810+            if (msg->m_type == NetMessageType::PLAINTEXT_ENCRYPTION_HANDSHAKE && !msg->verifyHeader()) {
    811+                // message contains expected network magic and "version" message command
    812+                // threat as version message
    


    practicalswift commented at 6:08 pm on August 23, 2018:
    Nit: “treat”
  6. in src/net_encryption.cpp:156 in e654fd60d8 outdated
    151+    size_t vsize = data_in_out.size();
    152+
    153+    LOCK(cs);
    154+    if (m_bytes_decrypted + vsize > ABORT_LIMIT_BYTES || GetTime() - m_time_last_rekey_send > ABORT_LIMIT_TIME ||
    155+        (gArgs.GetBoolArg("-netencryptionfastrekey", false) && m_bytes_decrypted + vsize > 12 * 1024)) {
    156+        // don't further decrypt and therefor abort connection when counterparty failed to respect rekey limits
    


    practicalswift commented at 6:11 pm on August 23, 2018:
    Nit: “therefore”?
  7. in src/net_message.h:37 in e654fd60d8 outdated
    32+    {
    33+        nTime = 0;
    34+    }
    35+
    36+    virtual bool complete() const = 0;
    37+    virtual uint32_t getMessageSize() const = 0;           //returns 0 when message hat not yet been parsed
    


    practicalswift commented at 6:13 pm on August 23, 2018:
    Nit: “has”?
  8. DrahtBot commented at 6:28 pm on August 23, 2018: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #16362 (gui: Bilingual translation by hebasto)
    • #16324 (Get cs_main out of the critical path in ProcessMessages by TheBlueMatt)
    • #16323 (Call ProcessNewBlock() asynchronously by TheBlueMatt)
    • #16273 (refactor: Remove unused includes by practicalswift)
    • #16248 (Make whitebind/whitelist permissions more flexible by NicolasDorier)
    • #16224 (gui: Bilingual GUI error messages by hebasto)
    • #16202 (Refactor network message deserialization by jonasschnelli)
    • #16097 (WIP: Prevent meaningless negating of arguments by hebasto)
    • #16060 (Bury bip9 deployments by jnewbery)
    • #15649 (Add ChaCha20Poly1305@Bitcoin AEAD by jonasschnelli)
    • #15505 ([p2p] Request NOTFOUND transactions immediately from other outbound peers, when possible by sdaftuar)
    • #15206 (Immediately disconnect on invalid net message checksum by jonasschnelli)
    • #15197 (Refactor and slightly stricter p2p message processing by jonasschnelli)
    • #14046 (net: Refactor message parsing (CNetMessage), adds flexibility by jonasschnelli)
    • #10102 ([experimental] Multiprocess bitcoin by ryanofsky)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  9. laanwj added this to the "Blockers" column in a project

  10. jonasschnelli force-pushed on Aug 23, 2018
  11. jonasschnelli commented at 7:50 pm on August 23, 2018: contributor
    Fixed @practicalswift points.
  12. laanwj removed this from the "Blockers" column in a project

  13. gmaxwell commented at 8:26 pm on August 23, 2018: contributor

    Great work!

    Although optimized crypto is certainly out of scope, we do want to be mindful of making any protocol decisions that would preclude using them. :)

  14. jonasschnelli force-pushed on Aug 24, 2018
  15. jonasschnelli commented at 9:22 am on August 24, 2018: contributor

    Note to reviewers: please review…

    • #14046 Refactor message parsing (CNetMessage), adds flexibility
    • #14047 Add HKDF_HMAC256_L32 and method to negate a private key
    • #14049 Enable libsecp256k1 ecdh module, add ECDH function to CKey
    • #14050 Add chacha20/poly1305 and chacha20poly1305_AEAD from openssh … first (extracted commits from this PR)
  16. DrahtBot added the label Needs rebase on Aug 25, 2018
  17. jonasschnelli force-pushed on Aug 29, 2018
  18. DrahtBot removed the label Needs rebase on Aug 29, 2018
  19. luke-jr commented at 6:20 pm on August 29, 2018: member
    What is the point of NODE_ENCRYPTED? Service bits shouldn’t be used for mere protocol negotiation…
  20. jonasschnelli commented at 7:11 pm on August 29, 2018: contributor

    What is the point of NODE_ENCRYPTED? Service bits shouldn’t be used for mere protocol negotiation…

    This has now been discussed on IRC: https://botbot.me/freenode/bitcoin-core-dev/2018-08-29/?msg=103889728&page=3

  21. jonasschnelli force-pushed on Aug 31, 2018
  22. in src/net_encryption.cpp:163 in 93f64ad566 outdated
    158+
    159+bool BIP151Encryption::EncryptAppendMAC(std::vector<unsigned char>& data_in_out)
    160+{
    161+    // first 3 bytes are the LE uint32 message length the most significant bit
    162+    // indicates to the counterparty that the next message will be using the next
    163+    // key (rekey) with resetted nonce
    


    practicalswift commented at 9:07 pm on September 1, 2018:
    Should be “reset”?
  23. in src/net_encryption.cpp:171 in 93f64ad566 outdated
    166+        return false;
    167+    }
    168+    bool should_rekey = ShouldRekeySend();
    169+    if (should_rekey) {
    170+        // set the rekey flag and signal that the next message will be encrypted
    171+        // with the next key (and resetted sequence)
    


    practicalswift commented at 9:07 pm on September 1, 2018:
    Same here: “reset”?
  24. jonasschnelli force-pushed on Sep 2, 2018
  25. in src/net_encryption.cpp:79 in 9c2fd588eb outdated
    76+                LogPrint(BCLog::NET, "Authentication or decryption failed\n");
    77+                return false;
    78+            }
    79+
    80+            // vRecv holds now the plaintext message excluding the AAD and MAC
    81+            // m_message_size holds the packet size exluding the MAC
    


    practicalswift commented at 8:00 am on September 2, 2018:
    Typo found by codespell: exluding

    jonasschnelli commented at 8:48 am on September 2, 2018:
    Fixed those spelling issues.
  26. jonasschnelli force-pushed on Sep 2, 2018
  27. jonasschnelli force-pushed on Sep 2, 2018
  28. jonasschnelli force-pushed on Sep 2, 2018
  29. Sjors commented at 8:40 am on September 2, 2018: member

    Lightly tested on macOS. I was able to establish an encrypted connection and sync headers to afresh node. It didn’t (immediately) sync blocks though, but maybe that’s normal behavior when you only have 1 peer?

    QT Peers Window doesn’t show the new service flag next to Services, and it also doesn’t show the encryption info, but that can be done in another PR.

    I would move the TODO add option to -connect= to a different PR. I’d also like a way to only accept inbound encrypted peers, and only connect to outbound encrypted peers.

    Can you add more functional tests, e.g. to check that it rotates the key after N bytes?

    I would be nice to have a fork of @sipa’s DNS seeder that finds these nodes on testnet. I’d be happy to switch mine over.

  30. jonasschnelli force-pushed on Sep 2, 2018
  31. in src/net.cpp:2898 in d98eedb3f8 outdated
    2916+    // get encryption handshake data
    2917+    std::vector<unsigned char> handshake_data;
    2918+    pnode->m_encryption_handler->GetHandshakeRequestData(handshake_data);
    2919+
    2920+    // push handshake data
    2921+    LogPrint(BCLog::NET, "Send stealth encryption handshake payload of %d bytes, peer=%d\n", handshake_data.size(), pnode->GetId());
    


    Sjors commented at 11:03 am on September 2, 2018:
    You’re using the term “stealth encryption” in various places, but this term isn’t used in the BIP.
  32. in src/protocol.h:271 in 0971380cca outdated
    267@@ -268,6 +268,9 @@ enum ServiceFlags : uint64_t {
    268     // serving the last 288 (2 day) blocks
    269     // See BIP159 for details on how this is implemented.
    270     NODE_NETWORK_LIMITED = (1 << 10),
    271+    // NODE_ENCRYPTED means that the node does accept encrypted communication after BIP151
    


    Sjors commented at 11:06 am on September 2, 2018:
    “does accept”? Maybe change to “NODE_ENCRYPTED: node accepts encrypted communication, see BIP151”?
  33. jonasschnelli commented at 11:23 am on September 3, 2018: contributor
    I removed the term “stealth encryption” from the source code (plus code comments). Also fixed the protocol.h NODE_ENCRYPTED comment.
  34. in src/net_encryption.h:61 in d98eedb3f8 outdated
    54+    CKey m_ecdh_key;
    55+    CPrivKey m_raw_ecdh_secret;
    56+    CPrivKey m_k1_encryption_keypack; // key1A & key1B (AAD & payload key)
    57+    CPrivKey m_k2_encryption_keypack; // key2A & key2B (AAD & payload key)
    58+    uint256 m_session_id;
    59+    bool m_inbound;
    


    practicalswift commented at 7:14 am on September 5, 2018:
    m_inbound is not initialized in the constructor?
  35. DrahtBot added the label Needs rebase on Sep 5, 2018
  36. jonasschnelli force-pushed on Sep 18, 2018
  37. jonasschnelli commented at 7:54 am on September 18, 2018: contributor
    Rebased.
  38. jonasschnelli removed the label Needs rebase on Sep 18, 2018
  39. practicalswift commented at 8:19 am on September 21, 2018: contributor
    This PR does not seem to compile after rebasing on master :-)
  40. in src/net_encryption.cpp:300 in 6e6f8bc3db outdated
    295+    // After calculating the ECDH secret, the ephemeral key can be cleansed from memory
    296+    m_ecdh_key.SetNull();
    297+    return ret;
    298+}
    299+
    300+BIP151Encryption::BIP151Encryption() : handshake_done(false)
    


    practicalswift commented at 8:27 am on September 21, 2018:
    02018-09-20 04:06:03 clang-tidy(pr=14032): src/net_encryption.cpp:300:1: warning: constructor does not initialize these fields: m_inbound, m_send_aead_ctx, m_recv_aead_ctx [cppcoreguidelines-pro-type-member-init]
    

    practicalswift commented at 8:29 am on September 21, 2018:
    02018-09-20 04:10:08 pvs-studio-analyzer(pr=14032): src/net_encryption.cpp:300 [err] V730 Not all members of a class are initialized inside the constructor. Consider inspecting: m_inbound, m_send_aead_ctx, m_recv_aead_ctx.
    
  41. in src/bench/chacha20poly1305.cpp:29 in 6e6f8bc3db outdated
    24+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    25+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    26+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
    27+
    28+    chacha20poly1305_init(&aead_ctx, aead_keys, 64);
    29+    std::vector<uint8_t> in(bufsize,0);
    


    practicalswift commented at 8:06 am on September 23, 2018:
    02018-09-22 21:25:19 cpplint(pr=14032): src/bench/chacha20poly1305.cpp:29:  Missing space after ,  [whitespace/comma] [3]
    
  42. in src/bench/chacha20poly1305.cpp:30 in 6e6f8bc3db outdated
    25+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    26+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
    27+
    28+    chacha20poly1305_init(&aead_ctx, aead_keys, 64);
    29+    std::vector<uint8_t> in(bufsize,0);
    30+    std::vector<uint8_t> out(bufsize,0);
    


    practicalswift commented at 8:07 am on September 23, 2018:
    02018-09-22 21:25:19 cpplint(pr=14032): src/bench/chacha20poly1305.cpp:30:  Missing space after ,  [whitespace/comma] [3]
    
  43. in src/bench/chacha20poly1305.cpp:51 in 6e6f8bc3db outdated
    46+}
    47+
    48+static void HASH256_(benchmark::State& state, uint64_t bufsize)
    49+{
    50+    uint8_t hash[CHash256::OUTPUT_SIZE];
    51+    std::vector<uint8_t> in(bufsize,0);
    


    practicalswift commented at 8:07 am on September 23, 2018:
    02018-09-22 21:25:19 cpplint(pr=14032): src/bench/chacha20poly1305.cpp:51:  Missing space after ,  [whitespace/comma] [3]
    
  44. in src/net_encryption.h:77 in 6e6f8bc3db outdated
    72+    // check if send channel should rekey
    73+    bool ShouldRekeySend();
    74+
    75+public:
    76+    BIP151Encryption();
    77+    ~BIP151Encryption()
    


    practicalswift commented at 8:17 pm on September 25, 2018:
    02018-09-25 21:57:17 clang(pr=14032): net_encryption.h:77:5: warning: '~BIP151Encryption' overrides a destructor but is not marked 'override' [-Winconsistent-missing-destructor-override]
    
  45. in src/net_encryption.h:161 in 6e6f8bc3db outdated
    156+    uint32_t m_data_pos;
    157+    std::string m_command_name;
    158+
    159+    EncryptionHandlerRef m_encryption_handler;
    160+
    161+    NetCryptedMessage(EncryptionHandlerRef encryption_handler, const CMessageHeader::MessageStartChars& pchMessageStartIn, int nTypeIn, int nVersionIn)
    


    practicalswift commented at 8:19 pm on September 25, 2018:
    02018-09-25 21:57:17 clang(pr=14032): net_encryption.h:161:105: warning: unused parameter 'pchMessageStartIn' [-Wunused-parameter]
    
  46. in src/net.cpp:2660 in 6e6f8bc3db outdated
    2818+    size_t nBytesSent = 0;
    2819 
    2820-    CVectorWriter{SER_NETWORK, INIT_PROTO_VERSION, serializedHeader, 0, hdr};
    2821+    if (should_crypt) {
    2822+        std::vector<unsigned char> serialized_envelope;
    2823+        uint32_t envelope_payload_length = serialized_command_size + nMessageSize;
    


    practicalswift commented at 8:22 pm on September 25, 2018:
    02018-09-25 21:57:17 clang(pr=14032): net.cpp:2815:68: warning: implicit conversion loses integer precision: 'unsigned long' to 'uint32_t' (aka 'unsigned int') [-Wshorten-64-to-32]
    

    sipa commented at 8:37 pm on September 25, 2018:

    @practicalswift Could you slow down the rate of these nits?

    They’re useful, but my mailbox is full of basically just these style of comments. Perhaps these are things to point out when a PR is active, and basically ready for merging, not when it’s laid dormant for weeks. This way it litters the PR page with loads of information that’s distracting for someone who hasn’t even gone to give a concept ACK.


    practicalswift commented at 9:06 pm on September 25, 2018:

    @sipa Absolutely! I’m still calibrating this reporting to increase the signal to noise, so feedback is appreciated!

    I’ll try to find the right threshold for things that are worth commenting about, and also some heuristic for determining which PR:s to analyze. Currently I’m analyzing all open PR:s but that is perhaps overkill.

    There should probably be a max comment count per PR too. This PR is a good example – it is massive (+1800 lines) which gives a high warning count even if the warning ratio is comparable with other PRs (say one warning per 50 lines of code).

    As said - feedback appreciated! :-)


    Sjors commented at 1:02 pm on September 26, 2018:
    I think waiting for either two concept ACK or one utACK / ACK / tACK would make sense.
  47. in test/functional/p2p_encryption.py:23 in 6e6f8bc3db outdated
    18+        connect_nodes(self.nodes[2], 1)
    19+        connect_nodes(self.nodes[2], 3)
    20+        connect_nodes(self.nodes[3], 1)
    21+        self.sync_all()
    22+
    23+    def getEncryptionSessions(self, node):
    


    practicalswift commented at 4:06 pm on September 30, 2018:
    Should be get_encryption_sessions? Could also be a function instead of method since self is not used?
  48. in src/net_encryption.cpp:58 in 6e6f8bc3db outdated
    50+
    51+        // switch state to reading message data
    52+        m_in_data = true;
    53+
    54+        return copy_bytes;
    55+    } else {
    


    practicalswift commented at 4:08 pm on September 30, 2018:
    Could drop this else statement (and keep the block as-is but one indentation level to the left) to make the code easier to follow?
  49. in src/net_encryption.cpp:74 in 6e6f8bc3db outdated
    66+        }
    67+
    68+        memcpy(&vRecv[AAD_LEN + m_data_pos], pch, copy_bytes);
    69+        m_data_pos += copy_bytes;
    70+
    71+        if (Complete()) {
    


    practicalswift commented at 4:12 pm on September 30, 2018:
    Invert logic here to handle the !Complete() case first? That would simplify the code and reduce indentation.
  50. in src/net_processing.cpp:1858 in 6e6f8bc3db outdated
    1598+                return false;
    1599+            }
    1600+            pfrom->m_encryption_handler->EnableEncryption(false);
    1601+            LogPrint(BCLog::NET, "Enabling encryption as handshake-initiator, sessionID=%s, peer=%d\n", pfrom->m_encryption_handler->GetSessionID().ToString(), pfrom->GetId());
    1602+
    1603+            // set the trigger to send the vesrion
    


    practicalswift commented at 8:24 pm on October 16, 2018:
    Should be “version” :-)
  51. DrahtBot added the label Needs rebase on Oct 20, 2018
  52. jonasschnelli force-pushed on Mar 12, 2019
  53. DrahtBot removed the label Needs rebase on Mar 12, 2019
  54. jonasschnelli force-pushed on Mar 12, 2019
  55. MarcoFalke deleted a comment on Mar 13, 2019
  56. MarcoFalke deleted a comment on Mar 13, 2019
  57. MarcoFalke deleted a comment on Mar 13, 2019
  58. MarcoFalke deleted a comment on Mar 13, 2019
  59. MarcoFalke deleted a comment on Mar 13, 2019
  60. MarcoFalke deleted a comment on Mar 13, 2019
  61. MarcoFalke deleted a comment on Mar 13, 2019
  62. jonasschnelli force-pushed on Mar 13, 2019
  63. MarcoFalke deleted a comment on Mar 13, 2019
  64. jonasschnelli force-pushed on Mar 13, 2019
  65. in src/crypto/chacha_poly_aead.cpp:45 in fe3be2d82f outdated
    40+}
    41+
    42+bool ChaCha20Poly1305AEAD::Crypt(uint64_t seqnr, unsigned char* dest, const unsigned char* src, uint32_t len, bool is_encrypt) {
    43+  unsigned char expected_tag[POLY1305_TAGLEN], poly_key[POLY1305_KEYLEN];
    44+  uint64_t seqnr64 = seqnr;
    45+  uint64_t aad_chacha_iv_hdr = 0;
    


    practicalswift commented at 9:49 pm on March 13, 2019:
    Scope could be reduced?
  66. in src/crypto/chacha_poly_aead.h:114 in fe3be2d82f outdated
    109+class ChaCha20Poly1305AEAD
    110+{
    111+private:
    112+    ChaCha20 m_chacha_main;
    113+    ChaCha20 m_chacha_header;
    114+    unsigned char m_aad_keystream_buffer[CHACHA20_ROUND_OUTPUT];
    


    practicalswift commented at 9:52 pm on March 13, 2019:
    Initialize to zero here (or in constructor) to be on the safe side?
  67. in src/protocol.cpp:205 in fe3be2d82f outdated
    200@@ -201,3 +201,30 @@ const std::vector<std::string> &getAllNetMessageTypes()
    201 {
    202     return allNetMessageTypesVec;
    203 }
    204+
    205+uint8_t GetShortCommandIDFromCommand(const std::string cmd) {
    


    practicalswift commented at 9:58 pm on March 13, 2019:
    Is the non-ref const string here intentional? Assuming SSO will take place?
  68. jonasschnelli force-pushed on Mar 22, 2019
  69. DrahtBot added the label Needs rebase on Mar 27, 2019
  70. laanwj referenced this in commit 376638afcf on May 16, 2019
  71. sidhujag referenced this in commit 0a01b31f24 on May 18, 2019
  72. ==== CRYPTO ==== b3cc13e1fd
  73. Enable libsecp256k1 ecdh module, add ecdh function to CKey 31d4f24bb0
  74. QA: Add EC Diffie-Hellman test 50821f8d9d
  75. Add ChaCha20Poly1305@Bitcoin AEAD implementation cb8a15cffd
  76. Add ChaCha20Poly1305@Bitcoin tests 7c93eb7f04
  77. Add ChaCha20Poly1305@Bitcoin AEAD benchmark 6f68673bee
  78. ==== REFACTORING ==== 97f065509e
  79. Use unique pointers for CNetMessage handling a3a9a79f91
  80. Split off format specific details from CNetMessage 99c378dcf0
  81. Move NetMessage (NetMessageBase) to net_message.h/cpp 29a3ac1220
  82. Factor out RecordRecvBytesPerMsgCmd() bd42fbde5c
  83. ==== V2 P2P implementation ==== 1c3668004d
  84. Add new p2p message format for encrypted communication bae1ec2873
  85. Add v2 message transport protocol encryption with static key d1138bada0
  86. Add v2 message transport protocol encryption handshake 3459cc94a0
  87. Add and respect service flag NODE_P2P_V2 59609e6db9
  88. Implement encryption rekeying 2568074332
  89. Avoid ephemeral key->pubkeys that start with net magic 3de5d2415a
  90. Add encryption state and session id to getpeerinfo c45e2a28ba
  91. [QA] add encryption functional test 11f4b77f6a
  92. Implement v2 p2p protocol command short IDs 39bf10fbe3
  93. jonasschnelli force-pushed on May 20, 2019
  94. DrahtBot removed the label Needs rebase on May 20, 2019
  95. DrahtBot commented at 6:54 pm on July 12, 2019: member
  96. DrahtBot added the label Needs rebase on Jul 12, 2019
  97. PastaPastaPasta referenced this in commit e01676c82b on Jan 25, 2020
  98. PastaPastaPasta referenced this in commit be3eaed62b on Jan 25, 2020
  99. in src/net.cpp:584 in 39bf10fbe3
    585-            vRecvMsg.push_back(CNetMessage(Params().MessageStart(), SER_NETWORK, INIT_PROTO_VERSION));
    586-
    587-        CNetMessage& msg = vRecvMsg.back();
    588+        if (vRecvMsg.empty() || vRecvMsg.back()->Complete()) {
    589+            if (m_encryption_handler && m_encryption_handler->ShouldCryptMsg()) {
    590+                vRecvMsg.emplace_back(MakeUnique<NetV2Message>(m_encryption_handler, Params().MessageStart(), SER_NETWORK, INIT_PROTO_VERSION));
    


    fanquake commented at 0:29 am on March 12, 2021:
  100. UdjinM6 referenced this in commit c4f7bb5d72 on Aug 10, 2021
  101. 5tefan referenced this in commit f7d8279f3d on Aug 12, 2021
  102. fanquake commented at 12:25 pm on August 18, 2021: member
    My understanding is that someone else is helping with / taking over these changes, and that the BIP is still being overhauled. I think we’ll be better off with new PRs, and clean discussion when work on the implementation resumes in this repo. Changes from here are be cherry-picked if / when needed. So I’m going to close this PR for now.
  103. fanquake closed this on Aug 18, 2021

  104. michaelfolkson commented at 12:16 pm on August 23, 2021: contributor
    For additional context on above from @fanquake BIP 151 has been withdrawn, the replacement is BIP 324 and the point of contact for BIP 324 appears to be @dhruv from this point on.
  105. dhruv added this to the "Closed unmerged" column in a project

  106. gades referenced this in commit f250a21ad2 on May 8, 2022
  107. DrahtBot locked this on Aug 24, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 21:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me