diff --git a/zerotier-core-crypto/Cargo.toml b/zerotier-core-crypto/Cargo.toml index 9d7af8642..3e333767d 100644 --- a/zerotier-core-crypto/Cargo.toml +++ b/zerotier-core-crypto/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "zerotier-core-crypto" version = "0.1.0" -edition = "2018" +edition = "2021" license = "MPL-2.0" authors = ["ZeroTier, Inc. ", "Adam Ierymenko "] diff --git a/zerotier-core-crypto/src/array_concat.rs b/zerotier-core-crypto/src/array_concat.rs index de1baa2de..187b578d9 100644 --- a/zerotier-core-crypto/src/array_concat.rs +++ b/zerotier-core-crypto/src/array_concat.rs @@ -52,3 +52,21 @@ pub fn concat_4_slices(s0: &[u8; S0], s1: &[u8; S1], s2: &[u8; S2], s3: &[u8; S3]) -> [u8; S] { concat_4_slices::(s0, s1, s2, s3) } + + +#[inline(always)] +pub fn concat_5_slices(s0: &[u8], s1: &[u8], s2: &[u8], s3: &[u8], s4: &[u8]) -> [u8; S] { + debug_assert_eq!(S0 + S1 + S2 + S3 + S4, S); + let mut tmp: [u8; S] = unsafe { MaybeUninit::uninit().assume_init() }; + tmp[..S0].copy_from_slice(s0); + tmp[S0..S1].copy_from_slice(s1); + tmp[(S0 + S1)..(S0 + S1 + S2)].copy_from_slice(s2); + tmp[(S0 + S1 + S2)..(S0 + S1 + S2 + S3)].copy_from_slice(s3); + tmp[(S0 + S1 + S2 + S3)..].copy_from_slice(s4); + tmp +} + +#[inline(always)] +pub fn concat_5_arrays(s0: &[u8; S0], s1: &[u8; S1], s2: &[u8; S2], s3: &[u8; S3], s4: &[u8; S4]) -> [u8; S] { + concat_5_slices::(s0, s1, s2, s3, s4) +} diff --git a/zerotier-network-hypervisor/Cargo.toml b/zerotier-network-hypervisor/Cargo.toml index 09d938a61..ca12737a4 100644 --- a/zerotier-network-hypervisor/Cargo.toml +++ b/zerotier-network-hypervisor/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "zerotier-network-hypervisor" version = "2.0.0" -edition = "2018" +edition = "2021" license = "MPL-2.0" authors = ["ZeroTier, Inc. ", "Adam Ierymenko "] diff --git a/zerotier-system-service/Cargo.toml b/zerotier-system-service/Cargo.toml index f8c281099..844c8da39 100644 --- a/zerotier-system-service/Cargo.toml +++ b/zerotier-system-service/Cargo.toml @@ -2,7 +2,7 @@ name = "zerotier-system-service" version = "0.1.0" authors = ["ZeroTier, Inc. ", "Adam Ierymenko "] -edition = "2018" +edition = "2021" license = "MPL-2.0" [profile.release]