From b9f6f096aa9d565af3a59998fd65c744da318f96 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 7 May 2020 14:20:49 +0200 Subject: [PATCH] hook reveng outputs to pm3 machinery, add regression test --- client/deps/reveng/Makefile | 2 +- client/deps/reveng/bmpbit.c | 6 ++++++ client/deps/reveng/config.h | 6 ++++++ pm3test.sh | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/client/deps/reveng/Makefile b/client/deps/reveng/Makefile index 0dbfa6007..d0382771d 100644 --- a/client/deps/reveng/Makefile +++ b/client/deps/reveng/Makefile @@ -4,7 +4,7 @@ # Add -DPRESETS to compile with preset models (edit config.h) MYSRCPATHS = -MYINCLUDES = -I../cliparser +MYINCLUDES = -I../cliparser -I../../src -I../../../include MYCFLAGS = MYDEFS = -DPRESETS MYSRCS = \ diff --git a/client/deps/reveng/bmpbit.c b/client/deps/reveng/bmpbit.c index e44ddb250..522d71ecc 100644 --- a/client/deps/reveng/bmpbit.c +++ b/client/deps/reveng/bmpbit.c @@ -30,6 +30,12 @@ #endif #include "reveng.h" +#ifdef BMPTST +# undef fprintf +# undef puts +# undef fputs +#endif + #if (defined BMPTST) || (BMP_BIT < 32) /* Size in bits of a bmp_t. Not necessarily a power of two. */ int bmpbit; diff --git a/client/deps/reveng/config.h b/client/deps/reveng/config.h index 94d3c4da5..177df030e 100644 --- a/client/deps/reveng/config.h +++ b/client/deps/reveng/config.h @@ -101,4 +101,10 @@ * * *****************************************/ +// Proxmark3 stdout/stderr hooking +#include "ui.h" +#define fprintf(stream, ...) PrintAndLogEx(INFO, __VA_ARGS__) +#define fputs(s, stream) PrintAndLogEx(INFO, "%s", s) +#define puts(s) PrintAndLogEx(SUCCESS, "%s", s) + #endif /* CONFIG_H */ diff --git a/pm3test.sh b/pm3test.sh index 99fe168dc..825398fae 100755 --- a/pm3test.sh +++ b/pm3test.sh @@ -108,7 +108,7 @@ while true; do if ! CheckExecute "proxmark help text hardnested" "$PM3BIN -t 2>&1" "hardnested"; then break; fi printf "\n${C_BLUE}Testing data manipulation:${C_NC}\n" - if ! CheckExecute "reveng test" "$PM3BIN -c 'reveng -w 8 -s 01020304e3 010204039d'" "CRC-8/SMBUS"; then break; fi + if ! CheckExecute "reveng test" "$PM3BIN -c 'reveng -h;reveng -w 8 -s 01020304e3 010204039d'" "CRC-8/SMBUS"; then break; fi if ! CheckExecute "mfu pwdgen test" "$PM3BIN -c 'hf mfu pwdgen t'" "Selftest OK"; then break; fi printf "\n${C_BLUE}Testing LF:${C_NC}\n"