summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-11-27 15:30:06 +0100
committerJustus Winter <justus@sequoia-pgp.org>2020-11-27 15:31:51 +0100
commit2def442c97f007f912395588c6d0bad016597e17 (patch)
treefadca7206f1326448ce3abc017db6360e281f191
parentfb1cbfb34ad0a895c449a9bcdcf9c8f5e9298fd9 (diff)
openpgp: Drop dependency on the digest crate.
-rw-r--r--Cargo.lock6
-rw-r--r--openpgp/Cargo.toml3
-rw-r--r--openpgp/src/crypto/backend/sha1cd.rs6
3 files changed, 7 insertions, 8 deletions
diff --git a/Cargo.lock b/Cargo.lock
index b8503533..416289c0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1893,7 +1893,6 @@ dependencies = [
"buffered-reader",
"bzip2",
"chrono",
- "digest 0.9.0",
"dyn-clone",
"ed25519-dalek",
"flate2",
@@ -2027,11 +2026,12 @@ dependencies = [
[[package]]
name = "sha1collisiondetection"
-version = "0.1.0"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c6df2f0600b061bab243ef94c8d077332f2991c232bf44a5e91d0c401523f514"
+checksum = "d1e36ccfbc02df1642fcbd1e92345dd01dbe7199378f1852be1c18a130940593"
dependencies = [
"digest 0.9.0",
+ "generic-array 0.14.4",
"libc",
]
diff --git a/openpgp/Cargo.toml b/openpgp/Cargo.toml
index 41f7e955..c7182007 100644
--- a/openpgp/Cargo.toml
+++ b/openpgp/Cargo.toml
@@ -29,7 +29,6 @@ anyhow = "1"
buffered-reader = { path = "../buffered-reader", version = "0.20", default-features = false }
base64 = "0.13"
bzip2 = { version = "0.4", optional = true }
-digest = "0.9"
dyn-clone = "1"
flate2 = { version = "1.0.1", optional = true }
idna = "0.2"
@@ -39,7 +38,7 @@ libc = "0.2"
memsec = { version = "0.6", default-features = false }
nettle = { version = "7", optional = true }
regex = "1"
-sha1collisiondetection = "0.1"
+sha1collisiondetection = { version = "0.2", default-features = false, features = ["std"] }
thiserror = "1"
backtrace = "0.3.46"
unicode-normalization = "0.1.9"
diff --git a/openpgp/src/crypto/backend/sha1cd.rs b/openpgp/src/crypto/backend/sha1cd.rs
index dd4664ca..2e00652d 100644
--- a/openpgp/src/crypto/backend/sha1cd.rs
+++ b/openpgp/src/crypto/backend/sha1cd.rs
@@ -15,13 +15,13 @@ impl Digest for sha1collisiondetection::Sha1CD {
}
fn update(&mut self, data: &[u8]) {
- digest::Update::update(self, data);
+ sha1collisiondetection::Sha1CD::update(self, data);
}
fn digest(&mut self, digest: &mut [u8]) -> Result<()> {
- let mut d = digest::Output::<sha1collisiondetection::Sha1CD>::default();
+ let mut d = sha1collisiondetection::Output::default();
let r = self.finalize_into_dirty_cd(&mut d);
- digest::Reset::reset(self);
+ self.reset();
let l = digest.len().min(d.len());
&mut digest[..l].copy_from_slice(&d[..l]);
r.map_err(Into::into)