-
Notifications
You must be signed in to change notification settings - Fork 28
/
example.c
32 lines (26 loc) · 870 Bytes
/
example.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* Example program using ELFcrypt
*
* Include ELFcrypt.h and prefix functions you'd like crypted with CRYPTED.
* Please also remember to add a call to ELFdecrypt() somewhere in your
* program before the protected functions are used.
*
* Your program must then be ran through ELFcrypt:
*
* $ ./ELFcrypt /path/to/program -o output
*/
#include <stdio.h>
/* include ELFcrypt.h for the required macros and functions
*/
#include "ELFcrypt.h"
/* Prefix your functions with CRYPTED to add them to the .crypted section
*/
CRYPTED int crypted_main(int argc, char *argv[]) {
printf("This function was crypted\n");
return 100;
}
int main(int argc, char *argv[]) {
ELFdecrypt(); /* you must call this function and provide a valid
password before the functions you've placed into the
.crypted section will work */
return crypted_main(argc, argv);
}