瀏覽代碼

✨ feat: OpenSSL3 add md2 (#5774)

* ✨ 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 <[email protected]>
xffish 8 月之前
父節點
當前提交
21f392ed37
共有 1 個文件被更改,包括 23 次插入0 次删除
  1. 23 0
      packages/o/openssl3/xmake.lua

+ 23 - 0
packages/o/openssl3/xmake.lua

@@ -19,6 +19,9 @@ package("openssl3")
 
 
     on_fetch("fetch")
     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)
     on_load(function (package)
         if not package:is_precompiled() then
         if not package:is_precompiled() then
             if package:is_plat("windows") 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, package:config("shared") and "shared" or "no-shared")
         table.insert(configs, "--prefix=" .. package:installdir())
         table.insert(configs, "--prefix=" .. package:installdir())
         table.insert(configs, "--openssldir=" .. package:installdir())
         table.insert(configs, "--openssldir=" .. package:installdir())
+        
+        if package:config("md2") then
+            table.insert(configs, "enable-md2")
+        end
+
         if jom then
         if jom then
             table.insert(configs, "no-makedepend")
             table.insert(configs, "no-makedepend")
             table.insert(configs, "/FS")
             table.insert(configs, "/FS")
@@ -100,6 +108,11 @@ package("openssl3")
         end
         end
         table.insert(configs, "--prefix=" .. installdir)
         table.insert(configs, "--prefix=" .. installdir)
         table.insert(configs, "--openssldir=" .. 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)
         local buildenvs = import("package.tools.autoconf").buildenvs(package)
         buildenvs.RC = package:build_getenv("mrc")
         buildenvs.RC = package:build_getenv("mrc")
         if is_subhost("msys") then
         if is_subhost("msys") then
@@ -127,6 +140,11 @@ package("openssl3")
         if package:debug() then
         if package:debug() then
             table.insert(configs, "--debug")
             table.insert(configs, "--debug")
         end
         end
+        
+        if package:config("md2") then
+            table.insert(configs, "enable-md2")
+        end
+
         os.vrunv("./config", configs, {envs = buildenvs})
         os.vrunv("./config", configs, {envs = buildenvs})
         local makeconfigs = {CFLAGS = buildenvs.CFLAGS, ASFLAGS = buildenvs.ASFLAGS}
         local makeconfigs = {CFLAGS = buildenvs.CFLAGS, ASFLAGS = buildenvs.ASFLAGS}
         import("package.tools.make").build(package, makeconfigs)
         import("package.tools.make").build(package, makeconfigs)
@@ -164,6 +182,11 @@ package("openssl3")
                          "no-threads",
                          "no-threads",
                          "--openssldir=" .. package:installdir():gsub("\\", "/"),
                          "--openssldir=" .. package:installdir():gsub("\\", "/"),
                          "--prefix=" .. 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)
         local buildenvs = import("package.tools.autoconf").buildenvs(package)
         if package:is_cross() and package:is_plat("android") and is_subhost("windows") then
         if package:is_cross() and package:is_plat("android") and is_subhost("windows") then
             buildenvs.CFLAGS = buildenvs.CFLAGS:gsub("\\", "/")
             buildenvs.CFLAGS = buildenvs.CFLAGS:gsub("\\", "/")