Merge pull request #156 from gendx/fix-imports

Fix imports in ctap, embedded_flash and lang-items.
This commit is contained in:
gendx
2020-09-22 14:47:28 +02:00
committed by GitHub
14 changed files with 133 additions and 72 deletions

View File

@@ -1,9 +1,9 @@
91a98f475cb3042dd5184598a8292edb2a414df8d967a35c8f2295826b5a161b third_party/tock/target/thumbv7em-none-eabi/release/nrf52840dk.bin 91a98f475cb3042dd5184598a8292edb2a414df8d967a35c8f2295826b5a161b third_party/tock/target/thumbv7em-none-eabi/release/nrf52840dk.bin
7cc5c802e22e73c1edfd5b890642c5f6c4a1f888b61f0cd6d638a770eb0af739 target/nrf52840dk_merged.hex fd7febdc4497c59d3adeeba572effbd20d95cb7e58dc29619306f002c919495f target/nrf52840dk_merged.hex
a5943c5311158b0f99370246d37782eb9b12fc36c56387eadb6587a3a4fe8fd5 third_party/tock/target/thumbv7em-none-eabi/release/nrf52840_dongle.bin a5943c5311158b0f99370246d37782eb9b12fc36c56387eadb6587a3a4fe8fd5 third_party/tock/target/thumbv7em-none-eabi/release/nrf52840_dongle.bin
9ff31263bd33e92b5f1f59d83f557046cb4d022919a5082931a197a2f6ec4398 target/nrf52840_dongle_merged.hex 4f4a5428fb06548ad2cf16f050bde37c9af5fac4629141455064fdb7f96dfbd9 target/nrf52840_dongle_merged.hex
663297e3e29b9e2a972b68cea1592aaf965d797242579bb5bca09cd73cdfb637 third_party/tock/target/thumbv7em-none-eabi/release/nrf52840_dongle_dfu.bin 663297e3e29b9e2a972b68cea1592aaf965d797242579bb5bca09cd73cdfb637 third_party/tock/target/thumbv7em-none-eabi/release/nrf52840_dongle_dfu.bin
4b1f17b3dda2460fe83adc157f8ae1fb2559fb151b8897806e7b0aa25c898ec1 target/nrf52840_dongle_dfu_merged.hex 4367026ef48c8109f0635d5e635ec5999f0a1f2e0af9c5f35e51969ebd3fd3c0 target/nrf52840_dongle_dfu_merged.hex
162a05d056aafc16d4868d5c3aa10518e41299dddd60608f96954dc9cf964cd3 third_party/tock/target/thumbv7em-none-eabi/release/nrf52840_mdk_dfu.bin 162a05d056aafc16d4868d5c3aa10518e41299dddd60608f96954dc9cf964cd3 third_party/tock/target/thumbv7em-none-eabi/release/nrf52840_mdk_dfu.bin
90369c2f5c1b3b3a443114be069fd2da0806444865830a7e992ed52e036c5a39 target/nrf52840_mdk_dfu_merged.hex 009f4e60074ad1dc6d0aacbeb7e78fa7b6de9e39fa79a6aaad33105389f8ed02 target/nrf52840_mdk_dfu_merged.hex
299201ff87cd84bd767516143b4e6a54759e01fcd864c0e579c62217b21d4fa4 target/tab/ctap2.tab 09b7ff9a4d44cd675c4ee581d43713addb5f3931ea9e7c8d71d448e0539f7070 target/tab/ctap2.tab

View File

@@ -1,9 +1,9 @@
3feb5d29a3d669107b460a00391440be4ebc5e50461f9ef3248714f4f99c070e third_party/tock/target/thumbv7em-none-eabi/release/nrf52840dk.bin 3feb5d29a3d669107b460a00391440be4ebc5e50461f9ef3248714f4f99c070e third_party/tock/target/thumbv7em-none-eabi/release/nrf52840dk.bin
875fdc2bbd473a5c77c119ba860e54a43f8097c20931cc5ae83a26e9311ce124 target/nrf52840dk_merged.hex b0711a92223dfd2b3801caf38b2f004a4e18fa2dbd1ca8d5ec60b7b7b0720a8e target/nrf52840dk_merged.hex
8eebe1c1dfe22003466c2570b3735c54c58ae91b8168582ad363ab79c9230a15 third_party/tock/target/thumbv7em-none-eabi/release/nrf52840_dongle.bin 8eebe1c1dfe22003466c2570b3735c54c58ae91b8168582ad363ab79c9230a15 third_party/tock/target/thumbv7em-none-eabi/release/nrf52840_dongle.bin
70c1249370144c6ca55ad490dc5e418f9c2994c2649941dec41d769963a0e0ad target/nrf52840_dongle_merged.hex 2af04acdc8705f9a06535dee1fdbedc6e39d1e59e88ced9acc2fd3e2b585c29b target/nrf52840_dongle_merged.hex
779d77071d1e629f92210ac313e230bcaea6d77c710210c1ac4b40f8085cdad7 third_party/tock/target/thumbv7em-none-eabi/release/nrf52840_dongle_dfu.bin 779d77071d1e629f92210ac313e230bcaea6d77c710210c1ac4b40f8085cdad7 third_party/tock/target/thumbv7em-none-eabi/release/nrf52840_dongle_dfu.bin
6c12edd4ec4d952619e976e635df39235d821eec9902e8882563fc43a1690ddb target/nrf52840_dongle_dfu_merged.hex 0b9591842b56e5c9a1c4a9160681d023a11135593373c483f383c39142be9a8f target/nrf52840_dongle_dfu_merged.hex
f466490d6498f6c06c7c4a717eb437ba2fb06d1985532c23f145d38b9daa8259 third_party/tock/target/thumbv7em-none-eabi/release/nrf52840_mdk_dfu.bin f466490d6498f6c06c7c4a717eb437ba2fb06d1985532c23f145d38b9daa8259 third_party/tock/target/thumbv7em-none-eabi/release/nrf52840_mdk_dfu.bin
7b67e726071ac5161344212821b9869c8f289559c8b91a5f2a0f17624855ce8a target/nrf52840_mdk_dfu_merged.hex 43393a780ed9fe89cfb000a153a6e8af3735e75c5ccc0b34795381a4914973e2 target/nrf52840_mdk_dfu_merged.hex
4dd8753dba382bdbadd0c9761949f7bdacbd77408cfc8dc466107a81ff664b15 target/tab/ctap2.tab 0fe175c3cf5a77a9f6df8f5aa3f82715986536e2f737aee44cb680a1e801dac4 target/tab/ctap2.tab

View File

@@ -1,76 +1,96 @@
======================================== ========================================
Board: nrf52840dk Board: nrf52840dk
---------------------------------------- ----------------------------------------
Min RAM size from sections in ELF: 20 bytes Creating "target/tab/thumbv7em-none-eabi.tbf"
Min RAM size from segments in ELF: 20 bytes
Number of writeable flash regions: 0 Number of writeable flash regions: 0
Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes. Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes.
Entry point is in .text section Entry point is in .text section
Adding .text section. Offset: 128 (0x80). Length: 178688 (0x2ba00) bytes. Adding .text section. Offset: 128 (0x80). Length: 186112 (0x2d700) bytes.
Adding .stack section. Offset: 178816 (0x2ba80). Length: 16384 (0x4000) bytes. Adding .stack section. Offset: 186240 (0x2d780). Length: 16384 (0x4000) bytes.
Searching for .rel.X sections to add. Searching for .rel.X sections to add.
TBF Header: TBF Header:
version: 2 0x2 version: 2 0x2
header_size: 44 0x2C header_size: 56 0x38
total_size: 262144 0x40000 total_size: 262144 0x40000
flags: 1 0x1 flags: 1 0x1
init_fn_offset: 85 0x55 init_fn_offset: 73 0x49
protected_size: 20 0x14 protected_size: 8 0x8
minimum_ram_size: 107428 0x1A3A4 minimum_ram_size: 107428 0x1A3A4
start_process_ram: 4294967295 0xFFFFFFFF
start_process_flash: 262208 0x40040
======================================== ========================================
Board: nrf52840_dongle Board: nrf52840_dongle
---------------------------------------- ----------------------------------------
Min RAM size from sections in ELF: 20 bytes Creating "target/tab/thumbv7em-none-eabi.tbf"
Min RAM size from segments in ELF: 20 bytes
Number of writeable flash regions: 0 Number of writeable flash regions: 0
Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes. Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes.
Entry point is in .text section Entry point is in .text section
Adding .text section. Offset: 128 (0x80). Length: 178688 (0x2ba00) bytes. Adding .text section. Offset: 128 (0x80). Length: 186112 (0x2d700) bytes.
Adding .stack section. Offset: 178816 (0x2ba80). Length: 16384 (0x4000) bytes. Adding .stack section. Offset: 186240 (0x2d780). Length: 16384 (0x4000) bytes.
Searching for .rel.X sections to add. Searching for .rel.X sections to add.
TBF Header: TBF Header:
version: 2 0x2 version: 2 0x2
header_size: 44 0x2C header_size: 56 0x38
total_size: 262144 0x40000 total_size: 262144 0x40000
flags: 1 0x1 flags: 1 0x1
init_fn_offset: 85 0x55 init_fn_offset: 73 0x49
protected_size: 20 0x14 protected_size: 8 0x8
minimum_ram_size: 107428 0x1A3A4 minimum_ram_size: 107428 0x1A3A4
start_process_ram: 4294967295 0xFFFFFFFF
start_process_flash: 262208 0x40040
======================================== ========================================
Board: nrf52840_dongle_dfu Board: nrf52840_dongle_dfu
---------------------------------------- ----------------------------------------
Min RAM size from sections in ELF: 20 bytes Creating "target/tab/thumbv7em-none-eabi.tbf"
Min RAM size from segments in ELF: 20 bytes
Number of writeable flash regions: 0 Number of writeable flash regions: 0
Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes. Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes.
Entry point is in .text section Entry point is in .text section
Adding .text section. Offset: 128 (0x80). Length: 178688 (0x2ba00) bytes. Adding .text section. Offset: 128 (0x80). Length: 186112 (0x2d700) bytes.
Adding .stack section. Offset: 178816 (0x2ba80). Length: 16384 (0x4000) bytes. Adding .stack section. Offset: 186240 (0x2d780). Length: 16384 (0x4000) bytes.
Searching for .rel.X sections to add. Searching for .rel.X sections to add.
TBF Header: TBF Header:
version: 2 0x2 version: 2 0x2
header_size: 44 0x2C header_size: 56 0x38
total_size: 262144 0x40000 total_size: 262144 0x40000
flags: 1 0x1 flags: 1 0x1
init_fn_offset: 85 0x55 init_fn_offset: 73 0x49
protected_size: 20 0x14 protected_size: 8 0x8
minimum_ram_size: 107428 0x1A3A4 minimum_ram_size: 107428 0x1A3A4
start_process_ram: 4294967295 0xFFFFFFFF
start_process_flash: 262208 0x40040
======================================== ========================================
Board: nrf52840_mdk_dfu Board: nrf52840_mdk_dfu
---------------------------------------- ----------------------------------------
Min RAM size from sections in ELF: 20 bytes Creating "target/tab/thumbv7em-none-eabi.tbf"
Min RAM size from segments in ELF: 20 bytes
Number of writeable flash regions: 0 Number of writeable flash regions: 0
Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes. Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes.
Entry point is in .text section Entry point is in .text section
Adding .text section. Offset: 128 (0x80). Length: 178688 (0x2ba00) bytes. Adding .text section. Offset: 128 (0x80). Length: 186112 (0x2d700) bytes.
Adding .stack section. Offset: 178816 (0x2ba80). Length: 16384 (0x4000) bytes. Adding .stack section. Offset: 186240 (0x2d780). Length: 16384 (0x4000) bytes.
Searching for .rel.X sections to add. Searching for .rel.X sections to add.
TBF Header: TBF Header:
version: 2 0x2 version: 2 0x2
header_size: 44 0x2C header_size: 56 0x38
total_size: 262144 0x40000 total_size: 262144 0x40000
flags: 1 0x1 flags: 1 0x1
init_fn_offset: 85 0x55 init_fn_offset: 73 0x49
protected_size: 20 0x14 protected_size: 8 0x8
minimum_ram_size: 107428 0x1A3A4 minimum_ram_size: 107428 0x1A3A4
start_process_ram: 4294967295 0xFFFFFFFF
start_process_flash: 262208 0x40040

View File

@@ -1,76 +1,96 @@
======================================== ========================================
Board: nrf52840dk Board: nrf52840dk
---------------------------------------- ----------------------------------------
Min RAM size from sections in ELF: 20 bytes Creating "target/tab/thumbv7em-none-eabi.tbf"
Min RAM size from segments in ELF: 20 bytes
Number of writeable flash regions: 0 Number of writeable flash regions: 0
Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes. Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes.
Entry point is in .text section Entry point is in .text section
Adding .text section. Offset: 128 (0x80). Length: 178536 (0x2b968) bytes. Adding .text section. Offset: 128 (0x80). Length: 186080 (0x2d6e0) bytes.
Adding .stack section. Offset: 178664 (0x2b9e8). Length: 16384 (0x4000) bytes. Adding .stack section. Offset: 186208 (0x2d760). Length: 16384 (0x4000) bytes.
Searching for .rel.X sections to add. Searching for .rel.X sections to add.
TBF Header: TBF Header:
version: 2 0x2 version: 2 0x2
header_size: 44 0x2C header_size: 56 0x38
total_size: 262144 0x40000 total_size: 262144 0x40000
flags: 1 0x1 flags: 1 0x1
init_fn_offset: 85 0x55 init_fn_offset: 73 0x49
protected_size: 20 0x14 protected_size: 8 0x8
minimum_ram_size: 107428 0x1A3A4 minimum_ram_size: 107428 0x1A3A4
start_process_ram: 4294967295 0xFFFFFFFF
start_process_flash: 262208 0x40040
======================================== ========================================
Board: nrf52840_dongle Board: nrf52840_dongle
---------------------------------------- ----------------------------------------
Min RAM size from sections in ELF: 20 bytes Creating "target/tab/thumbv7em-none-eabi.tbf"
Min RAM size from segments in ELF: 20 bytes
Number of writeable flash regions: 0 Number of writeable flash regions: 0
Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes. Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes.
Entry point is in .text section Entry point is in .text section
Adding .text section. Offset: 128 (0x80). Length: 178536 (0x2b968) bytes. Adding .text section. Offset: 128 (0x80). Length: 186080 (0x2d6e0) bytes.
Adding .stack section. Offset: 178664 (0x2b9e8). Length: 16384 (0x4000) bytes. Adding .stack section. Offset: 186208 (0x2d760). Length: 16384 (0x4000) bytes.
Searching for .rel.X sections to add. Searching for .rel.X sections to add.
TBF Header: TBF Header:
version: 2 0x2 version: 2 0x2
header_size: 44 0x2C header_size: 56 0x38
total_size: 262144 0x40000 total_size: 262144 0x40000
flags: 1 0x1 flags: 1 0x1
init_fn_offset: 85 0x55 init_fn_offset: 73 0x49
protected_size: 20 0x14 protected_size: 8 0x8
minimum_ram_size: 107428 0x1A3A4 minimum_ram_size: 107428 0x1A3A4
start_process_ram: 4294967295 0xFFFFFFFF
start_process_flash: 262208 0x40040
======================================== ========================================
Board: nrf52840_dongle_dfu Board: nrf52840_dongle_dfu
---------------------------------------- ----------------------------------------
Min RAM size from sections in ELF: 20 bytes Creating "target/tab/thumbv7em-none-eabi.tbf"
Min RAM size from segments in ELF: 20 bytes
Number of writeable flash regions: 0 Number of writeable flash regions: 0
Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes. Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes.
Entry point is in .text section Entry point is in .text section
Adding .text section. Offset: 128 (0x80). Length: 178536 (0x2b968) bytes. Adding .text section. Offset: 128 (0x80). Length: 186080 (0x2d6e0) bytes.
Adding .stack section. Offset: 178664 (0x2b9e8). Length: 16384 (0x4000) bytes. Adding .stack section. Offset: 186208 (0x2d760). Length: 16384 (0x4000) bytes.
Searching for .rel.X sections to add. Searching for .rel.X sections to add.
TBF Header: TBF Header:
version: 2 0x2 version: 2 0x2
header_size: 44 0x2C header_size: 56 0x38
total_size: 262144 0x40000 total_size: 262144 0x40000
flags: 1 0x1 flags: 1 0x1
init_fn_offset: 85 0x55 init_fn_offset: 73 0x49
protected_size: 20 0x14 protected_size: 8 0x8
minimum_ram_size: 107428 0x1A3A4 minimum_ram_size: 107428 0x1A3A4
start_process_ram: 4294967295 0xFFFFFFFF
start_process_flash: 262208 0x40040
======================================== ========================================
Board: nrf52840_mdk_dfu Board: nrf52840_mdk_dfu
---------------------------------------- ----------------------------------------
Min RAM size from sections in ELF: 20 bytes Creating "target/tab/thumbv7em-none-eabi.tbf"
Min RAM size from segments in ELF: 20 bytes
Number of writeable flash regions: 0 Number of writeable flash regions: 0
Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes. Adding .crt0_header section. Offset: 64 (0x40). Length: 64 (0x40) bytes.
Entry point is in .text section Entry point is in .text section
Adding .text section. Offset: 128 (0x80). Length: 178536 (0x2b968) bytes. Adding .text section. Offset: 128 (0x80). Length: 186080 (0x2d6e0) bytes.
Adding .stack section. Offset: 178664 (0x2b9e8). Length: 16384 (0x4000) bytes. Adding .stack section. Offset: 186208 (0x2d760). Length: 16384 (0x4000) bytes.
Searching for .rel.X sections to add. Searching for .rel.X sections to add.
TBF Header: TBF Header:
version: 2 0x2 version: 2 0x2
header_size: 44 0x2C header_size: 56 0x38
total_size: 262144 0x40000 total_size: 262144 0x40000
flags: 1 0x1 flags: 1 0x1
init_fn_offset: 85 0x55 init_fn_offset: 73 0x49
protected_size: 20 0x14 protected_size: 8 0x8
minimum_ram_size: 107428 0x1A3A4 minimum_ram_size: 107428 0x1A3A4
start_process_ram: 4294967295 0xFFFFFFFF
start_process_flash: 262208 0x40040

View File

@@ -16,11 +16,11 @@ use super::hid::ChannelID;
use super::key_material::{ATTESTATION_CERTIFICATE, ATTESTATION_PRIVATE_KEY}; use super::key_material::{ATTESTATION_CERTIFICATE, ATTESTATION_PRIVATE_KEY};
use super::status_code::Ctap2StatusCode; use super::status_code::Ctap2StatusCode;
use super::CtapState; use super::CtapState;
use crate::timer::ClockValue;
use alloc::vec::Vec; use alloc::vec::Vec;
use core::convert::Into; use core::convert::Into;
use core::convert::TryFrom; use core::convert::TryFrom;
use crypto::rng256::Rng256; use crypto::rng256::Rng256;
use libtock_drivers::timer::ClockValue;
// The specification referenced in this file is at: // The specification referenced in this file is at:
// https://fidoalliance.org/specs/fido-u2f-v1.2-ps-20170411/fido-u2f-raw-message-formats-v1.2-ps-20170411.pdf // https://fidoalliance.org/specs/fido-u2f-v1.2-ps-20170411/fido-u2f-raw-message-formats-v1.2-ps-20170411.pdf

View File

@@ -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.
mod receive; pub mod receive;
mod send; pub mod send;
use self::receive::MessageAssembler; use self::receive::MessageAssembler;
use self::send::HidPacketIterator; use self::send::HidPacketIterator;
@@ -22,13 +22,13 @@ use super::ctap1;
use super::status_code::Ctap2StatusCode; use super::status_code::Ctap2StatusCode;
use super::timed_permission::TimedPermission; use super::timed_permission::TimedPermission;
use super::CtapState; use super::CtapState;
use crate::timer::{ClockValue, Duration, Timestamp};
use alloc::vec::Vec; use alloc::vec::Vec;
#[cfg(feature = "debug_ctap")] #[cfg(feature = "debug_ctap")]
use core::fmt::Write; use core::fmt::Write;
use crypto::rng256::Rng256; use crypto::rng256::Rng256;
#[cfg(feature = "debug_ctap")] #[cfg(feature = "debug_ctap")]
use libtock_drivers::console::Console; use libtock_drivers::console::Console;
use libtock_drivers::timer::{ClockValue, Duration, Timestamp};
// CTAP specification (version 20190130) section 8.1 // CTAP specification (version 20190130) section 8.1
// TODO: Channel allocation, section 8.1.3? // TODO: Channel allocation, section 8.1.3?

View File

@@ -13,9 +13,9 @@
// limitations under the License. // limitations under the License.
use super::{ChannelID, CtapHid, HidPacket, Message, ProcessedPacket}; use super::{ChannelID, CtapHid, HidPacket, Message, ProcessedPacket};
use crate::timer::Timestamp;
use alloc::vec::Vec; use alloc::vec::Vec;
use core::mem::swap; use core::mem::swap;
use libtock_drivers::timer::Timestamp;
// A structure to assemble CTAPHID commands from a series of incoming USB HID packets. // A structure to assemble CTAPHID commands from a series of incoming USB HID packets.
pub struct MessageAssembler { pub struct MessageAssembler {
@@ -195,7 +195,7 @@ impl MessageAssembler {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use crate::timer::Duration; use libtock_drivers::timer::Duration;
// Except for tests that exercise timeouts, all packets are synchronized at the same dummy // Except for tests that exercise timeouts, all packets are synchronized at the same dummy
// timestamp. // timestamp.

View File

@@ -12,17 +12,17 @@
// 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.
use crate::crypto::rng256::Rng256;
#[cfg(feature = "with_ctap2_1")] #[cfg(feature = "with_ctap2_1")]
use crate::ctap::data_formats::{extract_array, extract_text_string}; use crate::ctap::data_formats::{extract_array, extract_text_string};
use crate::ctap::data_formats::{CredentialProtectionPolicy, PublicKeyCredentialSource}; use crate::ctap::data_formats::{CredentialProtectionPolicy, PublicKeyCredentialSource};
use crate::ctap::pin_protocol_v1::PIN_AUTH_LENGTH; use crate::ctap::pin_protocol_v1::PIN_AUTH_LENGTH;
use crate::ctap::status_code::Ctap2StatusCode; use crate::ctap::status_code::Ctap2StatusCode;
use crate::ctap::{key_material, USE_BATCH_ATTESTATION}; use crate::ctap::{key_material, USE_BATCH_ATTESTATION};
use crate::embedded_flash::{self, StoreConfig, StoreEntry, StoreError};
use alloc::string::String; use alloc::string::String;
use alloc::vec::Vec; use alloc::vec::Vec;
use core::convert::TryInto; use core::convert::TryInto;
use ctap2::embedded_flash::{self, StoreConfig, StoreEntry, StoreError}; use crypto::rng256::Rng256;
#[cfg(any(test, feature = "ram_storage"))] #[cfg(any(test, feature = "ram_storage"))]
type Storage = embedded_flash::BufferStorage; type Storage = embedded_flash::BufferStorage;
@@ -660,9 +660,9 @@ fn _serialize_min_pin_length_rp_ids(rp_ids: Vec<String>) -> Result<Vec<u8>, Ctap
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use crate::crypto;
use crate::crypto::rng256::{Rng256, ThreadRng256};
use crate::ctap::data_formats::{PublicKeyCredentialSource, PublicKeyCredentialType}; use crate::ctap::data_formats::{PublicKeyCredentialSource, PublicKeyCredentialType};
use crypto;
use crypto::rng256::{Rng256, ThreadRng256};
fn create_credential_source( fn create_credential_source(
rng: &mut ThreadRng256, rng: &mut ThreadRng256,

View File

@@ -12,7 +12,7 @@
// 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.
use crate::timer::{ClockValue, Duration}; use libtock_drivers::timer::{ClockValue, Duration};
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub enum TimedPermission { pub enum TimedPermission {

View File

@@ -12,12 +12,16 @@
// 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(any(test, feature = "ram_storage"))]
mod buffer; mod buffer;
mod storage; mod storage;
mod store; mod store;
#[cfg(not(any(test, feature = "ram_storage")))]
mod syscall; mod syscall;
#[cfg(any(test, feature = "ram_storage"))]
pub use self::buffer::{BufferOptions, BufferStorage}; pub use self::buffer::{BufferOptions, BufferStorage};
pub use self::storage::{Index, Storage, StorageError, StorageResult}; pub use self::storage::{Index, Storage, StorageError, StorageResult};
pub use self::store::{Store, StoreConfig, StoreEntry, StoreError, StoreIndex}; pub use self::store::{Store, StoreConfig, StoreEntry, StoreError, StoreIndex};
#[cfg(not(any(test, feature = "ram_storage")))]
pub use self::syscall::SyscallStorage; pub use self::syscall::SyscallStorage;

View File

@@ -163,9 +163,11 @@ mod bitfield;
mod format; mod format;
use self::format::{Format, IsReplace}; use self::format::{Format, IsReplace};
#[cfg(feature = "std")]
use super::BufferStorage;
use super::{Index, Storage}; use super::{Index, Storage};
#[cfg(any(test, feature = "ram_storage"))]
use crate::embedded_flash::BufferStorage;
#[cfg(any(test, feature = "ram_storage"))]
use alloc::boxed::Box;
use alloc::collections::BTreeMap; use alloc::collections::BTreeMap;
use alloc::vec::Vec; use alloc::vec::Vec;
@@ -402,6 +404,7 @@ impl<S: Storage, C: StoreConfig> Store<S, C> {
/// Computes the length in bytes that would be used in the storage if an insert operation is /// Computes the length in bytes that would be used in the storage if an insert operation is
/// executed provided the data of the inserted entry has `length` bytes and whether this data is /// executed provided the data of the inserted entry has `length` bytes and whether this data is
/// sensitive. /// sensitive.
#[allow(dead_code)]
pub fn insert_len(&self, sensitive: bool, length: usize) -> usize { pub fn insert_len(&self, sensitive: bool, length: usize) -> usize {
self.format.entry_size(IsReplace::Insert, sensitive, length) self.format.entry_size(IsReplace::Insert, sensitive, length)
} }
@@ -410,6 +413,7 @@ impl<S: Storage, C: StoreConfig> Store<S, C> {
/// ///
/// The value at index `page` of the result is the number of times page `page` was erased. This /// The value at index `page` of the result is the number of times page `page` was erased. This
/// number is an underestimate in case power was lost when this page was erased. /// number is an underestimate in case power was lost when this page was erased.
#[allow(dead_code)]
pub fn compaction_info(&self) -> Vec<usize> { pub fn compaction_info(&self) -> Vec<usize> {
let mut info = Vec::with_capacity(self.format.num_pages); let mut info = Vec::with_capacity(self.format.num_pages);
for page in 0..self.format.num_pages { for page in 0..self.format.num_pages {
@@ -766,7 +770,7 @@ impl<S: Storage, C: StoreConfig> Store<S, C> {
} }
// Those functions are not meant for production. // Those functions are not meant for production.
#[cfg(feature = "std")] #[cfg(any(test, feature = "ram_storage"))]
impl<C: StoreConfig> Store<BufferStorage, C> { impl<C: StoreConfig> Store<BufferStorage, C> {
/// Takes a snapshot of the storage after a given amount of word operations. /// Takes a snapshot of the storage after a given amount of word operations.
pub fn arm_snapshot(&mut self, delay: usize) { pub fn arm_snapshot(&mut self, delay: usize) {

View File

@@ -16,8 +16,13 @@
#[macro_use] #[macro_use]
extern crate alloc; extern crate alloc;
#[macro_use]
extern crate arrayref;
#[macro_use]
extern crate cbor;
extern crate lang_items; extern crate lang_items;
extern crate libtock_core; extern crate libtock_core;
extern crate libtock_drivers; extern crate libtock_drivers;
pub mod ctap;
pub mod embedded_flash; pub mod embedded_flash;

View File

@@ -28,6 +28,7 @@ extern crate cbor;
extern crate crypto; extern crate crypto;
mod ctap; mod ctap;
pub mod embedded_flash;
use core::cell::Cell; use core::cell::Cell;
#[cfg(feature = "debug_ctap")] #[cfg(feature = "debug_ctap")]

View File

@@ -7,3 +7,10 @@ mod allocator;
mod panic_handler; mod panic_handler;
#[cfg(not(feature = "std"))] #[cfg(not(feature = "std"))]
mod util; mod util;
#[cfg(feature = "std")]
#[no_mangle]
unsafe fn libtock_alloc_init(_app_heap_start: usize, _app_heap_size: usize) {
// Stub so that the symbol is present.
unimplemented!()
}