diff --git a/src/async_std/handshake.rs b/src/async_std/handshake.rs index 0c3cdc4..8fe26ef 100644 --- a/src/async_std/handshake.rs +++ b/src/async_std/handshake.rs @@ -34,15 +34,15 @@ pub async fn handshake_client( let mut send_buf = &mut buf[..handshake.send_bytes()]; let handshake = handshake.send_client_hello(&mut send_buf); - stream.write_all(&send_buf).await?; + stream.write_all(send_buf).await?; let mut recv_buf = &mut buf[..handshake.recv_bytes()]; stream.read_exact(&mut recv_buf).await?; - let handshake = handshake.recv_server_hello(&recv_buf)?; + let handshake = handshake.recv_server_hello(recv_buf)?; let mut send_buf = &mut buf[..handshake.send_bytes()]; let handshake = handshake.send_client_auth(&mut send_buf, server_pk)?; - stream.write_all(&send_buf).await?; + stream.write_all(send_buf).await?; let mut recv_buf = &mut buf[..handshake.recv_bytes()]; stream.read_exact(&mut recv_buf).await?; @@ -62,11 +62,11 @@ pub async fn handshake_server( let mut recv_buf = &mut buf[..handshake.recv_bytes()]; stream.read_exact(&mut recv_buf).await?; - let handshake = handshake.recv_client_hello(&recv_buf)?; + let handshake = handshake.recv_client_hello(recv_buf)?; let mut send_buf = &mut buf[..handshake.send_bytes()]; let handshake = handshake.send_server_hello(&mut send_buf); - stream.write_all(&send_buf).await?; + stream.write_all(send_buf).await?; let mut recv_buf = &mut buf[..handshake.recv_bytes()]; stream.read_exact(&mut recv_buf).await?; @@ -74,7 +74,7 @@ pub async fn handshake_server( let mut send_buf = &mut buf[..handshake.send_bytes()]; let handshake = handshake.send_server_accept(&mut send_buf); - stream.write_all(&send_buf).await?; + stream.write_all(send_buf).await?; Ok(handshake.complete()) } diff --git a/src/boxstream.rs b/src/boxstream.rs index 851c0b2..c325682 100644 --- a/src/boxstream.rs +++ b/src/boxstream.rs @@ -212,10 +212,7 @@ impl BoxStreamSend { return Err(Error::GoodbyeSent); } self.goodbye = true; - Ok(encrypt_box_stream_goodbye( - &mut self.key_nonce, - &mut enc[..], - )) + Ok(encrypt_box_stream_goodbye(&mut self.key_nonce, enc)) } /// Returns whether the goodbye message has been sent or not. @@ -251,7 +248,7 @@ fn decrypt_box_stream_header( buf[..MSG_HEADER_LEN].split_at_mut(secretbox::MACBYTES); match secretbox::open_detached( &mut header_body_buf, - &secretbox::Tag::from_slice(&header_tag_buf).unwrap(), + &secretbox::Tag::from_slice(header_tag_buf).unwrap(), &key_nonce.nonce, &key_nonce.key, ) { @@ -261,7 +258,7 @@ fn decrypt_box_stream_header( Ok(Decrypted::Goodbye) } else { Ok(Decrypted::Some( - Header::from_slice(&header_body_buf).unwrap(), + Header::from_slice(header_body_buf).unwrap(), )) } } diff --git a/src/handshake.rs b/src/handshake.rs index 43d9c3b..fef4ede 100644 --- a/src/handshake.rs +++ b/src/handshake.rs @@ -316,7 +316,7 @@ impl Handshake { let (tag_buf, mut enc_buf) = recv_buf.split_at_mut(secretbox::MACBYTES); secretbox::open_detached( &mut enc_buf, - &secretbox::Tag::from_slice(&tag_buf).unwrap(), + &secretbox::Tag::from_slice(tag_buf).unwrap(), &secretbox::Nonce([0; 24]), &secretbox::Key( sha256::hash( @@ -333,7 +333,7 @@ impl Handshake { ) .or(Err(Error::RecvServerAcceptSecretbox))?; let dec_buf = enc_buf; - let sig = ed25519::Signature::from_slice(&dec_buf).unwrap(); + let sig = ed25519::Signature::from_slice(dec_buf).unwrap(); if !ed25519::verify_detached( &sig, &[ @@ -450,7 +450,7 @@ impl Handshake { let (tag_buf, mut enc_buf) = recv_buf.split_at_mut(secretbox::MACBYTES); secretbox::open_detached( &mut enc_buf, - &secretbox::Tag::from_slice(&tag_buf).unwrap(), + &secretbox::Tag::from_slice(tag_buf).unwrap(), &secretbox::Nonce([0; 24]), &secretbox::Key( sha256::hash( diff --git a/src/sync/handshake.rs b/src/sync/handshake.rs index 9c90fac..e29b137 100644 --- a/src/sync/handshake.rs +++ b/src/sync/handshake.rs @@ -33,15 +33,15 @@ pub fn handshake_client( let mut send_buf = &mut buf[..handshake.send_bytes()]; let handshake = handshake.send_client_hello(&mut send_buf); - stream.write_all(&send_buf)?; + stream.write_all(send_buf)?; let mut recv_buf = &mut buf[..handshake.recv_bytes()]; stream.read_exact(&mut recv_buf)?; - let handshake = handshake.recv_server_hello(&recv_buf)?; + let handshake = handshake.recv_server_hello(recv_buf)?; let mut send_buf = &mut buf[..handshake.send_bytes()]; let handshake = handshake.send_client_auth(&mut send_buf, server_pk)?; - stream.write_all(&send_buf)?; + stream.write_all(send_buf)?; let mut recv_buf = &mut buf[..handshake.recv_bytes()]; stream.read_exact(&mut recv_buf)?; @@ -61,11 +61,11 @@ pub fn handshake_server( let mut recv_buf = &mut buf[..handshake.recv_bytes()]; stream.read_exact(&mut recv_buf)?; - let handshake = handshake.recv_client_hello(&recv_buf)?; + let handshake = handshake.recv_client_hello(recv_buf)?; let mut send_buf = &mut buf[..handshake.send_bytes()]; let handshake = handshake.send_server_hello(&mut send_buf); - stream.write_all(&send_buf)?; + stream.write_all(send_buf)?; let mut recv_buf = &mut buf[..handshake.recv_bytes()]; stream.read_exact(&mut recv_buf)?; @@ -73,7 +73,7 @@ pub fn handshake_server( let mut send_buf = &mut buf[..handshake.send_bytes()]; let handshake = handshake.send_server_accept(&mut send_buf); - stream.write_all(&send_buf)?; + stream.write_all(send_buf)?; Ok(handshake.complete()) }