Skip to content

Commit f470fb3

Browse files
authored
Merge pull request #125 from nyonson/std-io
Add a std IO protocol interface
2 parents d7a849a + 22980b9 commit f470fb3

File tree

10 files changed

+657
-53
lines changed

10 files changed

+657
-53
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# BIP324 Encrypted Transport Protocol
1+
# BIP-324 Encrypted Transport Protocol
22

3-
[BIP324](https://github.com/bitcoin/bips/blob/master/bip-0324.mediawiki) describes the V2 encrypted communication protocol for the bitcoin P2P network.
3+
[BIP-324](https://github.com/bitcoin/bips/blob/master/bip-0324.mediawiki) describes the V2 encrypted communication protocol for the bitcoin P2P network.
44

55
## Motivation
66

@@ -10,9 +10,9 @@ Bitcoin's original P2P protocol, "V1", was designed without any encryption. Even
1010
* Plaintext message tampering, without detection, is trivial for a man in the middle (MitM) attacker.
1111
* Nefarious actors may associate metadata, such as IP addresses and transaction origins, without explicitly having to connect directly to peers.
1212

13-
BIP 324 - "V2" - encrypted communication protects against the above issues increasing the privacy and censorship-resistance of the bitcoin ecosystem. Any applications communicating with bitcoin nodes, including light clients, should make use of the V2 protocol.
13+
BIP-324 - "V2" - encrypted communication protects against the above issues increasing the privacy and censorship-resistance of the bitcoin ecosystem. Any applications communicating with bitcoin nodes, including light clients, should make use of the V2 protocol.
1414

1515
## Packages
1616

17-
* `protocol` - Exports the `BIP324` client library.
17+
* `protocol` - Exports the `bip324` client library.
1818
* `proxy` - A small side-car application to enable V2 communication for V1-only applications.

protocol/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ bitcoin_hashes = { version ="0.15.0", default-features = false }
2727
chacha20-poly1305 = { version = "0.1.1", default-features = false }
2828

2929
[dev-dependencies]
30-
# bitcoind version 26.0 includes support for BIP324's V2 protocol, but it is disabled by default.
30+
# bitcoind version 26.0 includes support for BIP-324's V2 protocol, but it is disabled by default.
3131
bitcoind = { package = "corepc-node", version = "0.7.1", default-features = false, features = ["26_0","download"] }
3232
hex = { package = "hex-conservative", version = "0.2.0" }

protocol/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Protocol
22

3-
A BIP324 library to establish and communicate over an encrypted channel.
3+
A BIP-324 library to establish and communicate over an encrypted channel.
44

55
The library is designed with a bare `no_std` and "Sans I/O" interface to keep it as agnostic as possible to application runtimes, but higher level interfaces are exposed for ease of use.
66

protocol/doc/DESIGN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ With Bob's public key, Alice derives the shared secret and ensures the decrypted
88

99
## ChaCha20Poly1305
1010

11-
BIP324 elects to use the ChaCha20Poly1305 Authenticated Encryption with Addition Data (AEAD) algorithm under the hood. This is a combination of the ChaCha20 stream cipher and the Poly1305 message authentication code (MAC). In this context, "authentication" refers to the encrypted message's integrity, not to the identity of either party communicating.
11+
BIP-324 elects to use the ChaCha20Poly1305 Authenticated Encryption with Addition Data (AEAD) algorithm under the hood. This is a combination of the ChaCha20 stream cipher and the Poly1305 message authentication code (MAC). In this context, "authentication" refers to the encrypted message's integrity, not to the identity of either party communicating.
1212

1313
Poly1305 is a purpose-built MAC, as opposed to something like an HMAC using SHA256 which leverages an existing hash scheme to build a message authentication code. Purpose-built introduces new complexity, but also allows for increased performance.

protocol/src/fschacha20poly1305.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: CC0-1.0
22

33
//! Wrap ciphers with automatic re-keying in order to provide [forward secrecy](https://eprint.iacr.org/2001/035.pdf) within a session.
4-
//! Logic is covered by the BIP324 test vectors.
4+
//! Logic is covered by the BIP-324 test vectors.
55
//!
66
//! ## Performance Considerations
77
//!
@@ -51,7 +51,7 @@ impl std::error::Error for Error {
5151
/// A wrapper over ChaCha20Poly1305 AEAD stream cipher which handles automatically changing
5252
/// nonces and re-keying, providing forward secrecy within the session.
5353
///
54-
/// FSChaCha20Poly1305 is used for message packets in BIP324.
54+
/// FSChaCha20Poly1305 is used for message packets in BIP-324.
5555
#[derive(Clone)]
5656
pub struct FSChaCha20Poly1305 {
5757
key: Key,
@@ -138,7 +138,7 @@ impl FSChaCha20Poly1305 {
138138
/// A wrapper over ChaCha20 (unauthenticated) stream cipher which handles automatically changing
139139
/// nonces and re-keying, providing forward secrecy within the session.
140140
///
141-
/// FSChaCha20 is used for lengths in BIP324. Should be noted that the lengths are still
141+
/// FSChaCha20 is used for lengths in BIP-324. Should be noted that the lengths are still
142142
/// implicitly authenticated by the message packets.
143143
#[derive(Clone)]
144144
pub struct FSChaCha20 {

0 commit comments

Comments
 (0)