From 9b5367618ae9d3fbae4b00264ab24dbaa03613b1 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 18 Jul 2019 12:13:17 +0100 Subject: debug improvements --- .gitignore | 2 ++ sha1/Makefile | 10 +++++++++- sha1/emul.script | 4 ++++ sha1/msauth.asm | 3 --- sha1/test/totp.pl | 6 +++++- 5 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 sha1/emul.script diff --git a/.gitignore b/.gitignore index 8188dde..9f2b447 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ sha1/*.img sha1/*.srec from_others/numpad/numpad-?.asm from_others/numpad/numpad.asm +*.obj +*.map diff --git a/sha1/Makefile b/sha1/Makefile index b2635cc..52805c3 100644 --- a/sha1/Makefile +++ b/sha1/Makefile @@ -14,6 +14,8 @@ AFLAGS=-i ../include/dl150 -cpu datalink AS=${CROSS}asl ${AFLAGS} P2BIN=${CROSS}p2bin +EMUL=../../sim68xx/src/boards/sim6805 + default:${APP} ${LSTS} ${S19} .PRECIOUS:${APP} ${LSTS} @@ -30,10 +32,16 @@ default:${APP} ${LSTS} ${S19} ${P2BIN} $< $@ -r 0x110-\$$ %.lst %.p:%.asm - ${AS} -L ${@:%.p=%.lst} -o $@ $< + ${AS} -g -L ${@:%.p=%.lst} -o $@ $< + ${CROSS}/process_map ${@:%.p=%.map} + + %.l:%.lst awk '{ if (($$1!="(1)") && ($$1!=" ") && NF) { print }}' < $< > $@ || /bin/rm -f $@ +do_test: ${PROG}.srec + ${EMUL} $< < emul.script + clean: /bin/rm -f ${APP} ${PS} ${LSTS} ${RLSTS} ${S19} diff --git a/sha1/emul.script b/sha1/emul.script new file mode 100644 index 0000000..cd3324d --- /dev/null +++ b/sha1/emul.script @@ -0,0 +1,4 @@ +b END +g TEST +md T1 4 +quit diff --git a/sha1/msauth.asm b/sha1/msauth.asm index 5e03d48..397e2eb 100644 --- a/sha1/msauth.asm +++ b/sha1/msauth.asm @@ -1,8 +1,5 @@ INCLUDE "WRISTAPP.I" - org $100 - jmp test - idx EQU $60 lidx EQU $61 diff --git a/sha1/test/totp.pl b/sha1/test/totp.pl index 5903133..cd40aa0 100755 --- a/sha1/test/totp.pl +++ b/sha1/test/totp.pl @@ -171,7 +171,11 @@ sub generateCurrentNumber { my $offset = hex(substr($hmac, -1)); print "offset=",$offset,"\n"; # take the 4 bytes (8 hex chars) at the offset (* 2 for hex), and drop the high bit - my $encrypted = hex(substr($hmac, $offset * 2, 8)) & 0x7fffffff; + my $hex = substr($hmac, $offset * 2, 8); + my $encrypted = hex($hex) & 0x7fffffff; + + print "hex=",sprintf("%08x", $encrypted),"\n"; + # the token is then the last 6 digits in the number my $token = $encrypted % 1000000; -- cgit v1.2.3