From c06e6b900da4b49952af886634e02a65f6be55b0 Mon Sep 17 00:00:00 2001 From: Jordan Hand Date: Mon, 14 Aug 2023 14:02:29 -0700 Subject: [PATCH] Rename dpe crates to have dpe prefix Rename crypto, platform, and simulator crates to use dpe-* naming to avoid confusing name collisions. --- crypto/Cargo.lock | 22 ++++----- crypto/Cargo.toml | 2 +- dpe/Cargo.lock | 30 ++++++------ dpe/Cargo.toml | 6 +-- dpe/src/commands/certify_key.rs | 8 ++-- dpe/src/commands/derive_child.rs | 4 +- dpe/src/commands/extend_tci.rs | 4 +- dpe/src/commands/get_certificate_chain.rs | 6 +-- dpe/src/commands/initialize_context.rs | 4 +- dpe/src/commands/rotate_context.rs | 4 +- dpe/src/commands/sign.rs | 6 +-- dpe/src/commands/tag_tci.rs | 4 +- dpe/src/dpe_instance.rs | 8 ++-- dpe/src/lib.rs | 6 +-- dpe/src/x509.rs | 4 +- platform/Cargo.lock | 2 +- platform/Cargo.toml | 2 +- simulator/Cargo.lock | 58 +++++++++++------------ simulator/Cargo.toml | 6 +-- simulator/src/main.rs | 4 +- tools/Cargo.toml | 6 +-- 21 files changed, 98 insertions(+), 98 deletions(-) diff --git a/crypto/Cargo.lock b/crypto/Cargo.lock index 691a5f06..89eeb3dd 100644 --- a/crypto/Cargo.lock +++ b/crypto/Cargo.lock @@ -44,17 +44,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crypto" -version = "0.1.0" -dependencies = [ - "hkdf", - "openssl", - "sha2", - "strum", - "strum_macros", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -76,6 +65,17 @@ dependencies = [ "subtle", ] +[[package]] +name = "dpe-crypto" +version = "0.1.0" +dependencies = [ + "hkdf", + "openssl", + "sha2", + "strum", + "strum_macros", +] + [[package]] name = "foreign-types" version = "0.3.2" diff --git a/crypto/Cargo.toml b/crypto/Cargo.toml index 2514a9b2..ac19fc72 100644 --- a/crypto/Cargo.toml +++ b/crypto/Cargo.toml @@ -1,7 +1,7 @@ # Licensed under the Apache-2.0 license [package] -name = "crypto" +name = "dpe-crypto" version = "0.1.0" edition = "2021" diff --git a/dpe/Cargo.lock b/dpe/Cargo.lock index 8961d411..5af0fbef 100644 --- a/dpe/Cargo.lock +++ b/dpe/Cargo.lock @@ -126,15 +126,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crypto" -version = "0.1.0" -dependencies = [ - "hkdf", - "openssl", - "sha2", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -192,13 +183,26 @@ name = "dpe" version = "0.1.0" dependencies = [ "asn1", - "crypto", + "dpe-crypto", + "dpe-platform", "openssl", - "platform", "x509-parser", "zerocopy", ] +[[package]] +name = "dpe-crypto" +version = "0.1.0" +dependencies = [ + "hkdf", + "openssl", + "sha2", +] + +[[package]] +name = "dpe-platform" +version = "0.1.0" + [[package]] name = "foreign-types" version = "0.3.2" @@ -372,10 +376,6 @@ version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" -[[package]] -name = "platform" -version = "0.1.0" - [[package]] name = "proc-macro2" version = "1.0.52" diff --git a/dpe/Cargo.toml b/dpe/Cargo.toml index 2ca6173f..14468b25 100644 --- a/dpe/Cargo.toml +++ b/dpe/Cargo.toml @@ -11,12 +11,12 @@ dpe_profile_p256_sha256 = [] dpe_profile_p384_sha384 = [] [dependencies] -crypto = {path = "../crypto"} -platform = {path = "../platform"} +dpe-crypto = {path = "../crypto"} +dpe-platform = {path = "../platform"} zerocopy = "0.6.1" [dev-dependencies] asn1 = "0.13.0" openssl = "0.10" x509-parser = "0.14.0" -crypto = {path = "../crypto", features = ["deterministic_rand"]} +dpe-crypto = {path = "../crypto", features = ["deterministic_rand"]} diff --git a/dpe/src/commands/certify_key.rs b/dpe/src/commands/certify_key.rs index c8616a7c..f08ecf86 100644 --- a/dpe/src/commands/certify_key.rs +++ b/dpe/src/commands/certify_key.rs @@ -8,8 +8,8 @@ use crate::{ x509::{MeasurementData, Name, X509CertWriter}, DPE_PROFILE, MAX_CERT_SIZE, MAX_HANDLES, }; -use crypto::Crypto; -use platform::{Platform, PlatformError, MAX_CHUNK_SIZE}; +use dpe_crypto::Crypto; +use dpe_platform::{Platform, PlatformError, MAX_CHUNK_SIZE}; #[repr(C)] #[derive(Debug, PartialEq, Eq, zerocopy::FromBytes, zerocopy::AsBytes)] @@ -165,8 +165,8 @@ mod tests { dpe_instance::tests::{TestTypes, SIMULATION_HANDLE, TEST_LOCALITIES}, support::Support, }; - use crypto::OpensslCrypto; - use platform::DefaultPlatform; + use dpe_crypto::OpensslCrypto; + use dpe_platform::DefaultPlatform; use x509_parser::nom::Parser; use x509_parser::prelude::X509CertificateParser; use x509_parser::prelude::*; diff --git a/dpe/src/commands/derive_child.rs b/dpe/src/commands/derive_child.rs index 95b3fb18..258f77b1 100644 --- a/dpe/src/commands/derive_child.rs +++ b/dpe/src/commands/derive_child.rs @@ -173,8 +173,8 @@ mod tests { support::Support, MAX_HANDLES, }; - use crypto::OpensslCrypto; - use platform::DefaultPlatform; + use dpe_crypto::OpensslCrypto; + use dpe_platform::DefaultPlatform; use zerocopy::AsBytes; const TEST_DERIVE_CHILD_CMD: DeriveChildCmd = DeriveChildCmd { diff --git a/dpe/src/commands/extend_tci.rs b/dpe/src/commands/extend_tci.rs index d3c9159c..1fab032f 100644 --- a/dpe/src/commands/extend_tci.rs +++ b/dpe/src/commands/extend_tci.rs @@ -48,8 +48,8 @@ mod tests { dpe_instance::tests::{TestTypes, SIMULATION_HANDLE, TEST_LOCALITIES}, support::Support, }; - use crypto::OpensslCrypto; - use platform::{DefaultPlatform, AUTO_INIT_LOCALITY}; + use dpe_crypto::OpensslCrypto; + use dpe_platform::{DefaultPlatform, AUTO_INIT_LOCALITY}; use zerocopy::AsBytes; const TEST_EXTEND_TCI_CMD: ExtendTciCmd = ExtendTciCmd { diff --git a/dpe/src/commands/get_certificate_chain.rs b/dpe/src/commands/get_certificate_chain.rs index ca28e40a..60162ab5 100644 --- a/dpe/src/commands/get_certificate_chain.rs +++ b/dpe/src/commands/get_certificate_chain.rs @@ -5,7 +5,7 @@ use crate::{ response::{DpeErrorCode, GetCertificateChainResp, Response, ResponseHdr}, MAX_CERT_SIZE, }; -use platform::{Platform, PlatformError, MAX_CHUNK_SIZE}; +use dpe_platform::{Platform, PlatformError, MAX_CHUNK_SIZE}; #[repr(C)] #[derive(Debug, PartialEq, Eq, zerocopy::FromBytes)] @@ -51,8 +51,8 @@ mod tests { dpe_instance::tests::{TestTypes, TEST_LOCALITIES}, support::test::SUPPORT, }; - use crypto::OpensslCrypto; - use platform::DefaultPlatform; + use dpe_crypto::OpensslCrypto; + use dpe_platform::DefaultPlatform; use zerocopy::AsBytes; const TEST_GET_CERTIFICATE_CHAIN_CMD: GetCertificateChainCmd = GetCertificateChainCmd { diff --git a/dpe/src/commands/initialize_context.rs b/dpe/src/commands/initialize_context.rs index 28bf7e00..99326aae 100644 --- a/dpe/src/commands/initialize_context.rs +++ b/dpe/src/commands/initialize_context.rs @@ -96,8 +96,8 @@ mod tests { dpe_instance::tests::{TestTypes, TEST_LOCALITIES}, support::Support, }; - use crypto::OpensslCrypto; - use platform::DefaultPlatform; + use dpe_crypto::OpensslCrypto; + use dpe_platform::DefaultPlatform; use zerocopy::AsBytes; const TEST_INIT_CTX_CMD: InitCtxCmd = InitCtxCmd { flags: 0x1234_5678 }; diff --git a/dpe/src/commands/rotate_context.rs b/dpe/src/commands/rotate_context.rs index 858cf333..5070b9be 100644 --- a/dpe/src/commands/rotate_context.rs +++ b/dpe/src/commands/rotate_context.rs @@ -65,8 +65,8 @@ mod tests { dpe_instance::tests::{TestTypes, SIMULATION_HANDLE, TEST_HANDLE, TEST_LOCALITIES}, support::Support, }; - use crypto::OpensslCrypto; - use platform::DefaultPlatform; + use dpe_crypto::OpensslCrypto; + use dpe_platform::DefaultPlatform; use zerocopy::AsBytes; const TEST_ROTATE_CTX_CMD: RotateCtxCmd = RotateCtxCmd { diff --git a/dpe/src/commands/sign.rs b/dpe/src/commands/sign.rs index 33279808..373ca3f4 100644 --- a/dpe/src/commands/sign.rs +++ b/dpe/src/commands/sign.rs @@ -6,7 +6,7 @@ use crate::{ response::{DpeErrorCode, Response, ResponseHdr, SignResp}, DPE_PROFILE, }; -use crypto::{Crypto, CryptoBuf, Digest, EcdsaSig, HmacSig}; +use dpe_crypto::{Crypto, CryptoBuf, Digest, EcdsaSig, HmacSig}; #[repr(C)] #[derive(Debug, PartialEq, Eq, zerocopy::FromBytes)] @@ -122,10 +122,10 @@ mod tests { dpe_instance::tests::{TestTypes, SIMULATION_HANDLE, TEST_LOCALITIES}, support::{test::SUPPORT, Support}, }; - use crypto::OpensslCrypto; + use dpe_crypto::OpensslCrypto; + use dpe_platform::DefaultPlatform; use openssl::x509::X509; use openssl::{bn::BigNum, ecdsa::EcdsaSig}; - use platform::DefaultPlatform; use zerocopy::AsBytes; #[cfg(feature = "dpe_profile_p256_sha256")] diff --git a/dpe/src/commands/tag_tci.rs b/dpe/src/commands/tag_tci.rs index 741b5bb0..47a748e0 100644 --- a/dpe/src/commands/tag_tci.rs +++ b/dpe/src/commands/tag_tci.rs @@ -57,8 +57,8 @@ mod tests { dpe_instance::tests::{TestTypes, SIMULATION_HANDLE, TEST_HANDLE, TEST_LOCALITIES}, support::Support, }; - use crypto::OpensslCrypto; - use platform::DefaultPlatform; + use dpe_crypto::OpensslCrypto; + use dpe_platform::DefaultPlatform; use zerocopy::AsBytes; const TEST_TAG_TCI_CMD: TagTciCmd = TagTciCmd { diff --git a/dpe/src/dpe_instance.rs b/dpe/src/dpe_instance.rs index d36cd533..6a978bbc 100644 --- a/dpe/src/dpe_instance.rs +++ b/dpe/src/dpe_instance.rs @@ -13,8 +13,8 @@ use crate::{ DPE_PROFILE, INTERNAL_INPUT_INFO_SIZE, MAX_HANDLES, }; use core::mem::size_of; -use crypto::{Crypto, Digest, Hasher}; -use platform::{Platform, MAX_CHUNK_SIZE}; +use dpe_crypto::{Crypto, Digest, Hasher}; +use dpe_platform::{Platform, MAX_CHUNK_SIZE}; use zerocopy::AsBytes; pub trait DpeTypes { @@ -394,8 +394,8 @@ pub mod tests { use crate::response::NewHandleResp; use crate::support::test::SUPPORT; use crate::{commands::CommandHdr, CURRENT_PROFILE_MAJOR_VERSION}; - use crypto::OpensslCrypto; - use platform::{DefaultPlatform, AUTO_INIT_LOCALITY, MAX_CHUNK_SIZE, TEST_CERT_CHAIN}; + use dpe_crypto::OpensslCrypto; + use dpe_platform::{DefaultPlatform, AUTO_INIT_LOCALITY, MAX_CHUNK_SIZE, TEST_CERT_CHAIN}; use zerocopy::AsBytes; pub struct TestTypes; diff --git a/dpe/src/lib.rs b/dpe/src/lib.rs index 965dd365..5874dabf 100644 --- a/dpe/src/lib.rs +++ b/dpe/src/lib.rs @@ -48,10 +48,10 @@ impl DpeProfile { pub const fn get_hash_size(&self) -> usize { self.get_tci_size() } - pub const fn alg_len(&self) -> crypto::AlgLen { + pub const fn alg_len(&self) -> dpe_crypto::AlgLen { match self { - DpeProfile::P256Sha256 => crypto::AlgLen::Bit256, - DpeProfile::P384Sha384 => crypto::AlgLen::Bit384, + DpeProfile::P256Sha256 => dpe_crypto::AlgLen::Bit256, + DpeProfile::P384Sha384 => dpe_crypto::AlgLen::Bit384, } } } diff --git a/dpe/src/x509.rs b/dpe/src/x509.rs index 396cd7b8..b6f1c14f 100644 --- a/dpe/src/x509.rs +++ b/dpe/src/x509.rs @@ -10,7 +10,7 @@ use crate::{ tci::{TciMeasurement, TciNodeData}, DpeProfile, DPE_PROFILE, }; -use crypto::{EcdsaPub, EcdsaSig}; +use dpe_crypto::{EcdsaPub, EcdsaSig}; /// Type for specifying an X.509 RelativeDistinguisedName /// @@ -1119,7 +1119,7 @@ mod tests { use crate::tci::{TciMeasurement, TciNodeData}; use crate::x509::{MeasurementData, Name, X509CertWriter}; use crate::DPE_PROFILE; - use crypto::{AlgLen, CryptoBuf, EcdsaPub, EcdsaSig}; + use dpe_crypto::{AlgLen, CryptoBuf, EcdsaPub, EcdsaSig}; use std::str; use x509_parser::certificate::X509CertificateParser; use x509_parser::nom::Parser; diff --git a/platform/Cargo.lock b/platform/Cargo.lock index b1ce8d85..d26512ce 100644 --- a/platform/Cargo.lock +++ b/platform/Cargo.lock @@ -3,5 +3,5 @@ version = 3 [[package]] -name = "platform" +name = "dpe-platform" version = "0.1.0" diff --git a/platform/Cargo.toml b/platform/Cargo.toml index c8381a30..bc1f9843 100644 --- a/platform/Cargo.toml +++ b/platform/Cargo.toml @@ -1,6 +1,6 @@ # Licensed under the Apache-2.0 license [package] -name = "platform" +name = "dpe-platform" version = "0.1.0" edition = "2021" \ No newline at end of file diff --git a/simulator/Cargo.lock b/simulator/Cargo.lock index 7a4329ce..a64fe01f 100644 --- a/simulator/Cargo.lock +++ b/simulator/Cargo.lock @@ -96,15 +96,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crypto" -version = "0.1.0" -dependencies = [ - "hkdf", - "openssl", - "sha2", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -140,11 +131,38 @@ dependencies = [ name = "dpe" version = "0.1.0" dependencies = [ - "crypto", - "platform", + "dpe-crypto", + "dpe-platform", "zerocopy", ] +[[package]] +name = "dpe-crypto" +version = "0.1.0" +dependencies = [ + "hkdf", + "openssl", + "sha2", +] + +[[package]] +name = "dpe-platform" +version = "0.1.0" + +[[package]] +name = "dpe-simulator" +version = "0.1.0" +dependencies = [ + "clap", + "ctrlc", + "dpe", + "dpe-crypto", + "dpe-platform", + "env_logger", + "log", + "openssl", +] + [[package]] name = "env_logger" version = "0.10.0" @@ -358,10 +376,6 @@ version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" -[[package]] -name = "platform" -version = "0.1.0" - [[package]] name = "proc-macro-error" version = "1.0.4" @@ -446,20 +460,6 @@ dependencies = [ "digest", ] -[[package]] -name = "simulator" -version = "0.1.0" -dependencies = [ - "clap", - "crypto", - "ctrlc", - "dpe", - "env_logger", - "log", - "openssl", - "platform", -] - [[package]] name = "static_assertions" version = "1.1.0" diff --git a/simulator/Cargo.toml b/simulator/Cargo.toml index 2b4f515b..980db5d7 100644 --- a/simulator/Cargo.toml +++ b/simulator/Cargo.toml @@ -1,7 +1,7 @@ # Licensed under the Apache-2.0 license [package] -name = "simulator" +name = "dpe-simulator" version = "0.1.0" edition = "2021" @@ -14,5 +14,5 @@ clap = { version = "4.1.8", features = ["derive"] } log = "0.4.17" env_logger = "0.10.0" dpe = { path = "../dpe" } -crypto = { path = "../crypto", features = ["openssl"] } -platform = { path = "../platform" } +dpe-crypto = { path = "../crypto", features = ["openssl"] } +dpe-platform = { path = "../platform" } diff --git a/simulator/src/main.rs b/simulator/src/main.rs index 8a91b00b..44646ffd 100644 --- a/simulator/src/main.rs +++ b/simulator/src/main.rs @@ -1,9 +1,9 @@ // Licensed under the Apache-2.0 license use clap::Parser; -use crypto::OpensslCrypto; +use dpe_crypto::OpensslCrypto; +use dpe_platform::DefaultPlatform; use log::{error, info, trace, warn}; -use platform::DefaultPlatform; use std::fs; use std::io::{Error, ErrorKind, Read, Write}; use std::os::unix::net::{UnixListener, UnixStream}; diff --git a/tools/Cargo.toml b/tools/Cargo.toml index e41aca8d..88b5ac4c 100644 --- a/tools/Cargo.toml +++ b/tools/Cargo.toml @@ -1,7 +1,7 @@ # Licensed under the Apache-2.0 license [package] -name = "tools" +name = "dpe-tools" version = "0.1.0" edition = "2021" @@ -12,9 +12,9 @@ dpe_profile_p384_sha384 = ["dpe/dpe_profile_p384_sha384"] [dependencies] dpe = {path = "../dpe"} -crypto = {path = "../crypto", features = ["deterministic_rand"]} +dpe-crypto = {path = "../crypto", features = ["deterministic_rand"]} pem = "2" -platform = {path = "../platform"} +dpe-platform = {path = "../platform"} zerocopy = "0.6.1" clap = { version = "4.3.17", features = ["derive"] }