diff --git a/src/encrypt.rs b/src/encrypt.rs index 65a4a4c7159af0c16942d256e2e20bec0750adcf..d108cf37d7cb0bb59e2660a583a4ef7f4f6c6400 100644 --- a/src/encrypt.rs +++ b/src/encrypt.rs @@ -800,7 +800,7 @@ mod tests { // arbitrary keys let h = SessId::from_slice(&Sha256::digest("some exchange hash".as_bytes())).unwrap(); let sess_id = SessId::from_slice(&Sha256::digest("some sessid".as_bytes())).unwrap(); - let sharedkey = "hello".as_bytes(); + let sharedkey = b"hello"; trace!("algos enc {algos:?}"); let newkeys = Keys::new_from(sharedkey, &h, &sess_id, &algos).unwrap(); @@ -835,9 +835,9 @@ mod tests { let mut keys = KeyState::new_cleartext(); if let Some(algos) = algos { // arbitrary keys - let h = SessId::from_slice(&Sha256::digest("some exchange hash".as_bytes())).unwrap(); - let sess_id = SessId::from_slice(&Sha256::digest("some sessid".as_bytes())).unwrap(); - let sharedkey = "hello".as_bytes(); + let h = SessId::from_slice(&Sha256::digest(b"some exchange hash")).unwrap(); + let sess_id = SessId::from_slice(&Sha256::digest(b"some sessid")).unwrap(); + let sharedkey = b"hello"; let newkeys = Keys::new_from(sharedkey, &h, &sess_id, &algos).unwrap(); diff --git a/src/ident.rs b/src/ident.rs index c7852a8860d99f869059fd31da134bd27dfb0c09..1ee11e397f2860de67e989819ae5815c73b7f387 100644 --- a/src/ident.rs +++ b/src/ident.rs @@ -1,4 +1,4 @@ -use crate::error::{Error,TrapBug}; +use crate::error::{Error,TrapBug, Result}; pub(crate) const OUR_VERSION: &[u8] = b"SSH-2.0-SunsetSSH-0.1"; @@ -81,7 +81,7 @@ impl<'a> RemoteVersion { /// Reads the initial SSH stream to find the version string and returns /// the number of bytes consumed. /// Behaviour is undefined if called later after an error. - pub fn consume(&mut self, buf: &[u8]) -> Result<usize, Error> { + pub fn consume(&mut self, buf: &[u8]) -> Result<usize> { // consume input byte by byte, feeding through the states let mut taken = 0; for &b in buf { @@ -157,11 +157,11 @@ impl<'a> RemoteVersion { #[rustfmt::skip] mod tests { use crate::ident; - use crate::error::{Error,TrapBug}; + use crate::error::{Error,TrapBug,Result}; use crate::sunsetlog::init_test_log; use proptest::prelude::*; - fn test_version(v: &str, split: usize, expect: &str) -> Result<usize, Error> { + fn test_version(v: &str, split: usize, expect: &str) -> Result<usize> { let mut r = ident::RemoteVersion::new(); let split = split.min(v.len()); @@ -187,7 +187,7 @@ mod tests { #[test] /// check round trip of packet enums is right - fn version() -> Result<(), Error> { + fn version() -> Result<()> { let long = core::str::from_utf8(&[60u8; 300]).unwrap(); // split input at various positions let splits = [ diff --git a/src/kex.rs b/src/kex.rs index 4dd659927367bb11fe33d2b6e41657776200eea5..265719b1389056600e238a75862020f91789f65c 100644 --- a/src/kex.rs +++ b/src/kex.rs @@ -672,9 +672,9 @@ mod tests { let serv_conf = kex::AlgoConfig::new(false); let mut serv_version = RemoteVersion::new(); // needs to be hardcoded because that's what we send. - serv_version.consume("SSH-2.0-sunset\r\n".as_bytes()).unwrap(); + serv_version.consume(b"SSH-2.0-sunset\r\n").unwrap(); let mut cli_version = RemoteVersion::new(); - cli_version.consume("SSH-2.0-sunset\r\n".as_bytes()).unwrap(); + cli_version.consume(b"SSH-2.0-sunset\r\n").unwrap(); let mut sb = TestServBehaviour { // TODO: put keys in