diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-11-25 11:29:37 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-11-25 11:35:06 +0100 |
commit | 9c6174635ac40a32b273bf78493c1d6db3cc2d34 (patch) | |
tree | 6cb90209caa44931abe6061144af3cfbd61711e5 /openpgp/src | |
parent | 6b3574906ed2cd647a6d4f8dcb3243e3dd0d5616 (diff) |
openpgp: Rename openpgp::constants to openpgp::types.
- Fixes #381.
Diffstat (limited to 'openpgp/src')
35 files changed, 84 insertions, 84 deletions
diff --git a/openpgp/src/crypto/aead.rs b/openpgp/src/crypto/aead.rs index 72d029a4..50255d2f 100644 --- a/openpgp/src/crypto/aead.rs +++ b/openpgp/src/crypto/aead.rs @@ -5,7 +5,7 @@ use std::io; use nettle::{aead, cipher}; use buffered_reader::BufferedReader; -use crate::constants::{ +use crate::types::{ AEADAlgorithm, SymmetricAlgorithm, }; diff --git a/openpgp/src/crypto/asymmetric.rs b/openpgp/src/crypto/asymmetric.rs index 41d61014..e67461ce 100644 --- a/openpgp/src/crypto/asymmetric.rs +++ b/openpgp/src/crypto/asymmetric.rs @@ -5,7 +5,7 @@ use nettle::{dsa, ecc, ecdsa, ed25519, rsa, Yarrow}; use crate::packet::{self, key, Key}; use crate::crypto::SessionKey; use crate::crypto::mpis::{self, MPI}; -use crate::constants::{Curve, HashAlgorithm}; +use crate::types::{Curve, HashAlgorithm}; use crate::Error; use crate::Result; diff --git a/openpgp/src/crypto/ecdh.rs b/openpgp/src/crypto/ecdh.rs index 15228f59..9f281865 100644 --- a/openpgp/src/crypto/ecdh.rs +++ b/openpgp/src/crypto/ecdh.rs @@ -7,7 +7,7 @@ use crate::packet::{ key, }; use crate::Result; -use crate::constants::{ +use crate::types::{ Curve, HashAlgorithm, SymmetricAlgorithm, diff --git a/openpgp/src/crypto/keygrip.rs b/openpgp/src/crypto/keygrip.rs index 66240b92..08afb12a 100644 --- a/openpgp/src/crypto/keygrip.rs +++ b/openpgp/src/crypto/keygrip.rs @@ -2,7 +2,7 @@ use std::fmt; use crate::Error; use crate::Result; -use crate::constants::{Curve, HashAlgorithm}; +use crate::types::{Curve, HashAlgorithm}; use crate::crypto::mpis::{MPI, PublicKey}; /// A proprietary, protocol agnostic identifier for public keys. diff --git a/openpgp/src/crypto/mem.rs b/openpgp/src/crypto/mem.rs index aab9abee..dd4fc244 100644 --- a/openpgp/src/crypto/mem.rs +++ b/openpgp/src/crypto/mem.rs @@ -130,7 +130,7 @@ const ENCRYPTED_MEMORY_PAGE_SIZE: usize = 4096; mod has_access_to_prekey { use std::io::{self, Cursor, Write}; use lazy_static; - use crate::constants::{AEADAlgorithm, HashAlgorithm, SymmetricAlgorithm}; + use crate::types::{AEADAlgorithm, HashAlgorithm, SymmetricAlgorithm}; use crate::crypto::{aead, SessionKey}; use super::*; diff --git a/openpgp/src/crypto/mod.rs b/openpgp/src/crypto/mod.rs index 150014cc..fd43481c 100644 --- a/openpgp/src/crypto/mod.rs +++ b/openpgp/src/crypto/mod.rs @@ -6,7 +6,7 @@ use std::fmt; use nettle::{Random, Yarrow}; -use crate::constants::HashAlgorithm; +use crate::types::HashAlgorithm; use crate::Result; pub(crate) mod aead; diff --git a/openpgp/src/crypto/mpis.rs b/openpgp/src/crypto/mpis.rs index e3a7f483..8500a1ed 100644 --- a/openpgp/src/crypto/mpis.rs +++ b/openpgp/src/crypto/mpis.rs @@ -6,7 +6,7 @@ use std::cmp::Ordering; use quickcheck::{Arbitrary, Gen}; use rand::Rng; -use crate::constants::{ +use crate::types::{ Curve, HashAlgorithm, PublicKeyAlgorithm, diff --git a/openpgp/src/lib.rs b/openpgp/src/lib.rs index a4c54f6e..7f03e08e 100644 --- a/openpgp/src/lib.rs +++ b/openpgp/src/lib.rs @@ -135,8 +135,8 @@ pub mod serialize; mod packet_pile; pub mod message; -pub mod constants; -use crate::constants::{ +pub mod types; +use crate::types::{ PublicKeyAlgorithm, SymmetricAlgorithm, HashAlgorithm, @@ -196,7 +196,7 @@ pub enum Error { /// Unsupported elliptic curve ASN.1 OID. #[fail(display = "Unsupported elliptic curve: {}", _0)] - UnsupportedEllipticCurve(constants::Curve), + UnsupportedEllipticCurve(types::Curve), /// Unsupported symmetric key algorithm. #[fail(display = "Unsupported symmetric algorithm: {}", _0)] @@ -204,11 +204,11 @@ pub enum Error { /// Unsupported AEAD algorithm. #[fail(display = "Unsupported AEAD algorithm: {}", _0)] - UnsupportedAEADAlgorithm(constants::AEADAlgorithm), + UnsupportedAEADAlgorithm(types::AEADAlgorithm), /// Unsupported Compression algorithm. #[fail(display = "Unsupported Compression algorithm: {}", _0)] - UnsupportedCompressionAlgorithm(constants::CompressionAlgorithm), + UnsupportedCompressionAlgorithm(types::CompressionAlgorithm), /// Unsupported signature type. #[fail(display = "Unsupported signature type: {}", _0)] diff --git a/openpgp/src/message/mod.rs b/openpgp/src/message/mod.rs index 2e1981e0..e3b3992b 100644 --- a/openpgp/src/message/mod.rs +++ b/openpgp/src/message/mod.rs @@ -444,9 +444,9 @@ impl ::std::ops::Deref for Message { mod tests { use super::*; - use crate::constants::DataFormat::Text; + use crate::types::DataFormat::Text; use crate::HashAlgorithm; - use crate::constants::CompressionAlgorithm; + use crate::types::CompressionAlgorithm; use crate::SymmetricAlgorithm; use crate::PublicKeyAlgorithm; use crate::SignatureType; @@ -807,9 +807,9 @@ mod tests { let mut lit = Literal::new(Text); lit.set_body(b"data".to_vec()); - let hash = crate::constants::HashAlgorithm::SHA512; + let hash = crate::types::HashAlgorithm::SHA512; let key: key::SecretKey = - crate::packet::key::Key4::generate_ecc(true, crate::constants::Curve::Ed25519) + crate::packet::key::Key4::generate_ecc(true, crate::types::Curve::Ed25519) .unwrap().into(); let mut pair = key.clone().into_keypair().unwrap(); let sig = crate::packet::signature::Builder::new(SignatureType::Binary) @@ -919,9 +919,9 @@ mod tests { let mut lit = Literal::new(Text); lit.set_body(b"data".to_vec()); - let hash = crate::constants::HashAlgorithm::SHA512; + let hash = crate::types::HashAlgorithm::SHA512; let key: key::SecretKey = - crate::packet::key::Key4::generate_ecc(true, crate::constants::Curve::Ed25519) + crate::packet::key::Key4::generate_ecc(true, crate::types::Curve::Ed25519) .unwrap().into(); let mut pair = key.clone().into_keypair().unwrap(); let sig = crate::packet::signature::Builder::new(SignatureType::Binary) diff --git a/openpgp/src/packet/aed.rs b/openpgp/src/packet/aed.rs index 745e925c..a69dc575 100644 --- a/openpgp/src/packet/aed.rs +++ b/openpgp/src/packet/aed.rs @@ -2,7 +2,7 @@ use std::ops::{Deref, DerefMut}; -use crate::constants::{ +use crate::types::{ AEADAlgorithm, SymmetricAlgorithm, }; diff --git a/openpgp/src/packet/compressed_data.rs b/openpgp/src/packet/compressed_data.rs index a66fa7a8..db166ed3 100644 --- a/openpgp/src/packet/compressed_data.rs +++ b/openpgp/src/packet/compressed_data.rs @@ -4,7 +4,7 @@ use std::ops::{Deref, DerefMut}; use crate::packet::{self, Common}; use crate::Packet; use crate::Container; -use crate::constants::CompressionAlgorithm; +use crate::types::CompressionAlgorithm; /// Holds a compressed data packet. /// diff --git a/openpgp/src/packet/key/mod.rs b/openpgp/src/packet/key/mod.rs index 968a062d..a1b3c561 100644 --- a/openpgp/src/packet/key/mod.rs +++ b/openpgp/src/packet/key/mod.rs @@ -63,7 +63,7 @@ use crate::packet::prelude::*; use crate::PublicKeyAlgorithm; use crate::SymmetricAlgorithm; use crate::HashAlgorithm; -use crate::constants::Curve; +use crate::types::Curve; use crate::crypto::s2k::S2K; use crate::Result; use crate::conversions::Time; @@ -1312,7 +1312,7 @@ mod tests { #[test] fn eq() { - use crate::constants::Curve::*; + use crate::types::Curve::*; for curve in vec![NistP256, NistP384, NistP521] { let sign_key : Key4<_, key::UnspecifiedRole> @@ -1336,7 +1336,7 @@ mod tests { #[test] fn roundtrip() { - use crate::constants::Curve::*; + use crate::types::Curve::*; let keys = vec![NistP256, NistP384, NistP521].into_iter().flat_map(|cv| { @@ -1389,7 +1389,7 @@ mod tests { #[test] fn encryption_roundtrip() { use crate::crypto::SessionKey; - use crate::constants::Curve::*; + use crate::types::Curve::*; let keys = vec![NistP256, NistP384, NistP521].into_iter().map(|cv| { Key4::generate_ecc(false, cv).unwrap() @@ -1415,7 +1415,7 @@ mod tests { #[test] fn secret_encryption_roundtrip() { - use crate::constants::Curve::*; + use crate::types::Curve::*; let keys = vec![NistP256, NistP384, NistP521].into_iter().map(|cv| { let k : Key4<key::SecretParts, key::PrimaryRole> @@ -1558,7 +1558,7 @@ mod tests { #[test] fn import_ed25519() { use crate::{Fingerprint, KeyID}; - use crate::constants::SignatureType; + use crate::types::SignatureType; use crate::packet::signature::Signature4; use crate::packet::signature::subpacket::{ Subpacket, SubpacketValue, SubpacketArea}; diff --git a/openpgp/src/packet/literal.rs b/openpgp/src/packet/literal.rs index be21c337..4a2d3ed6 100644 --- a/openpgp/src/packet/literal.rs +++ b/openpgp/src/packet/literal.rs @@ -3,7 +3,7 @@ use std::cmp; use std::time; use quickcheck::{Arbitrary, Gen}; -use crate::constants::DataFormat; +use crate::types::DataFormat; use crate::conversions::Time; use crate::Error; use crate::packet; diff --git a/openpgp/src/packet/pkesk.rs b/openpgp/src/packet/pkesk.rs index 214889bb..3ea83c73 100644 --- a/openpgp/src/packet/pkesk.rs +++ b/openpgp/src/packet/pkesk.rs @@ -336,7 +336,7 @@ mod tests { use crate::PublicKeyAlgorithm; use crate::SymmetricAlgorithm; use crate::HashAlgorithm; - use crate::constants::Curve; + use crate::types::Curve; use crate::packet::key; use crate::packet::key::Key4; use nettle::curve25519; diff --git a/openpgp/src/packet/signature/mod.rs b/openpgp/src/packet/signature/mod.rs index 3e2420df..460dbe21 100644 --- a/openpgp/src/packet/signature/mod.rs +++ b/openpgp/src/packet/signature/mod.rs @@ -3,7 +3,7 @@ use std::fmt; use std::ops::{Deref, DerefMut}; -use crate::constants::Curve; +use crate::types::Curve; use crate::Error; use crate::Result; use crate::crypto::{ @@ -1286,7 +1286,7 @@ mod test { #[test] fn sign_message() { - use crate::constants::Curve; + use crate::types::Curve; let key: Key<key::SecretParts, key::PrimaryRole> = Key4::generate_ecc(true, Curve::Ed25519) diff --git a/openpgp/src/packet/signature/subpacket.rs b/openpgp/src/packet/signature/subpacket.rs index 968f79e6..f0950a1d 100644 --- a/openpgp/src/packet/signature/subpacket.rs +++ b/openpgp/src/packet/signature/subpacket.rs @@ -81,7 +81,7 @@ use crate::{ KeyID, SignatureType, }; -use crate::constants::{ +use crate::types::{ AEADAlgorithm, CompressionAlgorithm, Features, @@ -2727,12 +2727,12 @@ impl signature::Builder { #[test] fn accessors() { - use crate::constants::Curve; + use crate::types::Curve; let pk_algo = PublicKeyAlgorithm::EdDSA; let hash_algo = HashAlgorithm::SHA512; let hash = hash_algo.context().unwrap(); - let mut sig = signature::Builder::new(crate::constants::SignatureType::Binary); + let mut sig = signature::Builder::new(crate::types::SignatureType::Binary); let mut key: crate::packet::key::SecretKey = crate::packet::key::Key4::generate_ecc(true, Curve::Ed25519).unwrap().into(); let mut keypair = key.clone().into_keypair().unwrap(); diff --git a/openpgp/src/packet/skesk.rs b/openpgp/src/packet/skesk.rs index 55064fbd..b39c11f5 100644 --- a/openpgp/src/packet/skesk.rs +++ b/openpgp/src/packet/skesk.rs @@ -13,7 +13,7 @@ use crate::Result; use crate::crypto; use crate::crypto::s2k::S2K; use crate::Error; -use crate::constants::{ +use crate::types::{ AEADAlgorithm, SymmetricAlgorithm, }; diff --git a/openpgp/src/packet_pile.rs b/openpgp/src/packet_pile.rs index 72374aa8..ae533e38 100644 --- a/openpgp/src/packet_pile.rs +++ b/openpgp/src/packet_pile.rs @@ -180,7 +180,7 @@ impl PacketPile { /// /// ```rust /// # extern crate sequoia_openpgp as openpgp; - /// # use openpgp::{Result, constants::{CompressionAlgorithm, DataFormat}, + /// # use openpgp::{Result, types::{CompressionAlgorithm, DataFormat}, /// # Packet, PacketPile, packet::Literal, packet::CompressedData}; /// /// # fn main() { f().unwrap(); } @@ -418,8 +418,8 @@ impl<'a> PacketParserBuilder<'a> { mod test { use super::*; - use crate::constants::CompressionAlgorithm; - use crate::constants::DataFormat::Text; + use crate::types::CompressionAlgorithm; + use crate::types::DataFormat::Text; use crate::packet::Literal; use crate::packet::CompressedData; use crate::packet::seip::SEIP1; diff --git a/openpgp/src/parse/mpis.rs b/openpgp/src/parse/mpis.rs index c247a848..98c3a9e7 100644 --- a/openpgp/src/parse/mpis.rs +++ b/openpgp/src/parse/mpis.rs @@ -8,7 +8,7 @@ use crate::{ SymmetricAlgorithm, HashAlgorithm, }; -use crate::constants::Curve; +use crate::types::Curve; use crate::crypto::mpis::{self, MPI}; use crate::parse::{ PacketHeaderParser, diff --git a/openpgp/src/parse/parse.rs b/openpgp/src/parse/parse.rs index ae07ac24..f6d64b66 100644 --- a/openpgp/src/parse/parse.rs +++ b/openpgp/src/parse/parse.rs @@ -28,7 +28,7 @@ use crate::{ KeyID, crypto::SessionKey, }; -use crate::constants::{ +use crate::types::{ AEADAlgorithm, CompressionAlgorithm, SignatureType, @@ -1734,7 +1734,7 @@ impl_parse_generic_packet!(Literal); #[test] fn literal_parser_test () { - use crate::constants::DataFormat; + use crate::types::DataFormat; { let data = crate::tests::message("literal-mode-b.gpg"); let mut pp = PacketParser::from_bytes(data).unwrap().unwrap(); @@ -1840,7 +1840,7 @@ impl_parse_generic_packet!(CompressedData); #[cfg(any(feature = "compression-deflate", feature = "compression-bzip2"))] #[test] fn compressed_data_parser_test () { - use crate::constants::DataFormat; + use crate::types::DataFormat; let expected = crate::tests::manifesto(); diff --git a/openpgp/src/parse/stream.rs b/openpgp/src/parse/stream.rs index 48c1fd2a..66937de1 100644 --- a/openpgp/src/parse/stream.rs +++ b/openpgp/src/parse/stream.rs @@ -20,7 +20,7 @@ use buffered_reader::BufferedReader; use crate::{ Error, Fingerprint, - constants::{ + types::{ AEADAlgorithm, CompressionAlgorithm, DataFormat, @@ -1067,7 +1067,7 @@ impl DetachedVerifier { /// extern crate failure; /// use std::io::Read; /// use openpgp::crypto::SessionKey; -/// use openpgp::constants::SymmetricAlgorithm; +/// use openpgp::types::SymmetricAlgorithm; /// use openpgp::{KeyID, TPK, Result, packet::{Key, PKESK, SKESK}}; /// use openpgp::parse::stream::*; /// # fn main() { f().unwrap(); } diff --git a/openpgp/src/serialize/mod.rs b/openpgp/src/serialize/mod.rs index 325b181f..136f7545 100644 --- a/openpgp/src/serialize/mod.rs +++ b/openpgp/src/serialize/mod.rs @@ -2486,7 +2486,7 @@ impl Serialize for autocrypt::AutocryptHeader { #[cfg(test)] mod test { use super::*; - use crate::constants::CompressionAlgorithm; + use crate::types::CompressionAlgorithm; use crate::parse::to_unknown_packet; use crate::parse::PacketParserBuilder; use crate::parse::Parse; @@ -2744,7 +2744,7 @@ mod test { // reparse them, and make sure we get the same result. #[test] fn serialize_test_3() { - use crate::constants::DataFormat::Text as T; + use crate::types::DataFormat::Text as T; // serialize_test_1 and serialize_test_2 parse a byte stream. // This tests creates the message, and then serializes and diff --git a/openpgp/src/serialize/padding.rs b/openpgp/src/serialize/padding.rs index d30374a0..4b95c09e 100644 --- a/openpgp/src/serialize/padding.rs +++ b/openpgp/src/serialize/padding.rs @@ -49,7 +49,7 @@ use super::{ writer, stream::Cookie, }; -use crate::constants::{ +use crate::types::{ CompressionAlgorithm, }; @@ -92,7 +92,7 @@ use crate::constants::{ /// use std::io::Write; /// use openpgp::serialize::stream::{Message, LiteralWriter}; /// use openpgp::serialize::p |