mkottman/luacrypto — Issue #13: ability to do OpenSSL initialization outside of luacrypto
Author: IlyaM
Created: 2012-03-05 11:17:53+00:00
State: open

Hi,

Is it possible to change the module so that OpenSSL environment initialization is conditionally disabled in luacrypto so that application which embeds Lua and luacrypto can do OpenSSL environment initialization by itself? By the initialization I mean calls OpenSSL_add_all_digests() and OpenSSL_add_all_ciphers() in luaopen_crypto(). This is necessary in certain use cases; particularly it is more or less required for multi-threaded applications where application creates multiple independent Lua environments in different threads where each Lua environment loads luacrypto library. The problem is that OpenSSL environment initialization should be done only once per-process; if you try to do OpenSSL enviroment initialization in multiple threads at the same time it causes crashes as corresponding API is not supposed to be called in parallel. Also in general for multi thread use case OpenSSL environment needs more complex initialization logic.