diff options
| author | Root THC | 2026-02-24 12:42:47 +0000 |
|---|---|---|
| committer | Root THC | 2026-02-24 12:42:47 +0000 |
| commit | c9cbeced5b3f2bdd7407e29c0811e65954132540 (patch) | |
| tree | aefc355416b561111819de159ccbd86c3004cf88 /other/wrez/lime-interface.c | |
| parent | 073fe4bf9fca6bf40cef2886d75df832ef4b6fca (diff) | |
initial
Diffstat (limited to 'other/wrez/lime-interface.c')
| -rw-r--r-- | other/wrez/lime-interface.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/other/wrez/lime-interface.c b/other/wrez/lime-interface.c new file mode 100644 index 0000000..c40b416 --- /dev/null +++ b/other/wrez/lime-interface.c | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | /* interface code for the LiME polymorphism engine | ||
| 2 | */ | ||
| 3 | |||
| 4 | #include "lime-interface.h" | ||
| 5 | |||
| 6 | |||
| 7 | /* lime_generate | ||
| 8 | * | ||
| 9 | * generate a new polymorph code from source data at 'source', with a length | ||
| 10 | * of 'source_len' bytes. the decrypter and encrypted data will be put at | ||
| 11 | * 'dest', without any length check (expect no more than 4096 bytes for the | ||
| 12 | * decrypter, so 4096 + source_len will do). 'delta' is the virtual address | ||
| 13 | * the decryptor will be placed, its the virutal address of dest[0]. | ||
| 14 | * `rnd' is a random seed. | ||
| 15 | * | ||
| 16 | * return the number of bytes put at 'dest' | ||
| 17 | */ | ||
| 18 | |||
| 19 | inline unsigned int | ||
| 20 | lime_generate (unsigned char *source, unsigned int source_len, | ||
| 21 | unsigned char *dest, unsigned long int delta, unsigned int rnd) | ||
| 22 | { | ||
| 23 | unsigned int rlen; | ||
| 24 | |||
| 25 | /* FIXME: eax is not random parameter anymore, but does not hurt */ | ||
| 26 | __asm__ __volatile__ (" | ||
| 27 | pushl %%ebp | ||
| 28 | movl 0x14(%%ebp), %%ebp | ||
| 29 | pushf | ||
| 30 | pusha | ||
| 31 | call lime | ||
| 32 | movl %%edx, 0x14(%%esp) | ||
| 33 | popa | ||
| 34 | popf | ||
| 35 | popl %%ebp\n\t" | ||
| 36 | : "=d" (rlen) | ||
| 37 | : "a" (rnd), "b" ((unsigned int) dest), | ||
| 38 | "c" ((unsigned int) source), "d" (source_len)); | ||
| 39 | |||
| 40 | return (rlen); | ||
| 41 | } | ||
| 42 | |||
| 43 | |||
