This commit is contained in:
iceman1001
2026-04-03 11:46:58 +07:00
parent 11e4fa3fd7
commit c33f10f56b
3 changed files with 15 additions and 3 deletions
+8
View File
@@ -102,22 +102,30 @@ bool g_tearoff_enabled = false;
uint8_t g_tearoff_skip = 0;
int tearoff_hook(void) {
if (g_tearoff_enabled) {
if (g_tearoff_delay_us == 0) {
if (g_dbglevel >= DBG_ERROR) Dbprintf(_RED_("No tear-off delay configured!"));
g_tearoff_enabled = false;
return PM3_SUCCESS; // SUCCESS = the hook didn't do anything
}
if (g_tearoff_skip > 0) {
if (g_dbglevel >= DBG_INFO) Dbprintf(_GREEN_("Tear-off skipped!"));
g_tearoff_skip--;
return PM3_SUCCESS; // SUCCESS = the hook didn't do anything
}
SpinDelayUsPrecision(g_tearoff_delay_us);
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
g_tearoff_enabled = false;
if (g_dbglevel >= DBG_INFO) Dbprintf(_YELLOW_("Tear-off triggered!"));
return PM3_ETEAROFF;
} else {
return PM3_SUCCESS; // SUCCESS = the hook didn't do anything
}
+1
View File
@@ -3785,6 +3785,7 @@ void ReaderIso14443a(PacketCommandNG *c) {
}
if ((param & ISO14A_RAW) == ISO14A_RAW) {
if ((param & ISO14A_CRYPTO1MODE) == ISO14A_CRYPTO1MODE) {
// Intercept special Auth command 6xxx<key>CRCA
if ((len == 10) && ((cmd[0] & 0xF0) == 0x60)) {
+6 -3
View File
@@ -40,8 +40,9 @@ void SpinDelayUsPrecision(int us) {
AT91C_BASE_PWMC_CH0->PWMC_CPRDR = 0xFFFF; // Channel Period Register
uint16_t end = AT91C_BASE_PWMC_CH0->PWMC_CCNTR + ticks;
if (end == 0) // AT91C_BASE_PWMC_CH0->PWMC_CCNTR is never == 0
if (end == 0) { // AT91C_BASE_PWMC_CH0->PWMC_CCNTR is never == 0
end++; // so we have to end++ to avoid inivity loop
}
for (;;) {
uint16_t now = AT91C_BASE_PWMC_CH0->PWMC_CCNTR;
@@ -68,14 +69,16 @@ void SpinDelayUs(int us) {
AT91C_BASE_PWMC_CH0->PWMC_CPRDR = 0xffff; // Channel Period Register
uint16_t end = AT91C_BASE_PWMC_CH0->PWMC_CCNTR + ticks;
if (end == 0) // AT91C_BASE_PWMC_CH0->PWMC_CCNTR is never == 0
if (end == 0) { // AT91C_BASE_PWMC_CH0->PWMC_CCNTR is never == 0
end++; // so we have to end++ to avoid inivity loop
}
for (;;) {
uint16_t now = AT91C_BASE_PWMC_CH0->PWMC_CCNTR;
if (now == end)
if (now == end) {
return;
}
WDT_HIT();
}
}