pub enum Generation {
Naples,
Rome,
Milan,
Genoa,
Turin,
}Expand description
A representation for EPYC generational product lines.
Implements type conversion traits to determine which generation
a given SEV certificate chain corresponds to. This is helpful for
automatically detecting what platform code is running on, as one
can simply export the SEV certificate chain and attempt to produce
a Generation from it with the TryFrom trait.
§Example
// NOTE: The conversion traits require the `sev` crate to have the
// `openssl` feature enabled.
use std::convert::TryFrom;
use sev::certs::sev::Usage;
use sev::firmware::host::types::Firmware;
use sev::Generation;
let mut firmware = Firmware::open().expect("failed to open /dev/sev");
let chain = firmware.pdh_cert_export()
.expect("unable to export SEV certificates");
let id = firmware.get_identifier().expect("error fetching identifier");
// NOTE: Requesting a signed CEK from AMD's KDS has been omitted for
// brevity.
let generation = Generation::try_from(&chain).expect("not a SEV/ES chain");
match generation {
Generation::Naples => println!("Naples"),
Generation::Rome => println!("Rome"),
}Variants§
Naples
First generation EPYC (SEV).
Rome
Second generation EPYC (SEV, SEV-ES).
Milan
Third generation EPYC (SEV, SEV-ES, SEV-SNP).
Genoa
Fourth generation EPYC (SEV, SEV-ES, SEV-SNP).
Turin
Fifth generation EPYC (SEV, SEV-ES, SEV-SNP).
Implementations§
Source§impl Generation
impl Generation
Sourcepub fn identify_cpu(family: u8, model: u8) -> Result<Self, Error>
pub fn identify_cpu(family: u8, model: u8) -> Result<Self, Error>
Identify the SEV generation based on the CPU family and model.
Sourcepub fn identify_host_generation() -> Result<Self, Error>
pub fn identify_host_generation() -> Result<Self, Error>
Identify the EPYC processor generation based on the CPUID instruction.
Trait Implementations§
Source§impl ByteParser<Generation> for SnpPlatformStatus
impl ByteParser<Generation> for SnpPlatformStatus
Source§const EXPECTED_LEN: Option<usize>
const EXPECTED_LEN: Option<usize>
Expected size of the byte container
Source§type Bytes = [u8; 32]
type Bytes = [u8; 32]
Byte container definition
Must be constructible and mutable as bytes for encoding,
Source§impl ByteParser<Generation> for TcbVersion
impl ByteParser<Generation> for TcbVersion
Source§const EXPECTED_LEN: Option<usize>
const EXPECTED_LEN: Option<usize>
Expected size of the byte container
Source§type Bytes = [u8; 8]
type Bytes = [u8; 8]
Byte container definition
Must be constructible and mutable as bytes for encoding,
Source§impl ByteParser<Generation> for WrappedVlekHashstick
impl ByteParser<Generation> for WrappedVlekHashstick
Source§const EXPECTED_LEN: Option<usize>
const EXPECTED_LEN: Option<usize>
Expected size of the byte container
Source§type Bytes = [u8; 432]
type Bytes = [u8; 432]
Byte container definition
Must be constructible and mutable as bytes for encoding,
Source§impl Clone for Generation
impl Clone for Generation
Source§fn clone(&self) -> Generation
fn clone(&self) -> Generation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Decoder<Generation> for SnpPlatformStatus
impl Decoder<Generation> for SnpPlatformStatus
Source§impl Decoder<Generation> for TcbVersion
impl Decoder<Generation> for TcbVersion
Source§impl Decoder<Generation> for WrappedVlekHashstick
impl Decoder<Generation> for WrappedVlekHashstick
Source§impl Encoder<Generation> for SnpPlatformStatus
impl Encoder<Generation> for SnpPlatformStatus
Source§impl Encoder<Generation> for TcbVersion
impl Encoder<Generation> for TcbVersion
Source§impl Encoder<Generation> for WrappedVlekHashstick
impl Encoder<Generation> for WrappedVlekHashstick
Source§impl From<Generation> for Chain
impl From<Generation> for Chain
Source§fn from(generation: Generation) -> CertSevCaChain
fn from(generation: Generation) -> CertSevCaChain
Converts to this type from the input type.
Source§impl TryFrom<&[u8]> for Generation
impl TryFrom<&[u8]> for Generation
Source§impl TryFrom<String> for Generation
impl TryFrom<String> for Generation
impl Copy for Generation
Auto Trait Implementations§
impl Freeze for Generation
impl RefUnwindSafe for Generation
impl Send for Generation
impl Sync for Generation
impl Unpin for Generation
impl UnwindSafe for Generation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more