Skip to content

Commit 8137923

Browse files
authored
Merge pull request #120 from nyonson/handshake-module
Move Handshake to own module
2 parents 97566eb + ee09eb7 commit 8137923

6 files changed

Lines changed: 675 additions & 641 deletions

File tree

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ _default:
7373

7474
# Run benchmarks.
7575
bench:
76-
cargo +{{NIGHTLY_TOOLCHAIN}} bench --package bip324 --bench packet_handler
76+
cargo +{{NIGHTLY_TOOLCHAIN}} bench --package bip324 --bench cipher_session
7777

7878
# Run fuzz test: handshake.
7979
@fuzz target="handshake" time="60":

protocol/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The library is designed with a bare `no_std` and "Sans I/O" interface to keep it
66

77
The `futures` feature includes the high-level `AsyncProcotol` type which helps create and manage an encrypted channel.
88

9-
The lower-level `CipherSession` and `Handshake` types can be directly used by applications which require more control. The handshake performs the one-and-a-half round trip dance between the peers in order to generate secret materials. A successful handshake results in a packet handler which performs the encrypt and decrypt operations for the lifetime of the channel.
9+
The lower-level `CipherSession` and `Handshake` types can be directly used by applications which require more control. The handshake performs the one-and-a-half round trip dance between the peers in order to generate secret materials and verify a channel. A successful handshake results in a cipher session which performs the encrypt and decrypt operations for the lifetime of the channel.
1010

1111
## Feature Flags
1212

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ extern crate test;
55
use bip324::{CipherSession, Handshake, InboundCipher, Network, OutboundCipher, PacketType, Role};
66
use test::{black_box, Bencher};
77

8-
fn create_packet_handler_pair() -> (CipherSession, CipherSession) {
8+
fn create_cipher_session_pair() -> (CipherSession, CipherSession) {
99
// Create a proper handshake between Alice and Bob.
1010
let mut alice_init_buffer = vec![0u8; 64];
1111
let mut alice_handshake = Handshake::new(
@@ -62,7 +62,7 @@ fn create_packet_handler_pair() -> (CipherSession, CipherSession) {
6262
#[bench]
6363
fn bench_round_trip_small_packet(b: &mut Bencher) {
6464
let plaintext = b"Hello, World!"; // ~13 bytes.
65-
let (mut alice, mut bob) = create_packet_handler_pair();
65+
let (mut alice, mut bob) = create_cipher_session_pair();
6666

6767
b.iter(|| {
6868
// Encrypt the packet.
@@ -101,7 +101,7 @@ fn bench_round_trip_small_packet(b: &mut Bencher) {
101101
#[bench]
102102
fn bench_round_trip_large_packet(b: &mut Bencher) {
103103
let plaintext = vec![0u8; 4096]; // 4KB packet.
104-
let (mut alice, mut bob) = create_packet_handler_pair();
104+
let (mut alice, mut bob) = create_cipher_session_pair();
105105

106106
b.iter(|| {
107107
// Encrypt the packet.

0 commit comments

Comments
 (0)