diff options
author | segfault <segfault@secmail.pro> | 2019-05-29 00:07:07 +0200 |
---|---|---|
committer | segfault <segfault@secmail.pro> | 2019-05-29 00:07:07 +0200 |
commit | aa6421d0785ae4e2f0eafc68fedf9aeaf69e4cc6 (patch) | |
tree | 10b6b0232f9a6b793579b8a3a92efca081411226 | |
parent | 6d7b0811c91a1387b1b315d5c119c1f38ff5350d (diff) |
readable output
Signed-off-by: segfault <segfault@secmail.pro>
-rw-r--r-- | Makefile | 14 | ||||
-rw-r--r-- | example.c | 5 | ||||
-rw-r--r-- | funccrypt.c | 4 | ||||
-rw-r--r-- | funccrypt.h | 2 |
4 files changed, 21 insertions, 4 deletions
@@ -39,13 +39,27 @@ example_x64$(SF64): funccrypt.h funccrypt.c example.c $(CC64) $(CFLAGS) $^ -o $@ test: all + @printf '\n%s\n' './example_x86$(SF32)' test -x example_x86$(SF32) && $(INTERP32) ./example_x86$(SF32) + @printf '\n%s\n' './example_x86$(SF64)' test -x example_x64$(SF64) && $(INTERP64) ./example_x64$(SF64) full: + @printf '\n%s\n' '******************' + @printf '%s\n' '*** HOST BUILD ***' + @printf '%s\n\n' '******************' -$(MAKE) all + @printf '\n%s\n' '*******************' + @printf '%s\n' '*** MINGW BUILD ***' + @printf '%s\n\n' '*******************' -$(MAKE) all WIN32=1 WIN64=1 + @printf '\n%s\n' '*****************' + @printf '%s\n' '*** HOST TEST ***' + @printf '%s\n\n' '*****************' -$(MAKE) test + @printf '\n%s\n' '******************' + @printf '%s\n' '*** MINGW TEST ***' + @printf '%s\n\n' '******************' -$(MAKE) test WIN32=1 WIN64=1 full-clean: @@ -63,17 +63,18 @@ int main(void) crypt_func((void *)crypted_fn3)); #endif +#ifdef _DEBUG printf("crypted_fn:\n"); printHexBuf((uint8_t *)crypted_fn, 160, 32); printf("crypted_fn2:\n"); printHexBuf((uint8_t *)crypted_fn2, 160, 32); printf("crypted_fn3:\n"); printHexBuf((uint8_t *)crypted_fn3, 160, 32); -#ifdef _DEBUG +#endif printf("\noutput:\n"); printf("crypted_fn: 0x%X\n", crypted_fn(0, NULL, NULL)); crypted_fn2(); crypted_fn3(NULL, (unsigned int)-1, "TEST"); -#endif + return 0; } diff --git a/funccrypt.c b/funccrypt.c index 2c48192..60c3edd 100644 --- a/funccrypt.c +++ b/funccrypt.c @@ -12,7 +12,6 @@ const char *crypt_strs[] = { "ERROR", "PROLOGUE", "EPILOGUE", "CHECK", "OK" }; -#endif void printHexBuf(uint8_t *buf, size_t siz, size_t chars_per_line) @@ -28,6 +27,7 @@ void printHexBuf(uint8_t *buf, size_t siz, size_t chars_per_line) if ((i) % chars_per_line != 0) printf("\n"); } +#endif crypt_return crypt_func(void *fn_start) { @@ -40,7 +40,9 @@ crypt_return crypt_func(void *fn_start) crypt_header *hdr; size_t crypt_size; +#ifdef _DEBUG printf("Fn: %p\n", fnbuf); +#endif for (i = 0; i < CRYPT_FUNC_MAXSIZ; ++i) { if (cret == CRET_ERROR && diff --git a/funccrypt.h b/funccrypt.h index e2ad45a..bdac0f3 100644 --- a/funccrypt.h +++ b/funccrypt.h @@ -76,8 +76,8 @@ typedef enum crypt_return { #ifdef _DEBUG extern const char *crypt_strs[]; -#endif extern void printHexBuf(uint8_t *buf, size_t siz, size_t chars_per_line); +#endif extern crypt_return crypt_func(void *fn_start); #endif |