Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OpenSK
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
koenigl2
OpenSK
Commits
892f950c
Commit
892f950c
authored
4 years ago
by
Julien Cretin
Browse files
Options
Downloads
Patches
Plain Diff
Add missing cfg
parent
62470980
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ctap/storage.rs
+3
-2
3 additions, 2 deletions
src/ctap/storage.rs
with
3 additions
and
2 deletions
src/ctap/storage.rs
+
3
−
2
View file @
892f950c
...
...
@@ -143,6 +143,7 @@ const PAGE_SIZE: usize = 0x1000;
// 0x30000-0x3ffff: Padding
// 0x40000-0xbffff: App
// 0xc0000-0xfffff: Store
#[cfg(not(any(test,
feature
=
"ram_storage"
)))]
const
STORE_ADDR
:
usize
=
0xC0000
;
const
STORE_SIZE_LIMIT
:
usize
=
0x40000
;
const
STORE_SIZE
:
usize
=
NUM_PAGES
*
PAGE_SIZE
;
...
...
@@ -154,6 +155,8 @@ impl PersistentStore {
///
/// This should be at most one instance of persistent store per program lifetime.
pub
fn
new
(
rng
:
&
mut
impl
Rng256
)
->
PersistentStore
{
// This should ideally be a compile-time assert, but Rust doesn't have native support.
assert!
(
STORE_SIZE
<=
STORE_SIZE_LIMIT
);
#[cfg(not(any(test,
feature
=
"ram_storage"
)))]
let
storage
=
PersistentStore
::
new_prod_storage
();
#[cfg(any(test,
feature
=
"ram_storage"
))]
...
...
@@ -167,8 +170,6 @@ impl PersistentStore {
#[cfg(not(any(test,
feature
=
"ram_storage"
)))]
fn
new_prod_storage
()
->
Storage
{
// This should ideally be a compile-time assert, but Rust doesn't have native support.
assert!
(
STORE_SIZE
<=
STORE_SIZE_LIMIT
);
let
store
=
unsafe
{
// Safety: The store cannot alias because this function is called only once.
core
::
slice
::
from_raw_parts_mut
(
STORE_ADDR
as
*
mut
u8
,
STORE_SIZE
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment