diff --git a/src/header/mod.rs b/src/header/mod.rs index dcec760..3f81dac 100644 --- a/src/header/mod.rs +++ b/src/header/mod.rs @@ -34,13 +34,13 @@ pub mod routing; // 32 represents size of a MontgomeryPoint on Curve25519 pub const HEADER_SIZE: usize = 32 + HEADER_INTEGRITY_MAC_SIZE + ENCRYPTED_ROUTING_INFO_SIZE; -#[derive(Debug)] -#[cfg_attr(test, derive(Clone))] +#[derive(Debug, Clone)] pub struct SphinxHeader { pub shared_secret: SharedSecret, pub routing_info: EncapsulatedRoutingInformation, } +#[derive(Clone)] pub enum ProcessedHeader { ForwardHop(Box, NodeAddressBytes, Delay, PayloadKey), FinalHop(DestinationAddressBytes, SURBIdentifier, PayloadKey), diff --git a/src/header/routing/destination.rs b/src/header/routing/destination.rs index 69282df..cdb6985 100644 --- a/src/header/routing/destination.rs +++ b/src/header/routing/destination.rs @@ -76,7 +76,7 @@ impl FinalRoutingInformation { // return D || I || PAD PaddedFinalRoutingInformation { value: std::iter::once(self.flag) - .chain(self.version.to_bytes().into_iter()) + .chain(self.version.to_bytes()) .chain(self.destination.as_bytes().iter().cloned()) .chain(self.identifier.iter().cloned()) .chain(padding.iter().cloned()) diff --git a/src/header/routing/nodes.rs b/src/header/routing/nodes.rs index 31358ff..87d5881 100644 --- a/src/header/routing/nodes.rs +++ b/src/header/routing/nodes.rs @@ -69,7 +69,7 @@ impl RoutingInformation { .chain(self.version.to_bytes().iter().cloned()) .chain(self.node_address.as_bytes_ref().iter().cloned()) .chain(self.delay.to_bytes().iter().cloned()) - .chain(self.header_integrity_mac.into_inner().into_iter()) + .chain(self.header_integrity_mac.into_inner()) .chain(self.next_routing_information.iter().cloned()) .collect() } diff --git a/src/surb/mod.rs b/src/surb/mod.rs index 7a88f57..d07a0f9 100644 --- a/src/surb/mod.rs +++ b/src/surb/mod.rs @@ -12,6 +12,7 @@ use std::fmt; /// the address of the first hop in the route of the SURB, and the key material /// used to layer encrypt the payload. #[allow(non_snake_case)] +#[derive(Clone)] pub struct SURB { SURB_header: header::SphinxHeader, first_hop_address: NodeAddressBytes,