From d4c291dc30ffb58accaeacd325c89165d7457174 Mon Sep 17 00:00:00 2001 From: driftluo Date: Thu, 21 Jul 2022 14:28:16 +0800 Subject: [PATCH 1/3] feat: re-export openssl vendored --- multiaddr/Cargo.toml | 2 ++ secio/Cargo.toml | 3 +++ tentacle/Cargo.toml | 2 ++ 3 files changed, 7 insertions(+) diff --git a/multiaddr/Cargo.toml b/multiaddr/Cargo.toml index b3070f12..ab0e64d2 100644 --- a/multiaddr/Cargo.toml +++ b/multiaddr/Cargo.toml @@ -3,6 +3,8 @@ name = "tentacle-multiaddr" version = "0.3.3" authors = ["driftluo "] edition = "2021" +license = "MIT" +description = "Mini Implementation of multiaddr" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/secio/Cargo.toml b/secio/Cargo.toml index f7bcc814..ba19df04 100644 --- a/secio/Cargo.toml +++ b/secio/Cargo.toml @@ -44,6 +44,9 @@ hmac = "0.12.0" x25519-dalek = "1.1" chacha20poly1305 = "0.9" +[features] +openssl-vendored = ["openssl/vendored"] + [dev-dependencies] env_logger = "0.6" criterion = "0.3" diff --git a/tentacle/Cargo.toml b/tentacle/Cargo.toml index 4ffbe7bc..ad3ee0c1 100644 --- a/tentacle/Cargo.toml +++ b/tentacle/Cargo.toml @@ -78,6 +78,8 @@ tls = ["tokio-rustls"] upnp = ["igd"] unstable = [] +openssl-vendored = ["secio/openssl-vendored"] + # Related to runtime tokio-timer = ["yamux/tokio-timer", "tokio/time", "tokio-runtime"] From 9c666d4a4c6c27b18f0fe5c34c2ba39eda5aee18 Mon Sep 17 00:00:00 2001 From: driftluo Date: Thu, 21 Jul 2022 14:51:51 +0800 Subject: [PATCH 2/3] chore: bump to 0.4.1 --- CHANGELOG.md | 5 +++++ secio/Cargo.toml | 2 +- tentacle/Cargo.toml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22e945c3..f8811ed4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.4.1 + +### Features +- Re-export openssl vendored + ## 0.4.0 ### Bug Fix diff --git a/secio/Cargo.toml b/secio/Cargo.toml index ba19df04..b050a2e6 100644 --- a/secio/Cargo.toml +++ b/secio/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tentacle-secio" -version = "0.5.5" +version = "0.5.6" license = "MIT" description = "Secio encryption protocol for p2p" authors = ["piaoliu ", "Nervos Core Dev "] diff --git a/tentacle/Cargo.toml b/tentacle/Cargo.toml index ad3ee0c1..f9d2cbd9 100644 --- a/tentacle/Cargo.toml +++ b/tentacle/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tentacle" -version = "0.4.0" +version = "0.4.1" license = "MIT" description = "Minimal implementation for a multiplexed p2p network framework." authors = ["piaoliu ", "Nervos Core Dev "] From 108770f3b653973cfdbb424d5a9f596977b1c1a0 Mon Sep 17 00:00:00 2001 From: driftluo Date: Fri, 29 Jul 2022 15:10:17 +0800 Subject: [PATCH 3/3] chore: replace hmac oneshot to update and sign --- secio/src/codec/hmac_compat/openssl_impl.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/secio/src/codec/hmac_compat/openssl_impl.rs b/secio/src/codec/hmac_compat/openssl_impl.rs index 34125d52..9d6f900e 100644 --- a/secio/src/codec/hmac_compat/openssl_impl.rs +++ b/secio/src/codec/hmac_compat/openssl_impl.rs @@ -33,10 +33,9 @@ impl Hmac { /// Signs the data. pub fn sign(&mut self, crypted_data: &[u8]) -> Vec { - Signer::new(self.digest, &self.key) - .expect("init openssl signer ctx fail") - .sign_oneshot_to_vec(crypted_data) - .expect("hmac sign oneshot fail") + let mut sign = Signer::new(self.digest, &self.key).expect("init openssl signer ctx fail"); + sign.update(crypted_data).expect("openssl hmac update fail"); + sign.sign_to_vec().expect("hmac sign oneshot fail") } /// Verifies that the data matches the expected hash.