Merge pull request #234 from ia0/no_ram_storage
Remove ram_storage feature
This commit is contained in:
6
.github/workflows/cargo_check.yml
vendored
6
.github/workflows/cargo_check.yml
vendored
@@ -66,12 +66,6 @@ jobs:
|
|||||||
command: check
|
command: check
|
||||||
args: --target thumbv7em-none-eabi --release --features debug_allocations
|
args: --target thumbv7em-none-eabi --release --features debug_allocations
|
||||||
|
|
||||||
- name: Check OpenSK ram_storage
|
|
||||||
uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: check
|
|
||||||
args: --target thumbv7em-none-eabi --release --features ram_storage
|
|
||||||
|
|
||||||
- name: Check OpenSK verbose
|
- name: Check OpenSK verbose
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ debug_allocations = ["lang_items/debug_allocations"]
|
|||||||
debug_ctap = ["crypto/derive_debug", "libtock_drivers/debug_ctap"]
|
debug_ctap = ["crypto/derive_debug", "libtock_drivers/debug_ctap"]
|
||||||
panic_console = ["lang_items/panic_console"]
|
panic_console = ["lang_items/panic_console"]
|
||||||
std = ["cbor/std", "crypto/std", "crypto/derive_debug", "lang_items/std", "persistent_store/std"]
|
std = ["cbor/std", "crypto/std", "crypto/derive_debug", "lang_items/std", "persistent_store/std"]
|
||||||
ram_storage = []
|
|
||||||
verbose = ["debug_ctap", "libtock_drivers/verbose_usb"]
|
verbose = ["debug_ctap", "libtock_drivers/verbose_usb"]
|
||||||
with_ctap1 = ["crypto/with_ctap1"]
|
with_ctap1 = ["crypto/with_ctap1"]
|
||||||
with_ctap2_1 = []
|
with_ctap2_1 = []
|
||||||
|
|||||||
@@ -863,14 +863,6 @@ if __name__ == "__main__":
|
|||||||
"This is useful to allow flashing multiple OpenSK authenticators "
|
"This is useful to allow flashing multiple OpenSK authenticators "
|
||||||
"in a row without them being considered clones."),
|
"in a row without them being considered clones."),
|
||||||
)
|
)
|
||||||
main_parser.add_argument(
|
|
||||||
"--no-persistent-storage",
|
|
||||||
action="append_const",
|
|
||||||
const="ram_storage",
|
|
||||||
dest="features",
|
|
||||||
help=("Compiles and installs the OpenSK application without persistent "
|
|
||||||
"storage (i.e. unplugging the key will reset the key)."),
|
|
||||||
)
|
|
||||||
|
|
||||||
main_parser.add_argument(
|
main_parser.add_argument(
|
||||||
"--elf2tab-output",
|
"--elf2tab-output",
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ arrayref = "0.3.6"
|
|||||||
libtock_drivers = { path = "../../third_party/libtock-drivers" }
|
libtock_drivers = { path = "../../third_party/libtock-drivers" }
|
||||||
crypto = { path = "../../libraries/crypto", features = ['std'] }
|
crypto = { path = "../../libraries/crypto", features = ['std'] }
|
||||||
cbor = { path = "../../libraries/cbor", features = ['std'] }
|
cbor = { path = "../../libraries/cbor", features = ['std'] }
|
||||||
ctap2 = { path = "../..", features = ['std', 'ram_storage'] }
|
ctap2 = { path = "../..", features = ['std'] }
|
||||||
lang_items = { path = "../../third_party/lang-items", features = ['std'] }
|
lang_items = { path = "../../third_party/lang-items", features = ['std'] }
|
||||||
|
|||||||
@@ -348,6 +348,7 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
mod buffer;
|
mod buffer;
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
mod driver;
|
mod driver;
|
||||||
@@ -357,6 +358,7 @@ mod model;
|
|||||||
mod storage;
|
mod storage;
|
||||||
mod store;
|
mod store;
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
pub use self::buffer::{BufferCorruptFunction, BufferOptions, BufferStorage};
|
pub use self::buffer::{BufferCorruptFunction, BufferOptions, BufferStorage};
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
pub use self::driver::{
|
pub use self::driver::{
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ cargo check --release --target=thumbv7em-none-eabi --features with_ctap2_1
|
|||||||
cargo check --release --target=thumbv7em-none-eabi --features debug_ctap
|
cargo check --release --target=thumbv7em-none-eabi --features debug_ctap
|
||||||
cargo check --release --target=thumbv7em-none-eabi --features panic_console
|
cargo check --release --target=thumbv7em-none-eabi --features panic_console
|
||||||
cargo check --release --target=thumbv7em-none-eabi --features debug_allocations
|
cargo check --release --target=thumbv7em-none-eabi --features debug_allocations
|
||||||
cargo check --release --target=thumbv7em-none-eabi --features ram_storage
|
|
||||||
cargo check --release --target=thumbv7em-none-eabi --features verbose
|
cargo check --release --target=thumbv7em-none-eabi --features verbose
|
||||||
cargo check --release --target=thumbv7em-none-eabi --features debug_ctap,with_ctap1
|
cargo check --release --target=thumbv7em-none-eabi --features debug_ctap,with_ctap1
|
||||||
cargo check --release --target=thumbv7em-none-eabi --features debug_ctap,with_ctap1,panic_console,debug_allocations,verbose
|
cargo check --release --target=thumbv7em-none-eabi --features debug_ctap,with_ctap1,panic_console,debug_allocations,verbose
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ use cbor::cbor_array_vec;
|
|||||||
use core::convert::TryInto;
|
use core::convert::TryInto;
|
||||||
use crypto::rng256::Rng256;
|
use crypto::rng256::Rng256;
|
||||||
|
|
||||||
#[cfg(any(test, feature = "ram_storage"))]
|
#[cfg(feature = "std")]
|
||||||
type Storage = persistent_store::BufferStorage;
|
type Storage = persistent_store::BufferStorage;
|
||||||
#[cfg(not(any(test, feature = "ram_storage")))]
|
#[cfg(not(feature = "std"))]
|
||||||
type Storage = crate::embedded_flash::SyscallStorage;
|
type Storage = crate::embedded_flash::SyscallStorage;
|
||||||
|
|
||||||
// Those constants may be modified before compilation to tune the behavior of the key.
|
// Those constants may be modified before compilation to tune the behavior of the key.
|
||||||
@@ -54,9 +54,6 @@ type Storage = crate::embedded_flash::SyscallStorage;
|
|||||||
// We have: I = (P * 4084 - 5107 - K * S) / 8 * C
|
// We have: I = (P * 4084 - 5107 - K * S) / 8 * C
|
||||||
//
|
//
|
||||||
// With P=20 and K=150, we have I=2M which is enough for 500 increments per day for 10 years.
|
// With P=20 and K=150, we have I=2M which is enough for 500 increments per day for 10 years.
|
||||||
#[cfg(feature = "ram_storage")]
|
|
||||||
const NUM_PAGES: usize = 3;
|
|
||||||
#[cfg(not(feature = "ram_storage"))]
|
|
||||||
const NUM_PAGES: usize = 20;
|
const NUM_PAGES: usize = 20;
|
||||||
const MAX_SUPPORTED_RESIDENTIAL_KEYS: usize = 150;
|
const MAX_SUPPORTED_RESIDENTIAL_KEYS: usize = 150;
|
||||||
|
|
||||||
@@ -92,9 +89,9 @@ impl PersistentStore {
|
|||||||
///
|
///
|
||||||
/// This should be at most one instance of persistent store per program lifetime.
|
/// This should be at most one instance of persistent store per program lifetime.
|
||||||
pub fn new(rng: &mut impl Rng256) -> PersistentStore {
|
pub fn new(rng: &mut impl Rng256) -> PersistentStore {
|
||||||
#[cfg(not(any(test, feature = "ram_storage")))]
|
#[cfg(not(feature = "std"))]
|
||||||
let storage = PersistentStore::new_prod_storage();
|
let storage = PersistentStore::new_prod_storage();
|
||||||
#[cfg(any(test, feature = "ram_storage"))]
|
#[cfg(feature = "std")]
|
||||||
let storage = PersistentStore::new_test_storage();
|
let storage = PersistentStore::new_test_storage();
|
||||||
let mut store = PersistentStore {
|
let mut store = PersistentStore {
|
||||||
store: persistent_store::Store::new(storage).ok().unwrap(),
|
store: persistent_store::Store::new(storage).ok().unwrap(),
|
||||||
@@ -104,17 +101,14 @@ impl PersistentStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a syscall storage in flash.
|
/// Creates a syscall storage in flash.
|
||||||
#[cfg(not(any(test, feature = "ram_storage")))]
|
#[cfg(not(feature = "std"))]
|
||||||
fn new_prod_storage() -> Storage {
|
fn new_prod_storage() -> Storage {
|
||||||
Storage::new(NUM_PAGES).unwrap()
|
Storage::new(NUM_PAGES).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a buffer storage in RAM.
|
/// Creates a buffer storage in RAM.
|
||||||
#[cfg(any(test, feature = "ram_storage"))]
|
#[cfg(feature = "std")]
|
||||||
fn new_test_storage() -> Storage {
|
fn new_test_storage() -> Storage {
|
||||||
#[cfg(not(test))]
|
|
||||||
const PAGE_SIZE: usize = 0x100;
|
|
||||||
#[cfg(test)]
|
|
||||||
const PAGE_SIZE: usize = 0x1000;
|
const PAGE_SIZE: usize = 0x1000;
|
||||||
let store = vec![0xff; NUM_PAGES * PAGE_SIZE].into_boxed_slice();
|
let store = vec![0xff; NUM_PAGES * PAGE_SIZE].into_boxed_slice();
|
||||||
let options = persistent_store::BufferOptions {
|
let options = persistent_store::BufferOptions {
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#[cfg(not(any(test, feature = "ram_storage")))]
|
#[cfg(not(feature = "std"))]
|
||||||
mod syscall;
|
mod syscall;
|
||||||
|
|
||||||
#[cfg(not(any(test, feature = "ram_storage")))]
|
#[cfg(not(feature = "std"))]
|
||||||
pub use self::syscall::SyscallStorage;
|
pub use self::syscall::SyscallStorage;
|
||||||
|
|||||||
Reference in New Issue
Block a user