Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Distribute a application to the public so they can compile, without revealing the source

I have a proprietary application I would like to hand out to a few people for testing, except we do not want to reveal the source to them. The application is written in C++ for Linux. It links against readily available packages on the Fedora/Ubuntu repos.

Is there any way to process the source to something intermediate... then distribute it, and have the users do a final compile which actually compiles and links the intermediate code to their native platform.

I am trying to see if there is any alternative to distributing precompiled binaries. Thanks.

like image 315
The Unknown Avatar asked Jul 16 '09 00:07

The Unknown


6 Answers

It's not a technical answer, but do you trust them enough to just ask for a signed NDA?

like image 119
John Avatar answered Nov 17 '22 22:11

John


Just compile it to assembler. Can be done using the -S option.

helloworld.cpp:

#include <iostream>

using namespace std;

int main(void)
{
    cout << "Hello World" << endl;
    return 0;
}

And then do:

emil@lanfear /home/emil/dev/assemblertest $ g++ -S -o helloworld.s helloworld.cpp
emil@lanfear /home/emil/dev/assemblertest $ g++ -o helloworld helloworld.s
emil@lanfear /home/emil/dev/assemblertest $ ./helloworld
Hello World

Using this method you can distribute only the .s-files which will contain very hard to read assembler.

like image 34
Emil H Avatar answered Nov 17 '22 20:11

Emil H


You can process the existing source code to "mangle" it; basically this consists of stripping out all comments, and changing variable names to be minimal and stripping out all source code formatting. The problem is, they can relatively easily change the variable names back and add formatting and comments; while they won't have the same level of information in the resultant source code as you do, they WILL have completely functional source code (because that's what you distributed to them). This is about the only way to do this sort of thing.

like image 42
Paul Sonier Avatar answered Nov 17 '22 21:11

Paul Sonier


In short, no. By definition if they can compile it then they have your source. The best you can do is increase the pain of them trying to understand it.

I agree with John. If you have a small number of clients and trust them, an NDA would be a better route.

Another thing I just thought about... what about just running the preprocessor and compiler, but not the assembler and the linker? You would need a copy for each specific architecture's assembly language, but I assume that would be painful enough to dissuade editing while easy enough to compile.

like image 22
Bob Somers Avatar answered Nov 17 '22 21:11

Bob Somers


You could divide your application in two parts: first part will contain precompiled libraries with the OS independent functionality, and the second one will contain a little parts of sources that users would compile. In such way NVIDIA distributes their drivers.

like image 1
Kirill V. Lyadvinsky Avatar answered Nov 17 '22 20:11

Kirill V. Lyadvinsky


You could obfuscate your C/C++ code. See my question for C/C++ obfuscation tools

like image 1
hhafez Avatar answered Nov 17 '22 22:11

hhafez