Add firmware protection to the environment

This commit is contained in:
Julien Cretin
2022-03-04 11:24:10 +01:00
parent b80b67e2cf
commit bb40e3244a
6 changed files with 38 additions and 3 deletions

12
src/env/test/mod.rs vendored
View File

@@ -1,4 +1,5 @@
use self::upgrade_storage::BufferUpgradeStorage;
use crate::api::firmware_protection::FirmwareProtection;
use crate::ctap::hid::ChannelID;
use crate::ctap::status_code::Ctap2StatusCode;
use crate::env::{Env, UserPresence};
@@ -38,11 +39,18 @@ impl UserPresence for TestUserPresence {
}
}
impl FirmwareProtection for TestEnv {
fn lock(&mut self) -> bool {
true
}
}
impl Env for TestEnv {
type Rng = ThreadRng256;
type UserPresence = TestUserPresence;
type Storage = BufferStorage;
type UpgradeStorage = BufferUpgradeStorage;
type FirmwareProtection = Self;
fn rng(&mut self) -> &mut Self::Rng {
&mut self.rng
@@ -70,4 +78,8 @@ impl Env for TestEnv {
fn upgrade_storage(&mut self) -> StorageResult<Self::UpgradeStorage> {
BufferUpgradeStorage::new()
}
fn firmware_protection(&mut self) -> &mut Self::FirmwareProtection {
self
}
}