From 21f392ed3708eaa2bc122dfa29752e5053cb6de6 Mon Sep 17 00:00:00 2001 From: xffish Date: Tue, 19 Nov 2024 08:57:52 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20OpenSSL3=20add=20md2=20(#57?= =?UTF-8?q?74)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ✨ feat: OpenSSL3 add md2 Add md2 feature switch for openssl3 * 🦄 refactor: modify config name change "enable_md2" to just "md2" --------- Co-authored-by: Chengxiang Liu --- packages/o/openssl3/xmake.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/o/openssl3/xmake.lua b/packages/o/openssl3/xmake.lua index d204a542d..adcb614ec 100644 --- a/packages/o/openssl3/xmake.lua +++ b/packages/o/openssl3/xmake.lua @@ -19,6 +19,9 @@ package("openssl3") on_fetch("fetch") + -- https://security.stackexchange.com/questions/173425/how-do-i-calculate-md2-hash-with-openssl + add_configs("md2", {description = "Enable MD2 on OpenSSl3 or not", default = false, type = "boolean"}) + on_load(function (package) if not package:is_precompiled() then if package:is_plat("windows") then @@ -74,6 +77,11 @@ package("openssl3") table.insert(configs, package:config("shared") and "shared" or "no-shared") table.insert(configs, "--prefix=" .. package:installdir()) table.insert(configs, "--openssldir=" .. package:installdir()) + + if package:config("md2") then + table.insert(configs, "enable-md2") + end + if jom then table.insert(configs, "no-makedepend") table.insert(configs, "/FS") @@ -100,6 +108,11 @@ package("openssl3") end table.insert(configs, "--prefix=" .. installdir) table.insert(configs, "--openssldir=" .. installdir) + + if package:config("md2") then + table.insert(configs, "enable-md2") + end + local buildenvs = import("package.tools.autoconf").buildenvs(package) buildenvs.RC = package:build_getenv("mrc") if is_subhost("msys") then @@ -127,6 +140,11 @@ package("openssl3") if package:debug() then table.insert(configs, "--debug") end + + if package:config("md2") then + table.insert(configs, "enable-md2") + end + os.vrunv("./config", configs, {envs = buildenvs}) local makeconfigs = {CFLAGS = buildenvs.CFLAGS, ASFLAGS = buildenvs.ASFLAGS} import("package.tools.make").build(package, makeconfigs) @@ -164,6 +182,11 @@ package("openssl3") "no-threads", "--openssldir=" .. package:installdir():gsub("\\", "/"), "--prefix=" .. package:installdir():gsub("\\", "/")} + + if package:config("md2") then + table.insert(configs, "enable-md2") + end + local buildenvs = import("package.tools.autoconf").buildenvs(package) if package:is_cross() and package:is_plat("android") and is_subhost("windows") then buildenvs.CFLAGS = buildenvs.CFLAGS:gsub("\\", "/")