From 369da40c2a99879e2fe8c23cd4d1638bd431826f Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 14 Oct 2021 23:51:14 -0700 Subject: [PATCH] lua-openssl: update to 0.8.0-6 Remove upstreamed patches and backport cmake fix. Signed-off-by: Rosen Penev --- lang/lua-openssl/Makefile | 4 +- lang/lua-openssl/patches/010-cmake.patch | 69 ++++++++- .../patches/020-openssl-deprecated.patch | 143 ------------------ 3 files changed, 64 insertions(+), 152 deletions(-) delete mode 100644 lang/lua-openssl/patches/020-openssl-deprecated.patch diff --git a/lang/lua-openssl/Makefile b/lang/lua-openssl/Makefile index c071ca123..6c2e10258 100644 --- a/lang/lua-openssl/Makefile +++ b/lang/lua-openssl/Makefile @@ -12,8 +12,8 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/zhaozg/lua-openssl.git -PKG_SOURCE_VERSION:=0.7.8-0 -PKG_MIRROR_HASH:=890dda7b23ff303e70ca8aa0d729836de347c0e58057282f55c6abf87e39c602 +PKG_SOURCE_VERSION:=0.8.0-6 +PKG_MIRROR_HASH:=d3b80bcde0463b3106cb8cdd1b255fa894ac5af02640c9f3c98ae706d3659267 PKG_MAINTAINER:=Amnon Paz PKG_LICENSE:=MIT diff --git a/lang/lua-openssl/patches/010-cmake.patch b/lang/lua-openssl/patches/010-cmake.patch index c1cbd6706..f9ff532b2 100644 --- a/lang/lua-openssl/patches/010-cmake.patch +++ b/lang/lua-openssl/patches/010-cmake.patch @@ -1,11 +1,66 @@ +From a88d7f4348e54abba47a96f9ec4ffe7c60ba9400 Mon Sep 17 00:00:00 2001 +From: O +Date: Fri, 30 Jul 2021 17:17:45 +0800 +Subject: [PATCH] build so file on mac + +--- + CMakeLists.txt | 18 +++++++++++++----- + 1 file changed, 13 insertions(+), 5 deletions(-) + --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -21,8 +21,6 @@ add_definitions(-DPTHREADS) +@@ -20,7 +20,7 @@ find_package(Threads REQUIRED) + add_definitions(-DPTHREADS) if(BUILD_SHARED_LUA_OPENSSL) - set(LUA_OPENSSL_LIBTYPE SHARED) -- add_definitions(-DLUA_BUILD_AS_DLL -DLUA_LIB) -- set(EXTRA_LIBS "ws2_32.lib" "crypt32.lib") - else() - set(LUA_OPENSSL_LIBTYPE STATIC) - endif() +- set(LUA_OPENSSL_LIBTYPE SHARED) ++ set(LUA_OPENSSL_LIBTYPE MODULE) + if(WIN32) + add_definitions(-DLUA_BUILD_AS_DLL) + set(EXTRA_LIBS "ws2_32.lib" "crypt32.lib") +@@ -45,7 +45,7 @@ add_library(lua-openssl ${LUA_OPENSSL_LI + src/dsa.c + src/ec.c + src/engine.c +- src/mac.c ++ src/hmac.c + src/lbn.c + src/lhash.c + src/misc.c +@@ -73,7 +73,7 @@ add_library(lua-openssl ${LUA_OPENSSL_LI + + target_include_directories(lua-openssl PUBLIC + ${OPENSSL_INCLUDE_DIR} +- ${LUA_INCLUDE_DIRS} ++ ${LUA_INCLUDE_DIR} + deps + deps/lua-compat/c-api + deps/auxiliar +@@ -81,17 +81,25 @@ target_include_directories(lua-openssl P + + target_link_libraries(lua-openssl PUBLIC + ${OPENSSL_LIBRARIES} +- ${LUA_LIBRARIES} + ${EXTRA_LIBS} + Threads::Threads + ) + ++if(WIN32) ++ target_link_libraries(lua-openssl PUBLIC ++ ${LUA_LIBRARIES} ++ ) ++endif() ++ ++if(APPLE) ++ target_link_options(lua-openssl PUBLIC -bundle -undefined dynamic_lookup) ++endif() ++ + target_compile_options(lua-openssl PRIVATE -DLUA_LIB) + + set_target_properties(lua-openssl PROPERTIES + PREFIX "" + OUTPUT_NAME "openssl" +- VERSION 0.8.0.0 SOVERSION 0 + ) + + install(TARGETS lua-openssl diff --git a/lang/lua-openssl/patches/020-openssl-deprecated.patch b/lang/lua-openssl/patches/020-openssl-deprecated.patch deleted file mode 100644 index 408843a75..000000000 --- a/lang/lua-openssl/patches/020-openssl-deprecated.patch +++ /dev/null @@ -1,143 +0,0 @@ ---- a/src/cipher.c -+++ b/src/cipher.c -@@ -8,6 +8,10 @@ cipher module for lua-openssl binding - #include "openssl.h" - #include "private.h" - -+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) -+#define EVP_CIPHER_CTX_reset EVP_CIPHER_CTX_init -+#endif -+ - /*** - list all support cipher algs - -@@ -109,7 +113,7 @@ static LUA_FUNCTION(openssl_evp_encrypt) - memcpy(evp_iv, iv, iv_len); - } - -- EVP_CIPHER_CTX_init(c); -+ EVP_CIPHER_CTX_reset(c); - ret = EVP_EncryptInit_ex(c, cipher, e, (const byte*)evp_key, iv_len > 0 ? (const byte*)evp_iv : NULL); - if (ret == 1) - { -@@ -131,8 +135,12 @@ static LUA_FUNCTION(openssl_evp_encrypt) - OPENSSL_free(buffer); - } - } -+#if OPENSSL_VERSION_NUMBER >= 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) -+ EVP_CIPHER_CTX_reset(c); -+#else - EVP_CIPHER_CTX_cleanup(c); - EVP_CIPHER_CTX_free(c); -+#endif - return (ret == 1) ? ret : openssl_pushresult(L, ret); - } - else -@@ -196,7 +204,7 @@ static LUA_FUNCTION(openssl_evp_decrypt) - memcpy(evp_iv, iv, iv_len); - } - -- EVP_CIPHER_CTX_init(c); -+ EVP_CIPHER_CTX_reset(c); - ret = EVP_DecryptInit_ex(c, cipher, e, key ? (const byte*)evp_key : NULL, iv_len > 0 ? (const byte*)evp_iv : NULL); - if (ret == 1) - { -@@ -220,8 +228,12 @@ static LUA_FUNCTION(openssl_evp_decrypt) - OPENSSL_free(buffer); - } - } -+#if OPENSSL_VERSION_NUMBER >= 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) -+ EVP_CIPHER_CTX_reset(c); -+#else - EVP_CIPHER_CTX_cleanup(c); - EVP_CIPHER_CTX_free(c); -+#endif - return (ret == 1) ? ret : openssl_pushresult(L, ret); - } - else -@@ -292,7 +304,7 @@ static LUA_FUNCTION(openssl_evp_cipher) - memcpy(evp_iv, iv, iv_len); - } - -- EVP_CIPHER_CTX_init(c); -+ EVP_CIPHER_CTX_reset(c); - ret = EVP_CipherInit_ex(c, cipher, e, (const byte*)evp_key, iv_len > 0 ? (const byte*)evp_iv : NULL, enc); - if (ret == 1) - { -@@ -317,8 +329,12 @@ static LUA_FUNCTION(openssl_evp_cipher) - OPENSSL_free(buffer); - } - } -+#if OPENSSL_VERSION_NUMBER >= 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) -+ EVP_CIPHER_CTX_reset(c); -+#else - EVP_CIPHER_CTX_cleanup(c); - EVP_CIPHER_CTX_free(c); -+#endif - return (ret == 1) ? ret : openssl_pushresult(L, ret); - } - else -@@ -376,7 +392,7 @@ static LUA_FUNCTION(openssl_cipher_new) - memcpy(evp_iv, iv, iv_len); - } - c = EVP_CIPHER_CTX_new(); -- EVP_CIPHER_CTX_init(c); -+ EVP_CIPHER_CTX_reset(c); - if (!EVP_CipherInit_ex(c, cipher, e, key ? (const byte*)evp_key : NULL, iv_len > 0 ? (const byte*)evp_iv : NULL, enc)) - { - luaL_error(L, "EVP_CipherInit_ex failed, please check openssl error"); -@@ -431,7 +447,7 @@ static LUA_FUNCTION(openssl_cipher_encry - memcpy(evp_iv, iv, iv_len); - } - c = EVP_CIPHER_CTX_new(); -- EVP_CIPHER_CTX_init(c); -+ EVP_CIPHER_CTX_reset(c); - ret = EVP_EncryptInit_ex(c, cipher, e, - key ? (const byte*)evp_key : NULL, - iv_len > 0 ? (const byte*)evp_iv : NULL); -@@ -491,7 +507,7 @@ static LUA_FUNCTION(openssl_cipher_decry - memcpy(evp_iv, iv, iv_len); - } - c = EVP_CIPHER_CTX_new(); -- EVP_CIPHER_CTX_init(c); -+ EVP_CIPHER_CTX_reset(c); - ret = EVP_DecryptInit_ex(c, cipher, e, - key ? (const byte*)evp_key : NULL, - iv_len > 0 ? (const byte*)evp_iv : NULL); -@@ -937,8 +953,12 @@ static LUA_FUNCTION(openssl_cipher_ctx_f - return 0; - lua_pushnil(L); - lua_rawsetp(L, LUA_REGISTRYINDEX, ctx); -+#if OPENSSL_VERSION_NUMBER >= 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) -+ EVP_CIPHER_CTX_reset(ctx); -+#else - EVP_CIPHER_CTX_cleanup(ctx); - EVP_CIPHER_CTX_free(ctx); -+#endif - FREE_OBJECT(1); - return 0; - } ---- a/src/openssl.c -+++ b/src/openssl.c -@@ -523,9 +523,7 @@ LUALIB_API int luaopen_openssl(lua_State - #endif - - #ifndef OPENSSL_NO_ENGINE -- ENGINE_load_dynamic(); -- ENGINE_load_openssl(); -- ENGINE_load_builtin_engines(); -+ ENGINE_register_all_complete(); - #endif - #ifdef LOAD_ENGINE_CUSTOM - LOAD_ENGINE_CUSTOM ---- a/src/th-lock.c -+++ b/src/th-lock.c -@@ -310,7 +310,7 @@ unsigned long irix_thread_id(void) - - /* Linux and a few others */ - #ifdef PTHREADS --#ifndef OPENSSL_SYS_WIN32 -+#if !defined(OPENSSL_SYS_WIN32) && (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)) - static pthread_mutex_t *lock_cs; - static long *lock_count; -