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 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 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