From 7bc2131edb352d862fccea7b782d56668b11eceb Mon Sep 17 00:00:00 2001 From: Conor Patrick Date: Thu, 11 Jun 2020 20:20:29 -0400 Subject: [PATCH] use iso7816 component --- Cargo.toml | 8 ++++---- src/command/instruction.rs | 2 ++ src/response/status.rs | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 599e41f..75587a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ edition = "2018" heapless = "0.5.5" heapless-bytes = { git = "https://github.com/ycrypto/heapless-bytes", branch = "main" } -[patch.crates-io] -ufmt = { git = "https://github.com/nickray/ufmt", branch = "nickray-derive-empty-enums" } -ufmt-macros = { git = "https://github.com/nickray/ufmt", branch = "nickray-derive-empty-enums" } -heapless = { git = "https://github.com/nickray/heapless", branch = "nickray-udebug" } \ No newline at end of file +[patch.crates-io] +ufmt = { git = "https://github.com/nickray/ufmt", branch = "nickray-derive-empty-enums" } +ufmt-macros = { git = "https://github.com/nickray/ufmt", branch = "nickray-derive-empty-enums" } +heapless = { git = "https://github.com/nickray/heapless", branch = "nickray-udebug" } \ No newline at end of file diff --git a/src/command/instruction.rs b/src/command/instruction.rs index 7869713..0e1b0ad 100644 --- a/src/command/instruction.rs +++ b/src/command/instruction.rs @@ -9,6 +9,7 @@ pub enum Instruction { PutData, GenerateAsymmetricKeyPair, GetResponse, + ReadBinary, Unknown(u8), } @@ -26,6 +27,7 @@ impl core::convert::From for Instruction { 0xc0 => Instruction::GetResponse, 0xcb => Instruction::GetData, 0xdb => Instruction::PutData, + 0xb0 => Instruction::ReadBinary, ins => Instruction::Unknown(ins), } } diff --git a/src/response/status.rs b/src/response/status.rs index c7fafc3..c4750c0 100644 --- a/src/response/status.rs +++ b/src/response/status.rs @@ -4,7 +4,7 @@ impl Default for Status { } } -// ISO/IEC 7816-4, 5.1.3 "Status bytes" +// I0x6985SO/IEC 7816-4, 5.1.3 "Status bytes" #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum Status { @@ -53,6 +53,7 @@ pub enum Status { // 69xx: command not allowed (cf. SW2) SecurityStatusNotSatisfied, + ConditionsOfUseNotSatisfied, OperationBlocked, // 6Axx: wrong parameters P1-P2 (cf. SW2) @@ -95,6 +96,7 @@ impl Into for Status { Self::CommandChainingNotSupported => 0x6884, Self::SecurityStatusNotSatisfied => 0x6982, + Self::ConditionsOfUseNotSatisfied => 0x6985, Self::OperationBlocked => 0x6983, Self::IncorrectDataParameter => 0x6a80,