Skip to content

Commit

Permalink
Out of hell ... Everything seems to be working again with the MEMORY_…
Browse files Browse the repository at this point in the history
…LIMITED_TESTING define set in the Makefile :)
  • Loading branch information
maxieds committed Feb 13, 2022
1 parent 65766e1 commit ac265b4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 0 additions & 2 deletions Firmware/Chameleon-Mini/Application/CryptoCMAC.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ This notice must be retained at the top of all source files where indicated.
#include "CryptoTDEA.h"
#include "CryptoAES128.h"

#if 0
static uint8_t _cmac_K1[CRYPTO_MAX_BLOCK_SIZE] = { 0x00 };
static uint8_t _cmac_K2[CRYPTO_MAX_BLOCK_SIZE] = { 0x00 };
static uint8_t _cmac_RB[CRYPTO_MAX_BLOCK_SIZE] = { 0x00 };
Expand Down Expand Up @@ -191,4 +190,3 @@ bool checkBufferMAC(uint8_t *bufferData, uint16_t bufferSize, uint16_t checksumS
}
return true;
}
#endif
10 changes: 4 additions & 6 deletions Firmware/Chameleon-Mini/Application/DESFire/DESFireUtils.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,8 @@ bool DesfireCheckParityBits(uint8_t *Buffer, uint16_t BitCount) {
}

uint16_t DesfirePreprocessAPDU(uint8_t CommMode, uint8_t *Buffer, uint16_t BufferSize) {
//DEBUG_PRINT_P(PSTR("PRE -- CommMode -- 0x%02x"), CommMode);
switch (CommMode) {
/*case DESFIRE_COMMS_PLAINTEXT_MAC: {
case DESFIRE_COMMS_PLAINTEXT_MAC: {
uint16_t ChecksumBytes = 0;
if (DesfireCommandState.CryptoMethodType == CRYPTO_TYPE_DES || DesfireCommandState.CryptoMethodType == CRYPTO_TYPE_2KTDEA) {
ChecksumBytes = 4;
Expand Down Expand Up @@ -187,7 +186,7 @@ uint16_t DesfirePreprocessAPDU(uint8_t CommMode, uint8_t *Buffer, uint16_t Buffe
return 0;
}
return MAX(0, BufferSize - ChecksumBytes);
}*/
}
case DESFIRE_COMMS_PLAINTEXT:
default:
// Leave the CRCA bytes intact:
Expand All @@ -196,9 +195,8 @@ uint16_t DesfirePreprocessAPDU(uint8_t CommMode, uint8_t *Buffer, uint16_t Buffe
}

uint16_t DesfirePostprocessAPDU(uint8_t CommMode, uint8_t *Buffer, uint16_t BufferSize) {
//DEBUG_PRINT_P(PSTR("POST -- CommMode -- 0x%02x"), CommMode);
switch (CommMode) {
/*case DESFIRE_COMMS_PLAINTEXT_MAC: {
case DESFIRE_COMMS_PLAINTEXT_MAC: {
if (DesfireCommandState.CryptoMethodType == CRYPTO_TYPE_DES || DesfireCommandState.CryptoMethodType == CRYPTO_TYPE_2KTDEA) {
return appendBufferMAC(SessionKey, Buffer, BufferSize);
} else {
Expand Down Expand Up @@ -235,7 +233,7 @@ uint16_t DesfirePostprocessAPDU(uint8_t CommMode, uint8_t *Buffer, uint16_t Buff
CryptoAESEncryptBuffer(XferBytes, Buffer, &Buffer[XferBytes], SessionIV, SessionKey);
memmove(&Buffer[0], &Buffer[XferBytes], XferBytes);
return XferBytes;
}*/
}
case DESFIRE_COMMS_PLAINTEXT:
default:
ISO14443AAppendCRCA(Buffer, BufferSize);
Expand Down
4 changes: 4 additions & 0 deletions Firmware/Chameleon-Mini/Map.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
#include <stdbool.h>
#include <avr/pgmspace.h>

#ifdef MEMORY_LIMITED_TESTING
#define MAP_TEXT_BUF_SIZE 24
#else
#define MAP_TEXT_BUF_SIZE 32
#endif
#define MAP_MAX_TEXT_SIZE (MAP_TEXT_BUF_SIZE - 1)

typedef uint8_t MapIdType;
Expand Down

0 comments on commit ac265b4

Please sign in to comment.