I am trying to create a kong plugin. It works great when running as part of kong server but when I am trying to write some unit tests with busted, resty.openssl.digest
func load fails. More specifically while loading the version.lua
I am not sure what exactly I am missing. Maybe some link which is supposed to link openSSL's C functions to lua.
Here is a minimal snippet to reproduce the problem.
package.cpath = package.cpath .. ';/usr/local/lib/lua/5.1/?.so'
local ffi = require("ffi")
ffi.cdef[[
// 1.0
unsigned long SSLeay(void);
const char *SSLeay_version(int t);
// >= 1.1
unsigned long OpenSSL_version_num();
const char *OpenSSL_version(int t);
// >= 3.0
const char *OPENSSL_info(int t);
// BoringSSL
int BORINGSSL_self_test(void);
]]
local num = ffi.C.OpenSSL_version_num()
print(num)
Error:
luajit: test.lua:18: Symbol not found: OpenSSL_version_num
stack traceback:
[C]: in function '__index'
test.lua:18: in main chunk
[C]: at 0x55b71c78ffa4