diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2019-04-13 19:38:53 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2019-04-13 20:02:07 +0200 |
commit | 91d928cf38eaa83cf74119c74aeda0b23a043489 (patch) | |
tree | 029367f5c8f89b62302234d4bb366b0e21ce9b06 | |
parent | 6dd2d7148cf142f91886b5dc8cba7b9d1cc0766a (diff) |
funccrypt MAXSIZ macro, gitlab-ci integration
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r-- | funccrypt.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/funccrypt.c b/funccrypt.c index 9235b0f..7f13c78 100644 --- a/funccrypt.c +++ b/funccrypt.c @@ -19,11 +19,16 @@ typedef struct crypt_header { uint64_t func_body[0]; } GCC_PACKED crypt_header; +#define CRYPT_FUNC_MAXSIZ 0x100 #define CRYPT_FUNC(fn) \ crypt_func((void *)fn) #define CRYPT_PROLOGUE(fn) \ + crypt_return __cr; \ { \ - CRYPT_FUNC(fn); \ + __cr = CRYPT_FUNC(fn); \ + if (__cr != CRET_OK) \ + asm volatile goto("jmp %l0 \n" \ + : : : : cr_epilogue); \ asm volatile goto("jmp %l0 \n" \ : : : : cr_prologue); \ asm volatile( \ @@ -113,7 +118,7 @@ static crypt_return crypt_func(void *fn_start) size_t crypt_size; printf("Fn: %p\n", fnbuf); - for (i = 0; i < 0x100; ++i) { + for (i = 0; i < CRYPT_FUNC_MAXSIZ; ++i) { if (cret == CRET_ERROR && *(uint32_t *) &fnbuf[i] == prologue_marker) { |