aboutsummaryrefslogtreecommitdiffstats
path: root/server/resty/openssl/include/crypto.lua
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2023-04-14 11:59:32 +0000
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2023-04-14 11:59:32 +0000
commitd68841d9f75636575cd778838a8ceea5fd5aada3 (patch)
tree778c84203ed9bfa4dc1c8234e4e2cf60da6ebd8c /server/resty/openssl/include/crypto.lua
parent42af09588f1f839b9ab36356f02f34c89559bcfa (diff)
Upload ui
Issue-ID: PORTAL-1084 Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de> Change-Id: Id0c94859a775094e67b0bb9c91ca5e776a08c068
Diffstat (limited to 'server/resty/openssl/include/crypto.lua')
-rw-r--r--server/resty/openssl/include/crypto.lua31
1 files changed, 31 insertions, 0 deletions
diff --git a/server/resty/openssl/include/crypto.lua b/server/resty/openssl/include/crypto.lua
new file mode 100644
index 0000000..6ca1f08
--- /dev/null
+++ b/server/resty/openssl/include/crypto.lua
@@ -0,0 +1,31 @@
+local ffi = require "ffi"
+local C = ffi.C
+
+local OPENSSL_10 = require("resty.openssl.version").OPENSSL_10
+local OPENSSL_11_OR_LATER = require("resty.openssl.version").OPENSSL_11_OR_LATER
+
+local OPENSSL_free
+if OPENSSL_10 then
+ ffi.cdef [[
+ void CRYPTO_free(void *ptr);
+ ]]
+ OPENSSL_free = C.CRYPTO_free
+elseif OPENSSL_11_OR_LATER then
+ ffi.cdef [[
+ void CRYPTO_free(void *ptr, const char *file, int line);
+ ]]
+ OPENSSL_free = function(ptr)
+ -- file and line is for debuggin only, since we can't know the c file info
+ -- the macro is expanded, just ignore this
+ C.CRYPTO_free(ptr, "", 0)
+ end
+end
+
+ffi.cdef [[
+ int FIPS_mode(void);
+ int FIPS_mode_set(int ONOFF);
+]]
+
+return {
+ OPENSSL_free = OPENSSL_free,
+}