summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-07-02 14:44:14 +0200
committerJustus Winter <justus@sequoia-pgp.org>2019-07-02 15:27:12 +0200
commita5548dc2e4db5b4a5469e7b320f37f89e32bb1b3 (patch)
tree63f8035242560edea8712159b03c7a7218938cc7
parent1d30a4e19d3a812418f81b028781136cdb688492 (diff)
openpgp: Make the crypto::hash module public, remove re-export.
-rw-r--r--openpgp/src/crypto/hash.rs11
-rw-r--r--openpgp/src/crypto/mod.rs4
-rw-r--r--openpgp/src/crypto/mpis.rs2
-rw-r--r--openpgp/src/packet/key.rs2
-rw-r--r--openpgp/src/packet/signature/mod.rs2
-rw-r--r--openpgp/src/parse/parse.rs2
-rw-r--r--openpgp/src/tpk/mod.rs2
-rw-r--r--sqv/src/sqv.rs2
8 files changed, 16 insertions, 11 deletions
diff --git a/openpgp/src/crypto/hash.rs b/openpgp/src/crypto/hash.rs
index 693a795e..625cb5c8 100644
--- a/openpgp/src/crypto/hash.rs
+++ b/openpgp/src/crypto/hash.rs
@@ -37,8 +37,15 @@ impl HashAlgorithm {
}
}
- /// Creates a new Nettle hash context for this algorith. Fails if Sequoia
- /// does not support this algorithm. See `is_supported`.
+ /// Creates a new Nettle hash context for this algorith.
+ ///
+ /// # Errors
+ ///
+ /// Fails with `Error::UnsupportedHashAlgorithm` if Sequoia does
+ /// not support this algorithm. See
+ /// [`HashAlgorithm::is_supported`].
+ ///
+ /// [`HashAlgorithm::is_supported`]: #method.is_supported
pub fn context(self) -> Result<Box<nettle::Hash>> {
use nettle::hash::*;
use nettle::hash::insecure_do_not_use::Sha1;
diff --git a/openpgp/src/crypto/mod.rs b/openpgp/src/crypto/mod.rs
index cc1bdc18..8a37e509 100644
--- a/openpgp/src/crypto/mod.rs
+++ b/openpgp/src/crypto/mod.rs
@@ -12,7 +12,7 @@ use Result;
pub(crate) mod aead;
mod asymmetric;
pub(crate) mod ecdh;
-mod hash;
+pub mod hash;
mod keygrip;
pub use self::keygrip::Keygrip;
pub(crate) mod mem;
@@ -27,8 +27,6 @@ pub use self::asymmetric::{
KeyPair,
};
-pub use self::hash::Hash;
-
/// Holds a session key.
///
/// The session key is cleared when dropped.
diff --git a/openpgp/src/crypto/mpis.rs b/openpgp/src/crypto/mpis.rs
index 5eb44f9a..117529ea 100644
--- a/openpgp/src/crypto/mpis.rs
+++ b/openpgp/src/crypto/mpis.rs
@@ -13,7 +13,7 @@ use constants::{
PublicKeyAlgorithm,
SymmetricAlgorithm,
};
-use crypto::Hash;
+use crypto::hash::Hash;
use crypto::mem::{secure_cmp, Protected};
use serialize::Serialize;
diff --git a/openpgp/src/packet/key.rs b/openpgp/src/packet/key.rs
index 20016769..f0beed7c 100644
--- a/openpgp/src/packet/key.rs
+++ b/openpgp/src/packet/key.rs
@@ -9,7 +9,7 @@ use nettle::Hash as NettleHash;
use nettle::hash::insecure_do_not_use::Sha1;
use Error;
-use crypto::{mem::Protected, mpis, Hash, KeyPair};
+use crypto::{mem::Protected, mpis, hash::Hash, KeyPair};
use packet::Tag;
use packet;
use Packet;
diff --git a/openpgp/src/packet/signature/mod.rs b/openpgp/src/packet/signature/mod.rs
index 67144716..dc161dad 100644
--- a/openpgp/src/packet/signature/mod.rs
+++ b/openpgp/src/packet/signature/mod.rs
@@ -8,7 +8,7 @@ use Error;
use Result;
use crypto::{
mpis,
- Hash,
+ hash::Hash,
Signer,
};
use HashAlgorithm;
diff --git a/openpgp/src/parse/parse.rs b/openpgp/src/parse/parse.rs
index cb2a1fb7..d2e8fda4 100644
--- a/openpgp/src/parse/parse.rs
+++ b/openpgp/src/parse/parse.rs
@@ -15,7 +15,7 @@ use nettle;
use ::buffered_reader::*;
use {
- crypto::{aead, Hash},
+ crypto::{aead, hash::Hash},
Result,
CTB,
BodyLength,
diff --git a/openpgp/src/tpk/mod.rs b/openpgp/src/tpk/mod.rs
index 01630127..5f5fbbbf 100644
--- a/openpgp/src/tpk/mod.rs
+++ b/openpgp/src/tpk/mod.rs
@@ -11,7 +11,7 @@ use time;
use failure;
use {
- crypto::{Hash, Signer},
+ crypto::{hash::Hash, Signer},
Error,
Result,
RevocationStatus,
diff --git a/sqv/src/sqv.rs b/sqv/src/sqv.rs
index 873ca9e8..91ff33f1 100644
--- a/sqv/src/sqv.rs
+++ b/sqv/src/sqv.rs
@@ -16,7 +16,7 @@ use std::collections::{HashMap, HashSet};
use openpgp::{TPK, Packet, packet::Signature, KeyID, RevocationStatus};
use openpgp::constants::HashAlgorithm;
-use openpgp::crypto::Hash;
+use openpgp::crypto::hash::Hash;
use openpgp::parse::{Parse, PacketParserResult, PacketParser};
use openpgp::tpk::TPKParser;