cbor: rename crate to sk-cbor
In anticipation of publishing to crates.io, which already has a `cbor` crate.
This commit is contained in:
committed by
kaczmarczyck
parent
f2812e4fe2
commit
7719078d46
@@ -13,7 +13,7 @@ edition = "2018"
|
|||||||
libtock_core = { path = "third_party/libtock-rs/core" }
|
libtock_core = { path = "third_party/libtock-rs/core" }
|
||||||
libtock_drivers = { path = "third_party/libtock-drivers" }
|
libtock_drivers = { path = "third_party/libtock-drivers" }
|
||||||
lang_items = { path = "third_party/lang-items" }
|
lang_items = { path = "third_party/lang-items" }
|
||||||
cbor = { path = "libraries/cbor" }
|
sk-cbor = { path = "libraries/cbor" }
|
||||||
crypto = { path = "libraries/crypto" }
|
crypto = { path = "libraries/crypto" }
|
||||||
persistent_store = { path = "libraries/persistent_store" }
|
persistent_store = { path = "libraries/persistent_store" }
|
||||||
byteorder = { version = "1", default-features = false }
|
byteorder = { version = "1", default-features = false }
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ edition = "2018"
|
|||||||
arrayref = "0.3.6"
|
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" }
|
sk-cbor = { path = "../../libraries/cbor" }
|
||||||
ctap2 = { path = "../..", features = ['std'] }
|
ctap2 = { path = "../..", features = ['std'] }
|
||||||
lang_items = { path = "../../third_party/lang-items", features = ['std'] }
|
lang_items = { path = "../../third_party/lang-items", features = ['std'] }
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ use ctap2::ctap::hid::{ChannelID, CtapHid, HidPacket, Message};
|
|||||||
use ctap2::ctap::status_code::Ctap2StatusCode;
|
use ctap2::ctap::status_code::Ctap2StatusCode;
|
||||||
use ctap2::ctap::CtapState;
|
use ctap2::ctap::CtapState;
|
||||||
use libtock_drivers::timer::{ClockValue, Timestamp};
|
use libtock_drivers::timer::{ClockValue, Timestamp};
|
||||||
|
use sk_cbor as cbor;
|
||||||
|
|
||||||
const COMMAND_INIT: u8 = 0x06;
|
const COMMAND_INIT: u8 = 0x06;
|
||||||
const CHANNEL_BROADCAST: ChannelID = [0xFF, 0xFF, 0xFF, 0xFF];
|
const CHANNEL_BROADCAST: ChannelID = [0xFF, 0xFF, 0xFF, 0xFF];
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cbor"
|
name = "sk-cbor"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = [
|
authors = [
|
||||||
"Fabian Kaczmarczyck <kaczmarczyck@google.com>",
|
"Fabian Kaczmarczyck <kaczmarczyck@google.com>",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "cbor-fuzz"
|
name = "sk-cbor-fuzz"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
authors = ["Automatically generated"]
|
authors = ["Automatically generated"]
|
||||||
publish = false
|
publish = false
|
||||||
@@ -12,7 +12,7 @@ cargo-fuzz = true
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
libfuzzer-sys = "0.3"
|
libfuzzer-sys = "0.3"
|
||||||
|
|
||||||
[dependencies.cbor]
|
[dependencies.sk-cbor]
|
||||||
path = ".."
|
path = ".."
|
||||||
|
|
||||||
# Prevent this from interfering with workspaces
|
# Prevent this from interfering with workspaces
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ extern crate alloc;
|
|||||||
|
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use libfuzzer_sys::fuzz_target;
|
use libfuzzer_sys::fuzz_target;
|
||||||
|
use sk_cbor as cbor;
|
||||||
|
|
||||||
fuzz_target!(|data: &[u8]| {
|
fuzz_target!(|data: &[u8]| {
|
||||||
if let Ok(value) = cbor::read(data) {
|
if let Ok(value) = cbor::read(data) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ use core::iter::Peekable;
|
|||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # extern crate alloc;
|
/// # extern crate alloc;
|
||||||
/// # use cbor::destructure_cbor_map;
|
/// # use sk_cbor::destructure_cbor_map;
|
||||||
/// #
|
/// #
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
/// # let map = alloc::vec::Vec::new();
|
/// # let map = alloc::vec::Vec::new();
|
||||||
@@ -143,7 +143,7 @@ macro_rules! assert_sorted_keys {
|
|||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # extern crate alloc;
|
/// # extern crate alloc;
|
||||||
/// # use cbor::cbor_map;
|
/// # use sk_cbor::cbor_map;
|
||||||
/// let map = cbor_map! {
|
/// let map = cbor_map! {
|
||||||
/// 0x01 => false,
|
/// 0x01 => false,
|
||||||
/// "02" => -3,
|
/// "02" => -3,
|
||||||
@@ -182,7 +182,7 @@ macro_rules! cbor_map {
|
|||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # extern crate alloc;
|
/// # extern crate alloc;
|
||||||
/// # use cbor::cbor_map_options;
|
/// # use sk_cbor::cbor_map_options;
|
||||||
/// let missing_value: Option<bool> = None;
|
/// let missing_value: Option<bool> = None;
|
||||||
/// let map = cbor_map_options! {
|
/// let map = cbor_map_options! {
|
||||||
/// 0x01 => Some(false),
|
/// 0x01 => Some(false),
|
||||||
@@ -232,7 +232,7 @@ macro_rules! cbor_map_collection {
|
|||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # extern crate alloc;
|
/// # extern crate alloc;
|
||||||
/// # use cbor::cbor_array;
|
/// # use sk_cbor::cbor_array;
|
||||||
/// let array = cbor_array![1, "2"];
|
/// let array = cbor_array![1, "2"];
|
||||||
/// ```
|
/// ```
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
@@ -339,7 +339,7 @@ macro_rules! cbor_bytes {
|
|||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # extern crate alloc;
|
/// # extern crate alloc;
|
||||||
/// # use cbor::cbor_bytes_lit;
|
/// # use sk_cbor::cbor_bytes_lit;
|
||||||
/// let byte_array = cbor_bytes_lit!(b"foo");
|
/// let byte_array = cbor_bytes_lit!(b"foo");
|
||||||
/// ```
|
/// ```
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libtock_drivers = { path = "../../third_party/libtock-drivers" }
|
libtock_drivers = { path = "../../third_party/libtock-drivers" }
|
||||||
cbor = { path = "../cbor" }
|
|
||||||
arrayref = "0.3.6"
|
arrayref = "0.3.6"
|
||||||
subtle = { version = "2.2.3", default-features = false, features = ["nightly"] }
|
subtle = { version = "2.2.3", default-features = false, features = ["nightly"] }
|
||||||
byteorder = { version = "1", default-features = false }
|
byteorder = { version = "1", default-features = false }
|
||||||
|
|||||||
@@ -26,8 +26,9 @@ use super::status_code::Ctap2StatusCode;
|
|||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use arrayref::array_ref;
|
use arrayref::array_ref;
|
||||||
use cbor::destructure_cbor_map;
|
|
||||||
use core::convert::TryFrom;
|
use core::convert::TryFrom;
|
||||||
|
use sk_cbor as cbor;
|
||||||
|
use sk_cbor::destructure_cbor_map;
|
||||||
|
|
||||||
// This constant is a consequence of the structure of messages.
|
// This constant is a consequence of the structure of messages.
|
||||||
const MIN_LARGE_BLOB_LEN: usize = 17;
|
const MIN_LARGE_BLOB_LEN: usize = 17;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ use super::response::ResponseData;
|
|||||||
use super::status_code::Ctap2StatusCode;
|
use super::status_code::Ctap2StatusCode;
|
||||||
use super::storage::PersistentStore;
|
use super::storage::PersistentStore;
|
||||||
use alloc::vec;
|
use alloc::vec;
|
||||||
|
use sk_cbor as cbor;
|
||||||
|
|
||||||
/// Processes the subcommand enableEnterpriseAttestation for AuthenticatorConfig.
|
/// Processes the subcommand enableEnterpriseAttestation for AuthenticatorConfig.
|
||||||
fn process_enable_enterprise_attestation(
|
fn process_enable_enterprise_attestation(
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ use alloc::vec::Vec;
|
|||||||
use crypto::sha256::Sha256;
|
use crypto::sha256::Sha256;
|
||||||
use crypto::Hash256;
|
use crypto::Hash256;
|
||||||
use libtock_drivers::timer::ClockValue;
|
use libtock_drivers::timer::ClockValue;
|
||||||
|
use sk_cbor as cbor;
|
||||||
|
|
||||||
/// Generates a set with all existing RP IDs.
|
/// Generates a set with all existing RP IDs.
|
||||||
fn get_stored_rp_ids(
|
fn get_stored_rp_ids(
|
||||||
|
|||||||
@@ -16,11 +16,12 @@ use super::status_code::Ctap2StatusCode;
|
|||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use arrayref::array_ref;
|
use arrayref::array_ref;
|
||||||
use cbor::{cbor_array_vec, cbor_map, cbor_map_options, destructure_cbor_map};
|
|
||||||
use core::convert::TryFrom;
|
use core::convert::TryFrom;
|
||||||
use crypto::{ecdh, ecdsa};
|
use crypto::{ecdh, ecdsa};
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use enum_iterator::IntoEnumIterator;
|
use enum_iterator::IntoEnumIterator;
|
||||||
|
use sk_cbor as cbor;
|
||||||
|
use sk_cbor::{cbor_array_vec, cbor_map, cbor_map_options, destructure_cbor_map};
|
||||||
|
|
||||||
// Used as the identifier for ECDSA in assertion signatures and COSE.
|
// Used as the identifier for ECDSA in assertion signatures and COSE.
|
||||||
const ES256_ALGORITHM: i64 = -7;
|
const ES256_ALGORITHM: i64 = -7;
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ use alloc::vec;
|
|||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use arrayref::array_ref;
|
use arrayref::array_ref;
|
||||||
use byteorder::{BigEndian, ByteOrder};
|
use byteorder::{BigEndian, ByteOrder};
|
||||||
use cbor::cbor_map_options;
|
|
||||||
use core::convert::TryFrom;
|
use core::convert::TryFrom;
|
||||||
#[cfg(feature = "debug_ctap")]
|
#[cfg(feature = "debug_ctap")]
|
||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
@@ -80,6 +79,8 @@ use crypto::Hash256;
|
|||||||
use libtock_drivers::console::Console;
|
use libtock_drivers::console::Console;
|
||||||
use libtock_drivers::crp;
|
use libtock_drivers::crp;
|
||||||
use libtock_drivers::timer::{ClockValue, Duration};
|
use libtock_drivers::timer::{ClockValue, Duration};
|
||||||
|
use sk_cbor as cbor;
|
||||||
|
use sk_cbor::cbor_map_options;
|
||||||
|
|
||||||
pub const INITIAL_SIGNATURE_COUNTER: u32 = 1;
|
pub const INITIAL_SIGNATURE_COUNTER: u32 = 1;
|
||||||
// Our credential ID consists of
|
// Our credential ID consists of
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ use super::data_formats::{
|
|||||||
};
|
};
|
||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use cbor::{cbor_array_vec, cbor_bool, cbor_int, cbor_map_collection, cbor_map_options, cbor_text};
|
use sk_cbor as cbor;
|
||||||
|
use sk_cbor::{
|
||||||
|
cbor_array_vec, cbor_bool, cbor_int, cbor_map_collection, cbor_map_options, cbor_text,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub enum ResponseData {
|
pub enum ResponseData {
|
||||||
|
|||||||
@@ -32,11 +32,12 @@ use alloc::string::String;
|
|||||||
use alloc::vec;
|
use alloc::vec;
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use arrayref::array_ref;
|
use arrayref::array_ref;
|
||||||
use cbor::cbor_array_vec;
|
|
||||||
use core::cmp;
|
use core::cmp;
|
||||||
use core::convert::TryInto;
|
use core::convert::TryInto;
|
||||||
use crypto::rng256::Rng256;
|
use crypto::rng256::Rng256;
|
||||||
use persistent_store::{fragment, StoreUpdate};
|
use persistent_store::{fragment, StoreUpdate};
|
||||||
|
use sk_cbor as cbor;
|
||||||
|
use sk_cbor::cbor_array_vec;
|
||||||
|
|
||||||
/// Wrapper for master keys.
|
/// Wrapper for master keys.
|
||||||
pub struct MasterKeys {
|
pub struct MasterKeys {
|
||||||
|
|||||||
Reference in New Issue
Block a user