sim module firmware is now v4.60, (sim020.bin) it adds a better drain when T=0 exits abnormal (abort). Better waiting time floor, with faster ETU which doesnt shrink with WWT.\n Changes to i2c with SDA timings, also modified the fixed msleep(100) with an idle time waiting which leads to 107 ms off from every iteration.\n Added a ATR cache to remember which TA1 was autonegotiated. This impact i2c comms speed with sim module for same card. 'smart pps' is better documented.\n The sam_common.c now also logs 61xx and GET_RESPONSE :) and generic long-form ASN-1 lengths. trace list -t 7816 now also shows rdr frames in us. \n All in all, this should lead for 'emv reader -w' to go from 5.87sec to 2.78sec. 'hf seos sam' is down to 1.92sec. 'hw ping' is down to 0.57sec. A USB round trip is down from 20.8ms to 1.3ms. It should give a snappier end user experience
This commit is contained in:
1 parent
d996b75578
commit
76181dfb8e
12 files changed
+283
-17
No files matched your search
Binary file not shown.
@@ -0,0 +1 @@
|
||||
41a0ec1cdd0036e44b28b3462f3de64f04bbf6d7456c7e969490fe6c8c6b5c8feb5746244ba8100d4d223760431cb6d9da5ffe824c1dcd7ef096869f8c0d93ba *client/resources/sim020.bin
|
||||
@@ -2370,6 +2370,21 @@ static int CmdHfSeosSAM(const char *Cmd) {
|
||||
// 07
|
||||
} else if (d[0] == 0xbd && d[2] == 0xb3 && d[4] == 0xa0) {
|
||||
const uint8_t *pacs = d + 6;
|
||||
// The a0 content element normally starts with 80 <len> <PACS bits>.
|
||||
// Some SAMs / cards return a status-only element with no access-bits
|
||||
// field, e.g. a0 03 82 01 03 - here the first inner tag is 82, not 80.
|
||||
// Don't parse the status byte as PACS (that yields a bogus
|
||||
// "Invalid PACS value"); report that the card has no readable PACS.
|
||||
if (pacs[0] != 0x80) {
|
||||
PrintAndLogEx(WARNING, "No PACS/SIO access-bits returned by the SAM");
|
||||
if (pacs[0] == 0x82 && pacs[1] == 0x01) {
|
||||
PrintAndLogEx(INFO, "SAM content status: " _YELLOW_("0x%02X") " (no physicalAccessBits field)", pacs[2]);
|
||||
}
|
||||
if (verbose) {
|
||||
print_hex(d, resp.length);
|
||||
}
|
||||
return PM3_ENOPACS;
|
||||
}
|
||||
const uint8_t pacs_length = pacs[1];
|
||||
const uint8_t *pacs_data = pacs + 2;
|
||||
int res = HIDDumpPACSBits(pacs_data, pacs_length, verbose);
|
||||
|
||||
@@ -622,7 +622,7 @@ static int CmdSmartUpgrade(const char *Cmd) {
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "smart upgrade",
|
||||
"Upgrade RDV4 sim module firmware",
|
||||
"smart upgrade -f sim017.bin"
|
||||
"smart upgrade -f sim020.bin"
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
@@ -927,7 +927,14 @@ static int CmdSmartPPS(const char *Cmd) {
|
||||
"\n"
|
||||
"Note `smart raw -1` already switches a card to T=1 by itself when\n"
|
||||
"the ATR offers it; this is for negotiating Fi/Di explicitly.\n"
|
||||
"Needs SIM module firmware v4.51 or newer.",
|
||||
"Needs SIM module firmware v4.51 or newer.\n"
|
||||
"\n"
|
||||
"The negotiated rate only holds for the rest of this session, and\n"
|
||||
"only for commands that do not reset the card. Connecting a client\n"
|
||||
"reads the module version, which reboots the module back to the\n"
|
||||
"default rate while the card stays at the negotiated one - the next\n"
|
||||
"command then fails until something resets the card. `smart info`,\n"
|
||||
"or any `smart raw -s`, puts both back to the default.",
|
||||
"smart pps -1 -> select T=1\n"
|
||||
"smart pps -0 -> select T=0\n"
|
||||
"smart pps -1 --ta1 96 -> select T=1 and F=512 / D=32"
|
||||
|
||||
@@ -1519,7 +1519,7 @@ int CmdTraceList(const char *Cmd) {
|
||||
}
|
||||
|
||||
if (protocol == ISO_7816_4)
|
||||
PrintAndLogEx(INFO, _YELLOW_("ISO7816-4 / Smartcard") " - Timings n/a");
|
||||
PrintAndLogEx(INFO, _YELLOW_("ISO7816-4 / Smartcard") " - Timings in ticks (1/1.5MHz == 0.67us)");
|
||||
|
||||
if (protocol == PROTO_CALYPSO)
|
||||
PrintAndLogEx(INFO, _YELLOW_("Calypso") " - Timings n/a");
|
||||
|
||||
@@ -80,6 +80,30 @@ static uint64_t last_packet_time;
|
||||
|
||||
static bool dl_it(uint8_t *dest, uint32_t bytes, PacketResponseNG *response, size_t ms_timeout, bool show_warning, uint32_t rec_cmd);
|
||||
|
||||
// Wait until the comm thread has actually put a queued command on the wire.
|
||||
// Callers used to sleep a fixed guess instead, which was reasonable when a
|
||||
// command could sit in the buffer for a whole receive timeout; it is now sent
|
||||
// within a millisecond or so.
|
||||
bool WaitForTxIdle(uint32_t ms_timeout) {
|
||||
|
||||
uint64_t start = msclock();
|
||||
|
||||
for (;;) {
|
||||
|
||||
pthread_mutex_lock(&txBufferMutex);
|
||||
bool pending = txBuffer_pending;
|
||||
pthread_mutex_unlock(&txBufferMutex);
|
||||
|
||||
if (pending == false) {
|
||||
return true;
|
||||
}
|
||||
if (msclock() - start >= ms_timeout) {
|
||||
return false;
|
||||
}
|
||||
msleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Simple alias to track usages linked to the Bootloader, these commands must not be migrated.
|
||||
// - commands sent to enter bootloader mode as we might have to talk to old firmwares
|
||||
// - commands sent to the bootloader as it only supports OLD frames (which will always be the case for old BL)
|
||||
|
||||
@@ -113,6 +113,7 @@ void StartReconnectProxmark(void);
|
||||
size_t WaitForRawDataTimeout(uint8_t *buffer, size_t len, size_t ms_timeout, bool show_process, bool keep_raw_mode);
|
||||
bool WaitForResponseTimeoutW(uint32_t cmd, PacketResponseNG *response, size_t ms_timeout, bool show_warning);
|
||||
bool WaitForResponseTimeout(uint32_t cmd, PacketResponseNG *response, size_t ms_timeout);
|
||||
bool WaitForTxIdle(uint32_t ms_timeout);
|
||||
bool WaitForResponse(uint32_t cmd, PacketResponseNG *response);
|
||||
|
||||
int SetHfFieldTimeout(uint32_t timeout_sec, bool quiet);
|
||||
|
||||
@@ -687,7 +687,7 @@ check_script:
|
||||
if (g_session.pm3_present) {
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_QUIT_SESSION, NULL, 0);
|
||||
msleep(100); // Make sure command is sent before killing client
|
||||
WaitForTxIdle(100); // make sure it really went out before killing the client
|
||||
}
|
||||
|
||||
while (current_cmdscriptfile()) {
|
||||
|
||||
Reference in new issue
Block a user