Skip to content

Commit

Permalink
accomodate change in nightly TryFrom
Browse files Browse the repository at this point in the history
  • Loading branch information
mcginty committed Mar 21, 2017
1 parent c0dc40a commit 6813559
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ impl Into<Session> for HandshakeState {
}

impl TryFrom<HandshakeState> for TransportState {
type Err = NoiseError;
type Error = NoiseError;

fn try_from(old: HandshakeState) -> Result<Self, Self::Err> {
fn try_from(old: HandshakeState) -> Result<Self, Self::Error> {
let initiator = old.is_initiator();
let cipherstates = old.finish()?;
Ok(TransportState::new(cipherstates, initiator))
Expand Down
9 changes: 9 additions & 0 deletions tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ fn test_oversized_handshake_message() {
assert!(h_i.write_message(&[0u8; 65530], &mut buffer_out).is_err());
}

#[test]
fn test_handshake_max_message_len() {
let params: NoiseParams = "Noise_NN_25519_AESGCM_SHA256".parse().unwrap();
let mut h_i = NoiseBuilder::new(params).build_initiator().unwrap();

let mut buffer_out = [0u8; 65535*2];
assert!(h_i.write_message(&[0u8; 65530], &mut buffer_out).is_err());
}

#[test]
fn test_undersized_handshake_output_buffer() {
let params: NoiseParams = "Noise_NN_25519_AESGCM_SHA256".parse().unwrap();
Expand Down

0 comments on commit 6813559

Please sign in to comment.