Merge branch 'firmware_protection' into env_console

This commit is contained in:
Julien Cretin
2022-03-08 15:02:34 +01:00
28 changed files with 2280 additions and 1883 deletions

15
src/env/mod.rs vendored
View File

@@ -3,7 +3,7 @@ use crate::api::upgrade_storage::UpgradeStorage;
use crate::ctap::hid::ChannelID;
use crate::ctap::status_code::Ctap2StatusCode;
use crypto::rng256::Rng256;
use persistent_store::{Storage, StorageResult};
use persistent_store::{Storage, Store};
#[cfg(feature = "std")]
pub mod test;
@@ -27,16 +27,13 @@ pub trait Env {
fn rng(&mut self) -> &mut Self::Rng;
fn user_presence(&mut self) -> &mut Self::UserPresence;
fn store(&mut self) -> &mut Store<Self::Storage>;
/// Returns the unique storage instance.
/// Returns the upgrade storage instance.
///
/// This function is called at most once. Implementation may panic if called more than once.
fn storage(&mut self) -> StorageResult<Self::Storage>;
/// Returns the unique upgrade storage instance.
///
/// This function is called at most once. Implementation may panic if called more than once.
fn upgrade_storage(&mut self) -> StorageResult<Self::UpgradeStorage>;
/// Upgrade storage is optional, so implementations may return `None`. However, implementations
/// should either always return `None` or always return `Some`.
fn upgrade_storage(&mut self) -> Option<&mut Self::UpgradeStorage>;
fn firmware_protection(&mut self) -> &mut Self::FirmwareProtection;