Hello!
On Sun, May 19, 2013 at 6:08 PM, Siddon Tang wrote:
> I've found that only hmac_sha1 support in openresty, but our team has
> use hmac_md5 for http url sign. So I write hmac.lua for resty string module.
> But now it only support openssl >= 1.0.0 because of some function
> definitions are changed.
>
> Is it there some easy way to support different function definitions in
> openssl >= 1.0.0 and openssl 0.9.x when using luajit ffi?
>
IMHO, the easiest way may be to write a thin layer of C to abstract
away the differences between different verrsions of openssl and then
call your intermediate C API by LuaJIT FFI.
The "thin layer of C" could be a DSO file dynamically loaded by
ffi.load() (which is looked up from within LUA_CPATH, probably) or
could just reside in an Nginx C module.
In ngx_lua's new FFI-based Lua API, I'm taking this approach (see
ngx_lua's ffi branch and the lua-resty-core library):
https://github.com/chaoslawful/lua-nginx-module/tree/ffi
https://github.com/agentzh/lua-resty-core
Best regards,
-agentzh