Best practice for providing C API hiding internal functions

I wrote the C library, which consists of several .h and .c files. I will compile it as a static .a library.

I would like to expose the user to only certain functions and keep the rest as “obscure" as possible, to make reverse engineering complex enough.

Ideally, my library would consist of:

1st .h file with only functions open to the user

2- myLibrary.a: how can reengineering

What are the best methods for doing this? Where should I look, is there a good textbook / book somewhere?

More specific:

for - 1

I already have all my .h and .c, and I would like to avoid changing them by moving the function declarations from .h to .c and going to the round pbs links. Is it possible?

For example, is it a good idea to create a new .h file that I will only use for distribution with my .a? This .h will contain copies of the functions that I want to expose and forward declarations of the types that I use. Is that a good idea?

for - 2

a) what should I know about gcc flags (or xcode) (for deletion, no debugging symbols, etc.), b) a good pointer to find out how to obfuscate the code?

Any thought will help

Thank you woman

+5
source share
3 answers

, , , static . .

, , , .h, . , , - ( , objdump nm), .

, , , , API struct, API .h. , . , struct .h.

struct, , . , , , , .

, strip , .

, , . , , , , .

, , , , - . , , , , .

+7

, "" . , " +". - ANSI C. . Quantum leaps.

+1

Remove the headers for these functions, do some obfuscation in the export table and get a code package and apply some anti-debugging algorithm.

http://upx.sourceforge.net/

http://www.oreans.com/

0
source

All Articles