Skip to main content

ScpMode

Enum ScpMode 

Source
pub enum ScpMode {
    S8,
    S16,
}
Expand description

SCP03 secure-channel size mode (Amendment D §5.1 Table 5-1, bit b4 0x08): S8 uses 8-byte challenges/cryptograms and 8-byte (truncated) MACs (legacy); S16 (Amendment D v1.2) uses 16-byte challenges/cryptograms and full 16-byte MACs. The MAC chaining value is 16 bytes in both modes.

Variants§

§

S8

8-byte fields, 8-byte truncated MACs.

§

S16

16-byte fields, full 16-byte MACs (Amendment D v1.2).

Implementations§

Source§

impl ScpMode

Source

pub const fn from_i(i_param: u8) -> Self

Derive the mode from the SCP03 i parameter (bit b4 0x08 ⇒ S16).

Source

pub const fn field_len(self) -> usize

Challenge / cryptogram length in bytes (8 or 16).

Source

pub const fn mac_len(self) -> usize

Length of the MAC appended to commands/responses: 8 bytes (truncated) in S8, the full 16 bytes in S16 (Amendment D §6.2.4/§6.2.5).

Source

pub const fn l_bits(self) -> u16

KDF “L” (derived-data length in bits) for challenges and cryptograms: 0x0040 (64) in S8, 0x0080 (128) in S16 (Amendment D §6.2.2).

Trait Implementations§

Source§

impl Clone for ScpMode

Source§

fn clone(&self) -> ScpMode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ScpMode

Source§

impl Debug for ScpMode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ScpMode

Source§

impl PartialEq for ScpMode

Source§

fn eq(&self, other: &ScpMode) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ScpMode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.