diff --git a/src/handshake.rs b/src/handshake.rs index 558b04e..455fa54 100644 --- a/src/handshake.rs +++ b/src/handshake.rs @@ -224,7 +224,6 @@ mod tests { } #[test] - #[should_panic] fn handshake_fails_with_neko_security_mismatch() { let psk: [u8; 32] = [ 31, 48, 29, 177, 88, 236, 186, 84, 65, 51, 214, 243, 174, 24, 45, 101, 229, 129, 62, @@ -243,11 +242,12 @@ mod tests { alice.send(&mut rng, &mut buf).unwrap(); // Pretend to send ek across the webz: client -> server - let _bob = bob.respond(&mut rng, &mut buf).unwrap(); + let bob = bob.respond(&mut rng, &mut buf); + + assert!(bob.is_err()); } #[test] - #[should_panic] fn handshake_fails_with_kem_security_mismatch() { let psk: [u8; 32] = [ 31, 48, 29, 177, 88, 236, 186, 84, 65, 51, 214, 243, 174, 24, 45, 101, 229, 129, 62, @@ -266,11 +266,12 @@ mod tests { alice.send(&mut rng, &mut buf).unwrap(); // Pretend to send ek across the webz: client -> server - let _bob = bob.respond(&mut rng, &mut buf).unwrap(); + let bob = bob.respond(&mut rng, &mut buf); + + assert!(bob.is_err()); } #[test] - #[should_panic] fn handshake_fails_with_psk_mismatch() { let psk: [u8; 32] = [ 31, 48, 29, 177, 88, 236, 186, 84, 65, 51, 214, 243, 174, 24, 45, 101, 229, 129, 62, @@ -289,6 +290,8 @@ mod tests { alice.send(&mut rng, &mut buf).unwrap(); // Pretend to send ek across the webz: client -> server - let _bob = bob.respond(&mut rng, &mut buf).unwrap(); + let bob = bob.respond(&mut rng, &mut buf); + + assert!(bob.is_err()); } } diff --git a/src/transport.rs b/src/transport.rs index 505e55a..271dd72 100644 --- a/src/transport.rs +++ b/src/transport.rs @@ -307,7 +307,6 @@ mod tests { } #[test] - #[should_panic] fn two_way_transport_fails_with_security_level_mismatch() { let shared_secret = [ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, @@ -345,6 +344,6 @@ mod tests { assert_ne!(orig.as_slice(), msg.as_slice()); - bob_recv.decrypt(&mut msg, ad).unwrap(); + assert!(bob_recv.decrypt(&mut msg, ad).is_err()); } }