Skip to content

Commit 7176259

Browse files
committed
Stashing incremental testing release code
1 parent ca0afad commit 7176259

File tree

4 files changed

+83
-6
lines changed

4 files changed

+83
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
The DESFire stack portion of this firmware source
3+
is free software written by Maxie Dion Schmidt (@maxieds):
4+
You can redistribute it and/or modify
5+
it under the terms of this license.
6+
7+
This program is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
11+
The complete source distribution of
12+
this firmware is available at the following link:
13+
https://github.com/maxieds/ChameleonMiniFirmwareDESFireStack.
14+
15+
Based in part on the original DESFire code created by
16+
@dev-zzo (GitHub handle) [Dmitry Janushkevich] available at
17+
https://github.com/dev-zzo/ChameleonMini/tree/desfire.
18+
19+
This notice must be retained at the top of all source files where indicated.
20+
*/
21+
22+
/*
23+
* CryptoMAC.h :
24+
* Maxie D. Schmidt (github.com/maxieds)
25+
*/
26+
27+
#ifndef __CRYPTO_MAC_H__
28+
#define __CRYPTO_MAC_H__
29+
30+
#include "DESFire/DESFireCrypto.h"
31+
#include "CryptoTDEA.h"
32+
#include "CryptoAES128.h"
33+
34+
35+
36+
37+
38+
#endif

Firmware/Chameleon-Mini/Application/DESFire/DESFireInstructions.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,8 @@ uint16_t EV0CmdAuthenticateLegacy1(uint8_t *Buffer, uint16_t ByteCount) {
453453
}
454454

455455
/* Indicate that we are in DES key authentication land */
456-
Key = &SessionKey;
457456
keySize = GetDefaultCryptoMethodKeySize(CRYPTO_TYPE_3K3DES);
457+
Key = &SessionKey;
458458
DesfireCommandState.KeyId = KeyId;
459459
DesfireCommandState.CryptoMethodType = CRYPTO_TYPE_3K3DES;
460460
DesfireCommandState.ActiveCommMode = GetCryptoMethodCommSettings(CRYPTO_TYPE_3K3DES);
@@ -510,10 +510,10 @@ uint16_t EV0CmdAuthenticateLegacy2(uint8_t *Buffer, uint16_t ByteCount) {
510510
}
511511

512512
/* Reset parameters for authentication from the first exchange */
513-
Key = &SessionKey;
514513
KeyId = DesfireCommandState.KeyId;
515514
cryptoKeyType = DesfireCommandState.CryptoMethodType;
516515
keySize = GetDefaultCryptoMethodKeySize(CRYPTO_TYPE_3K3DES);
516+
Key = &SessionKey;
517517
ReadAppKey(SelectedApp.Slot, KeyId, *Key, keySize);
518518

519519
/* Decrypt the challenge sent back to get RndA and a shifted RndB */
@@ -1763,10 +1763,10 @@ uint16_t DesfireCmdAuthenticate3KTDEA2(uint8_t *Buffer, uint16_t ByteCount) {
17631763
}
17641764

17651765
/* Reset parameters for authentication from the first exchange */
1766-
Key = &SessionKey;
17671766
KeyId = DesfireCommandState.KeyId;
17681767
cryptoKeyType = DesfireCommandState.CryptoMethodType;
17691768
keySize = GetDefaultCryptoMethodKeySize(CRYPTO_TYPE_3K3DES);
1769+
Key = &SessionKey;
17701770
ReadAppKey(SelectedApp.Slot, KeyId, *Key, keySize);
17711771

17721772
/* Decrypt the challenge sent back to get RndA and a shifted RndB */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
The DESFire stack portion of this firmware source
3+
is free software written by Maxie Dion Schmidt (@maxieds):
4+
You can redistribute it and/or modify
5+
it under the terms of this license.
6+
7+
This program is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
11+
The complete source distribution of
12+
this firmware is available at the following link:
13+
https://github.com/maxieds/ChameleonMiniFirmwareDESFireStack.
14+
15+
Based in part on the original DESFire code created by
16+
@dev-zzo (GitHub handle) [Dmitry Janushkevich] available at
17+
https://github.com/dev-zzo/ChameleonMini/tree/desfire.
18+
19+
This notice must be retained at the top of all source files where indicated.
20+
*/
21+
22+
/*
23+
* DESFireKeyUtils.h :
24+
* Maxie D. Schmidt (github.com/maxieds)
25+
*/
26+
27+
#ifndef __DESFIRE_KEY_UTILS_H__
28+
#define __DESFIRE_KEY_UTILS_H__
29+
30+
#include "DESFireCrypto.h"
31+
32+
/* TODO: Placeholder for:
33+
* => Key (re)initialization
34+
* => Configuring the session key on the fly
35+
* => CommSettings: PLAIN | MACED | ENCIPHERD
36+
* => Possibly others
37+
*/
38+
39+
#endif

Firmware/Chameleon-Mini/Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ SETTINGS += -DDESFIRE_DEFAULT_LOGGING_MODE=DEBUGGING
100100
#SETTINGS += -DDESFIRE_DEFAULT_LOGGING_MODE=OFF
101101

102102
#Set a default testing mode setting (0 = OFF, non-NULL = ON):
103-
SETTINGS += -DDESFIRE_DEFAULT_TESTING_MODE=0
104-
#SETTINGS += -DDESFIRE_DEFAULT_TESTING_MODE=1
103+
#SETTINGS += -DDESFIRE_DEFAULT_TESTING_MODE=0
104+
SETTINGS += -DDESFIRE_DEFAULT_TESTING_MODE=1
105105

106106
#Feature: Use randomized UIDs that mask the actual secret UID until
107107
#the tag has been issued a successful authentication sequence:
@@ -133,7 +133,7 @@ SETTINGS += -DDESFIRE_MIN_OUTGOING_LOGSIZE=1
133133

134134
#Option to save space with the "Application/Crypto1.c" code by storing large tables
135135
#in PROGMEM. Note that this will slow down the read times when accessing these tables:
136-
#SETTINGS += -DDESFIRE_CRYPTO1_SAVE_SPACE
136+
SETTINGS += -DDESFIRE_CRYPTO1_SAVE_SPACE
137137

138138
DESFIRE_MAINSRC = Application/DESFire
139139

0 commit comments

Comments
 (0)