Arduino library source code encryption

Hi Is there any way to make the library sources encrypted. In C++, we can compile a library and give the user .o and .h files. Or we can use dynamic link libraries (dll).

What can we do using Arduino?

Thanks for answers!

I think it is against the ethos of the Arduino hardware and software. The hardware was constructed to be open source, and so was the software....

Any file can be encrypted.

jremington: Any file can be encrypted.

But will the IDE be able to use it ?

giovanniguerra: I think it is against the ethos of the Arduino hardware and software. The hardware was constructed to be open source, and so was the software....

I agree with you. Open Source is the way to go. If I have a choice (and I usually do), I avoid closed source software.

Dear all Thanks for your responding.

Are you sure that Arduino is just open source and there is no way to use a pre-compiled library?

Yes, Arduino is intended to be open source.

You can link code with pre-compiled libraries, but the Arduino IDE does not make this easy.

Is your intention to make a commercial project? If so, if you use open source code, you are expected to obey all open source restrictions.

.o and .h files are not encrypted. More importantly for you (based on the nature of the question), the .o file can be reverse engineered.

You can generste .o files; the IDE does it when it compiles the libraries. And the gcc-avr compiler has a flag to skip the linking stage.

jremington: Yes, Arduino is intended to be open source.

You can link code with pre-compiled libraries, but the Arduino IDE does not make this easy.

Is your intention to make a commercial project? If so, if you use open source code, you are expected to obey all open source restrictions.

The open source restrictions is where it starts to get very messy when trying to create a closed source project, particularly given the various licenses involved. The issue is that each library can have its own license and there are many different licenses in use. Even the bundled libraries that come with the IDE are not all the same license. Most are LGPL and some are GPL and then there are a few other licenses used as well. There are many different licenses used for 3rd party library libraries as it is up to the individual Authors. Some allow using with closed source and some don't. Some allow using with closed source with some restrictions that can't be met with the Arduino IDE.

While you can use LGPL with closed sources, the issue it that the LGPL license demands that you give the user the ability to rebuild the full image. This means that you have to supply object files for the closed source modules to allow the user to recompile everything else and then link against the closed source modules to create an updated image. However, the IDE has no way to use pre-compiled object modules.

So essentially when using the Arduino IDE there is no way to comply with the LGPL licensing requirements when using closed source.

While it is possible to comply with the LGPL licensing terms when using some other tool than the Arduino IDE, there are some libraries that are licensed as GPL that NEVER allow being used with closed source.

So depending on which libraries a project uses, the licenses involved may not allow the project to contain any closed source.

--- bill

In C++, we can compile a library and give the user .o and .h files. Or we can use dynamic link libraries (dll).

Of course, you'd have to modify the IDE to include decryption, or write your own IDE/compiler with decryption.

I'm not sure about using/modifying GPL/LGPL licensed Arduino, but you could probably make your version of the IDE open source GPL (and legal) without disclosing the actual key (which could be encrypted in a separate file). For example, there are open source encryption tools and just having the algorithm doesn't make it easy to crack.

DVDdoug: Of course, you'd have to modify the IDE to include decryption, or write your own IDE/compiler with decryption.

I'm not sure about using/modifying GPL/LGPL licensed Arduino, but you could probably make your version of the IDE open source GPL (and legal) without disclosing the actual key (which could be encrypted in a separate file). For example, there are open source encryption tools and just having the algorithm doesn't make it easy to crack.

For the encryption to mean anything, it has to be decrypted by the device not a programming tool. Even if you created your own IDE that supported encryption, and added all the needed decryption support to your own custom bootloader, that still doesn't deal with the library licensing issues.

To me the entire point of using Arduino is for the libraries. If you don't need any of the Arduino libraries, then don't mess with Arduino at all. Just write your own code, write your own makefiles and use the gcc tools directly.

ADanayi: Hi Is there any way to make the library sources encrypted. In C++, we can compile a library and give the user .o and .h files. Or we can use dynamic link libraries (dll).

What can we do using Arduino?

I think the AVR-GCC compiler also creates and uses .o object code files, BUT:

The Arduino-IDE is not ready to use "old pre-compiled .o files" Each time the Arduino-IDE is launched. the IDE loads the latest board settings and then when it comes to compile a project, the IDE wants to do a "FULL COMPILE" of all libraries which are older than the time of the changed board setting.

Because of this logic - full compile of all libraries after board settings change is required - incremental compile is only done if only the .ino project file has changed it is NO GOOD for the IDE to use pre-compiled libraries

So when using the Arduino-IDE, you always need full source code of all libraries

Pre-compiled libraries might work if you set up a programming environment whithout Arduino-IDE, consisting of a makefile.

That's nothing for noobs.

For easy usage, noobs use the Arduino-IDE and need full-source libraries only, pre-compiled libraries are completely useless when using the Arduino-IDE for projects, compiling, linking, uploading.

And DLL is a pure Microsoft invention for Windows. DLL hell! Nobody working with open source wants a DLL hell, so better forget it and do programming for Windows as you like!

You do not seem to be a open source guy and do not want to give away anything which is not "protected" or "encrypted" and possibly must be paid! So possibly do programming for Microsoft Windows, and sell your software to any one who wants to pay for your protected and encrypted code! Open source is much different from how things work with Microsoft Windows.

And: A microcontroller is not a PC and has no operating system at all!

Without operating system, there is no chance to load extra code dynamically at runtime into the Ardiuino microcontrollers (at least the AVR ones).

AVR Atmega controllers must have full code uploaded to the microcontroller before the program starts!

jurs: And DLL is a pure Microsoft invention for Windows. DLL hell!

Technically, it was developed for OS/2.

aarg: Technically, it was developed for OS/2.

Keep trying. I'll give you two a hint. The operating system guru who very likely brought the idea to Microsoft left a much older company doing essentially the same work.