Use the Device TCTI if there is no TPMRM

Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
This commit is contained in:
Patrick Uiterwijk 2020-08-03 10:57:12 +02:00
parent 8c1524f1b9
commit 2a9a579033

View file

@ -1377,7 +1377,11 @@ fn main() {
}
fn get_tpm2_ctx() -> Result<Context, tss_esapi::response_code::Error> {
unsafe { Context::new(tcti::Tcti::Tabrmd(Default::default())) }
if std::path::Path::new("/dev/tpmrm0").exists() {
unsafe { Context::new(tcti::Tcti::Tabrmd(Default::default())) }
} else {
unsafe { Context::new(tcti::Tcti::Device(Default::default())) }
}
}
fn get_tpm2_primary_key(