Skip to content

Commit e22b286

Browse files
committed
Removing default testing nonce B from auth commands ; Running make style
1 parent ba3c736 commit e22b286

17 files changed

+182
-182
lines changed

Firmware/Chameleon-Mini/Application/CryptoTDEA.c

+29-29
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ void EncryptDESBuffer(uint16_t Count, const void *Plaintext, void *Ciphertext, c
2121
if (IVIn == NULL) {
2222
memset(IV, 0x00, CRYPTO_DES_BLOCK_SIZE);
2323
} else {
24-
memcpy(IV, IVIn, CRYPTO_DES_BLOCK_SIZE);
24+
memcpy(IV, IVIn, CRYPTO_DES_BLOCK_SIZE);
2525
}
2626
while (blockIndex < numBlocks) {
2727
if (blockIndex == 0) {
2828
memcpy(inputBlock, &Plaintext[0], CRYPTO_DES_BLOCK_SIZE);
29-
CryptoMemoryXOR(IV, inputBlock, CRYPTO_DES_BLOCK_SIZE);
30-
} else {
29+
CryptoMemoryXOR(IV, inputBlock, CRYPTO_DES_BLOCK_SIZE);
30+
} else {
3131
memcpy(inputBlock, &Ciphertext[(blockIndex - 1) * CRYPTO_DES_BLOCK_SIZE], CRYPTO_DES_BLOCK_SIZE);
32-
CryptoMemoryXOR(&Plaintext[blockIndex * CRYPTO_DES_BLOCK_SIZE], inputBlock, CRYPTO_DES_BLOCK_SIZE);
33-
}
34-
CryptoSpec.cryptFunc(inputBlock, ctBuf, Keys);
35-
ctBuf += CryptoSpec.blockSize;
36-
blockIndex++;
32+
CryptoMemoryXOR(&Plaintext[blockIndex * CRYPTO_DES_BLOCK_SIZE], inputBlock, CRYPTO_DES_BLOCK_SIZE);
33+
}
34+
CryptoSpec.cryptFunc(inputBlock, ctBuf, Keys);
35+
ctBuf += CryptoSpec.blockSize;
36+
blockIndex++;
3737
}
3838
}
3939

@@ -49,18 +49,18 @@ void DecryptDESBuffer(uint16_t Count, void *Plaintext, const void *Ciphertext, c
4949
if (IVIn == NULL) {
5050
memset(IV, 0x00, CRYPTO_DES_BLOCK_SIZE);
5151
} else {
52-
memcpy(IV, IVIn, CRYPTO_DES_BLOCK_SIZE);
52+
memcpy(IV, IVIn, CRYPTO_DES_BLOCK_SIZE);
5353
}
5454
while (blockIndex < numBlocks) {
55-
CryptoSpec.cryptFunc(inputBlock, Ciphertext + blockIndex * CRYPTO_DES_BLOCK_SIZE, Keys);
55+
CryptoSpec.cryptFunc(inputBlock, Ciphertext + blockIndex * CRYPTO_DES_BLOCK_SIZE, Keys);
5656
if (blockIndex == 0) {
5757
memcpy(Plaintext, inputBlock, CRYPTO_DES_BLOCK_SIZE);
58-
CryptoMemoryXOR(IV, Plaintext, CRYPTO_DES_BLOCK_SIZE);
59-
} else {
58+
CryptoMemoryXOR(IV, Plaintext, CRYPTO_DES_BLOCK_SIZE);
59+
} else {
6060
memcpy(Plaintext + blockIndex * CRYPTO_DES_BLOCK_SIZE, inputBlock, CRYPTO_DES_BLOCK_SIZE);
61-
CryptoMemoryXOR(&Ciphertext[(blockIndex - 1) * CRYPTO_DES_BLOCK_SIZE],
62-
Plaintext + blockIndex * CRYPTO_DES_BLOCK_SIZE, CRYPTO_DES_BLOCK_SIZE);
63-
}
61+
CryptoMemoryXOR(&Ciphertext[(blockIndex - 1) * CRYPTO_DES_BLOCK_SIZE],
62+
Plaintext + blockIndex * CRYPTO_DES_BLOCK_SIZE, CRYPTO_DES_BLOCK_SIZE);
63+
}
6464
blockIndex++;
6565
}
6666
}
@@ -78,19 +78,19 @@ void Encrypt3DESBuffer(uint16_t Count, const void *Plaintext, void *Ciphertext,
7878
if (IVIn == NULL) {
7979
memset(IV, 0x00, CRYPTO_3KTDEA_BLOCK_SIZE);
8080
} else {
81-
memcpy(IV, IVIn, CRYPTO_3KTDEA_BLOCK_SIZE);
81+
memcpy(IV, IVIn, CRYPTO_3KTDEA_BLOCK_SIZE);
8282
}
8383
while (blockIndex < numBlocks) {
8484
if (blockIndex == 0) {
8585
memcpy(inputBlock, &Plaintext[0], CRYPTO_3KTDEA_BLOCK_SIZE);
86-
CryptoMemoryXOR(IV, inputBlock, CRYPTO_3KTDEA_BLOCK_SIZE);
87-
} else {
86+
CryptoMemoryXOR(IV, inputBlock, CRYPTO_3KTDEA_BLOCK_SIZE);
87+
} else {
8888
memcpy(inputBlock, &Ciphertext[(blockIndex - 1) * CRYPTO_3KTDEA_BLOCK_SIZE], CRYPTO_3KTDEA_BLOCK_SIZE);
89-
CryptoMemoryXOR(&Plaintext[blockIndex * CRYPTO_3KTDEA_BLOCK_SIZE], inputBlock, CRYPTO_3KTDEA_BLOCK_SIZE);
90-
}
91-
CryptoSpec.cryptFunc(inputBlock, ctBuf, Keys);
89+
CryptoMemoryXOR(&Plaintext[blockIndex * CRYPTO_3KTDEA_BLOCK_SIZE], inputBlock, CRYPTO_3KTDEA_BLOCK_SIZE);
90+
}
91+
CryptoSpec.cryptFunc(inputBlock, ctBuf, Keys);
9292
ctBuf += CryptoSpec.blockSize;
93-
blockIndex++;
93+
blockIndex++;
9494
}
9595
}
9696

@@ -106,18 +106,18 @@ void Decrypt3DESBuffer(uint16_t Count, void *Plaintext, const void *Ciphertext,
106106
if (IVIn == NULL) {
107107
memset(IV, 0x00, CRYPTO_3KTDEA_BLOCK_SIZE);
108108
} else {
109-
memcpy(IV, IVIn, CRYPTO_3KTDEA_BLOCK_SIZE);
109+
memcpy(IV, IVIn, CRYPTO_3KTDEA_BLOCK_SIZE);
110110
}
111111
while (blockIndex < numBlocks) {
112-
CryptoSpec.cryptFunc(inputBlock, Ciphertext + blockIndex * CRYPTO_3KTDEA_BLOCK_SIZE, Keys);
112+
CryptoSpec.cryptFunc(inputBlock, Ciphertext + blockIndex * CRYPTO_3KTDEA_BLOCK_SIZE, Keys);
113113
if (blockIndex == 0) {
114114
memcpy(Plaintext, inputBlock, CRYPTO_3KTDEA_BLOCK_SIZE);
115-
CryptoMemoryXOR(IV, Plaintext, CRYPTO_3KTDEA_BLOCK_SIZE);
116-
} else {
115+
CryptoMemoryXOR(IV, Plaintext, CRYPTO_3KTDEA_BLOCK_SIZE);
116+
} else {
117117
memcpy(Plaintext + blockIndex * CRYPTO_3KTDEA_BLOCK_SIZE, inputBlock, CRYPTO_3KTDEA_BLOCK_SIZE);
118-
CryptoMemoryXOR(&Ciphertext[(blockIndex - 1) * CRYPTO_3KTDEA_BLOCK_SIZE],
119-
Plaintext + blockIndex * CRYPTO_3KTDEA_BLOCK_SIZE, CRYPTO_3KTDEA_BLOCK_SIZE);
120-
}
118+
CryptoMemoryXOR(&Ciphertext[(blockIndex - 1) * CRYPTO_3KTDEA_BLOCK_SIZE],
119+
Plaintext + blockIndex * CRYPTO_3KTDEA_BLOCK_SIZE, CRYPTO_3KTDEA_BLOCK_SIZE);
120+
}
121121
blockIndex++;
122122
}
123123
}

Firmware/Chameleon-Mini/Application/CryptoTDEA.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/*
2-
* CryptoDES.h
3-
*
4-
* Created on: 18.10.2016
5-
* Author: dev_zzo
6-
*/
1+
/*
2+
* CryptoDES.h
3+
*
4+
* Created on: 18.10.2016
5+
* Author: dev_zzo
6+
*/
77

88
#ifndef CRYPTODES_H_
99
#define CRYPTODES_H_

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ void SetAppProperty(DesfireCardLayout propId, BYTE AppSlot, SIZET Value) {
209209
bool KeyIdValid(uint8_t AppSlot, uint8_t KeyId) {
210210
if (KeyId >= DESFIRE_MAX_KEYS || KeyId >= ReadMaxKeyCount(AppSlot)) {
211211
const char *debugMsg = PSTR("INVKEY-KeyId(%02x)-RdMax(%02x)");
212-
DEBUG_PRINT_P(debugMsg, KeyId, ReadMaxKeyCount(AppSlot));
212+
DEBUG_PRINT_P(debugMsg, KeyId, ReadMaxKeyCount(AppSlot));
213213
return false;
214214
}
215215
return true;
@@ -585,8 +585,8 @@ uint16_t CreateApp(const DESFireAidType Aid, uint8_t KeyCount, uint8_t KeySettin
585585
/* Allocate storage for the application structure itself */
586586
AppDir.AppCacheStructBlockOffset[Slot] = AllocateBlocks(SELECTED_APP_CACHE_TYPE_BLOCK_SIZE);
587587
if (AppDir.AppCacheStructBlockOffset[Slot] == 0) {
588-
const char *debugMsg = PSTR("X - alloc blks, slot = %d");
589-
DEBUG_PRINT_P(debugMsg, Slot);
588+
const char *debugMsg = PSTR("X - alloc blks, slot = %d");
589+
DEBUG_PRINT_P(debugMsg, Slot);
590590
return STATUS_OUT_OF_EEPROM_ERROR;
591591
}
592592
/* Allocate storage for the application components */
@@ -628,8 +628,8 @@ uint16_t CreateApp(const DESFireAidType Aid, uint8_t KeyCount, uint8_t KeySettin
628628
} else {
629629
SIZET fileAccessRightsData[DESFIRE_MAX_FILES];
630630
for (int fidx = 0; fidx < DESFIRE_MAX_FILES; fidx++) {
631-
fileAccessRightsData[fidx] = 0x000f;
632-
}
631+
fileAccessRightsData[fidx] = 0x000f;
632+
}
633633
WriteBlockBytes(fileAccessRightsData, appCacheData.FileAccessRights, sizeof(SIZET) * DESFIRE_MAX_FILES);
634634
}
635635
appCacheData.KeyVersionsArray = AllocateBlocks(APP_CACHE_KEY_VERSIONS_ARRAY_BLOCK_SIZE);
@@ -669,8 +669,8 @@ uint16_t CreateApp(const DESFireAidType Aid, uint8_t KeyCount, uint8_t KeySettin
669669
}
670670
BYTE cryptoBlankKeyData[CRYPTO_MAX_KEY_SIZE];
671671
memset(cryptoBlankKeyData, 0x00, CRYPTO_MAX_KEY_SIZE);
672-
WriteBlockBytes(cryptoBlankKeyData, keyAddresses[0], CRYPTO_MAX_KEY_SIZE);
673-
WriteBlockBytes(keyAddresses, appCacheData.KeyAddress, sizeof(SIZET) * DESFIRE_MAX_KEYS);
672+
WriteBlockBytes(cryptoBlankKeyData, keyAddresses[0], CRYPTO_MAX_KEY_SIZE);
673+
WriteBlockBytes(keyAddresses, appCacheData.KeyAddress, sizeof(SIZET) * DESFIRE_MAX_KEYS);
674674
}
675675
SIZET appCacheDataBlockId = AppDir.AppCacheStructBlockOffset[Slot];
676676
WriteBlockBytes(&appCacheData, appCacheDataBlockId, sizeof(SelectedAppCacheType));

Firmware/Chameleon-Mini/Application/DESFire/DESFireApplicationDirectory.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ This notice must be retained at the top of all source files where indicated.
3737

3838
#ifdef MEMORY_LIMITED_TESTING
3939
#define DESFIRE_MAX_APPS (3)
40-
#else
40+
#else
4141
#ifdef DESFIRE_CUSTOM_MAX_APPS
4242
#define DESFIRE_MAX_APPS (DESFIRE_CUSTOM_MAX_APPS)
4343
#else
@@ -49,7 +49,7 @@ This notice must be retained at the top of all source files where indicated.
4949

5050
#ifdef MEMORY_LIMITED_TESTING
5151
#define DESFIRE_MAX_FILES (4)
52-
#else
52+
#else
5353
#ifdef DESFIRE_CUSTOM_MAX_FILES
5454
#define DESFIRE_MAX_FILES (DESFIRE_CUSTOM_MAX_FILES)
5555
#else
@@ -59,7 +59,7 @@ This notice must be retained at the top of all source files where indicated.
5959

6060
#ifdef MEMORY_LIMITED_TESTING
6161
#define DESFIRE_MAX_KEYS (2)
62-
#else
62+
#else
6363
#ifdef DESFIRE_CUSTOM_MAX_KEYS
6464
#define DESFIRE_MAX_KEYS (DESFIRE_CUSTOM_MAX_KEYS)
6565
#else

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,13 @@ CommandStatusIdType CommandDESFireSetTestingMode(char *OutParam, const char *InP
242242
CommandStatusIdType CommandDESFireGetCommMode(char *OutParam) {
243243
if (!IsDESFireConfiguration()) {
244244
ExitOnInvalidConfigurationError(OutParam);
245-
} else if(DesfireCommMode == DESFIRE_COMMS_PLAINTEXT) {
245+
} else if (DesfireCommMode == DESFIRE_COMMS_PLAINTEXT) {
246246
snprintf_P(OutParam, TERMINAL_BUFFER_SIZE, PSTR("Plaintext"));
247-
} else if(DesfireCommMode == DESFIRE_COMMS_PLAINTEXT_MAC) {
247+
} else if (DesfireCommMode == DESFIRE_COMMS_PLAINTEXT_MAC) {
248248
snprintf_P(OutParam, TERMINAL_BUFFER_SIZE, PSTR("Plaintext/MAC"));
249-
} else if(DesfireCommMode == DESFIRE_COMMS_CIPHERTEXT_DES) {
249+
} else if (DesfireCommMode == DESFIRE_COMMS_CIPHERTEXT_DES) {
250250
snprintf_P(OutParam, TERMINAL_BUFFER_SIZE, PSTR("Enciphered/DES"));
251-
} else if(DesfireCommMode == DESFIRE_COMMS_CIPHERTEXT_AES128) {
251+
} else if (DesfireCommMode == DESFIRE_COMMS_CIPHERTEXT_AES128) {
252252
snprintf_P(OutParam, TERMINAL_BUFFER_SIZE, PSTR("Enciphered/AES128"));
253253
} else {
254254
snprintf_P(OutParam, TERMINAL_BUFFER_SIZE, PSTR("Unknown"));

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

+25-25
Original file line numberDiff line numberDiff line change
@@ -122,32 +122,32 @@ const char *GetCommSettingsDesc(uint8_t cryptoType) {
122122

123123
/* Code is adapted from @github/andrade/nfcjlib */
124124
bool generateSessionKey(uint8_t *sessionKey, uint8_t *rndA, uint8_t *rndB, uint16_t cryptoType) {
125-
switch(cryptoType) {
126-
case CRYPTO_TYPE_DES:
125+
switch (cryptoType) {
126+
case CRYPTO_TYPE_DES:
127+
memcpy(sessionKey, rndA, 4);
128+
memcpy(sessionKey + 4, rndB, 4);
129+
break;
130+
case CRYPTO_TYPE_2KTDEA:
131+
memcpy(sessionKey, rndA, 4);
132+
memcpy(sessionKey + 4, rndB, 4);
133+
memcpy(sessionKey + 8, rndA + 4, 4);
134+
memcpy(sessionKey + 12, rndB + 4, 4);
135+
break;
136+
case CRYPTO_TYPE_3K3DES:
137+
memcpy(sessionKey, rndA, 4);
138+
memcpy(sessionKey + 4, rndB, 4);
139+
memcpy(sessionKey + 8, rndA + 6, 4);
140+
memcpy(sessionKey + 12, rndB + 6, 4);
141+
memcpy(sessionKey + 16, rndA + 12, 4);
142+
memcpy(sessionKey + 20, rndB + 12, 4);
143+
break;
144+
case CRYPTO_TYPE_AES128:
127145
memcpy(sessionKey, rndA, 4);
128-
memcpy(sessionKey + 4, rndB, 4);
129-
break;
130-
case CRYPTO_TYPE_2KTDEA:
131-
memcpy(sessionKey, rndA, 4);
132-
memcpy(sessionKey + 4, rndB, 4);
133-
memcpy(sessionKey + 8, rndA + 4, 4);
134-
memcpy(sessionKey + 12, rndB + 4, 4);
135-
break;
136-
case CRYPTO_TYPE_3K3DES:
137-
memcpy(sessionKey, rndA, 4);
138-
memcpy(sessionKey + 4, rndB, 4);
139-
memcpy(sessionKey + 8, rndA + 6, 4);
140-
memcpy(sessionKey + 12, rndB + 6, 4);
141-
memcpy(sessionKey + 16, rndA + 12, 4);
142-
memcpy(sessionKey + 20, rndB + 12, 4);
143-
break;
144-
case CRYPTO_TYPE_AES128:
145-
memcpy(sessionKey, rndA, 4);
146-
memcpy(sessionKey + 4, rndB, 4);
147-
memcpy(sessionKey + 8, rndA + 12, 4);
148-
memcpy(sessionKey + 12, rndB + 12, 4);
149-
break;
150-
default:
146+
memcpy(sessionKey + 4, rndB, 4);
147+
memcpy(sessionKey + 8, rndA + 12, 4);
148+
memcpy(sessionKey + 12, rndB + 12, 4);
149+
break;
150+
default:
151151
return false;
152152
}
153153
return true;

Firmware/Chameleon-Mini/Application/DESFire/DESFireCrypto.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ extern BYTE DesfireCommMode;
6464

6565
/* Key sizes, block sizes (in bytes): */
6666
#define CRYPTO_AES_KEY_SIZE (16)
67-
#define CRYPTO_MAX_KEY_SIZE (24)
67+
#define CRYPTO_MAX_KEY_SIZE (24)
6868
#define CRYPTO_MAX_BLOCK_SIZE (16)
6969
#define DESFIRE_AES_IV_SIZE (CRYPTO_AES_BLOCK_SIZE)
7070
#define CRYPTO_CHALLENGE_RESPONSE_BYTES (16)

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

+23-23
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ This notice must be retained at the top of all source files where indicated.
4545

4646
DesfireSavedCommandStateType DesfireCommandState = { 0 };
4747

48-
/* NOTE: The order of the structures in this buffer MUST be kept in
49-
* ascending sorted order by the INS code. This property of the
50-
* array has to be maintained as new commands and functions are
51-
* added to keep CallInstructionHandler(uint8_t*, uint16_t)
52-
* operating correctly. The instruction handler performs a
53-
* binary search on the array to save time locating the correct
54-
* C function to call to execute the command -- and this speedup
55-
* helps keep timing issues at bay. DO NOT just append new command
56-
* handlers to the end of the array, or insert them haphazardly in
48+
/* NOTE: The order of the structures in this buffer MUST be kept in
49+
* ascending sorted order by the INS code. This property of the
50+
* array has to be maintained as new commands and functions are
51+
* added to keep CallInstructionHandler(uint8_t*, uint16_t)
52+
* operating correctly. The instruction handler performs a
53+
* binary search on the array to save time locating the correct
54+
* C function to call to execute the command -- and this speedup
55+
* helps keep timing issues at bay. DO NOT just append new command
56+
* handlers to the end of the array, or insert them haphazardly in
5757
* the middle !!!
5858
*/
5959
const __flash DESFireCommand DESFireCommandSet[] = {
@@ -309,19 +309,19 @@ uint16_t CallInstructionHandler(uint8_t *Buffer, uint16_t ByteCount) {
309309
uint16_t curInsLower = 0, curInsUpper = sizeof(DESFireCommandSet) / sizeof(DESFireCommand) - 1;
310310
uint16_t curInsIndex;
311311
DESFireCommand dfCmd;
312-
while(curInsUpper >= curInsLower) {
312+
while (curInsUpper >= curInsLower) {
313313
curInsIndex = curInsLower + (curInsUpper + 1 - curInsLower) / 2;
314314
memcpy_P(&dfCmd, insLookupTableBuf + curInsIndex * sizeof(DESFireCommand), sizeof(DESFireCommand));
315315
if (dfCmd.insCode == insCode) {
316-
if (dfCmd.insFunc == NULL) {
317-
return CmdNotImplemented(Buffer, ByteCount);
318-
}
319-
return dfCmd.insFunc(Buffer, ByteCount);
320-
} else if (dfCmd.insCode < insCode) {
321-
curInsLower = curInsIndex + 1;
322-
} else {
323-
curInsUpper = curInsIndex - 1;
324-
}
316+
if (dfCmd.insFunc == NULL) {
317+
return CmdNotImplemented(Buffer, ByteCount);
318+
}
319+
return dfCmd.insFunc(Buffer, ByteCount);
320+
} else if (dfCmd.insCode < insCode) {
321+
curInsLower = curInsIndex + 1;
322+
} else {
323+
curInsUpper = curInsIndex - 1;
324+
}
325325
}
326326
return ISO14443A_APP_NO_RESPONSE;
327327
}
@@ -507,7 +507,7 @@ uint16_t EV0CmdAuthenticateLegacy2(uint8_t *Buffer, uint16_t ByteCount) {
507507

508508
/* Set status for the next incoming command on error */
509509
DesfireState = DESFIRE_IDLE;
510-
510+
511511
/* Validate command length */
512512
if (ByteCount != 2 * CRYPTO_CHALLENGE_RESPONSE_BYTES + 1) {
513513
Buffer[0] = STATUS_LENGTH_ERROR;
@@ -534,7 +534,7 @@ uint16_t EV0CmdAuthenticateLegacy2(uint8_t *Buffer, uint16_t ByteCount) {
534534
/* Check that the returned RndB matches what we sent in the previous round */
535535
if (memcmp(DesfireCommandState.RndB, challengeRndB, CRYPTO_CHALLENGE_RESPONSE_BYTES)) {
536536
Buffer[0] = STATUS_AUTHENTICATION_ERROR;
537-
return DESFIRE_STATUS_RESPONSE_SIZE;
537+
return DESFIRE_STATUS_RESPONSE_SIZE;
538538
}
539539

540540
/* Authenticated successfully */
@@ -1791,7 +1791,7 @@ uint16_t DesfireCmdAuthenticate3KTDEA2(uint8_t *Buffer, uint16_t ByteCount) {
17911791
/* Check that the returned RndB matches what we sent in the previous round */
17921792
if (memcmp(DesfireCommandState.RndB, challengeRndB, CRYPTO_CHALLENGE_RESPONSE_BYTES)) {
17931793
LogEntry(LOG_ERR_DESFIRE_GENERIC_ERROR, (const void *) challengeRndB, CRYPTO_CHALLENGE_RESPONSE_BYTES);
1794-
Buffer[0] = STATUS_AUTHENTICATION_ERROR;
1794+
Buffer[0] = STATUS_AUTHENTICATION_ERROR;
17951795
return DESFIRE_STATUS_RESPONSE_SIZE;
17961796
}
17971797

@@ -1805,7 +1805,7 @@ uint16_t DesfireCmdAuthenticate3KTDEA2(uint8_t *Buffer, uint16_t ByteCount) {
18051805
RotateArrayLeft(challengeRndA, challengeRndAB, CRYPTO_CHALLENGE_RESPONSE_BYTES);
18061806
Encrypt3DESBuffer(CRYPTO_CHALLENGE_RESPONSE_BYTES, challengeRndAB,
18071807
&Buffer[1], NULL, Key);
1808-
1808+
18091809
generateSessionKey(SessionKey, challengeRndA, challengeRndB, CRYPTO_TYPE_3K3DES);
18101810

18111811
/* Return the status on success */

Firmware/Chameleon-Mini/Application/DESFire/DESFirePICCHeaderLayout.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ This notice must be retained at the top of all source files where indicated.
145145
#define PICC_FORMAT_BYTE (0x00)
146146
#define PICC_EMPTY_BYTE (0x00)
147147

148-
typedef struct DESFIRE_FIRMWARE_PACKING DESFIRE_FIRMWARE_ALIGNAT{
148+
typedef struct DESFIRE_FIRMWARE_PACKING DESFIRE_FIRMWARE_ALIGNAT {
149149
/* Static data: does not change during the PICC's lifetime.
150150
* We will add Chameleon Mini terminal commands to enable
151151
* resetting this data so tags can be emulated authentically.

0 commit comments

Comments
 (0)