From 173bec26a5eb204d6fa92ee20abdc98480f9780f Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 20 Jul 2020 20:55:03 -0400 Subject: [PATCH] Update to latest packages; ed25519 now needs signature crate traits. --- tor-bytes/Cargo.toml | 5 +++-- tor-bytes/src/impls.rs | 11 ++++++----- tor-cert/Cargo.toml | 3 ++- tor-cert/src/lib.rs | 1 + tor-llcrypto/Cargo.toml | 17 +++++++++-------- tor-llcrypto/tests/testvec.rs | 3 ++- tor-netdoc/Cargo.toml | 5 +++-- tor-netdoc/src/routerdesc.rs | 1 + tor-proto/Cargo.toml | 12 ++++++------ 9 files changed, 33 insertions(+), 25 deletions(-) diff --git a/tor-bytes/Cargo.toml b/tor-bytes/Cargo.toml index 75080b6c4..e3b3d37b4 100644 --- a/tor-bytes/Cargo.toml +++ b/tor-bytes/Cargo.toml @@ -10,10 +10,11 @@ publish = false tor-llcrypto = { path="../tor-llcrypto" } arrayref = "0.3.6" -generic-array = "0.14.2" +generic-array = "0.14.3" crypto-mac = "0.8.0" thiserror = "1.0.20" +signature = "1.1.0" [dev-dependencies] -hex-literal = "0.2.1" +hex-literal = "0.3.0" diff --git a/tor-bytes/src/impls.rs b/tor-bytes/src/impls.rs index 97f8ead53..40463d4b3 100644 --- a/tor-bytes/src/impls.rs +++ b/tor-bytes/src/impls.rs @@ -149,26 +149,27 @@ mod net_impls { /// Implement Readable and Writeable for Ed25519 types. mod ed25519_impls { use super::*; - use tor_llcrypto::pk::ed25519::{PublicKey, Signature}; + use signature::Signature; + use tor_llcrypto::pk::ed25519; - impl Writeable for PublicKey { + impl Writeable for ed25519::PublicKey { fn write_onto(&self, b: &mut B) { b.write_all(self.as_bytes()) } } - impl Readable for PublicKey { + impl Readable for ed25519::PublicKey { fn take_from(b: &mut Reader<'_>) -> Result { let bytes = b.take(32)?; Self::from_bytes(array_ref![bytes, 0, 32]) .map_err(|_| Error::BadMessage("Couldn't decode Ed25519 public key")) } } - impl Writeable for Signature { + impl Writeable for ed25519::Signature { fn write_onto(&self, b: &mut B) { b.write_all(&self.to_bytes()[..]) } } - impl Readable for Signature { + impl Readable for ed25519::Signature { fn take_from(b: &mut Reader<'_>) -> Result { let bytes = b.take(64)?; Self::from_bytes(array_ref![bytes, 0, 64]) diff --git a/tor-cert/Cargo.toml b/tor-cert/Cargo.toml index e520ceceb..bd24f8deb 100644 --- a/tor-cert/Cargo.toml +++ b/tor-cert/Cargo.toml @@ -10,6 +10,7 @@ publish = false caret = { path="../caret" } tor-llcrypto = { path="../tor-llcrypto" } tor-bytes = { path="../tor-bytes" } +signature = "1.1.0" [dev-dependencies] -base64 = "0.12.2" +base64 = "0.12.3" diff --git a/tor-cert/src/lib.rs b/tor-cert/src/lib.rs index 9de38d135..3b16f5eed 100644 --- a/tor-cert/src/lib.rs +++ b/tor-cert/src/lib.rs @@ -29,6 +29,7 @@ #![deny(missing_docs)] use caret::caret_int; +use signature::{Signer, Verifier}; use tor_bytes::{Error, Result}; use tor_bytes::{Readable, Reader, Writeable, Writer}; use tor_llcrypto::pk::*; diff --git a/tor-llcrypto/Cargo.toml b/tor-llcrypto/Cargo.toml index ee0bf4716..15b72c1a0 100644 --- a/tor-llcrypto/Cargo.toml +++ b/tor-llcrypto/Cargo.toml @@ -12,24 +12,25 @@ digest = "0.9.0" typenum = "1.12.0" # XXXX why did I have to downgrade? #generic-array = "0.12" -generic-array = "0.14.2" +generic-array = "0.14.3" aes-ctr = "0.4.0" zeroize = "1.1.0" rsa = "0.3.0" -simple_asn1= "0.4.0" +simple_asn1= "0.4.1" subtle = "2.2.3" -stream-cipher = "0.4.1" +stream-cipher = "0.4.0" num-traits = "0.2.12" num-bigint = "0.3.0" curve25519-dalek = "2.1.0" x25519-dalek = "0.6.0" -ed25519-dalek = "1.0.0-pre.3" -sha-1 = "0.9.0" -sha2 = "0.9.0" -sha3 = "0.9.0" +ed25519-dalek = "1.0.0-pre.4" +sha-1 = "0.9.1" +sha2 = "0.9.1" +sha3 = "0.9.1" [dev-dependencies] -hex-literal = "0.2.1" +hex-literal = "0.3.0" +signature = "*" # This is a magic crate that runs the tests and checks the format # before it lets you commit or push. It installs git hooks for this whenever diff --git a/tor-llcrypto/tests/testvec.rs b/tor-llcrypto/tests/testvec.rs index 562b939f1..8854714a4 100644 --- a/tor-llcrypto/tests/testvec.rs +++ b/tor-llcrypto/tests/testvec.rs @@ -1,6 +1,6 @@ use digest::Digest; use hex_literal::hex; -use stream_cipher::{NewStreamCipher, StreamCipher}; +use stream_cipher::*; use tor_llcrypto as ll; #[test] @@ -48,6 +48,7 @@ fn tv_curve25519() { #[test] fn tv_ed25519() { use ll::pk::ed25519::*; + use signature::{Signer, Verifier}; // Test vectors from RFC 8032. // TEST 1 diff --git a/tor-netdoc/Cargo.toml b/tor-netdoc/Cargo.toml index c05ae5003..1d8e32e38 100644 --- a/tor-netdoc/Cargo.toml +++ b/tor-netdoc/Cargo.toml @@ -15,6 +15,7 @@ digest = "0.9.0" phf = { version = "0.8.0", features = ["macros"] } hex = "0.4.2" lazy_static = "1.4.0" -base64 = "0.12.2" +base64 = "0.12.3" thiserror = "1.0.20" -chrono = "0.4.11" +chrono = "0.4.13" +signature = "1.1.0" diff --git a/tor-netdoc/src/routerdesc.rs b/tor-netdoc/src/routerdesc.rs index 326ca4c77..45809ba7e 100644 --- a/tor-netdoc/src/routerdesc.rs +++ b/tor-netdoc/src/routerdesc.rs @@ -43,6 +43,7 @@ use tor_llcrypto as ll; use tor_llcrypto::pk::rsa::RSAIdentity; use digest::Digest; +use signature::{Signature, Verifier}; /// A router descriptor, with possible annotations. #[allow(dead_code)] diff --git a/tor-proto/Cargo.toml b/tor-proto/Cargo.toml index 237d3375f..3728253b7 100644 --- a/tor-proto/Cargo.toml +++ b/tor-proto/Cargo.toml @@ -16,16 +16,16 @@ digest = "0.9.0" rand = "0.7.3" typenum = "1.12.0" # XXXX why did I have to downgrade? -generic-array = "0.14.2" +generic-array = "0.14.3" rand_core = "0.5.1" crypto-mac = "0.8.0" -hmac = "0.8.0" -hkdf = "0.9.0-alpha.0" +hmac = "0.8.1" +hkdf = "0.9.0" zeroize = "1.1.0" subtle = "2.2.3" -stream-cipher = "0.4.1" -sha2 = "0.9.0" +stream-cipher = "0.6.0" +sha2 = "0.9.1" [dev-dependencies] -hex-literal = "0.2.1" +hex-literal = "0.3.0"