use crate::{
structures::{
CertifyInfo, CommandAuditInfo, CreationInfo, NvCertifyInfo, QuoteInfo, SessionAuditInfo,
TimeAttestInfo,
},
tss2_esys::TPMU_ATTEST,
};
#[derive(Debug, Clone)]
pub enum AttestInfo {
Certify { info: CertifyInfo },
Quote { info: QuoteInfo },
SessionAudit { info: SessionAuditInfo },
CommandAudit { info: CommandAuditInfo },
Time { info: TimeAttestInfo },
Creation { info: CreationInfo },
Nv { info: NvCertifyInfo },
}
impl From<AttestInfo> for TPMU_ATTEST {
fn from(attest_info: AttestInfo) -> Self {
match attest_info {
AttestInfo::Certify { info } => TPMU_ATTEST {
certify: info.into(),
},
AttestInfo::Quote { info } => TPMU_ATTEST { quote: info.into() },
AttestInfo::SessionAudit { info } => TPMU_ATTEST {
sessionAudit: info.into(),
},
AttestInfo::CommandAudit { info } => TPMU_ATTEST {
commandAudit: info.into(),
},
AttestInfo::Time { info } => TPMU_ATTEST { time: info.into() },
AttestInfo::Creation { info } => TPMU_ATTEST {
creation: info.into(),
},
AttestInfo::Nv { info } => TPMU_ATTEST { nv: info.into() },
}
}
}