Add support for authentication using 3K3DES.
Please note that according to the NXP documentation of the Mifare DESFire EV1, the mifare_desfire_authenticate_iso() function can be used using either 3DES or 3K3DES keys. The former has not been tested yet and is likely not to work. To word it differently, this is a 3K3DES crypto support, not a ISO authentication support...
This commit is contained in:
parent
f06b0ac5d3
commit
d098bf623f
9 changed files with 939 additions and 13 deletions
|
|
@ -27,6 +27,8 @@ uint8_t key_data_null[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|||
uint8_t key_data_des[8] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H' };
|
||||
uint8_t key_data_3des[16] = { 'C', 'a', 'r', 'd', ' ', 'M', 'a', 's', 't', 'e', 'r', ' ', 'K', 'e', 'y', '!' };
|
||||
uint8_t key_data_aes[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
uint8_t key_data_3k3des[24] = { 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
const uint8_t key_data_aes_version = 0x42;
|
||||
|
||||
|
|
@ -53,6 +55,9 @@ mifare_desfire_auto_authenticate (MifareTag tag, uint8_t key_no)
|
|||
case 0xC7:
|
||||
key = mifare_desfire_3des_key_new_with_version (key_data_3des);
|
||||
break;
|
||||
case 0x55:
|
||||
key = mifare_desfire_3k3des_key_new_with_version (key_data_3k3des);
|
||||
break;
|
||||
default:
|
||||
cut_fail ("Unknown master key.");
|
||||
}
|
||||
|
|
@ -66,8 +71,12 @@ mifare_desfire_auto_authenticate (MifareTag tag, uint8_t key_no)
|
|||
case 0xC7:
|
||||
res = mifare_desfire_authenticate (tag, key_no, key);
|
||||
break;
|
||||
case 0x55:
|
||||
res = mifare_desfire_authenticate_iso (tag, key_no, key);
|
||||
break;
|
||||
case 0x42:
|
||||
res = mifare_desfire_authenticate_aes (tag, key_no, key);
|
||||
break;
|
||||
}
|
||||
cut_assert_equal_int (0, res, cut_message ("mifare_desfire_authenticate()"));
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ extern uint8_t key_data_null[8];
|
|||
extern uint8_t key_data_des[8];
|
||||
extern uint8_t key_data_3des[16];
|
||||
extern uint8_t key_data_aes[16];
|
||||
extern uint8_t key_data_3k3des[24];
|
||||
extern const uint8_t key_data_aes_version;
|
||||
|
||||
void mifare_desfire_auto_authenticate (MifareTag tag, uint8_t key_no);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue