Building for Other Environments
If you need leancrypto to work in other environments like small embedded systems, you need:
-
Adjust the build system as needed to compile and link it
-
Adjust the file
ext_headers.h
to point to the right header files and locations. -
set the flag
LC_MEM_ON_HEAP
if your environment only has a limited stack size. When set, functions with large memory requirements use the heap instead of the stack for this memory. The maximum stack size used by a function is 2048 bytes and is verified by a compiler check. -
If your environment does not offer an automated constructor logic that is invoked by the compiler attribute
__attribute__((constructor))
you must add the appropriate handling tovisibility.h
by adding an appropriateLC_CONSTRUCTOR
macro. It could be as easy as makingLC_CONSTRUCTOR
just defining the symbol (see how this macro is defined forLC_EFI
) and require that leancrypto is initialized withlc_init
.
An example on the approach is given with the Linux kernel support found
in the directory linux_kernel
.