Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding deprecation flags for SEV components and bumping to 5.1 #253

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sev"
version = "5.0.0"
version = "5.1.0"
authors = [
"Nathaniel McCallum <[email protected]>",
"The VirTEE Project Developers",
Expand Down
4 changes: 4 additions & 0 deletions src/certs/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// SPDX-License-Identifier: Apache-2.0

/// Legacy SEV certificates.
#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
#[cfg(feature = "sev")]
pub mod sev;

Expand Down
17 changes: 16 additions & 1 deletion src/certs/sev/builtin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,24 @@
//!
//! These are primarily offered as a convenience measure to avoid making
//! HTTP requests to AMD's servers.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You left a deprecated note on this module in src/certs/mod.rs. Why are these deprecation notes also needed?

#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
pub mod genoa;
#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
pub mod milan;
#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
pub mod naples;
#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
pub mod rome;
pub mod turin;
1 change: 0 additions & 1 deletion src/certs/sev/ca/cert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use std::mem::size_of;

use serde::{de, ser};
use serde_bytes::{ByteBuf, Bytes};

/// An OCA certificate.
#[derive(Clone, Copy)]
#[repr(C)]
Expand Down
8 changes: 8 additions & 0 deletions src/certs/sev/ca/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

//! For operating on OCA certificates.

#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
mod cert;
#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
mod chain;

pub use cert::Certificate;
Expand Down
32 changes: 26 additions & 6 deletions src/certs/sev/mod.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
// SPDX-License-Identifier: Apache-2.0

//! Everything needed for working with AMD SEV certificate chains.

#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
pub mod builtin;
#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
pub mod ca;
#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
mod chain;

#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
#[cfg(feature = "openssl")]
mod crypto;
#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
#[allow(clippy::module_inception)]
pub mod sev;

#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
#[cfg(feature = "openssl")]
mod util;

#[cfg(feature = "openssl")]
mod crypto;

pub use chain::Chain;

use crate::util::*;
Expand Down
12 changes: 12 additions & 0 deletions src/firmware/linux/host/types/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
// SPDX-License-Identifier: Apache-2.0

#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
#[cfg(feature = "sev")]
mod sev;

#[cfg(feature = "snp")]
mod snp;

#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
#[cfg(feature = "sev")]
pub use self::sev::*;

Expand Down Expand Up @@ -48,6 +56,10 @@ impl<'a> GetId<'a> {
/// Reset the platform's persistent state.
///
/// (Chapter 5.5)
#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
#[cfg(feature = "sev")]
#[cfg(target_os = "linux")]
pub struct PlatformReset;
4 changes: 4 additions & 0 deletions src/launch/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
//! Operations and types for launching on Linux
pub(crate) mod ioctl;

#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
#[cfg(feature = "sev")]
pub(crate) mod sev;

Expand Down
4 changes: 4 additions & 0 deletions src/launch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#[cfg(any(feature = "sev", feature = "snp"))]
mod linux;

#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
#[cfg(feature = "sev")]
pub mod sev;

Expand Down
18 changes: 18 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,19 @@ pub mod launch;
target_os = "linux"
))]
pub mod measurement;

#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
#[cfg(all(target_os = "linux", feature = "openssl", feature = "sev"))]
pub mod session;
mod util;

#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
pub mod vmsa;

/// Error module.
Expand Down Expand Up @@ -238,10 +248,18 @@ impl codicon::Encoder<()> for Build {
#[derive(Copy, Clone)]
pub enum Generation {
/// First generation EPYC (SEV).
#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
#[cfg(feature = "sev")]
Naples,

/// Second generation EPYC (SEV, SEV-ES).
#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
#[cfg(feature = "sev")]
Rome,

Expand Down
4 changes: 4 additions & 0 deletions src/measurement/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ pub mod vcpu_types;
#[cfg(all(feature = "snp", feature = "openssl"))]
pub mod snp;

#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
#[cfg(all(feature = "sev", feature = "openssl"))]
pub mod sev;

Expand Down
8 changes: 8 additions & 0 deletions src/measurement/sev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ pub fn seves_calc_launch_digest(
Ok(launch_hash.finish())
}

#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
/// Arguments required to calculate the SEV measurement
pub struct SevMeasurementArgs<'a> {
/// Path to OVMF file
Expand All @@ -92,6 +96,10 @@ pub struct SevMeasurementArgs<'a> {
pub append: Option<&'a str>,
}

#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
/// Calculate an SEV launch digest
pub fn sev_calc_launch_digest(
sev_measurement: SevMeasurementArgs,
Expand Down
4 changes: 4 additions & 0 deletions src/measurement/vmsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ use std::{convert::TryFrom, fmt, str::FromStr};
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum SevMode {
/// SEV
#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
Sev,
/// SEV-ES
SevEs,
Expand Down
12 changes: 12 additions & 0 deletions src/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
//! Utilities for creating a secure channel and facilitating the
//! attestation process between the tenant and the AMD SP.

#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
mod key;

use crate::error::SessionError;
Expand All @@ -28,6 +32,10 @@ pub struct Verified(launch::sev::Measurement);
/// Describes a secure channel with the AMD SP.
///
/// This is required for facilitating an SEV launch and attestation.
#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
pub struct Session<T> {
policy: launch::sev::Policy,

Expand Down Expand Up @@ -119,6 +127,10 @@ impl Session<Initialized> {

/// Like the above start function, yet takes PDH as input instead of deriving it from a
/// certificate chain.
#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
pub fn start_pdh(
&self,
pdh: certs::sev::sev::Certificate,
Expand Down
5 changes: 5 additions & 0 deletions src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

//! Helpful primitives for developing the crate.

#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
pub mod cached_chain;

mod impl_const_id;

use std::{
Expand Down
10 changes: 9 additions & 1 deletion src/vmsa/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0

//! Types and abstractions regarding Virtual Machine Save Areas (VMSAs).
//! Types and abstractions regarding Legacy SEV Virtual Machine Save Areas (VMSAs).

#![allow(dead_code)]

Expand Down Expand Up @@ -44,6 +44,10 @@ const ATTR_W_MASK: u16 = 1 << ATTR_W_SHIFT;
/// Virtual Machine Control Block
/// The layout of a VMCB struct is documented in Table B-1 of the
/// AMD64 Architecture Programmer’s Manual, Volume 2: System Programming
#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
#[repr(C, packed)]
#[derive(Default, Serialize, Deserialize, Clone, Copy)]
pub struct VmcbSegment {
Expand All @@ -65,6 +69,10 @@ pub struct VmcbSegment {
/// Virtual Machine Save Area
/// The layout of a VMCB struct is documented in Table B-4 of the
/// AMD64 Architecture Programmer’s Manual, Volume 2: System Programming
#[deprecated(
since = "5.0.0",
note = "Legacy SEV features will no longer be included/supported in library versions past 5"
)]
#[repr(C, packed)]
#[derive(Copy, Clone, Serialize, Deserialize)]
pub struct Vmsa {
Expand Down
Loading