disable more code with SKIP_ISO14443*

This commit is contained in:
Philippe Teuwen 2020-11-05 22:26:47 +01:00
commit bae2f5f04e
2 changed files with 31 additions and 4 deletions

View file

@ -22,10 +22,12 @@
#include "commonutil.h" #include "commonutil.h"
#include "ticks.h" #include "ticks.h"
#ifdef WITH_ISO14443a
// Protocol and Parameter Selection Request for ISO 14443 type A cards // Protocol and Parameter Selection Request for ISO 14443 type A cards
// use regular (1x) speed in both directions // use regular (1x) speed in both directions
// CRC is already included // CRC is already included
static const uint8_t pps[] = {0xD0, 0x11, 0x00, 0x52, 0xA6}; static const uint8_t pps[] = {0xD0, 0x11, 0x00, 0x52, 0xA6};
#endif
// APDUs for communication with German Identification Card // APDUs for communication with German Identification Card
@ -116,9 +118,25 @@ static char iso_type = 0;
static int EPA_APDU(uint8_t *apdu, size_t length, uint8_t *response, uint16_t respmaxlen) { static int EPA_APDU(uint8_t *apdu, size_t length, uint8_t *response, uint16_t respmaxlen) {
switch (iso_type) { switch (iso_type) {
case 'a': case 'a':
#ifdef WITH_ISO14443a
return iso14_apdu(apdu, (uint16_t) length, false, response, NULL); return iso14_apdu(apdu, (uint16_t) length, false, response, NULL);
#else
(void) apdu;
(void) length;
(void) response;
(void) respmaxlen;
return PM3_ENOTIMPL;
#endif
case 'b': case 'b':
#ifdef WITH_ISO14443b
return iso14443b_apdu(apdu, length, false, response, respmaxlen, NULL); return iso14443b_apdu(apdu, length, false, response, respmaxlen, NULL);
#else
(void) apdu;
(void) length;
(void) response;
(void) respmaxlen;
return PM3_ENOTIMPL;
#endif
default: default:
return 0; return 0;
} }
@ -522,7 +540,10 @@ void EPA_PACE_Replay(PacketCommandNG *c) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int EPA_Setup(void) { int EPA_Setup(void) {
#ifdef WITH_ISO14443a
{
// first, look for type A cards // first, look for type A cards
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
// power up the field // power up the field
iso14443a_setup(FPGA_HF_ISO14443A_READER_MOD); iso14443a_setup(FPGA_HF_ISO14443A_READER_MOD);
iso14a_card_select_t card_a_info; iso14a_card_select_t card_a_info;
@ -541,20 +562,24 @@ int EPA_Setup(void) {
iso_type = 'a'; iso_type = 'a';
return 0; return 0;
} }
}
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); #endif
#ifdef WITH_ISO14443b
{
// if we're here, there is no type A card, so we look for type B // if we're here, there is no type A card, so we look for type B
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
// power up the field // power up the field
iso14443b_setup(); iso14443b_setup();
iso14b_card_select_t card_b_info; iso14b_card_select_t card_b_info;
return_code = iso14443b_select_card(&card_b_info); int return_code = iso14443b_select_card(&card_b_info);
if (return_code == 0) { if (return_code == 0) {
Dbprintf("ISO 14443 Type B"); Dbprintf("ISO 14443 Type B");
iso_type = 'b'; iso_type = 'b';
return 0; return 0;
} }
}
#endif
Dbprintf("No card found"); Dbprintf("No card found");
return 1; return 1;
} }

View file

@ -141,6 +141,8 @@ SKIP_FELICA=1
``` ```
Situation might change when the firmware is growing of course, requiring to skip more elements. Situation might change when the firmware is growing of course, requiring to skip more elements.
Last note: if you skip a tech, be careful not to use a standalone mode which requires that same tech, else the firmware size reduction won't be much.
## Next step ## Next step
See [Compilation instructions](/doc/md/Use_of_Proxmark/0_Compilation-Instructions.md) See [Compilation instructions](/doc/md/Use_of_Proxmark/0_Compilation-Instructions.md)