From a4447a66045518f3904e2a682732b7eb4e77a927 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Jun 2022 14:25:58 +0000 Subject: [PATCH 1/2] Bump sodiumoxide from 0.2.5 to 0.2.7 Bumps [sodiumoxide](https://github.com/sodiumoxide/sodiumoxide) from 0.2.5 to 0.2.7. - [Release notes](https://github.com/sodiumoxide/sodiumoxide/releases) - [Changelog](https://github.com/sodiumoxide/sodiumoxide/blob/master/CHANGELOG.md) - [Commits](https://github.com/sodiumoxide/sodiumoxide/compare/0.2.5...0.2.7) --- updated-dependencies: - dependency-name: sodiumoxide dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 114 ++++++++++------------------------------------------- Cargo.toml | 2 +- 2 files changed, 22 insertions(+), 94 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0d0312a..d3617aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,12 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "adler32" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" - [[package]] name = "atty" version = "0.2.14" @@ -103,15 +97,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "crc32fast" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" -dependencies = [ - "cfg-if 0.1.10", -] - [[package]] name = "criterion" version = "0.3.5" @@ -216,22 +201,19 @@ dependencies = [ ] [[package]] -name = "either" -version = "1.5.3" +name = "ed25519" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" +checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" +dependencies = [ + "signature", +] [[package]] -name = "filetime" -version = "0.2.16" +name = "either" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0408e2626025178a6a7f7ffc05a25bc47103229f19c113755de7bf63816290c" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "redox_syscall", - "winapi", -] +checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" [[package]] name = "half" @@ -292,30 +274,16 @@ version = "0.2.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74dfca3d9957906e8d1e6a0b641dc9a59848e793f1da2165889fd4f62d10d79c" -[[package]] -name = "libflate" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9135df43b1f5d0e333385cb6e7897ecd1a43d7d11b91ac003f4d2c2d2401fdd" -dependencies = [ - "adler32", - "crc32fast", - "rle-decode-fast", - "take_mut", -] - [[package]] name = "libsodium-sys" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c344ff12b90ef8fa1f0fffacd348c1fd041db331841fec9eab23fdb991f5e73" +checksum = "6b779387cd56adfbc02ea4a668e704f729be8d6a6abd2c27ca5ee537849a92fd" dependencies = [ "cc", "libc", - "libflate", "pkg-config", - "tar", - "vcpkg", + "walkdir", ] [[package]] @@ -453,15 +421,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "redox_syscall" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" -dependencies = [ - "bitflags", -] - [[package]] name = "regex" version = "1.5.6" @@ -486,12 +445,6 @@ version = "0.6.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" -[[package]] -name = "rle-decode-fast" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac" - [[package]] name = "rustc_version" version = "0.2.3" @@ -575,12 +528,19 @@ dependencies = [ "serde", ] +[[package]] +name = "signature" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f054c6c1a6e95179d6f23ed974060dcefb2d9388bb7256900badad682c499de4" + [[package]] name = "sodiumoxide" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585232e78a4fc18133eef9946d3080befdf68b906c51b621531c37e91787fa2b" +checksum = "e26be3acb6c2d9a7aac28482586a7856436af4cfe7100031d219de2d2ecb0028" dependencies = [ + "ed25519", "libc", "libsodium-sys", ] @@ -596,23 +556,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "take_mut" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" - -[[package]] -name = "tar" -version = "0.4.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b55807c0344e1e6c04d7c965f5289c39a8d94ae23ed5c0b57aabac549f871c6" -dependencies = [ - "filetime", - "libc", - "xattr", -] - [[package]] name = "textwrap" version = "0.11.0" @@ -644,12 +587,6 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" -[[package]] -name = "vcpkg" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33dd455d0f96e90a75803cfeb7f948768c08d70a6de9a8d2362461935698bf95" - [[package]] name = "walkdir" version = "2.3.1" @@ -755,12 +692,3 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "xattr" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" -dependencies = [ - "libc", -] diff --git a/Cargo.toml b/Cargo.toml index fd7cfb3..995689c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ license = "GPL-3.0" [dependencies] cbor-codec = ">= 0.7.0" hkdf = { git = "https://github.com/wireapp/hkdf", tag = "v0.3.2"} -sodiumoxide = { version = "^0.2.5", default-features = false, features = ["std"] } +sodiumoxide = { version = "^0.2.7", default-features = false, features = ["std"] } [dev-dependencies] criterion = "0.3" From ca5da7fb7651813a430e0d7f5afb53f1ce3e9091 Mon Sep 17 00:00:00 2001 From: Sebastian Willenborg Date: Tue, 7 Jun 2022 17:20:57 +0200 Subject: [PATCH 2/2] fix: establish sodiumoxide 0.2.7 compatibility --- src/internal/keys.rs | 4 ++-- src/internal/types.rs | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/internal/keys.rs b/src/internal/keys.rs index 9da4ec9..900b275 100644 --- a/src/internal/keys.rs +++ b/src/internal/keys.rs @@ -555,7 +555,7 @@ pub struct Signature { impl Signature { pub fn encode(&self, e: &mut Encoder) -> EncodeResult<()> { e.object(1)?; - e.u8(0).and(e.bytes(&self.sig.0))?; + e.u8(0).and(e.bytes(&self.sig.to_bytes()))?; Ok(()) } @@ -567,7 +567,7 @@ impl Signature { 0 => uniq!( "Signature::sig", sig, - Bytes64::decode(d).map(|v| sign::Signature(v.array))? + Bytes64::decode(d).map(|v| sign::Signature::from_bytes(&v.array))?? ), _ => d.skip()?, } diff --git a/src/internal/types.rs b/src/internal/types.rs index aec25d3..cbf8965 100644 --- a/src/internal/types.rs +++ b/src/internal/types.rs @@ -90,6 +90,7 @@ pub type DecodeResult = Result; #[derive(Debug)] pub enum DecodeError { Decoder(cbor::DecodeError), + SodiumoxideDecoder(sodiumoxide::crypto::sign::Error), InvalidArrayLen(usize), LocalIdentityChanged(IdentityKey), InvalidType(u8, &'static str), @@ -102,6 +103,7 @@ impl fmt::Display for DecodeError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { DecodeError::Decoder(ref e) => write!(f, "CBOR decoder error: {}", e), + DecodeError::SodiumoxideDecoder(ref e) => write!(f, "Sodiumoxide decoder error: {}", e), DecodeError::InvalidArrayLen(n) => write!(f, "CBOR array length mismatch: {}", n), DecodeError::LocalIdentityChanged(_) => write!(f, "Local identity changed"), DecodeError::InvalidType(t, ref s) => write!(f, "Invalid type {}: {}", t, s), @@ -130,3 +132,9 @@ impl From for DecodeError { DecodeError::Decoder(err) } } + +impl From for DecodeError { + fn from(err: sodiumoxide::crypto::sign::Error) -> DecodeError { + DecodeError::SodiumoxideDecoder(err) + } +}