Replace WITH_SMARTCARD by dynamic detection in client

This commit is contained in:
Philippe Teuwen 2019-05-01 22:33:27 +02:00
commit 6b2677c154
2 changed files with 19 additions and 23 deletions

View file

@ -809,13 +809,12 @@ static int CmdEMVExec(const char *Cmd) {
uint8_t psenum = (channel == ECC_CONTACT) ? 1 : 2;
CLIParserFree();
#ifndef WITH_SMARTCARD
// not compiled with smartcard functionality, we need to exit
if (channel == ECC_CONTACT) {
PrintAndLogEx(WARNING, "PM3 Client is not compiled with support for SMARTCARD. Exiting.");
return PM3_EDEVNOTSUPP;
if (!IfPm3Smartcard()) {
if (channel == ECC_CONTACT) {
PrintAndLogEx(WARNING, "PM3 does not have SMARTCARD support. Exiting.");
return PM3_EDEVNOTSUPP;
}
}
#endif
SetAPDULogging(showAPDU);
@ -1400,13 +1399,12 @@ static int CmdEMVScan(const char *Cmd) {
CLIGetStrWithReturn(12, relfname, &relfnamelen);
CLIParserFree();
#ifndef WITH_SMARTCARD
// not compiled with smartcard functionality, we need to exit
if (channel == ECC_CONTACT) {
PrintAndLogEx(ERR, "PM3 Client is not compiled with support for SMARTCARD. Exiting.");
return PM3_EDEVNOTSUPP;
if (!IfPm3Smartcard()) {
if (channel == ECC_CONTACT) {
PrintAndLogEx(WARNING, "PM3 does not have SMARTCARD support. Exiting.");
return PM3_EDEVNOTSUPP;
}
}
#endif
SetAPDULogging(showAPDU);
@ -1736,13 +1734,12 @@ static int CmdEMVRoca(const char *Cmd) {
PrintChannel(channel);
CLIParserFree();
#ifndef WITH_SMARTCARD
// not compiled with smartcard functionality, we need to exit
if (channel == ECC_CONTACT) {
PrintAndLogEx(WARNING, "PM3 Client is not compiled with support for SMARTCARD. Exiting.");
return PM3_EDEVNOTSUPP;
if (!IfPm3Smartcard()) {
if (channel == ECC_CONTACT) {
PrintAndLogEx(WARNING, "PM3 does not have SMARTCARD support. Exiting.");
return PM3_EDEVNOTSUPP;
}
}
#endif
// select card
uint8_t psenum = (channel == ECC_CONTACT) ? 1 : 2;