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 | |
parent | 6b3574906ed2cd647a6d4f8dcb3243e3dd0d5616 (diff) |
openpgp: Rename openpgp::constants to openpgp::types.
- Fixes #381.
Diffstat (limited to 'openpgp')
40 files changed, 89 insertions, 89 deletions
diff --git a/openpgp/examples/decrypt-with.rs b/openpgp/examples/decrypt-with.rs index 99ec1fd7..e3b861e5 100644 --- a/openpgp/examples/decrypt-with.rs +++ b/openpgp/examples/decrypt-with.rs @@ -9,7 +9,7 @@ extern crate failure; extern crate sequoia_openpgp as openpgp; use crate::openpgp::crypto::{KeyPair, SessionKey}; -use crate::openpgp::constants::SymmetricAlgorithm; +use crate::openpgp::types::SymmetricAlgorithm; use crate::openpgp::packet::key; use crate::openpgp::parse::{ Parse, diff --git a/openpgp/examples/encrypt-for.rs b/openpgp/examples/encrypt-for.rs index 82f636d9..50f9e35b 100644 --- a/openpgp/examples/encrypt-for.rs +++ b/openpgp/examples/encrypt-for.rs @@ -6,7 +6,7 @@ use std::io; extern crate sequoia_openpgp as openpgp; use crate::openpgp::armor; -use crate::openpgp::constants::KeyFlags; +use crate::openpgp::types::KeyFlags; use crate::openpgp::parse::Parse; use crate::openpgp::serialize::stream::{ Message, LiteralWriter, Encryptor, diff --git a/openpgp/examples/generate-encrypt-decrypt.rs b/openpgp/examples/generate-encrypt-decrypt.rs index a2577906..995ecabd 100644 --- a/openpgp/examples/generate-encrypt-decrypt.rs +++ b/openpgp/examples/generate-encrypt-decrypt.rs @@ -4,7 +4,7 @@ use std::io::{self, Write}; extern crate sequoia_openpgp as openpgp; use crate::openpgp::crypto::SessionKey; -use crate::openpgp::constants::{KeyFlags, SymmetricAlgorithm}; +use crate::openpgp::types::{KeyFlags, SymmetricAlgorithm}; use crate::openpgp::serialize::stream::*; use crate::openpgp::parse::stream::*; diff --git a/openpgp/examples/pad.rs b/openpgp/examples/pad.rs index 6a3d7c96..f63cb105 100644 --- a/openpgp/examples/pad.rs +++ b/openpgp/examples/pad.rs @@ -7,7 +7,7 @@ use std::io; extern crate sequoia_openpgp as openpgp; use crate::openpgp::armor; use crate::openpgp::KeyID; -use crate::openpgp::constants::KeyFlags; +use crate::openpgp::types::KeyFlags; use crate::openpgp::parse::Parse; use crate::openpgp::serialize::stream::{ Message, LiteralWriter, Encryptor, Recipient, diff --git a/openpgp/examples/statistics.rs b/openpgp/examples/statistics.rs index 138497e3..acea38c1 100644 --- a/openpgp/examples/statistics.rs +++ b/openpgp/examples/statistics.rs @@ -11,7 +11,7 @@ use std::env; use std::collections::HashMap; extern crate sequoia_openpgp as openpgp; use crate::openpgp::Packet; -use crate::openpgp::constants::*; +use crate::openpgp::types::*; use crate::openpgp::packet::{user_attribute, header::BodyLength, Tag}; use crate::openpgp::packet::signature::subpacket::SubpacketTag; use crate::openpgp::parse::{Parse, PacketParserResult, PacketParser}; 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}; |