Skip to content

Commit ab4db17

Browse files
authored
Merge pull request #188 from Freax13/enhancement/clean-up-modules
clean up modules
2 parents 662935c + 321bd4d commit ab4db17

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+753
-766
lines changed

common/loader/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ mod input;
1010
mod kernel;
1111
mod supervisor;
1212

13-
pub use input::Input;
1413
pub use io::input::HashType;
1514

15+
pub use self::input::Input;
16+
1617
#[derive(Debug)]
1718
pub struct LoadCommand {
1819
pub physical_address: PhysFrame,

common/snp-types/src/id_block.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ use bytemuck::{AnyBitPattern, CheckedBitPattern, NoUninit};
44
#[cfg(feature = "p384")]
55
use p384::ecdsa::VerifyingKey;
66

7-
use crate::guest_policy::GuestPolicy;
8-
97
pub use crate::attestation::EcdsaP384Sha384Signature;
8+
use crate::guest_policy::GuestPolicy;
109

1110
#[derive(Debug, Clone, Copy, CheckedBitPattern, NoUninit)]
1211
#[repr(C)]

common/snp-types/src/vmsa.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
//! Related to the VMSA. The VMSA type is aware of VMSA register protection.
22
3+
use core::{
4+
fmt::{self, Debug},
5+
mem::{offset_of, size_of},
6+
};
7+
38
use bit_field::BitArray;
49
use bitflags::bitflags;
510
use bytemuck::{CheckedBitPattern, Pod, Zeroable, bytes_of_mut};
@@ -14,11 +19,6 @@ use x86_64::registers::{
1419

1520
use crate::{Reserved, Uninteresting};
1621

17-
use core::{
18-
fmt::{self, Debug},
19-
mem::{offset_of, size_of},
20-
};
21-
2222
macro_rules! vmsa_field_accessor {
2323
($ident:ident: $ty:ty) => {
2424
// Don't emit anything if $vis is empty (default -> private).

common/tdx-types/src/td_quote.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ use bytemuck::{
77
bytes_of,
88
checked::{CheckedCastError, try_pod_read_unaligned},
99
};
10-
use p256::EncodedPoint;
11-
use p256::ecdsa::{
12-
DerSignature, Signature, VerifyingKey,
13-
signature::{DigestVerifier, Verifier},
10+
use p256::{
11+
EncodedPoint,
12+
ecdsa::{
13+
DerSignature, Signature, VerifyingKey,
14+
signature::{DigestVerifier, Verifier},
15+
},
1416
};
1517
pub use raw::{
1618
AttestationType, Attributes, Body, EnclaveReportBody, Header, QeVendorId, TeeType, Version,

host/mushroom-verify/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
use std::fmt::{self, Display};
22

3-
use io::input::{Header, MAX_HASH_SIZE};
4-
use sha2::{Digest, Sha256};
5-
use thiserror::Error;
6-
73
#[cfg(feature = "insecure")]
84
pub use insecure::forge_insecure_attestation_report;
5+
use io::input::{Header, MAX_HASH_SIZE};
96
pub use loader::{HashType, Input};
7+
use sha2::{Digest, Sha256};
108
#[cfg(feature = "snp")]
119
pub use snp_types::{attestation::TcbVersion, guest_policy::GuestPolicy};
1210
#[cfg(feature = "tdx")]
1311
pub use tdx_types::td_quote::TeeTcbSvn;
12+
use thiserror::Error;
1413

1514
#[cfg(feature = "serde")]
1615
mod hex;

host/mushroom/src/kvm.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ use snp_types::{
3030
use tracing::debug;
3131
use volatile::VolatilePtr;
3232

33-
use crate::{kvm::hidden::KvmCpuid2, slot::Slot};
33+
use self::hidden::KvmCpuid2;
34+
use crate::slot::Slot;
3435

3536
const KVMIO: u8 = 0xAE;
3637
pub const KVM_HC_MAP_GPA_RANGE: u64 = 12;
@@ -1419,7 +1420,7 @@ pub struct KvmTdxExit {
14191420
}
14201421

14211422
mod hidden {
1422-
use super::KvmCpuidEntry2;
1423+
use crate::kvm::KvmCpuidEntry2;
14231424

14241425
#[repr(C)]
14251426
pub struct KvmCpuid2<const N: usize> {

host/mushroom/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ use bytemuck::checked::try_pod_read_unaligned;
1010
use clap::{Args, Parser, Subcommand, ValueEnum};
1111
use loader::{HashType, Input};
1212
use mushroom::{KvmHandle, MushroomResult, Tee, profiler::ProfileFolder};
13-
use mushroom_verify::{Configuration, HashedInput};
14-
use mushroom_verify::{InputHash, OutputHash};
13+
use mushroom_verify::{Configuration, HashedInput, InputHash, OutputHash};
1514
#[cfg(feature = "snp")]
1615
use snp_types::{attestation::TcbVersion, guest_policy::GuestPolicy};
1716
#[cfg(feature = "tdx")]

host/mushroom/src/snp.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ use constants::{
1919
use loader::Input;
2020
use mushroom_verify::snp::{LaunchDigest, create_signature, id_block};
2121
use nix::sys::pthread::pthread_kill;
22+
pub use snp_types::guest_policy::GuestPolicy;
2223
use snp_types::{
2324
PageType,
2425
id_block::{EcdsaP384PublicKey, EcdsaP384Sha384Signature, IdAuthInfo, KeyAlgo, PublicKey},
2526
};
2627
use tracing::{debug, info};
28+
pub use vcek_kds::Vcek;
2729
use x86_64::{
2830
PhysAddr,
2931
structures::paging::{PageSize, PhysFrame, Size2MiB, Size4KiB},
@@ -41,9 +43,6 @@ use crate::{
4143
slot::Slot,
4244
};
4345

44-
pub use snp_types::guest_policy::GuestPolicy;
45-
pub use vcek_kds::Vcek;
46-
4746
#[allow(clippy::too_many_arguments)]
4847
pub fn main(
4948
kvm_handle: &KvmHandle,

rustfmt.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
imports_granularity = "crate"
2+
group_imports = "StdExternalCrate"

tee/kernel/src/char_dev.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use alloc::sync::Arc;
2+
23
use linkme::distributed_slice;
34

45
use crate::{
@@ -8,7 +9,7 @@ use crate::{
89
fd::StrongFileDescriptor,
910
node::{FileAccessContext, LinkLocation},
1011
},
11-
user::process::syscall::args::{OpenFlags, Stat},
12+
user::syscall::args::{OpenFlags, Stat},
1213
};
1314

1415
pub mod char;

0 commit comments

Comments
 (0)