From 68135594629dda42eb4e313969161f9305c654d1 Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Tue, 21 Mar 2017 16:15:20 +0800 Subject: [PATCH] accomodate change in nightly TryFrom related: https://github.com/rust-lang/rust/pull/40281 --- src/session.rs | 4 ++-- tests/lib.rs | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/session.rs b/src/session.rs index d4c8a753..25608aea 100644 --- a/src/session.rs +++ b/src/session.rs @@ -118,9 +118,9 @@ impl Into for HandshakeState { } impl TryFrom for TransportState { - type Err = NoiseError; + type Error = NoiseError; - fn try_from(old: HandshakeState) -> Result { + fn try_from(old: HandshakeState) -> Result { let initiator = old.is_initiator(); let cipherstates = old.finish()?; Ok(TransportState::new(cipherstates, initiator)) diff --git a/tests/lib.rs b/tests/lib.rs index 1b96fbd7..65409e61 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -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();