aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2019-04-11 13:43:57 +0200
committerToni Uhlig <matzeton@googlemail.com>2019-04-11 13:43:57 +0200
commit620e9785b8b3462aed1421212e9e65b4169ae4bf (patch)
tree094f63ad80364f50b9f6e085c649e2779d0297b4
parent101044ee5f8e16503b8211fcabebe246d46e15d8 (diff)
pre C99 compat
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r--funccrypt.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/funccrypt.c b/funccrypt.c
index 7ab37ca..cce1e11 100644
--- a/funccrypt.c
+++ b/funccrypt.c
@@ -30,8 +30,9 @@ typedef enum crypt_return {
static int crypted_fn(int arg0, char *arg1, void *arg2)
{
CRYPT_PROLOGUE
+ int i;
printf("I'm decrypted ..\n");
- for (int i = 0; i < 32; ++i)
+ for (i = 0; i < 32; ++i)
printf("%d ", i);
puts("");
CRYPT_EPILOGUE
@@ -48,13 +49,14 @@ static void crypted_fn2(void)
static crypt_return crypt_func(void *fn_start)
{
+ int i;
enum crypt_return cret = CRET_ERROR;
uint8_t *fnbuf = (uint8_t *) fn_start;
const uint32_t prologue_marker = 0xC0DEC0DE;
const uint32_t epilogue_marker = 0xCAFECAFE;
printf("Fn: %p\n", fnbuf);
- for (int i = 0; i < 0x100; ++i) {
+ for (i = 0; i < 0x100; ++i) {
if (cret == CRET_ERROR &&
*(uint32_t *) &fnbuf[i] == prologue_marker)
{
@@ -75,7 +77,9 @@ static crypt_return crypt_func(void *fn_start)
static void printHexBuf(uint8_t *buf, size_t siz, size_t chars_per_line)
{
- for (int i = 0; i < siz; ++i) {
+ int i;
+
+ for (i = 0; i < siz; ++i) {
printf("%02X ", buf[i]);
if ((i+1) % chars_per_line == 0)
printf("\n");
@@ -97,4 +101,6 @@ int main(void)
printf("\noutput:\n");
printf("crypted_fn: 0x%X\n", crypted_fn(0, NULL, NULL));
crypted_fn2();
+
+ return 0;
}