RfidResearchGroup / proxmark3

Iceman Fork - Proxmark3
http://www.icedev.se
GNU General Public License v3.0
3.89k stars 1.03k forks source link

Beware of clock wrapping #858

Open doegox opened 5 years ago

doegox commented 5 years ago

Eg

ti = GetTickCount();
[...]
ti = GetTickCount() - ti;

doesn't take into account when RTTC_RTVR wraps around. Better to have some GetTickDelta(uint32_t start_tick) that does the job properly.

ti = GetTickCount();
[...]
ti = GetTickDelta(ti);
iceman1001 commented 5 years ago

Not just GetTickCount has these kinds of issues. One popular click-death was just the darkside attack in iso14443a.c was based on this kind of bug.

doegox commented 5 years ago

GetTickCountDelta was added and used everywhere. Where else to look at ? Or first we need to identify & document these clocks?

iceman1001 commented 5 years ago

I would suggest we identfy and document these clocks. Especially which that can't be mixed / used together.

iceman1001 commented 5 years ago

Was playing with iclass timing, since they are kind of crap, it uses SspClk and SpinDelayUS.. I thought it would be a good thing to test WaitUS... haha, not, because it uses the same clocks TC0,TC1, TC2 as Ssp ...