p2p: fix data corruption on longer packets #1393
reviewdog [clippy] report
reported by reviewdog 🐶
Findings (0)
Filtered Findings (9)
p2p/src/secret_connection/kdf.rs|23 col 5| error: docs for function which may panic missing # Panics
section
--> p2p/src/secret_connection/kdf.rs:23:5
|
23 | pub fn derive_secrets_and_challenge(shared_secret: &[u8; 32], loc_is_lo: bool) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first possible panic found here
--> p2p/src/secret_connection/kdf.rs:26:9
|
26 | / Hkdf::::new(None, shared_secret)
27 | | .expand(HKDF_INFO, &mut key_material)
28 | | .expect("secret expansion failed");
| |^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
= note: -D clippy::missing-panics-doc
implied by -D warnings
= help: to override -D warnings
add #[allow(clippy::missing_panics_doc)]
p2p/src/secret_connection/nonce.rs|19 col 5| error: docs for function which may panic missing # Panics
section
--> p2p/src/secret_connection/nonce.rs:19:5
|
19 | pub fn increment(&mut self) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first possible panic found here
--> p2p/src/secret_connection/nonce.rs:20:47
|
20 | let counter: u64 = u64::from_le_bytes(self.0[4..].try_into().expect("framing failed"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
p2p/src/secret_connection/protocol.rs|76 col 5| error: docs for function which may panic missing # Panics
section
--> p2p/src/secret_connection/protocol.rs:76:5
|
76 | pub fn decode_initial_handshake(self, bytes: &[u8]) -> Result<EphemeralPublic, Error> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first possible panic found here
--> p2p/src/secret_connection/protocol.rs:85:46
|
85 | let eph_pubkey_bytes: [u8; 32] = bytes[2..].try_into().expect("framing failed");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
p2p/src/secret_connection/protocol.rs|110 col 5| error: docs for function which may panic missing # Panics
section
--> p2p/src/secret_connection/protocol.rs:110:5
|
110 | / pub fn encode_auth_signature(
111 | | self,
112 | | pub_key: &ed25519_consensus::VerificationKey,
113 | | signature: &ed25519_consensus::Signature,
114 | | ) -> Vec {
| |^
|
note: first possible panic found here
--> p2p/src/secret_connection/protocol.rs:129:13
|
129 | / msg.encode_length_delimited(&mut buf)
130 | | .expect("couldn't encode AuthSigMessage proto");
| |_________________________________^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
p2p/src/secret_connection.rs|89 col 32| error: taken reference of right operand
--> p2p/src/secret_connection.rs:89:32
|
89 | let local_eph_pubkey = X25519_BASEPOINT * &local_eph_privkey;
| ^^^^^^^^^^^^^^^^^^^------------------
| |
| help: use the right value directly: local_eph_privkey
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
= note: -D clippy::op-ref
implied by -D warnings
= help: to override -D warnings
add #[allow(clippy::op_ref)]
p2p/src/secret_connection.rs|117 col 32| error: taken reference of right operand
--> p2p/src/secret_connection.rs:117:32
|
117 | let local_eph_pubkey = X25519_BASEPOINT * &local_eph_privkey;
| ^^^^^^^^^^^^^^^^^^^------------------
| |
| help: use the right value directly: local_eph_privkey
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
p2p/src/secret_connection.rs|120 col 29| error: needlessly taken reference of both operands
--> p2p/src/secret_connection.rs:120:29
|
120 | let shared_secret = &local_eph_privkey * &remote_eph_pubkey;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
help: use the values directly
|
120 | let shared_secret = local_eph_privkey * remote_eph_pubkey;
| ~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
p2p/src/secret_connection.rs|271 col 5| error: docs for function which may panic missing # Panics
section
--> p2p/src/secret_connection.rs:271:5
|
271 | pub fn remote_pubkey(&self) -> PublicKey {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first possible panic found here
--> p2p/src/secret_connection.rs:272:9
|
272 | self.remote_pubkey.expect("remote_pubkey uninitialized")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
p2p/src/secret_connection.rs|346 col 5| error: docs for function which may panic missing # Panics
section
--> p2p/src/secret_connection.rs:346:5
|
346 | pub fn split(self) -> Result<(Sender, Receiver), Error> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first possible panic found here
--> p2p/src/secret_connection.rs:347:29
|
347 | let remote_pubkey = self.remote_pubkey.expect("remote_pubkey to be initialized");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc