diff --git a/build.zig b/build.zig index dcab8ab..f8f962a 100644 --- a/build.zig +++ b/build.zig @@ -496,7 +496,6 @@ pub fn build(b: *std.Build) void { "bio/bss_null.c", "bio/bss_sock.c", "bio/ossl_core_bio.c", - "bn/asm/x86_64-gcc.c", "bn/bn_add.c", "bn/bn_asm.c", "bn/bn_blind.c", @@ -878,7 +877,7 @@ pub fn build(b: *std.Build) void { "kdf/kdf_err.c", "lhash/lh_stats.c", "lhash/lhash.c", - "loongarchcap.c", + //"md2/md2_dgst.c", //"md2/md2_one.c", "md4/md4_dgst.c", @@ -1190,50 +1189,67 @@ pub fn build(b: *std.Build) void { }); switch (target.result.cpu.arch) { - .x86_64 => mod.addCSourceFiles(.{ - .root = b.path("crypto"), - .files = &.{ - "aes/aes-x86_64.s", - "aes/aesni-mb-x86_64.s", - "aes/aesni-sha1-x86_64.s", - "aes/aesni-sha256-x86_64.s", - "aes/aesni-x86_64.s", - "aes/bsaes-x86_64.s", - "aes/vpaes-x86_64.s", - "bn/rsaz-x86_64.s", - "camellia/cmll-x86_64.s", - "chacha/chacha-x86_64.s", - "ec/ecp_nistz256-x86_64.s", - "ec/x25519-x86_64.s", - "ec/x25519-x86_64.s", - "md5/md5-x86_64.s", - "modes/aesni-gcm-x86_64.s", - "modes/ghash-x86_64.s", - "poly1305/poly1305-x86_64.s", - "rc4/rc4-md5-x86_64.s", - "rc4/rc4-x86_64.s", - "sha/keccak1600-x86_64.s", - "sha/sha1-mb-x86_64.s", - "sha/sha1-x86_64.s", - "sha/sha256-mb-x86_64.s", - "sha/sha256-x86_64.s", - "sha/sha512-x86_64.s", - "whrlpool/wp-x86_64.s", - - "x86_64cpuid.s", - "bn/x86_64-gf2m.s", - "bn/x86_64-mont5.s", - "bn/x86_64-mont.s", - "bn/rsaz-avx2.s", - "bn/rsaz-2k-avx512.s", - "bn/rsaz-3k-avx512.s", - "bn/rsaz-4k-avx512.s", + .x86_64 => { + mod.addCSourceFiles(.{ + .root = upstream.path("crypto"), + .files = &.{ + "bn/asm/x86_64-gcc.c", + }, + .flags = &crypto_flags, + }); + mod.addCSourceFiles(.{ + .root = b.path("crypto"), + .files = &.{ + "aes/aes-x86_64.s", + "aes/aesni-mb-x86_64.s", + "aes/aesni-sha1-x86_64.s", + "aes/aesni-sha256-x86_64.s", + "aes/aesni-x86_64.s", + "aes/bsaes-x86_64.s", + "aes/vpaes-x86_64.s", + "bn/rsaz-x86_64.s", + "camellia/cmll-x86_64.s", + "chacha/chacha-x86_64.s", + "ec/ecp_nistz256-x86_64.s", + "ec/x25519-x86_64.s", + "md5/md5-x86_64.s", + "modes/aesni-gcm-x86_64.s", + "modes/ghash-x86_64.s", + "poly1305/poly1305-x86_64.s", + "rc4/rc4-md5-x86_64.s", + "rc4/rc4-x86_64.s", + "sha/keccak1600-x86_64.s", + "sha/sha1-mb-x86_64.s", + "sha/sha1-x86_64.s", + "sha/sha256-mb-x86_64.s", + "sha/sha256-x86_64.s", + "sha/sha512-x86_64.s", + "whrlpool/wp-x86_64.s", + "x86_64cpuid.s", + "bn/x86_64-gf2m.s", + "bn/x86_64-mont5.s", + "bn/x86_64-mont.s", + "bn/rsaz-avx2.s", + "bn/rsaz-2k-avx512.s", + "bn/rsaz-3k-avx512.s", + "bn/rsaz-4k-avx512.s", + "modes/aes-gcm-avx512.s", + }, + .flags = &crypto_flags, + }); + }, + else => {}, + } - "modes/aes-gcm-avx512.s", + // loongarchcap.c requires sys/auxv.h which is Linux-only + if (target.result.os.tag == .linux) { + mod.addCSourceFiles(.{ + .root = upstream.path("crypto"), + .files = &.{ + "loongarchcap.c", }, .flags = &crypto_flags, - }), - else => {}, + }); } mod.addCSourceFiles(.{ @@ -1249,6 +1265,7 @@ pub fn build(b: *std.Build) void { mod.addIncludePath(b.path("include")); mod.addIncludePath(upstream.path("providers/common/include")); mod.addIncludePath(upstream.path("providers/implementations/include")); + mod.addIncludePath(upstream.path("crypto")); mod.addIncludePath(b.path("crypto")); lib.installHeadersDirectory(upstream.path("include"), "", .{});