Enum sev::Generation
source · pub enum Generation {
Naples,
Rome,
Milan,
Genoa,
}
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).
Implementations§
Trait Implementations§
source§impl Clone for Generation
impl Clone for Generation
source§fn clone(&self) -> Generation
fn clone(&self) -> Generation
Returns a copy 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 TryFrom<String> for Generation
impl TryFrom<String> for Generation
impl Copy for Generation
Auto Trait Implementations§
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