Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cert-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use tdx_attest::{eventlog::read_event_logs, get_quote};

pub enum CertRequestClient {
Local {
ca: CaCert,
ca: Box<CaCert>,
},
Kms {
client: KmsClient<RaClient>,
Expand Down Expand Up @@ -66,7 +66,7 @@ impl CertRequestClient {
KeyProvider::None { key } | KeyProvider::Local { key, .. } => {
let ca = CaCert::new(keys.ca_cert.clone(), key.clone())
.context("Failed to create CA")?;
Ok(CertRequestClient::Local { ca })
Ok(CertRequestClient::Local { ca: Box::new(ca) })
}
KeyProvider::Kms {
url,
Expand Down
36 changes: 0 additions & 36 deletions dstack-util/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use ra_tls::{
kdf::{derive_ecdsa_key, derive_ecdsa_key_pair_from_bytes},
rcgen::KeyPair,
};
use scale::Decode;
use serde::Deserialize;
use std::{collections::HashMap, path::Path};
use std::{
Expand Down Expand Up @@ -237,41 +236,6 @@ fn cmd_rand(rand_args: RandArgs) -> Result<()> {
Ok(())
}

#[derive(Decode)]
struct ParsedReport {
attributes: [u8; 8],
xfam: [u8; 8],
mrtd: [u8; 48],
mrconfigid: [u8; 48],
mrowner: [u8; 48],
mrownerconfig: [u8; 48],
rtmr0: [u8; 48],
rtmr1: [u8; 48],
rtmr2: [u8; 48],
rtmr3: [u8; 48],
servtd_hash: [u8; 48],
}

impl core::fmt::Debug for ParsedReport {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
use hex_fmt::HexFmt as HF;

f.debug_struct("ParsedReport")
.field("attributes", &HF(&self.attributes))
.field("xfam", &HF(&self.xfam))
.field("mrtd", &HF(&self.mrtd))
.field("mrconfigid", &HF(&self.mrconfigid))
.field("mrowner", &HF(&self.mrowner))
.field("mrownerconfig", &HF(&self.mrownerconfig))
.field("rtmr0", &HF(&self.rtmr0))
.field("rtmr1", &HF(&self.rtmr1))
.field("rtmr2", &HF(&self.rtmr2))
.field("rtmr3", &HF(&self.rtmr3))
.field("servtd_hash", &HF(&self.servtd_hash))
.finish()
}
}

fn cmd_show_mrs() -> Result<()> {
let attestation =
ra_tls::attestation::Attestation::local().context("Failed to get attestation")?;
Expand Down
2 changes: 1 addition & 1 deletion gateway/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ async fn maybe_gen_certs(config: &Config, tls_config: &TlsConfig) -> Result<()>
let cert = ra_tls::cert::CertRequest::builder()
.key(&key)
.subject("dstack-gateway")
.alt_names(&[config.rpc_domain.clone()])
.alt_names(std::slice::from_ref(&config.rpc_domain))
.usage_server_auth(true)
.build()
.self_signed()
Expand Down
2 changes: 1 addition & 1 deletion gateway/src/main_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl Proxy {
}

impl ProxyInner {
pub(crate) fn lock(&self) -> MutexGuard<ProxyState> {
pub(crate) fn lock(&self) -> MutexGuard<'_, ProxyState> {
self.state.lock().or_panic("Failed to lock AppState")
}

Expand Down
2 changes: 1 addition & 1 deletion gateway/src/proxy/sni.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn extract_sni(b: &[u8]) -> Option<&[u8]> {
extract_sni_inner(b).ok().map(|r| r.1)
}

fn extract_sni_inner(b: &[u8]) -> Result<(usize, &[u8]), PErr<u8>> {
fn extract_sni_inner(b: &[u8]) -> Result<(usize, &[u8]), PErr<'_, u8>> {
const HANDSHAKE_TYPE_CLIENT_HELLO: usize = 1;
const EXTENSION_TYPE_SNI: usize = 0;
const NAME_TYPE_HOST_NAME: usize = 0;
Expand Down
6 changes: 3 additions & 3 deletions serde-duration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ where
if duration == &Duration::MAX {
return serializer.serialize_str("never");
}
let (value, unit) = if duration.as_secs() % (24 * 3600) == 0 {
let (value, unit) = if duration.as_secs().is_multiple_of(24 * 3600) {
(duration.as_secs() / (24 * 3600), "d")
} else if duration.as_secs() % 3600 == 0 {
} else if duration.as_secs().is_multiple_of(3600) {
(duration.as_secs() / 3600, "h")
} else if duration.as_secs() % 60 == 0 {
} else if duration.as_secs().is_multiple_of(60) {
(duration.as_secs() / 60, "m")
} else {
(duration.as_secs(), "s")
Expand Down
2 changes: 1 addition & 1 deletion supervisor/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl Process {
}
}

pub(crate) fn lock(&self) -> MutexGuard<ProcessStateRT> {
pub(crate) fn lock(&self) -> MutexGuard<'_, ProcessStateRT> {
self.state.lock().or_panic("lock should never fail")
}

Expand Down
6 changes: 0 additions & 6 deletions verifier/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,3 @@ pub enum RtmrEventStatus {
Extra,
Missing,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ErrorResponse {
pub error: String,
pub details: Option<String>,
}
24 changes: 0 additions & 24 deletions verifier/src/verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -760,27 +760,3 @@ impl Mrs {
Ok(())
}
}

mod upgrade_authority {
use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
pub struct BootInfo {
pub mrtd: Vec<u8>,
pub rtmr0: Vec<u8>,
pub rtmr1: Vec<u8>,
pub rtmr2: Vec<u8>,
pub rtmr3: Vec<u8>,
pub mr_aggregated: Vec<u8>,
pub os_image_hash: Vec<u8>,
pub mr_system: Vec<u8>,
pub app_id: Vec<u8>,
pub compose_hash: Vec<u8>,
pub instance_id: Vec<u8>,
pub device_id: Vec<u8>,
pub key_provider_info: Vec<u8>,
pub event_log: String,
pub tcb_status: String,
pub advisory_ids: Vec<String>,
}
}
2 changes: 1 addition & 1 deletion vmm/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ pub struct App {
}

impl App {
fn lock(&self) -> MutexGuard<AppState> {
fn lock(&self) -> MutexGuard<'_, AppState> {
self.state.lock().or_panic("mutex poisoned")
}

Expand Down
Loading