use iso7816 component

This commit is contained in:
Conor Patrick
2020-06-28 00:51:07 +02:00
committed by Nicolas Stalder
parent 2e584f0649
commit 7bc2131edb
3 changed files with 9 additions and 5 deletions
+4 -4
View File
@@ -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" }
[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" }
+2
View File
@@ -9,6 +9,7 @@ pub enum Instruction {
PutData,
GenerateAsymmetricKeyPair,
GetResponse,
ReadBinary,
Unknown(u8),
}
@@ -26,6 +27,7 @@ impl core::convert::From<u8> for Instruction {
0xc0 => Instruction::GetResponse,
0xcb => Instruction::GetData,
0xdb => Instruction::PutData,
0xb0 => Instruction::ReadBinary,
ins => Instruction::Unknown(ins),
}
}
+3 -1
View File
@@ -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<u16> for Status {
Self::CommandChainingNotSupported => 0x6884,
Self::SecurityStatusNotSatisfied => 0x6982,
Self::ConditionsOfUseNotSatisfied => 0x6985,
Self::OperationBlocked => 0x6983,
Self::IncorrectDataParameter => 0x6a80,