Explorar o código

✨ 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 hai 8 meses
pai
achega
21f392ed37
Modificáronse 1 ficheiros con 23 adicións e 0 borrados
  1. 23 0
      packages/o/openssl3/xmake.lua

+ 23 - 0
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("\\", "/")