From e79113124f9a31c15ffa93ec85ffc187b9e898bd Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Sun, 26 Oct 2025 11:30:28 +0100 Subject: [PATCH 1/2] Various updates * MacOS to latest * OpenSSL to latest (1.1.1 is outdated and has only special support) * Abseil * Missing LLVM version requirement handling --- .github/workflows/tests.yml | 3 +- tests/MODULE.bazel | 13 +- tests/WORKSPACE | 22 +- tests/WORKSPACE.bzlmod | 7 - tests/openssl/BUILD.bazel | 4 - tests/openssl/MODULE.bazel | 23 + .../openssl/crypto/include/internal/bn_conf.h | 28 - .../crypto/include/internal/dso_conf.h | 17 - tests/openssl/include/openssl/opensslconf.h | 191 ---- tests/openssl/openssl.bazel | 918 ------------------ tests/openssl/overlay/BUILD.bazel | 565 +++++++++++ tests/openssl/overlay/MODULE.bazel | 1 + tests/openssl/overlay/configs/BUILD.bazel | 53 + .../overlay/test_bazel_build/BUILD.bazel | 41 + .../overlay/test_bazel_build/build_test.cc | 3 + .../overlay/test_bazel_build/sha256_test.cc | 54 ++ tests/openssl/overlay/utils.bzl | 97 ++ toolchain/internal/configure.bzl | 6 + toolchain/internal/llvm_distributions.bzl | 2 +- 19 files changed, 864 insertions(+), 1184 deletions(-) delete mode 100644 tests/openssl/BUILD.bazel create mode 100644 tests/openssl/MODULE.bazel delete mode 100644 tests/openssl/crypto/include/internal/bn_conf.h delete mode 100644 tests/openssl/crypto/include/internal/dso_conf.h delete mode 100644 tests/openssl/include/openssl/opensslconf.h delete mode 100644 tests/openssl/openssl.bazel create mode 100644 tests/openssl/overlay/BUILD.bazel create mode 120000 tests/openssl/overlay/MODULE.bazel create mode 100644 tests/openssl/overlay/configs/BUILD.bazel create mode 100644 tests/openssl/overlay/test_bazel_build/BUILD.bazel create mode 100644 tests/openssl/overlay/test_bazel_build/build_test.cc create mode 100644 tests/openssl/overlay/test_bazel_build/sha256_test.cc create mode 100644 tests/openssl/overlay/utils.bzl diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bc49d9c2..15ae84a1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -61,8 +61,7 @@ jobs: strategy: fail-fast: false matrix: - # TODO: This doesn't work with arm64 Macs yet, hence pinning to macos-13. - os: [macos-13, ubuntu-latest] + os: [macos-latest, ubuntu-latest] bazel_version: [latest] # rules_rust bzlmod support is experimental and needs latest version as of now (20230912). bzlmod: [true, false] runs-on: ${{ matrix.os }} diff --git a/tests/MODULE.bazel b/tests/MODULE.bazel index 711f279f..c8c7f784 100644 --- a/tests/MODULE.bazel +++ b/tests/MODULE.bazel @@ -22,12 +22,13 @@ local_path_override( bazel_dep(name = "bazel_skylib", version = "1.8.2") bazel_dep(name = "platforms", version = "1.0.0") -bazel_dep(name = "rules_cc", version = "0.0.9") -bazel_dep(name = "rules_go", version = "0.50.1", repo_name = "io_bazel_rules_go") +bazel_dep(name = "rules_cc", version = "0.2.8") +bazel_dep(name = "rules_go", version = "0.58.2", repo_name = "io_bazel_rules_go") bazel_dep(name = "rules_rust", version = "0.67.0") bazel_dep(name = "rules_foreign_cc", version = "0.15.0") bazel_dep(name = "rules_shell", version = "0.6.1") -bazel_dep(name = "abseil-cpp", version = "20240722.1", repo_name = "com_google_absl") +bazel_dep(name = "openssl", version = "3.3.1.bcr.7") +bazel_dep(name = "abseil-cpp", version = "20250814.1", repo_name = "com_google_absl") # TODO: Remove when protobuf is released with a version of rules_python that supports 8.x bazel_dep(name = "rules_python", version = "1.6.3") @@ -63,10 +64,10 @@ llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm") # When updating this version, also update the versions associated with # llvm_toolchain below, sys_paths_test in the workflows file, and xcompile_test # through the `llvm_toolchain_with_sysroot` toolchain. +# We use C++17 and the first LLVM version with full suppor is 16.0.0. +# We also use C++20 which has reasonable wide support starting with LLVM 17.0.0. LLVM_VERSIONS = { - "": "16.0.0", - "darwin-aarch64": "16.0.5", - "darwin-x86_64": "15.0.7", + "": "first:>=17.0.0,<18", } llvm.toolchain( diff --git a/tests/WORKSPACE b/tests/WORKSPACE index 93ea6b38..a6daf44a 100644 --- a/tests/WORKSPACE +++ b/tests/WORKSPACE @@ -48,10 +48,10 @@ load("@toolchains_llvm//toolchain:rules.bzl", "llvm_toolchain") # When updating this version, also update the versions associated with # llvm_toolchain below, sys_paths_test in the workflows file, and xcompile_test # through the `llvm_toolchain_with_sysroot` toolchain. +# We use C++17 and the first LLVM version with full suppor is 16.0.0. +# We also use C++20 which has reasonable wide support starting with LLVM 17.0.0. LLVM_VERSIONS = { - "": "16.0.0", - "darwin-aarch64": "16.0.5", - "darwin-x86_64": "15.0.7", + "": "first:>=17.0.0,<18", } llvm_toolchain( @@ -253,18 +253,20 @@ http_archive( http_archive( name = "openssl", - build_file = "//openssl:openssl.bazel", - sha256 = "f6fb3079ad15076154eda9413fed42877d668e7069d9b87396d0804fdb3f4c90", - strip_prefix = "openssl-1.1.1c", - urls = ["https://www.openssl.org/source/openssl-1.1.1c.tar.gz"], + build_file = "//openssl:BUILD.bazel", + integrity = "sha256-d3zVlihMiDN1oqehG/XSeG/FQTJV76sgxQ1v/m0CC34=", + strip_prefix = "openssl-3.3.1", + url = "https://github.com/openssl/openssl/releases/download/openssl-3.3.1/openssl-3.3.1.tar.gz", + patch_cmds = [ + "cp configs/BUILD.bazel configs", + ], ) http_archive( name = "io_bazel_rules_go", - sha256 = "f4a9314518ca6acfa16cc4ab43b0b8ce1e4ea64b81c38d8a3772883f153346b8", + sha256 = "54bbb67a4196170cc60ef3b52a2747ad1759cba4764b4c4752b744080ad99947", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.50.1/rules_go-v0.50.1.zip", - "https://github.com/bazelbuild/rules_go/releases/download/v0.50.1/rules_go-v0.50.1.zip", + "https://github.com/bazelbuild/rules_go/releases/download/v0.58.2/rules_go-v0.58.2.zip", ], ) diff --git a/tests/WORKSPACE.bzlmod b/tests/WORKSPACE.bzlmod index 7aae8c4f..509b82f0 100644 --- a/tests/WORKSPACE.bzlmod +++ b/tests/WORKSPACE.bzlmod @@ -4,13 +4,6 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # Well known repos; present here only for testing. -http_archive( - name = "openssl", - build_file = "//openssl:openssl.bazel", - sha256 = "f6fb3079ad15076154eda9413fed42877d668e7069d9b87396d0804fdb3f4c90", - strip_prefix = "openssl-1.1.1c", - urls = ["https://www.openssl.org/source/openssl-1.1.1c.tar.gz"], -) _ALL_CONTENT = """\ filegroup( diff --git a/tests/openssl/BUILD.bazel b/tests/openssl/BUILD.bazel deleted file mode 100644 index 01c44523..00000000 --- a/tests/openssl/BUILD.bazel +++ /dev/null @@ -1,4 +0,0 @@ -exports_files( - srcs = glob(["**/*.h"]), - visibility = ["//visibility:public"], -) diff --git a/tests/openssl/MODULE.bazel b/tests/openssl/MODULE.bazel new file mode 100644 index 00000000..91be6893 --- /dev/null +++ b/tests/openssl/MODULE.bazel @@ -0,0 +1,23 @@ +module( + name = "openssl", + version = "3.3.1.bcr.7", + # We use overlay, which requires at least 7.2.1 + bazel_compatibility = [">=7.2.1"], + # Note: This should rarely change. For now, we hold it as a constant. + # Realistically, we should only change it if the major version of openssl changes. + # When that happens, we probably want to change this to a single-digit number representing that version number. + compatibility_level = 3030100, +) + +bazel_dep(name = "platforms", version = "1.0.0") +bazel_dep(name = "rules_cc", version = "0.2.4") +bazel_dep(name = "rules_perl", version = "0.4.1") +bazel_dep(name = "bazel_skylib", version = "1.8.2") + +http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "openssl-generated-overlay", + integrity = "sha256-4RBLJl1SVyNTkyFQFunAnEPSF8EkPGj0Fjg/kKyhuL4=", + url = "https://github.com/raccoons-build/bazel-openssl-cc/releases/download/3.3.1.bcr.7/bazel-openssl-cc-3.3.1.bcr.7.tar.gz", +) diff --git a/tests/openssl/crypto/include/internal/bn_conf.h b/tests/openssl/crypto/include/internal/bn_conf.h deleted file mode 100644 index cb853e05..00000000 --- a/tests/openssl/crypto/include/internal/bn_conf.h +++ /dev/null @@ -1,28 +0,0 @@ -/* WARNING: do not edit! */ -/* Generated by Makefile from crypto/include/internal/bn_conf.h.in */ -/* - * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef HEADER_BN_CONF_H -#define HEADER_BN_CONF_H - -/* - * The contents of this file are not used in the UEFI build, as - * both 32-bit and 64-bit builds are supported from a single run - * of the Configure script. - */ - -/* Should we define BN_DIV2W here? */ - -/* Only one for the following should be defined */ -#define SIXTY_FOUR_BIT_LONG -#undef SIXTY_FOUR_BIT -#undef THIRTY_TWO_BIT - -#endif diff --git a/tests/openssl/crypto/include/internal/dso_conf.h b/tests/openssl/crypto/include/internal/dso_conf.h deleted file mode 100644 index 71ff3702..00000000 --- a/tests/openssl/crypto/include/internal/dso_conf.h +++ /dev/null @@ -1,17 +0,0 @@ -/* WARNING: do not edit! */ -/* Generated by Makefile from crypto/include/internal/dso_conf.h.in */ -/* - * Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef HEADER_DSO_CONF_H -#define HEADER_DSO_CONF_H -#define DSO_DLFCN -#define HAVE_DLFCN_H -#define DSO_EXTENSION ".dylib" -#endif diff --git a/tests/openssl/include/openssl/opensslconf.h b/tests/openssl/include/openssl/opensslconf.h deleted file mode 100644 index 2c28a2b5..00000000 --- a/tests/openssl/include/openssl/opensslconf.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * WARNING: do not edit! - * Generated by Makefile from include/openssl/opensslconf.h.in - * - * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef OPENSSL_ALGORITHM_DEFINES -#error OPENSSL_ALGORITHM_DEFINES no longer supported -#endif - -/* - * OpenSSL was configured with the following options: - */ - -#ifndef OPENSSL_NO_MD2 -#define OPENSSL_NO_MD2 -#endif -#ifndef OPENSSL_NO_RC5 -#define OPENSSL_NO_RC5 -#endif -#ifndef OPENSSL_THREADS -#define OPENSSL_THREADS -#endif -#ifndef OPENSSL_RAND_SEED_OS -#define OPENSSL_RAND_SEED_OS -#endif -#ifndef OPENSSL_NO_ASAN -#define OPENSSL_NO_ASAN -#endif -#ifndef OPENSSL_NO_CRYPTO_MDEBUG -#define OPENSSL_NO_CRYPTO_MDEBUG -#endif -#ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE -#define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE -#endif -#ifndef OPENSSL_NO_DEVCRYPTOENG -#define OPENSSL_NO_DEVCRYPTOENG -#endif -#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 -#define OPENSSL_NO_EC_NISTP_64_GCC_128 -#endif -#ifndef OPENSSL_NO_EGD -#define OPENSSL_NO_EGD -#endif -#ifndef OPENSSL_NO_EXTERNAL_TESTS -#define OPENSSL_NO_EXTERNAL_TESTS -#endif -#ifndef OPENSSL_NO_FUZZ_AFL -#define OPENSSL_NO_FUZZ_AFL -#endif -#ifndef OPENSSL_NO_FUZZ_LIBFUZZER -#define OPENSSL_NO_FUZZ_LIBFUZZER -#endif -#ifndef OPENSSL_NO_HEARTBEATS -#define OPENSSL_NO_HEARTBEATS -#endif -#ifndef OPENSSL_NO_MSAN -#define OPENSSL_NO_MSAN -#endif -#ifndef OPENSSL_NO_SCTP -#define OPENSSL_NO_SCTP -#endif -#ifndef OPENSSL_NO_SSL_TRACE -#define OPENSSL_NO_SSL_TRACE -#endif -#ifndef OPENSSL_NO_SSL3 -#define OPENSSL_NO_SSL3 -#endif -#ifndef OPENSSL_NO_SSL3_METHOD -#define OPENSSL_NO_SSL3_METHOD -#endif -#ifndef OPENSSL_NO_UBSAN -#define OPENSSL_NO_UBSAN -#endif -#ifndef OPENSSL_NO_UNIT_TEST -#define OPENSSL_NO_UNIT_TEST -#endif -#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS -#define OPENSSL_NO_WEAK_SSL_CIPHERS -#endif -#ifndef OPENSSL_NO_STATIC_ENGINE -#define OPENSSL_NO_STATIC_ENGINE -#endif - -/* - * Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers - * don't like that. This will hopefully silence them. - */ -#define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy; - -/* - * Applications should use -DOPENSSL_API_COMPAT= to suppress the - * declarations of functions deprecated in or before . Otherwise, they - * still won't see them if the library has been built to disable deprecated - * functions. - */ -#ifndef DECLARE_DEPRECATED -#define DECLARE_DEPRECATED(f) f; -#ifdef __GNUC__ -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) -#undef DECLARE_DEPRECATED -#define DECLARE_DEPRECATED(f) f __attribute__((deprecated)); -#endif -#endif -#endif - -#ifndef OPENSSL_FILE -#ifdef OPENSSL_NO_FILENAMES -#define OPENSSL_FILE "" -#define OPENSSL_LINE 0 -#else -#define OPENSSL_FILE __FILE__ -#define OPENSSL_LINE __LINE__ -#endif -#endif - -#ifndef OPENSSL_MIN_API -#define OPENSSL_MIN_API 0 -#endif - -#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < OPENSSL_MIN_API -#undef OPENSSL_API_COMPAT -#define OPENSSL_API_COMPAT OPENSSL_MIN_API -#endif - -/* - * Do not deprecate things to be deprecated in version 1.2.0 before the - * OpenSSL version number matches. - */ -#if OPENSSL_VERSION_NUMBER < 0x10200000L -#define DEPRECATEDIN_1_2_0(f) f; -#elif OPENSSL_API_COMPAT < 0x10200000L -#define DEPRECATEDIN_1_2_0(f) DECLARE_DEPRECATED(f) -#else -#define DEPRECATEDIN_1_2_0(f) -#endif - -#if OPENSSL_API_COMPAT < 0x10100000L -#define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f) -#else -#define DEPRECATEDIN_1_1_0(f) -#endif - -#if OPENSSL_API_COMPAT < 0x10000000L -#define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f) -#else -#define DEPRECATEDIN_1_0_0(f) -#endif - -#if OPENSSL_API_COMPAT < 0x00908000L -#define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f) -#else -#define DEPRECATEDIN_0_9_8(f) -#endif - -/* Generate 80386 code? */ -#undef I386_ONLY - -#undef OPENSSL_UNISTD -#define OPENSSL_UNISTD - -#undef OPENSSL_EXPORT_VAR_AS_FUNCTION - -/* - * The following are cipher-specific, but are part of the public API. - */ -#if !defined(OPENSSL_SYS_UEFI) -#undef BN_LLONG -/* Only one for the following should be defined */ -#define SIXTY_FOUR_BIT_LONG -#undef SIXTY_FOUR_BIT -#undef THIRTY_TWO_BIT -#endif - -#define RC4_INT unsigned int - -#ifdef __cplusplus -} -#endif diff --git a/tests/openssl/openssl.bazel b/tests/openssl/openssl.bazel deleted file mode 100644 index 92adb110..00000000 --- a/tests/openssl/openssl.bazel +++ /dev/null @@ -1,918 +0,0 @@ -# Copyright 2018 The Bazel Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -package(default_visibility = ["//visibility:public"]) - -COPTS = [ - "-DL_ENDIAN", - "-DOPENSSL_PIC", - "-DOPENSSL_CPUID_OBJ", - "-DOPENSSL_IA32_SSE2", - "-DOPENSSL_BN_ASM_MONT", - "-DOPENSSL_BN_ASM_MONT5", - "-DOPENSSL_BN_ASM_GF2m", - "-DSHA1_ASM", - "-DSHA256_ASM", - "-DSHA512_ASM", - "-DKECCAK1600_ASM", - "-DRC4_ASM", - "-DMD5_ASM", - "-DAES_ASM", - "-DVPAES_ASM", - "-DBSAES_ASM", - "-DGHASH_ASM", - "-DECP_NISTZ256_ASM", - "-DX25519_ASM", - "-DPOLY1305_ASM", - "-DOPENSSLDIR=\\\"/usr/local/ssl\\\"", - "-DENGINESDIR=\\\"/usr/local/lib/engines-1.1\\\"", - "-D_REENTRANT", - "-DNDEBUG", - "-Wno-unused-command-line-argument", -] - -CONF_FILES = [ - "crypto/include/internal/bn_conf.h", - "crypto/include/internal/dso_conf.h", - "include/openssl/opensslconf.h", -] - -genrule( - name = "configure", - srcs = [("@toolchains_llvm_tests//openssl:" + f) for f in CONF_FILES], - outs = CONF_FILES, - cmd = "\n".join([ - "cp $(location @toolchains_llvm_tests//openssl:{0}) $(location {0})".format(f) - for f in CONF_FILES - ]), - visibility = ["//visibility:private"], -) - -HDRS = glob(["include/**/*.h"]) + ["include/openssl/opensslconf.h"] - -genrule( - name = "gen-buildinf_h", - srcs = ["util/mkbuildinf.pl"], - outs = ["crypto/buildinf.h"], - cmd = "perl $(location util/mkbuildinf.pl) 'dummy' 'dummy' > $(location crypto/buildinf.h)", -) - -genrule( - name = "gen-asm", - srcs = [ - "crypto/aes/asm/aes-x86_64.pl", - "crypto/aes/asm/aesni-mb-x86_64.pl", - "crypto/aes/asm/aesni-sha1-x86_64.pl", - "crypto/aes/asm/aesni-sha256-x86_64.pl", - "crypto/aes/asm/aesni-x86_64.pl", - "crypto/aes/asm/bsaes-x86_64.pl", - "crypto/aes/asm/vpaes-x86_64.pl", - "crypto/bn/asm/rsaz-avx2.pl", - "crypto/bn/asm/rsaz-x86_64.pl", - "crypto/bn/asm/x86_64-gf2m.pl", - "crypto/bn/asm/x86_64-mont.pl", - "crypto/bn/asm/x86_64-mont5.pl", - "crypto/camellia/asm/cmll-x86_64.pl", - "crypto/chacha/asm/chacha-x86_64.pl", - "crypto/ec/ecp_nistz256_table.c", - "crypto/ec/asm/ecp_nistz256-x86_64.pl", - "crypto/ec/asm/x25519-x86_64.pl", - "crypto/md5/asm/md5-x86_64.pl", - "crypto/modes/asm/aesni-gcm-x86_64.pl", - "crypto/modes/asm/ghash-x86_64.pl", - "crypto/perlasm/x86_64-xlate.pl", - "crypto/poly1305/asm/poly1305-x86_64.pl", - "crypto/rc4/asm/rc4-md5-x86_64.pl", - "crypto/rc4/asm/rc4-x86_64.pl", - "crypto/sha/asm/keccak1600-x86_64.pl", - "crypto/sha/asm/sha1-mb-x86_64.pl", - "crypto/sha/asm/sha1-x86_64.pl", - "crypto/sha/asm/sha256-mb-x86_64.pl", - "crypto/sha/asm/sha512-x86_64.pl", - "crypto/whrlpool/asm/wp-x86_64.pl", - "crypto/x86_64cpuid.pl", - "engines/asm/e_padlock-x86_64.pl", - ], - outs = [ - "crypto/aes/aes-x86_64.s", - "crypto/aes/aesni-mb-x86_64.s", - "crypto/aes/aesni-sha1-x86_64.s", - "crypto/aes/aesni-sha256-x86_64.s", - "crypto/aes/aesni-x86_64.s", - "crypto/aes/bsaes-x86_64.s", - "crypto/aes/vpaes-x86_64.s", - "crypto/bn/rsaz-avx2.s", - "crypto/bn/rsaz-x86_64.s", - "crypto/bn/x86_64-gf2m.s", - "crypto/bn/x86_64-mont.s", - "crypto/bn/x86_64-mont5.s", - "crypto/camellia/cmll-x86_64.s", - "crypto/chacha/chacha-x86_64.s", - "crypto/ec/ecp_nistz256-x86_64.s", - "crypto/ec/x25519-x86_64.s", - "crypto/md5/md5-x86_64.s", - "crypto/modes/aesni-gcm-x86_64.s", - "crypto/modes/ghash-x86_64.s", - "crypto/poly1305/poly1305-x86_64.s", - "crypto/rc4/rc4-md5-x86_64.s", - "crypto/rc4/rc4-x86_64.s", - "crypto/sha/keccak1600-x86_64.s", - "crypto/sha/sha1-mb-x86_64.s", - "crypto/sha/sha1-x86_64.s", - "crypto/sha/sha256-mb-x86_64.s", - "crypto/sha/sha256-x86_64.s", - "crypto/sha/sha512-x86_64.s", - "crypto/whrlpool/wp-x86_64.s", - "crypto/x86_64cpuid.s", - "engines/e_padlock-x86_64.s", - ], - cmd = "\n".join([ - "FLAVOR='elf'", - "if [[ $$(uname -s) == 'Darwin' ]]; then FLAVOR='macosx'; fi", - "perl $(location crypto/aes/asm/aes-x86_64.pl) $$FLAVOR $(location crypto/aes/aes-x86_64.s)", - "perl $(location crypto/aes/asm/aesni-mb-x86_64.pl) $$FLAVOR $(location crypto/aes/aesni-mb-x86_64.s)", - "perl $(location crypto/aes/asm/aesni-sha1-x86_64.pl) $$FLAVOR $(location crypto/aes/aesni-sha1-x86_64.s)", - "perl $(location crypto/aes/asm/aesni-sha256-x86_64.pl) $$FLAVOR $(location crypto/aes/aesni-sha256-x86_64.s)", - "perl $(location crypto/aes/asm/aesni-x86_64.pl) $$FLAVOR $(location crypto/aes/aesni-x86_64.s)", - "perl $(location crypto/aes/asm/bsaes-x86_64.pl) $$FLAVOR $(location crypto/aes/bsaes-x86_64.s)", - "perl $(location crypto/aes/asm/vpaes-x86_64.pl) $$FLAVOR $(location crypto/aes/vpaes-x86_64.s)", - "perl $(location crypto/bn/asm/rsaz-avx2.pl) $$FLAVOR $(location crypto/bn/rsaz-avx2.s)", - "perl $(location crypto/bn/asm/rsaz-x86_64.pl) $$FLAVOR $(location crypto/bn/rsaz-x86_64.s)", - "perl $(location crypto/bn/asm/x86_64-gf2m.pl) $$FLAVOR $(location crypto/bn/x86_64-gf2m.s)", - "perl $(location crypto/bn/asm/x86_64-mont.pl) $$FLAVOR $(location crypto/bn/x86_64-mont.s)", - "perl $(location crypto/bn/asm/x86_64-mont5.pl) $$FLAVOR $(location crypto/bn/x86_64-mont5.s)", - "perl $(location crypto/camellia/asm/cmll-x86_64.pl) $$FLAVOR $(location crypto/camellia/cmll-x86_64.s)", - "perl $(location crypto/chacha/asm/chacha-x86_64.pl) $$FLAVOR $(location crypto/chacha/chacha-x86_64.s)", - "perl $(location crypto/ec/asm/ecp_nistz256-x86_64.pl) $$FLAVOR $(location crypto/ec/ecp_nistz256-x86_64.s)", - "perl $(location crypto/ec/asm/x25519-x86_64.pl) $$FLAVOR $(location crypto/ec/x25519-x86_64.s)", - "perl $(location crypto/md5/asm/md5-x86_64.pl) $$FLAVOR $(location crypto/md5/md5-x86_64.s)", - "perl $(location crypto/modes/asm/aesni-gcm-x86_64.pl) $$FLAVOR $(location crypto/modes/aesni-gcm-x86_64.s)", - "perl $(location crypto/modes/asm/ghash-x86_64.pl) $$FLAVOR $(location crypto/modes/ghash-x86_64.s)", - "perl $(location crypto/poly1305/asm/poly1305-x86_64.pl) $$FLAVOR $(location crypto/poly1305/poly1305-x86_64.s)", - "perl $(location crypto/rc4/asm/rc4-md5-x86_64.pl) $$FLAVOR $(location crypto/rc4/rc4-md5-x86_64.s)", - "perl $(location crypto/rc4/asm/rc4-x86_64.pl) $$FLAVOR $(location crypto/rc4/rc4-x86_64.s)", - "perl $(location crypto/sha/asm/keccak1600-x86_64.pl) $$FLAVOR $(location crypto/sha/keccak1600-x86_64.s)", - "perl $(location crypto/sha/asm/sha1-mb-x86_64.pl) $$FLAVOR $(location crypto/sha/sha1-mb-x86_64.s)", - "perl $(location crypto/sha/asm/sha1-x86_64.pl) $$FLAVOR $(location crypto/sha/sha1-x86_64.s)", - "perl $(location crypto/sha/asm/sha256-mb-x86_64.pl) $$FLAVOR $(location crypto/sha/sha256-mb-x86_64.s)", - "perl $(location crypto/sha/asm/sha512-x86_64.pl) $$FLAVOR $(location crypto/sha/sha256-x86_64.s)", - "perl $(location crypto/sha/asm/sha512-x86_64.pl) $$FLAVOR $(location crypto/sha/sha512-x86_64.s)", - "perl $(location crypto/whrlpool/asm/wp-x86_64.pl) $$FLAVOR $(location crypto/whrlpool/wp-x86_64.s)", - "perl $(location crypto/x86_64cpuid.pl) $$FLAVOR $(location crypto/x86_64cpuid.s)", - "perl $(location engines/asm/e_padlock-x86_64.pl) $$FLAVOR $(location engines/e_padlock-x86_64.s)", - ]), - target_compatible_with = ["@platforms//cpu:x86_64"], -) - -cc_library( - name = "libcrypto", - srcs = [ - "crypto/aes/aes-x86_64.s", - "crypto/aes/aes_cfb.c", - "crypto/aes/aes_ecb.c", - "crypto/aes/aes_ige.c", - "crypto/aes/aes_misc.c", - "crypto/aes/aes_ofb.c", - "crypto/aes/aes_wrap.c", - "crypto/aes/aesni-mb-x86_64.s", - "crypto/aes/aesni-sha1-x86_64.s", - "crypto/aes/aesni-sha256-x86_64.s", - "crypto/aes/aesni-x86_64.s", - "crypto/aes/bsaes-x86_64.s", - "crypto/aes/vpaes-x86_64.s", - "crypto/aria/aria.c", - "crypto/asn1/a_bitstr.c", - "crypto/asn1/a_d2i_fp.c", - "crypto/asn1/a_digest.c", - "crypto/asn1/a_dup.c", - "crypto/asn1/a_gentm.c", - "crypto/asn1/a_i2d_fp.c", - "crypto/asn1/a_int.c", - "crypto/asn1/a_mbstr.c", - "crypto/asn1/a_object.c", - "crypto/asn1/a_octet.c", - "crypto/asn1/a_print.c", - "crypto/asn1/a_sign.c", - "crypto/asn1/a_strex.c", - "crypto/asn1/a_strnid.c", - "crypto/asn1/a_time.c", - "crypto/asn1/a_type.c", - "crypto/asn1/a_utctm.c", - "crypto/asn1/a_utf8.c", - "crypto/asn1/a_verify.c", - "crypto/asn1/ameth_lib.c", - "crypto/asn1/asn1_err.c", - "crypto/asn1/asn1_gen.c", - "crypto/asn1/asn1_item_list.c", - "crypto/asn1/asn1_lib.c", - "crypto/asn1/asn1_par.c", - "crypto/asn1/asn_mime.c", - "crypto/asn1/asn_moid.c", - "crypto/asn1/asn_mstbl.c", - "crypto/asn1/asn_pack.c", - "crypto/asn1/bio_asn1.c", - "crypto/asn1/bio_ndef.c", - "crypto/asn1/d2i_pr.c", - "crypto/asn1/d2i_pu.c", - "crypto/asn1/evp_asn1.c", - "crypto/asn1/f_int.c", - "crypto/asn1/f_string.c", - "crypto/asn1/i2d_pr.c", - "crypto/asn1/i2d_pu.c", - "crypto/asn1/n_pkey.c", - "crypto/asn1/nsseq.c", - "crypto/asn1/p5_pbe.c", - "crypto/asn1/p5_pbev2.c", - "crypto/asn1/p5_scrypt.c", - "crypto/asn1/p8_pkey.c", - "crypto/asn1/t_bitst.c", - "crypto/asn1/t_pkey.c", - "crypto/asn1/t_spki.c", - "crypto/asn1/tasn_dec.c", - "crypto/asn1/tasn_enc.c", - "crypto/asn1/tasn_fre.c", - "crypto/asn1/tasn_new.c", - "crypto/asn1/tasn_prn.c", - "crypto/asn1/tasn_scn.c", - "crypto/asn1/tasn_typ.c", - "crypto/asn1/tasn_utl.c", - "crypto/asn1/x_algor.c", - "crypto/asn1/x_bignum.c", - "crypto/asn1/x_info.c", - "crypto/asn1/x_int64.c", - "crypto/asn1/x_long.c", - "crypto/asn1/x_pkey.c", - "crypto/asn1/x_sig.c", - "crypto/asn1/x_spki.c", - "crypto/asn1/x_val.c", - "crypto/async/arch/async_null.c", - "crypto/async/arch/async_posix.c", - "crypto/async/arch/async_win.c", - "crypto/async/async.c", - "crypto/async/async_err.c", - "crypto/async/async_wait.c", - "crypto/bf/bf_cfb64.c", - "crypto/bf/bf_ecb.c", - "crypto/bf/bf_enc.c", - "crypto/bf/bf_ofb64.c", - "crypto/bf/bf_skey.c", - "crypto/bio/b_addr.c", - "crypto/bio/b_dump.c", - "crypto/bio/b_print.c", - "crypto/bio/b_sock.c", - "crypto/bio/b_sock2.c", - "crypto/bio/bf_buff.c", - "crypto/bio/bf_lbuf.c", - "crypto/bio/bf_nbio.c", - "crypto/bio/bf_null.c", - "crypto/bio/bio_cb.c", - "crypto/bio/bio_err.c", - "crypto/bio/bio_lib.c", - "crypto/bio/bio_meth.c", - "crypto/bio/bss_acpt.c", - "crypto/bio/bss_bio.c", - "crypto/bio/bss_conn.c", - "crypto/bio/bss_dgram.c", - "crypto/bio/bss_fd.c", - "crypto/bio/bss_file.c", - "crypto/bio/bss_log.c", - "crypto/bio/bss_mem.c", - "crypto/bio/bss_null.c", - "crypto/bio/bss_sock.c", - "crypto/blake2/blake2b.c", - "crypto/blake2/blake2s.c", - "crypto/blake2/m_blake2b.c", - "crypto/blake2/m_blake2s.c", - "crypto/bn/asm/x86_64-gcc.c", - "crypto/bn/bn_add.c", - "crypto/bn/bn_blind.c", - "crypto/bn/bn_const.c", - "crypto/bn/bn_ctx.c", - "crypto/bn/bn_depr.c", - "crypto/bn/bn_dh.c", - "crypto/bn/bn_div.c", - "crypto/bn/bn_err.c", - "crypto/bn/bn_exp.c", - "crypto/bn/bn_exp2.c", - "crypto/bn/bn_gcd.c", - "crypto/bn/bn_gf2m.c", - "crypto/bn/bn_intern.c", - "crypto/bn/bn_kron.c", - "crypto/bn/bn_lib.c", - "crypto/bn/bn_mod.c", - "crypto/bn/bn_mont.c", - "crypto/bn/bn_mpi.c", - "crypto/bn/bn_mul.c", - "crypto/bn/bn_nist.c", - "crypto/bn/bn_prime.c", - "crypto/bn/bn_print.c", - "crypto/bn/bn_rand.c", - "crypto/bn/bn_recp.c", - "crypto/bn/bn_shift.c", - "crypto/bn/bn_sqr.c", - "crypto/bn/bn_sqrt.c", - "crypto/bn/bn_srp.c", - "crypto/bn/bn_word.c", - "crypto/bn/bn_x931p.c", - "crypto/bn/rsaz-avx2.s", - "crypto/bn/rsaz-x86_64.s", - "crypto/bn/rsaz_exp.c", - "crypto/bn/x86_64-gf2m.s", - "crypto/bn/x86_64-mont.s", - "crypto/bn/x86_64-mont5.s", - "crypto/buffer/buf_err.c", - "crypto/buffer/buffer.c", - "crypto/camellia/cmll-x86_64.s", - "crypto/camellia/cmll_cfb.c", - "crypto/camellia/cmll_ctr.c", - "crypto/camellia/cmll_ecb.c", - "crypto/camellia/cmll_misc.c", - "crypto/camellia/cmll_ofb.c", - "crypto/cast/c_cfb64.c", - "crypto/cast/c_ecb.c", - "crypto/cast/c_enc.c", - "crypto/cast/c_ofb64.c", - "crypto/cast/c_skey.c", - "crypto/chacha/chacha-x86_64.s", - "crypto/cmac/cm_ameth.c", - "crypto/cmac/cm_pmeth.c", - "crypto/cmac/cmac.c", - "crypto/cms/cms_asn1.c", - "crypto/cms/cms_att.c", - "crypto/cms/cms_cd.c", - "crypto/cms/cms_dd.c", - "crypto/cms/cms_enc.c", - "crypto/cms/cms_env.c", - "crypto/cms/cms_err.c", - "crypto/cms/cms_ess.c", - "crypto/cms/cms_io.c", - "crypto/cms/cms_kari.c", - "crypto/cms/cms_lib.c", - "crypto/cms/cms_pwri.c", - "crypto/cms/cms_sd.c", - "crypto/cms/cms_smime.c", - "crypto/comp/c_zlib.c", - "crypto/comp/comp_err.c", - "crypto/comp/comp_lib.c", - "crypto/conf/conf_api.c", - "crypto/conf/conf_def.c", - "crypto/conf/conf_err.c", - "crypto/conf/conf_lib.c", - "crypto/conf/conf_mall.c", - "crypto/conf/conf_mod.c", - "crypto/conf/conf_sap.c", - "crypto/conf/conf_ssl.c", - "crypto/cpt_err.c", - "crypto/cryptlib.c", - "crypto/ct/ct_b64.c", - "crypto/ct/ct_err.c", - "crypto/ct/ct_log.c", - "crypto/ct/ct_oct.c", - "crypto/ct/ct_policy.c", - "crypto/ct/ct_prn.c", - "crypto/ct/ct_sct.c", - "crypto/ct/ct_sct_ctx.c", - "crypto/ct/ct_vfy.c", - "crypto/ct/ct_x509v3.c", - "crypto/ctype.c", - "crypto/cversion.c", - "crypto/des/cbc_cksm.c", - "crypto/des/cbc_enc.c", - "crypto/des/cfb64ede.c", - "crypto/des/cfb64enc.c", - "crypto/des/cfb_enc.c", - "crypto/des/des_enc.c", - "crypto/des/ecb3_enc.c", - "crypto/des/ecb_enc.c", - "crypto/des/fcrypt.c", - "crypto/des/fcrypt_b.c", - "crypto/des/ofb64ede.c", - "crypto/des/ofb64enc.c", - "crypto/des/ofb_enc.c", - "crypto/des/pcbc_enc.c", - "crypto/des/qud_cksm.c", - "crypto/des/rand_key.c", - "crypto/des/set_key.c", - "crypto/des/str2key.c", - "crypto/des/xcbc_enc.c", - "crypto/dh/dh_ameth.c", - "crypto/dh/dh_asn1.c", - "crypto/dh/dh_check.c", - "crypto/dh/dh_depr.c", - "crypto/dh/dh_err.c", - "crypto/dh/dh_gen.c", - "crypto/dh/dh_kdf.c", - "crypto/dh/dh_key.c", - "crypto/dh/dh_lib.c", - "crypto/dh/dh_meth.c", - "crypto/dh/dh_pmeth.c", - "crypto/dh/dh_prn.c", - "crypto/dh/dh_rfc5114.c", - "crypto/dh/dh_rfc7919.c", - "crypto/dsa/dsa_ameth.c", - "crypto/dsa/dsa_asn1.c", - "crypto/dsa/dsa_depr.c", - "crypto/dsa/dsa_err.c", - "crypto/dsa/dsa_gen.c", - "crypto/dsa/dsa_key.c", - "crypto/dsa/dsa_lib.c", - "crypto/dsa/dsa_meth.c", - "crypto/dsa/dsa_ossl.c", - "crypto/dsa/dsa_pmeth.c", - "crypto/dsa/dsa_prn.c", - "crypto/dsa/dsa_sign.c", - "crypto/dsa/dsa_vrf.c", - "crypto/dso/dso_dl.c", - "crypto/dso/dso_dlfcn.c", - "crypto/dso/dso_err.c", - "crypto/dso/dso_lib.c", - "crypto/dso/dso_openssl.c", - "crypto/dso/dso_vms.c", - "crypto/dso/dso_win32.c", - "crypto/ebcdic.c", - "crypto/ec/curve25519.c", - "crypto/ec/curve448/arch_32/f_impl.c", - "crypto/ec/curve448/curve448.c", - "crypto/ec/curve448/curve448_tables.c", - "crypto/ec/curve448/eddsa.c", - "crypto/ec/curve448/f_generic.c", - "crypto/ec/curve448/scalar.c", - "crypto/ec/ec2_oct.c", - "crypto/ec/ec2_smpl.c", - "crypto/ec/ec_ameth.c", - "crypto/ec/ec_asn1.c", - "crypto/ec/ec_check.c", - "crypto/ec/ec_curve.c", - "crypto/ec/ec_cvt.c", - "crypto/ec/ec_err.c", - "crypto/ec/ec_key.c", - "crypto/ec/ec_kmeth.c", - "crypto/ec/ec_lib.c", - "crypto/ec/ec_mult.c", - "crypto/ec/ec_oct.c", - "crypto/ec/ec_pmeth.c", - "crypto/ec/ec_print.c", - "crypto/ec/ecdh_kdf.c", - "crypto/ec/ecdh_ossl.c", - "crypto/ec/ecdsa_ossl.c", - "crypto/ec/ecdsa_sign.c", - "crypto/ec/ecdsa_vrf.c", - "crypto/ec/eck_prn.c", - "crypto/ec/ecp_mont.c", - "crypto/ec/ecp_nist.c", - "crypto/ec/ecp_nistp224.c", - "crypto/ec/ecp_nistp256.c", - "crypto/ec/ecp_nistp521.c", - "crypto/ec/ecp_nistputil.c", - "crypto/ec/ecp_nistz256-x86_64.s", - "crypto/ec/ecp_nistz256.c", - "crypto/ec/ecp_oct.c", - "crypto/ec/ecp_smpl.c", - "crypto/ec/ecx_meth.c", - "crypto/ec/x25519-x86_64.s", - "crypto/engine/eng_all.c", - "crypto/engine/eng_cnf.c", - "crypto/engine/eng_ctrl.c", - "crypto/engine/eng_dyn.c", - "crypto/engine/eng_err.c", - "crypto/engine/eng_fat.c", - "crypto/engine/eng_init.c", - "crypto/engine/eng_lib.c", - "crypto/engine/eng_list.c", - "crypto/engine/eng_openssl.c", - "crypto/engine/eng_pkey.c", - "crypto/engine/eng_rdrand.c", - "crypto/engine/eng_table.c", - "crypto/engine/tb_asnmth.c", - "crypto/engine/tb_cipher.c", - "crypto/engine/tb_dh.c", - "crypto/engine/tb_digest.c", - "crypto/engine/tb_dsa.c", - "crypto/engine/tb_eckey.c", - "crypto/engine/tb_pkmeth.c", - "crypto/engine/tb_rand.c", - "crypto/engine/tb_rsa.c", - "crypto/err/err.c", - "crypto/err/err_all.c", - "crypto/err/err_prn.c", - "crypto/evp/bio_b64.c", - "crypto/evp/bio_enc.c", - "crypto/evp/bio_md.c", - "crypto/evp/bio_ok.c", - "crypto/evp/c_allc.c", - "crypto/evp/c_alld.c", - "crypto/evp/cmeth_lib.c", - "crypto/evp/digest.c", - "crypto/evp/e_aes.c", - "crypto/evp/e_aes_cbc_hmac_sha1.c", - "crypto/evp/e_aes_cbc_hmac_sha256.c", - "crypto/evp/e_aria.c", - "crypto/evp/e_bf.c", - "crypto/evp/e_camellia.c", - "crypto/evp/e_cast.c", - "crypto/evp/e_chacha20_poly1305.c", - "crypto/evp/e_des.c", - "crypto/evp/e_des3.c", - "crypto/evp/e_idea.c", - "crypto/evp/e_null.c", - "crypto/evp/e_old.c", - "crypto/evp/e_rc2.c", - "crypto/evp/e_rc4.c", - "crypto/evp/e_rc4_hmac_md5.c", - "crypto/evp/e_rc5.c", - "crypto/evp/e_seed.c", - "crypto/evp/e_sm4.c", - "crypto/evp/e_xcbc_d.c", - "crypto/evp/encode.c", - "crypto/evp/evp_cnf.c", - "crypto/evp/evp_enc.c", - "crypto/evp/evp_err.c", - "crypto/evp/evp_key.c", - "crypto/evp/evp_lib.c", - "crypto/evp/evp_pbe.c", - "crypto/evp/evp_pkey.c", - "crypto/evp/m_md2.c", - "crypto/evp/m_md4.c", - "crypto/evp/m_md5.c", - "crypto/evp/m_md5_sha1.c", - "crypto/evp/m_mdc2.c", - "crypto/evp/m_null.c", - "crypto/evp/m_ripemd.c", - "crypto/evp/m_sha1.c", - "crypto/evp/m_sha3.c", - "crypto/evp/m_sigver.c", - "crypto/evp/m_wp.c", - "crypto/evp/names.c", - "crypto/evp/p5_crpt.c", - "crypto/evp/p5_crpt2.c", - "crypto/evp/p_dec.c", - "crypto/evp/p_enc.c", - "crypto/evp/p_lib.c", - "crypto/evp/p_open.c", - "crypto/evp/p_seal.c", - "crypto/evp/p_sign.c", - "crypto/evp/p_verify.c", - "crypto/evp/pbe_scrypt.c", - "crypto/evp/pmeth_fn.c", - "crypto/evp/pmeth_gn.c", - "crypto/evp/pmeth_lib.c", - "crypto/ex_data.c", - "crypto/getenv.c", - "crypto/hmac/hm_ameth.c", - "crypto/hmac/hm_pmeth.c", - "crypto/hmac/hmac.c", - "crypto/idea/i_cbc.c", - "crypto/idea/i_cfb64.c", - "crypto/idea/i_ecb.c", - "crypto/idea/i_ofb64.c", - "crypto/idea/i_skey.c", - "crypto/init.c", - "crypto/kdf/hkdf.c", - "crypto/kdf/kdf_err.c", - "crypto/kdf/scrypt.c", - "crypto/kdf/tls1_prf.c", - "crypto/lhash/lh_stats.c", - "crypto/lhash/lhash.c", - "crypto/md4/md4_dgst.c", - "crypto/md4/md4_one.c", - "crypto/md5/md5-x86_64.s", - "crypto/md5/md5_dgst.c", - "crypto/md5/md5_one.c", - "crypto/mdc2/mdc2_one.c", - "crypto/mdc2/mdc2dgst.c", - "crypto/mem.c", - "crypto/mem_dbg.c", - "crypto/mem_sec.c", - "crypto/modes/aesni-gcm-x86_64.s", - "crypto/modes/cbc128.c", - "crypto/modes/ccm128.c", - "crypto/modes/cfb128.c", - "crypto/modes/ctr128.c", - "crypto/modes/cts128.c", - "crypto/modes/gcm128.c", - "crypto/modes/ghash-x86_64.s", - "crypto/modes/ocb128.c", - "crypto/modes/ofb128.c", - "crypto/modes/wrap128.c", - "crypto/modes/xts128.c", - "crypto/o_dir.c", - "crypto/o_fips.c", - "crypto/o_fopen.c", - "crypto/o_init.c", - "crypto/o_str.c", - "crypto/o_time.c", - "crypto/objects/o_names.c", - "crypto/objects/obj_dat.c", - "crypto/objects/obj_err.c", - "crypto/objects/obj_lib.c", - "crypto/objects/obj_xref.c", - "crypto/ocsp/ocsp_asn.c", - "crypto/ocsp/ocsp_cl.c", - "crypto/ocsp/ocsp_err.c", - "crypto/ocsp/ocsp_ext.c", - "crypto/ocsp/ocsp_ht.c", - "crypto/ocsp/ocsp_lib.c", - "crypto/ocsp/ocsp_prn.c", - "crypto/ocsp/ocsp_srv.c", - "crypto/ocsp/ocsp_vfy.c", - "crypto/ocsp/v3_ocsp.c", - "crypto/pem/pem_all.c", - "crypto/pem/pem_err.c", - "crypto/pem/pem_info.c", - "crypto/pem/pem_lib.c", - "crypto/pem/pem_oth.c", - "crypto/pem/pem_pk8.c", - "crypto/pem/pem_pkey.c", - "crypto/pem/pem_sign.c", - "crypto/pem/pem_x509.c", - "crypto/pem/pem_xaux.c", - "crypto/pem/pvkfmt.c", - "crypto/pkcs12/p12_add.c", - "crypto/pkcs12/p12_asn.c", - "crypto/pkcs12/p12_attr.c", - "crypto/pkcs12/p12_crpt.c", - "crypto/pkcs12/p12_crt.c", - "crypto/pkcs12/p12_decr.c", - "crypto/pkcs12/p12_init.c", - "crypto/pkcs12/p12_key.c", - "crypto/pkcs12/p12_kiss.c", - "crypto/pkcs12/p12_mutl.c", - "crypto/pkcs12/p12_npas.c", - "crypto/pkcs12/p12_p8d.c", - "crypto/pkcs12/p12_p8e.c", - "crypto/pkcs12/p12_sbag.c", - "crypto/pkcs12/p12_utl.c", - "crypto/pkcs12/pk12err.c", - "crypto/pkcs7/bio_pk7.c", - "crypto/pkcs7/pk7_asn1.c", - "crypto/pkcs7/pk7_attr.c", - "crypto/pkcs7/pk7_doit.c", - "crypto/pkcs7/pk7_lib.c", - "crypto/pkcs7/pk7_mime.c", - "crypto/pkcs7/pk7_smime.c", - "crypto/pkcs7/pkcs7err.c", - "crypto/poly1305/poly1305-x86_64.s", - "crypto/poly1305/poly1305.c", - "crypto/poly1305/poly1305_ameth.c", - "crypto/poly1305/poly1305_pmeth.c", - "crypto/rand/drbg_ctr.c", - "crypto/rand/drbg_lib.c", - "crypto/rand/rand_egd.c", - "crypto/rand/rand_err.c", - "crypto/rand/rand_lib.c", - "crypto/rand/rand_unix.c", - "crypto/rand/rand_vms.c", - "crypto/rand/rand_win.c", - "crypto/rand/randfile.c", - "crypto/rc2/rc2_cbc.c", - "crypto/rc2/rc2_ecb.c", - "crypto/rc2/rc2_skey.c", - "crypto/rc2/rc2cfb64.c", - "crypto/rc2/rc2ofb64.c", - "crypto/rc4/rc4-md5-x86_64.s", - "crypto/rc4/rc4-x86_64.s", - "crypto/ripemd/rmd_dgst.c", - "crypto/ripemd/rmd_one.c", - "crypto/rsa/rsa_ameth.c", - "crypto/rsa/rsa_asn1.c", - "crypto/rsa/rsa_chk.c", - "crypto/rsa/rsa_crpt.c", - "crypto/rsa/rsa_depr.c", - "crypto/rsa/rsa_err.c", - "crypto/rsa/rsa_gen.c", - "crypto/rsa/rsa_lib.c", - "crypto/rsa/rsa_meth.c", - "crypto/rsa/rsa_mp.c", - "crypto/rsa/rsa_none.c", - "crypto/rsa/rsa_oaep.c", - "crypto/rsa/rsa_ossl.c", - "crypto/rsa/rsa_pk1.c", - "crypto/rsa/rsa_pmeth.c", - "crypto/rsa/rsa_prn.c", - "crypto/rsa/rsa_pss.c", - "crypto/rsa/rsa_saos.c", - "crypto/rsa/rsa_sign.c", - "crypto/rsa/rsa_ssl.c", - "crypto/rsa/rsa_x931.c", - "crypto/rsa/rsa_x931g.c", - "crypto/seed/seed.c", - "crypto/seed/seed_cbc.c", - "crypto/seed/seed_cfb.c", - "crypto/seed/seed_ecb.c", - "crypto/seed/seed_ofb.c", - "crypto/sha/keccak1600-x86_64.s", - "crypto/sha/sha1-mb-x86_64.s", - "crypto/sha/sha1-x86_64.s", - "crypto/sha/sha1_one.c", - "crypto/sha/sha1dgst.c", - "crypto/sha/sha256-mb-x86_64.s", - "crypto/sha/sha256-x86_64.s", - "crypto/sha/sha256.c", - "crypto/sha/sha512-x86_64.s", - "crypto/sha/sha512.c", - "crypto/siphash/siphash.c", - "crypto/siphash/siphash_ameth.c", - "crypto/siphash/siphash_pmeth.c", - "crypto/sm2/sm2_crypt.c", - "crypto/sm2/sm2_err.c", - "crypto/sm2/sm2_pmeth.c", - "crypto/sm2/sm2_sign.c", - "crypto/sm3/m_sm3.c", - "crypto/sm3/sm3.c", - "crypto/sm4/sm4.c", - "crypto/srp/srp_lib.c", - "crypto/srp/srp_vfy.c", - "crypto/stack/stack.c", - "crypto/store/loader_file.c", - "crypto/store/store_err.c", - "crypto/store/store_init.c", - "crypto/store/store_lib.c", - "crypto/store/store_register.c", - "crypto/store/store_strings.c", - "crypto/threads_none.c", - "crypto/threads_pthread.c", - "crypto/threads_win.c", - "crypto/ts/ts_asn1.c", - "crypto/ts/ts_conf.c", - "crypto/ts/ts_err.c", - "crypto/ts/ts_lib.c", - "crypto/ts/ts_req_print.c", - "crypto/ts/ts_req_utils.c", - "crypto/ts/ts_rsp_print.c", - "crypto/ts/ts_rsp_sign.c", - "crypto/ts/ts_rsp_utils.c", - "crypto/ts/ts_rsp_verify.c", - "crypto/ts/ts_verify_ctx.c", - "crypto/txt_db/txt_db.c", - "crypto/ui/ui_err.c", - "crypto/ui/ui_lib.c", - "crypto/ui/ui_null.c", - "crypto/ui/ui_openssl.c", - "crypto/ui/ui_util.c", - "crypto/uid.c", - "crypto/whrlpool/wp-x86_64.s", - "crypto/whrlpool/wp_dgst.c", - "crypto/x509/by_dir.c", - "crypto/x509/by_file.c", - "crypto/x509/t_crl.c", - "crypto/x509/t_req.c", - "crypto/x509/t_x509.c", - "crypto/x509/x509_att.c", - "crypto/x509/x509_cmp.c", - "crypto/x509/x509_d2.c", - "crypto/x509/x509_def.c", - "crypto/x509/x509_err.c", - "crypto/x509/x509_ext.c", - "crypto/x509/x509_lu.c", - "crypto/x509/x509_meth.c", - "crypto/x509/x509_obj.c", - "crypto/x509/x509_r2x.c", - "crypto/x509/x509_req.c", - "crypto/x509/x509_set.c", - "crypto/x509/x509_trs.c", - "crypto/x509/x509_txt.c", - "crypto/x509/x509_v3.c", - "crypto/x509/x509_vfy.c", - "crypto/x509/x509_vpm.c", - "crypto/x509/x509cset.c", - "crypto/x509/x509name.c", - "crypto/x509/x509rset.c", - "crypto/x509/x509spki.c", - "crypto/x509/x509type.c", - "crypto/x509/x_all.c", - "crypto/x509/x_attrib.c", - "crypto/x509/x_crl.c", - "crypto/x509/x_exten.c", - "crypto/x509/x_name.c", - "crypto/x509/x_pubkey.c", - "crypto/x509/x_req.c", - "crypto/x509/x_x509.c", - "crypto/x509/x_x509a.c", - "crypto/x509v3/pcy_cache.c", - "crypto/x509v3/pcy_data.c", - "crypto/x509v3/pcy_lib.c", - "crypto/x509v3/pcy_map.c", - "crypto/x509v3/pcy_node.c", - "crypto/x509v3/pcy_tree.c", - "crypto/x509v3/v3_addr.c", - "crypto/x509v3/v3_admis.c", - "crypto/x509v3/v3_akey.c", - "crypto/x509v3/v3_akeya.c", - "crypto/x509v3/v3_alt.c", - "crypto/x509v3/v3_asid.c", - "crypto/x509v3/v3_bcons.c", - "crypto/x509v3/v3_bitst.c", - "crypto/x509v3/v3_conf.c", - "crypto/x509v3/v3_cpols.c", - "crypto/x509v3/v3_crld.c", - "crypto/x509v3/v3_enum.c", - "crypto/x509v3/v3_extku.c", - "crypto/x509v3/v3_genn.c", - "crypto/x509v3/v3_ia5.c", - "crypto/x509v3/v3_info.c", - "crypto/x509v3/v3_int.c", - "crypto/x509v3/v3_lib.c", - "crypto/x509v3/v3_ncons.c", - "crypto/x509v3/v3_pci.c", - "crypto/x509v3/v3_pcia.c", - "crypto/x509v3/v3_pcons.c", - "crypto/x509v3/v3_pku.c", - "crypto/x509v3/v3_pmaps.c", - "crypto/x509v3/v3_prn.c", - "crypto/x509v3/v3_purp.c", - "crypto/x509v3/v3_skey.c", - "crypto/x509v3/v3_sxnet.c", - "crypto/x509v3/v3_tlsf.c", - "crypto/x509v3/v3_utl.c", - "crypto/x509v3/v3err.c", - "crypto/x86_64cpuid.s", - ] + CONF_FILES + ["crypto/buildinf.h"] + glob([ - "*.h", - "crypto/**/*.h", - "crypto/include/*.h", - "include/internal/*.h", - ], allow_empty = True), - hdrs = HDRS + [ - # These are not independent compile units, but are included in other .c files. - "crypto/LPdir_unix.c", - "crypto/des/ncbc_enc.c", - ], - copts = COPTS + [ - "-isystem external/openssl", - "-iquote external/openssl/crypto", - "-iquote external/openssl/crypto/include", - "-iquote external/openssl/crypto/modes", - "-iquote external/openssl/crypto/ec/curve448", - "-iquote external/openssl/crypto/ec/curve448/arch_32", - "-iquote $(GENDIR)/external/openssl/crypto", - "-iquote $(GENDIR)/external/openssl/crypto/include", - ], - includes = ["include"], -) - -cc_library( - name = "libssl", - srcs = [ - "e_os.h", - "ssl/bio_ssl.c", - "ssl/d1_lib.c", - "ssl/d1_msg.c", - "ssl/d1_srtp.c", - "ssl/methods.c", - "ssl/packet.c", - "ssl/pqueue.c", - "ssl/record/dtls1_bitmap.c", - "ssl/record/rec_layer_d1.c", - "ssl/record/rec_layer_s3.c", - "ssl/record/ssl3_buffer.c", - "ssl/record/ssl3_record.c", - "ssl/record/ssl3_record_tls13.c", - "ssl/s3_cbc.c", - "ssl/s3_enc.c", - "ssl/s3_lib.c", - "ssl/s3_msg.c", - "ssl/ssl_asn1.c", - "ssl/ssl_cert.c", - "ssl/ssl_ciph.c", - "ssl/ssl_conf.c", - "ssl/ssl_err.c", - "ssl/ssl_init.c", - "ssl/ssl_lib.c", - "ssl/ssl_mcnf.c", - "ssl/ssl_rsa.c", - "ssl/ssl_sess.c", - "ssl/ssl_stat.c", - "ssl/ssl_txt.c", - "ssl/ssl_utst.c", - "ssl/statem/extensions.c", - "ssl/statem/extensions_clnt.c", - "ssl/statem/extensions_cust.c", - "ssl/statem/extensions_srvr.c", - "ssl/statem/statem.c", - "ssl/statem/statem_clnt.c", - "ssl/statem/statem_dtls.c", - "ssl/statem/statem_lib.c", - "ssl/statem/statem_srvr.c", - "ssl/t1_enc.c", - "ssl/t1_lib.c", - "ssl/t1_trce.c", - "ssl/tls13_enc.c", - "ssl/tls_srp.c", - ] + glob([ - "ssl/**/*.h", - ]), - hdrs = HDRS, - copts = COPTS, - deps = [":libcrypto"], -) diff --git a/tests/openssl/overlay/BUILD.bazel b/tests/openssl/overlay/BUILD.bazel new file mode 100644 index 00000000..abbc0146 --- /dev/null +++ b/tests/openssl/overlay/BUILD.bazel @@ -0,0 +1,565 @@ +# This code is heavily based on the implementation in `dbx_build_tools`: +# Ref: https://github.com/dropbox/dbx_build_tools/blob/master/thirdparty/openssl/BUILD.openssl.tail + +load("@bazel_skylib//rules:copy_file.bzl", "copy_file") +load("@bazel_skylib//rules:write_file.bzl", "write_file") +load("@openssl-generated-overlay//:collate_into_directory.bzl", "collate_into_directory") +load("@openssl-generated-overlay//:common.bzl", "COMMON_GENERATED_FILES") +load( + "@openssl-generated-overlay//:constants-darwin64-arm64-cc.bzl", + _DARWIN_ARM64_GEN_FILES = "GEN_FILES", + _DARWIN_ARM64_LIBCRYPTO_DEFINES = "LIBCRYPTO_DEFINES", + _DARWIN_ARM64_LIBCRYPTO_SRCS = "LIBCRYPTO_SRCS", + _DARWIN_ARM64_LIBSSL_DEFINES = "LIBSSL_DEFINES", + _DARWIN_ARM64_LIBSSL_SRCS = "LIBSSL_SRCS", + _DARWIN_ARM64_OPENSSL_APP_DEFINES = "LIBSSL_DEFINES", + _DARWIN_ARM64_OPENSSL_APP_SRCS = "OPENSSL_APP_SRCS", + _DARWIN_ARM64_OPENSSL_DEFINES = "OPENSSL_DEFINES", + _NIX_ARM64_PERLASM_GEN = "PERLASM_GEN", +) +load( + "@openssl-generated-overlay//:constants-darwin64-x86_64-cc.bzl", + _DARWIN_X86_64_GEN_FILES = "GEN_FILES", + _DARWIN_X86_64_LIBCRYPTO_DEFINES = "LIBCRYPTO_DEFINES", + _DARWIN_X86_64_LIBCRYPTO_SRCS = "LIBCRYPTO_SRCS", + _DARWIN_X86_64_LIBSSL_DEFINES = "LIBSSL_DEFINES", + _DARWIN_X86_64_LIBSSL_SRCS = "LIBSSL_SRCS", + _DARWIN_X86_64_OPENSSL_APP_DEFINES = "LIBSSL_DEFINES", + _DARWIN_X86_64_OPENSSL_APP_SRCS = "OPENSSL_APP_SRCS", + _DARWIN_X86_64_OPENSSL_DEFINES = "OPENSSL_DEFINES", +) +load( + "@openssl-generated-overlay//:constants-linux-aarch64.bzl", + _LINUX_ARM64_GEN_FILES = "GEN_FILES", + _LINUX_ARM64_LIBCRYPTO_DEFINES = "LIBCRYPTO_DEFINES", + _LINUX_ARM64_LIBCRYPTO_SRCS = "LIBCRYPTO_SRCS", + _LINUX_ARM64_LIBSSL_DEFINES = "LIBSSL_DEFINES", + _LINUX_ARM64_LIBSSL_SRCS = "LIBSSL_SRCS", + _LINUX_ARM64_OPENSSL_APP_DEFINES = "LIBSSL_DEFINES", + _LINUX_ARM64_OPENSSL_APP_SRCS = "OPENSSL_APP_SRCS", + _LINUX_ARM64_OPENSSL_DEFINES = "OPENSSL_DEFINES", +) +load( + "@openssl-generated-overlay//:constants-linux-x86_64-clang.bzl", + _LINUX_X86_64_GEN_FILES = "GEN_FILES", + _LINUX_X86_64_LIBCRYPTO_DEFINES = "LIBCRYPTO_DEFINES", + _LINUX_X86_64_LIBCRYPTO_SRCS = "LIBCRYPTO_SRCS", + _LINUX_X86_64_LIBSSL_DEFINES = "LIBSSL_DEFINES", + _LINUX_X86_64_LIBSSL_SRCS = "LIBSSL_SRCS", + _LINUX_X86_64_OPENSSL_APP_DEFINES = "LIBSSL_DEFINES", + _LINUX_X86_64_OPENSSL_APP_SRCS = "OPENSSL_APP_SRCS", + _LINUX_X86_64_OPENSSL_DEFINES = "OPENSSL_DEFINES", + _NIX_X86_64_PERLASM_GEN = "PERLASM_GEN", +) +load( + "@openssl-generated-overlay//:constants-VC-WIN64-CLANGASM-ARM.bzl", + _WINDOWS_ARM64_GEN_FILES = "GEN_FILES", + _WINDOWS_ARM64_LIBCRYPTO_DEFINES = "LIBCRYPTO_DEFINES", + _WINDOWS_ARM64_LIBCRYPTO_SRCS = "LIBCRYPTO_SRCS", + _WINDOWS_ARM64_LIBSSL_DEFINES = "LIBSSL_DEFINES", + _WINDOWS_ARM64_LIBSSL_SRCS = "LIBSSL_SRCS", + _WINDOWS_ARM64_OPENSSL_APP_DEFINES = "LIBSSL_DEFINES", + _WINDOWS_ARM64_OPENSSL_APP_SRCS = "OPENSSL_APP_SRCS", + _WINDOWS_ARM64_OPENSSL_DEFINES = "OPENSSL_DEFINES", + _WINDOWS_ARM64_PERLASM_GEN = "PERLASM_GEN", +) +load( + "@openssl-generated-overlay//:constants-VC-WIN64A-masm.bzl", + _WINDOWS_X86_64_GEN_FILES = "GEN_FILES", + _WINDOWS_X86_64_LIBCRYPTO_DEFINES = "LIBCRYPTO_DEFINES", + _WINDOWS_X86_64_LIBCRYPTO_SRCS = "LIBCRYPTO_SRCS", + _WINDOWS_X86_64_LIBSSL_DEFINES = "LIBSSL_DEFINES", + _WINDOWS_X86_64_LIBSSL_SRCS = "LIBSSL_SRCS", + _WINDOWS_X86_64_OPENSSL_APP_DEFINES = "LIBSSL_DEFINES", + _WINDOWS_X86_64_OPENSSL_APP_SRCS = "OPENSSL_APP_SRCS", + _WINDOWS_X86_64_OPENSSL_DEFINES = "OPENSSL_DEFINES", + _WINDOWS_X86_64_PERLASM_GEN = "PERLASM_GEN", +) +load("@openssl-generated-overlay//:perl_genrule.bzl", "perl_genrule") +load("@rules_cc//cc:cc_binary.bzl", "cc_binary") +load("@rules_cc//cc:cc_library.bzl", "cc_library") +load("//:utils.bzl", "get_repo_name", "parse_perlasm_gen", "remove_dupes") + +_REPO_NAME = get_repo_name() + +cc_library( + name = "crypto-textual-hdrs", + textual_hdrs = [ + "crypto/des/ncbc_enc.c", + ] + select({ + "@platforms//os:windows": [ + "crypto/LPdir_win32.c", + "crypto/LPdir_win.c", + "crypto/LPdir_wince.c", + ], + "//conditions:default": ["crypto/LPdir_unix.c"], + }), +) + +COMMON_OPENSSL_APP_SRCS = glob( + [ + "include/internal/*.h", + "apps/include/*.h", + "apps/*.h", + "include/openssl/*.h", + ], + exclude = COMMON_GENERATED_FILES, +) + [ + ":apps/progs.h", + ":include/openssl/asn1.h", + ":include/openssl/asn1t.h", + ":include/openssl/conf.h", + ":include/openssl/crypto.h", + ":include/openssl/ct.h", + ":include/openssl/err.h", + ":include/openssl/bio.h", + ":include/openssl/cmp.h", + ":include/openssl/cms.h", + ":include/openssl/crmf.h", + ":include/openssl/configuration.h", + ":include/openssl/core_names.h", + ":include/openssl/fipskey.h", + ":include/openssl/ess.h", + ":include/openssl/lhash.h", + ":include/openssl/opensslconf.h", + ":include/openssl/opensslv.h", + ":include/openssl/ocsp.h", + ":include/openssl/pkcs7.h", + ":include/openssl/pkcs12.h", + ":include/openssl/safestack.h", + ":include/openssl/srp.h", + ":include/openssl/ssl.h", + ":include/openssl/ui.h", + ":include/openssl/x509.h", + ":include/openssl/x509v3.h", + ":include/openssl/x509_vfy.h", +] + +# Some source files are missing from OpenSSL metadata so we never pick them up. +MISSING_OPENSSL_WINDOWS_SRCS = ["apps/lib/win32_init.c"] + +ALL_OPENSSL_APP_SRCS = COMMON_OPENSSL_APP_SRCS + select({ + "//configs:darwin_arm64": _DARWIN_ARM64_OPENSSL_APP_SRCS, + "//configs:darwin_x86_64": _DARWIN_X86_64_OPENSSL_APP_SRCS, + "//configs:linux_aarch64": _LINUX_ARM64_OPENSSL_APP_SRCS, + "//configs:linux_x86_64": _LINUX_X86_64_OPENSSL_APP_SRCS, + "//configs:windows_arm64": _WINDOWS_ARM64_OPENSSL_APP_SRCS + MISSING_OPENSSL_WINDOWS_SRCS, + "//configs:windows_x64": _WINDOWS_X86_64_OPENSSL_APP_SRCS + MISSING_OPENSSL_WINDOWS_SRCS, +}) + +OPENSSL_APP_NIX_COPTS = [ + "-iquote", + "$(BINDIR)/external/{}/apps".format(_REPO_NAME), + "-iquote", + "external/{}/apps".format(_REPO_NAME), + "-iquote", + "external/{}/apps/include".format(_REPO_NAME), +] + +OPENSSL_APP_WINDOWS_COPTS = [ + "/I$(BINDIR)/external/{}/apps".format(_REPO_NAME), + "/Iexternal/{}/apps".format(_REPO_NAME), + "/Iexternal/{}/apps/include".format(_REPO_NAME), +] + +OPENSSL_APP_NIX_LINKOPTS = [ +] + +OPENSSL_APP_WINDOWS_LINKOPTS = [ + "-defaultlib:ws2_32.lib", + "-defaultlib:advapi32.lib", + "-defaultlib:user32.lib", + "-defaultlib:crypt32.lib", +] + +COMMON_OPENSSL_WINDOWS_DEFINES = [ + "_WINSOCKAPI_", + "OPENSSL_SYS_WINCE", + "WIN32_LEAN_AND_MEAN", +] + +COMMON_OPENSSL_DEFINES = select({ + "//configs:windows_arm64": COMMON_OPENSSL_WINDOWS_DEFINES, + "//configs:windows_x64": COMMON_OPENSSL_WINDOWS_DEFINES, + "//conditions:default": [], +}) + +COMMON_OPENSSL_COPTS = [ + # If someone wants to link with -fPIC, the objects they're linking need to have been built with it. + # Add this flag so that people can choose to link that way if they want to. + "-fPIC", +] + [ + # This hardcoded path into the system mean we will find the system certs. Note Debian sets + # OPENSSLDIR=/usr/lib/ssl, but /usr/lib/ssl mostly consists of symlinks into /etc/ssl. We + # must set /etc/ssl here because some environments (e.g., YSS root filesystems) don't have + # /usr/lib/ssl at all. + "-DOPENSSLDIR=\\\"/etc/ssl\\\"", + # This is basically a no-op, since we've disabled dynamic loading of engines. + '-DENGINESDIR=\\"/usr/lib/engines-3.0\\"', + # also basically a no-op + "-DMODULESDIR=\\\"/dev/null\\\"", + "-DL_ENDIAN", + "-DOPENSSL_USE_NODELETE", +] + select({ + "//configs:linux_aarch64": ["-mno-outline-atomics"], + "//conditions:default": [], +}) + select({ + "//configs:windows_arm64": [ + "/Iexternal/{}/include".format(_REPO_NAME), + "/VERBOSE", + ], + "//configs:windows_x64": [ + "/Iexternal/{}/include".format(_REPO_NAME), + "/VERBOSE", + ], + "//conditions:default": [ + # As described in https://github.com/openssl/openssl/issues/4575, OpenSSL doesn't mark its + # assembly files as not requiring an executable stack. Pass --noexecstack to the assembler + # to do this. + "-Wa,--noexecstack", + "-Wno-unused-command-line-argument", + "-I", + "external/{}/include".format(_REPO_NAME), + ], +}) + +cc_binary( + name = "openssl", + srcs = ALL_OPENSSL_APP_SRCS, + copts = COMMON_OPENSSL_COPTS + select({ + "//configs:darwin_arm64": _DARWIN_ARM64_OPENSSL_APP_DEFINES, + "//configs:darwin_x86_64": _DARWIN_X86_64_OPENSSL_APP_DEFINES, + "//configs:linux_aarch64": _LINUX_ARM64_OPENSSL_APP_DEFINES, + "//configs:linux_x86_64": _LINUX_X86_64_OPENSSL_APP_DEFINES, + "//configs:windows_arm64": _WINDOWS_ARM64_OPENSSL_APP_DEFINES, + "//configs:windows_x64": _WINDOWS_X86_64_OPENSSL_APP_DEFINES, + }) + select({ + "//configs:windows_arm64": OPENSSL_APP_WINDOWS_COPTS, + "//configs:windows_x64": OPENSSL_APP_WINDOWS_COPTS, + "//conditions:default": OPENSSL_APP_NIX_COPTS, + }), + defines = COMMON_OPENSSL_DEFINES, + linkopts = select({ + "//configs:windows_arm64": OPENSSL_APP_WINDOWS_LINKOPTS, + "//configs:windows_x64": OPENSSL_APP_WINDOWS_LINKOPTS, + "//conditions:default": OPENSSL_APP_NIX_LINKOPTS, + }), + visibility = ["//visibility:public"], + deps = [":ssl"], +) + +NIX_ARM64_PERLASM_TOOLS_AND_OUTS, NIX_ARM64_PERLASM_TOOLS_AND_OUTS_DUPES_DICT = parse_perlasm_gen(_NIX_ARM64_PERLASM_GEN) + +NIX_X86_64_PERLASM_TOOLS_AND_OUTS, NIX_X86_64_PERLASM_TOOLS_AND_OUTS_DUPES_DICT = parse_perlasm_gen(_NIX_X86_64_PERLASM_GEN) + +WINDOWS_ARM64_PERLASM_TOOLS_AND_OUTS, WINDOWS_ARM64_PERLASM_TOOLS_AND_OUTS_DUPES_DICT = parse_perlasm_gen(_WINDOWS_ARM64_PERLASM_GEN) + +WINDOWS_X86_64_PERLASM_TOOLS_AND_OUTS, WINDOWS_X86_64_PERLASM_TOOLS_AND_OUTS_DUPES_DICT = parse_perlasm_gen(_WINDOWS_X86_64_PERLASM_GEN) + +PERLASM_TOOLS = glob( + ["crypto/perlasm/*.pl"], + exclude = COMMON_GENERATED_FILES, +) + +perl_genrule( + name = "perlasm_genfiles", + additional_srcs = PERLASM_TOOLS + ["crypto/ec/ecp_nistz256_table.c"], + assembly_flavor = select({ + "//configs:darwin_arm64": "ios64", + "//configs:darwin_x86_64": "macosx", + "//configs:linux_aarch64": "linux64", + "//configs:linux_x86_64": "elf", + "//configs:windows_arm64": "win64", + "//configs:windows_x64": "masm", + }), + srcs_to_outs = select({ + "//configs:darwin_arm64": NIX_ARM64_PERLASM_TOOLS_AND_OUTS, + "//configs:darwin_x86_64": NIX_X86_64_PERLASM_TOOLS_AND_OUTS, + "//configs:linux_aarch64": NIX_ARM64_PERLASM_TOOLS_AND_OUTS, + "//configs:linux_x86_64": NIX_X86_64_PERLASM_TOOLS_AND_OUTS, + "//configs:windows_arm64": WINDOWS_ARM64_PERLASM_TOOLS_AND_OUTS, + "//configs:windows_x64": WINDOWS_X86_64_PERLASM_TOOLS_AND_OUTS, + }), + srcs_to_outs_dupes = select({ + "//configs:darwin_arm64": NIX_ARM64_PERLASM_TOOLS_AND_OUTS_DUPES_DICT, + "//configs:darwin_x86_64": NIX_X86_64_PERLASM_TOOLS_AND_OUTS_DUPES_DICT, + "//configs:linux_aarch64": NIX_ARM64_PERLASM_TOOLS_AND_OUTS_DUPES_DICT, + "//configs:linux_x86_64": NIX_X86_64_PERLASM_TOOLS_AND_OUTS_DUPES_DICT, + "//configs:windows_arm64": WINDOWS_ARM64_PERLASM_TOOLS_AND_OUTS_DUPES_DICT, + "//configs:windows_x64": WINDOWS_X86_64_PERLASM_TOOLS_AND_OUTS_DUPES_DICT, + }), +) + +COMMON_LIBCRYPTO_SRCS = glob( + [ + "crypto/**/*.h", + "crypto/*.h", + "include/crypto/**/*.h", + "include/internal/*.h", + "include/openssl/*.h", + "providers/**/*.h", + "providers/*.inc", + "providers/implementations/**/*.inc", + ], + exclude = COMMON_GENERATED_FILES, +) + +# We miss some sources and headers when doing the normal extraction +OTHER_LIBCRYPTO_WINDOWS_SRCS = [ + "ms/uplink.h", + "ms/applink.c", + "engines/e_capi_err.h", + "engines/e_capi_err.c", +] + +ALL_LIBCRYPTO_SRCS = COMMON_LIBCRYPTO_SRCS + select({ + "//configs:darwin_arm64": remove_dupes( + _DARWIN_ARM64_LIBCRYPTO_SRCS, + NIX_ARM64_PERLASM_TOOLS_AND_OUTS.values() + NIX_ARM64_PERLASM_TOOLS_AND_OUTS_DUPES_DICT.values(), + ), + "//configs:darwin_x86_64": remove_dupes( + _DARWIN_X86_64_LIBCRYPTO_SRCS, + NIX_X86_64_PERLASM_TOOLS_AND_OUTS.values() + NIX_X86_64_PERLASM_TOOLS_AND_OUTS_DUPES_DICT.values(), + ), + "//configs:linux_aarch64": remove_dupes( + _LINUX_ARM64_LIBCRYPTO_SRCS, + NIX_ARM64_PERLASM_TOOLS_AND_OUTS.values() + NIX_ARM64_PERLASM_TOOLS_AND_OUTS_DUPES_DICT.values(), + ), + "//configs:linux_x86_64": remove_dupes( + _LINUX_X86_64_LIBCRYPTO_SRCS, + NIX_X86_64_PERLASM_TOOLS_AND_OUTS.values() + NIX_X86_64_PERLASM_TOOLS_AND_OUTS_DUPES_DICT.values(), + ), + "//configs:windows_arm64": remove_dupes( + _WINDOWS_ARM64_LIBCRYPTO_SRCS, + WINDOWS_ARM64_PERLASM_TOOLS_AND_OUTS.values() + WINDOWS_ARM64_PERLASM_TOOLS_AND_OUTS_DUPES_DICT.values(), + ) + OTHER_LIBCRYPTO_WINDOWS_SRCS, + "//configs:windows_x64": remove_dupes( + _WINDOWS_X86_64_LIBCRYPTO_SRCS, + WINDOWS_X86_64_PERLASM_TOOLS_AND_OUTS.values() + WINDOWS_X86_64_PERLASM_TOOLS_AND_OUTS_DUPES_DICT.values(), + ) + OTHER_LIBCRYPTO_WINDOWS_SRCS, +}) + +EXISTING_LIBCRYPTO_HDRS = glob( + [ + "include/openssl/*.h", + "include/openssl/**/*.h", + "include/crypto/*.h", + "include/crypto/**/*.h", + ], +) + +LIBCRYPTO_NIX_COPTS = [ + "-iquote", + "external/{}/providers/implementations/macs".format(_REPO_NAME), + "-iquote", + "external/{}/providers/implementations/include".format(_REPO_NAME), + "-iquote", + "external/{}/providers/common/include".format(_REPO_NAME), + "-iquote", + "$(BINDIR)/external/{}/providers/common/include".format(_REPO_NAME), + "-iquote", + "$(BINDIR)/external/{}/crypto".format(_REPO_NAME), + "-iquote", + "external/{}/crypto".format(_REPO_NAME), + "-I", + "external/{}/providers/implementations/include".format(_REPO_NAME), +] + +LIBCRYPTO_WINDOWS_COPTS = [ + "/Iexternal/{}/providers/implementations/macs".format(_REPO_NAME), + "/Iexternal/{}/providers/implementations/include".format(_REPO_NAME), + "/Iexternal/{}/providers/common/include".format(_REPO_NAME), + "/I$(BINDIR)/external/{}/providers/common/include".format(_REPO_NAME), + "/I$(BINDIR)/external/{}/crypto".format(_REPO_NAME), + "/Iexternal/{}/crypto".format(_REPO_NAME), + "/Iexternal/{}/providers/implementations/include".format(_REPO_NAME), +] + +ALL_LIBCRYPTO_HDRS = EXISTING_LIBCRYPTO_HDRS + [":generated-headers"] + +# Windows needs some additional include directories. +LIBCRYPTO_WINDOWS_INCLUDES = [ + "ms", + "engines", + "crypto/bn", + "crypto", +] + +cc_library( + name = "crypto", + # Some of the srcs are duplicated because we have to glob over the directories with missing files + # as only some of them are picked up. + srcs = ALL_LIBCRYPTO_SRCS + [":perlasm_genfiles"], + hdrs = ALL_LIBCRYPTO_HDRS, + additional_compiler_inputs = [ + ":generated-headers", + ] + glob( + # There are some .c files that are conditionally included textually, we want them to be + # available + ["providers/implementations/**/*.c"], + exclude = COMMON_GENERATED_FILES, + ), + # To make sure downstream targets add the right copts to be able to include the headers. + copts = COMMON_OPENSSL_COPTS + select({ + "//configs:darwin_arm64": _DARWIN_ARM64_OPENSSL_DEFINES, + "//configs:darwin_x86_64": _DARWIN_X86_64_OPENSSL_DEFINES, + "//configs:linux_aarch64": _LINUX_ARM64_OPENSSL_DEFINES, + "//configs:linux_x86_64": _LINUX_X86_64_OPENSSL_DEFINES, + "//configs:windows_arm64": _WINDOWS_ARM64_OPENSSL_DEFINES, + "//configs:windows_x64": _WINDOWS_X86_64_OPENSSL_DEFINES, + }) + select({ + "//configs:darwin_arm64": _DARWIN_ARM64_LIBCRYPTO_DEFINES, + "//configs:darwin_x86_64": _DARWIN_X86_64_LIBCRYPTO_DEFINES, + "//configs:linux_aarch64": _LINUX_ARM64_LIBCRYPTO_DEFINES, + "//configs:linux_x86_64": _LINUX_X86_64_LIBCRYPTO_DEFINES, + "//configs:windows_arm64": _WINDOWS_ARM64_LIBCRYPTO_DEFINES, + "//configs:windows_x64": _WINDOWS_X86_64_LIBCRYPTO_DEFINES, + }) + select({ + "//configs:windows_arm64": LIBCRYPTO_WINDOWS_COPTS, + "//configs:windows_x64": LIBCRYPTO_WINDOWS_COPTS, + "//conditions:default": LIBCRYPTO_NIX_COPTS, + }), + defines = COMMON_OPENSSL_DEFINES, + includes = [ + "include", + ] + select({ + "//configs:windows_arm64": LIBCRYPTO_WINDOWS_INCLUDES, + "//configs:windows_x64": LIBCRYPTO_WINDOWS_INCLUDES, + "//conditions:default": [], + }), + linkopts = [ + "-lc", + "-pthread", + ], + visibility = ["//visibility:public"], + deps = [ + ":crypto-textual-hdrs", + ], +) + +COMMON_LIBSSL_SRCS = glob( + ["ssl/**/*.h"], + exclude = COMMON_GENERATED_FILES, +) + +ALL_LIBSSL_SRCS = COMMON_LIBSSL_SRCS + select({ + "//configs:darwin_arm64": _DARWIN_ARM64_LIBSSL_SRCS, + "//configs:darwin_x86_64": _DARWIN_X86_64_LIBSSL_SRCS, + "//configs:linux_aarch64": _LINUX_ARM64_LIBSSL_SRCS, + "//configs:linux_x86_64": _LINUX_X86_64_LIBSSL_SRCS, + "//configs:windows_arm64": _WINDOWS_ARM64_LIBSSL_SRCS, + "//configs:windows_x64": _WINDOWS_X86_64_LIBSSL_SRCS, +}) + +EXISTING_LIBSSL_HDRS = glob( + ["include/openssl/*.h"], +) + +ALL_LIBSSL_HDRS = EXISTING_LIBSSL_HDRS + [":generated-headers"] + +cc_library( + name = "ssl", + srcs = ALL_LIBSSL_SRCS, + hdrs = ALL_LIBSSL_HDRS, + additional_compiler_inputs = [":generated-files"], + copts = COMMON_OPENSSL_COPTS + select({ + "//configs:darwin_arm64": _DARWIN_ARM64_OPENSSL_DEFINES, + "//configs:darwin_x86_64": _DARWIN_X86_64_OPENSSL_DEFINES, + "//configs:linux_aarch64": _LINUX_ARM64_OPENSSL_DEFINES, + "//configs:linux_x86_64": _LINUX_X86_64_OPENSSL_DEFINES, + "//configs:windows_arm64": _WINDOWS_ARM64_OPENSSL_DEFINES, + "//configs:windows_x64": _WINDOWS_X86_64_OPENSSL_DEFINES, + }) + select({ + "//configs:darwin_arm64": _DARWIN_ARM64_LIBSSL_DEFINES, + "//configs:darwin_x86_64": _DARWIN_X86_64_LIBSSL_DEFINES, + "//configs:linux_aarch64": _LINUX_ARM64_LIBSSL_DEFINES, + "//configs:linux_x86_64": _LINUX_X86_64_LIBSSL_DEFINES, + "//configs:windows_arm64": _WINDOWS_ARM64_LIBSSL_DEFINES, + "//configs:windows_x64": _WINDOWS_X86_64_LIBSSL_DEFINES, + }), + defines = COMMON_OPENSSL_DEFINES, + # To make sure downstream targets add the right copts to be able to include the headers. + includes = ["include"], + linkopts = ["-lc"], + visibility = ["//visibility:public"], + deps = [ + ":crypto", + ], +) + +filegroup( + name = "generated-files", + srcs = COMMON_GENERATED_FILES + [":generate-platform-specific-files"], +) + +filegroup( + name = "generated-headers", + srcs = [f for f in COMMON_GENERATED_FILES + _DARWIN_ARM64_GEN_FILES.keys() if f.endswith(".h")], +) + +[ + copy_file( + name = "copy_generated_{}".format(src), + src = "@openssl-generated-overlay//:{}".format(src), + out = src, + ) + for src in COMMON_GENERATED_FILES +] + +_PLATFORM_FILES = { + "//configs:darwin_arm64": _DARWIN_ARM64_GEN_FILES, + "//configs:darwin_x86_64": _DARWIN_X86_64_GEN_FILES, + "//configs:linux_aarch64": _LINUX_ARM64_GEN_FILES, + "//configs:linux_x86_64": _LINUX_X86_64_GEN_FILES, + "//configs:windows_arm64": _WINDOWS_ARM64_GEN_FILES, + "//configs:windows_x64": _WINDOWS_X86_64_GEN_FILES, +} + +# Flatten all filenames into a set by collecting them into a dict +_PLATFORM_ALL_FILE_NAMES = { + v: None + for inner in _PLATFORM_FILES.values() + for v in inner.keys() +}.keys() + +[ + write_file( + name = "gen_{}".format( + fname.replace("/", "_"), + ), + out = fname, + content = select({ + cfg: [mapping.get(fname, "")] + for cfg, mapping in _PLATFORM_FILES.items() + }), + newline = "unix", + ) + for fname in _PLATFORM_ALL_FILE_NAMES +] + +filegroup( + name = "generate-platform-specific-files", + srcs = select({ + cfg: [fname for fname in mapping.keys()] + for cfg, mapping in _PLATFORM_FILES.items() + }), +) + +collate_into_directory( + name = "gen_dir", + outs_prefix_map = { + ":crypto": "lib/", + ":openssl": "bin/", + ":ssl": "lib/", + }, + srcs_prefix_map = { + ":crypto": "external/{}".format(_REPO_NAME), + ":generated-headers": "external/{}".format(_REPO_NAME), + ":openssl": "external/{}".format(_REPO_NAME), + ":ssl": "external/{}".format(_REPO_NAME), + } | { + k: "external/{}".format(_REPO_NAME) + for k in glob(["include/openssl/*.h"]) + }, + visibility = ["//visibility:public"], +) diff --git a/tests/openssl/overlay/MODULE.bazel b/tests/openssl/overlay/MODULE.bazel new file mode 120000 index 00000000..9b599e3a --- /dev/null +++ b/tests/openssl/overlay/MODULE.bazel @@ -0,0 +1 @@ +../MODULE.bazel \ No newline at end of file diff --git a/tests/openssl/overlay/configs/BUILD.bazel b/tests/openssl/overlay/configs/BUILD.bazel new file mode 100644 index 00000000..39942e2c --- /dev/null +++ b/tests/openssl/overlay/configs/BUILD.bazel @@ -0,0 +1,53 @@ +config_setting( + name = "darwin_arm64", + constraint_values = [ + "@@platforms//os:macos", + "@@platforms//cpu:arm64", + ], + visibility = ["//visibility:public"], +) + +config_setting( + name = "darwin_x86_64", + constraint_values = [ + "@@platforms//os:macos", + "@@platforms//cpu:x86_64", + ], + visibility = ["//visibility:public"], +) + +config_setting( + name = "linux_aarch64", + constraint_values = [ + "@@platforms//os:linux", + "@@platforms//cpu:aarch64", + ], + visibility = ["//visibility:public"], +) + +config_setting( + name = "linux_x86_64", + constraint_values = [ + "@@platforms//os:linux", + "@@platforms//cpu:x86_64", + ], + visibility = ["//visibility:public"], +) + +config_setting( + name = "windows_arm64", + constraint_values = [ + "@@platforms//os:windows", + "@@platforms//cpu:arm64", + ], + visibility = ["//visibility:public"], +) + +config_setting( + name = "windows_x64", + constraint_values = [ + "@@platforms//os:windows", + "@@platforms//cpu:x86_64", + ], + visibility = ["//visibility:public"], +) diff --git a/tests/openssl/overlay/test_bazel_build/BUILD.bazel b/tests/openssl/overlay/test_bazel_build/BUILD.bazel new file mode 100644 index 00000000..d6123a31 --- /dev/null +++ b/tests/openssl/overlay/test_bazel_build/BUILD.bazel @@ -0,0 +1,41 @@ +load("@bazel_skylib//rules:write_file.bzl", "write_file") +load("@rules_cc//cc:cc_library.bzl", "cc_library") +load("@rules_cc//cc:cc_test.bzl", "cc_test") + +cc_test( + name = "sha256_test", + srcs = ["sha256_test.cc"], + copts = select({ + "//configs:windows_arm64": ["/std:c++17"], + "//configs:windows_x64": ["/std:c++17"], + "//conditions:default": ["-std=c++17"], + }), + data = ["@openssl"], + env = { + "OPENSSL": "$(rootpath @openssl)", + }, +) + +cc_test( + name = "build_test", + srcs = ["build_test.cc"], + deps = [ + ":includes_bn", + ], +) + +cc_library( + name = "includes_bn", + srcs = [":includes_bh.cpp"], + deps = ["@openssl//:ssl"], +) + +write_file( + name = "generate_includes_bh", + out = "includes_bh.cpp", + content = [ + "#include ", + "", + ], + newline = "unix", +) diff --git a/tests/openssl/overlay/test_bazel_build/build_test.cc b/tests/openssl/overlay/test_bazel_build/build_test.cc new file mode 100644 index 00000000..9b6bdc2e --- /dev/null +++ b/tests/openssl/overlay/test_bazel_build/build_test.cc @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/tests/openssl/overlay/test_bazel_build/sha256_test.cc b/tests/openssl/overlay/test_bazel_build/sha256_test.cc new file mode 100644 index 00000000..0443711e --- /dev/null +++ b/tests/openssl/overlay/test_bazel_build/sha256_test.cc @@ -0,0 +1,54 @@ +#include +#include +#include +#include +#include + +int main(void) { + std::filesystem::path tmpdir(std::getenv("TEST_TMPDIR")); + std::filesystem::path basename("testdata.txt"); + std::filesystem::path tmpfilePath = tmpdir / basename; + + std::cerr << "Writing temprory file to hash to " << tmpfilePath << std::endl; + + std::ofstream tmpfile; + tmpfile.open(tmpfilePath); + tmpfile << "European Burmese"; + tmpfile.close(); + + std::stringstream command; + command << "openssl dgst -sha256 "; + command << tmpfilePath; + + FILE *outputStream; +#ifdef _WIN32 + outputStream = _popen(command.str().c_str(), "r"); +#else + outputStream = popen(command.str().c_str(), "r"); +#endif + if (!outputStream) { + std::cerr << "Failed to run command" << std::endl; + return 1; + } + + const int MAX_BUFFER = 1024; + char buffer[MAX_BUFFER]; + + std::stringstream output; + + while (!feof(outputStream)) { + if (fgets(buffer, MAX_BUFFER, outputStream) != NULL) { + output << buffer; + } + } + + std::string sha256(output.str().substr(output.str().length() - 65, 64)); + std::string wantSha256("693d8db7b05e99c6b7a7c0616456039d89c555029026936248085193559a0b5d"); + + if (sha256 != wantSha256) { + std::cerr << "Wrong sha256 - want " << wantSha256 << " got " << sha256 << std::endl; + return 1; + } + + return 0; +} diff --git a/tests/openssl/overlay/utils.bzl b/tests/openssl/overlay/utils.bzl new file mode 100644 index 00000000..e9777afe --- /dev/null +++ b/tests/openssl/overlay/utils.bzl @@ -0,0 +1,97 @@ +"""utils for the BUILD files. +""" + +def get_repo_name(): + return Label("//:BUILD.bazel").workspace_name + +def remove_extra_chars(str): + return str.replace(")", "").replace(";", "").replace("\r", "") + +def parse_perlasm_gen(perlasm_gen): + """Take a perlasm gen string and parse it. + + Args: + perlasm_gen: The perlasm generation string + Returns: + Two dictionaries. The first has the keys and values that are not dupes or the first instances of dupes. + The second has the remaining keys and values that are dupes. Keys are tools and values are outs. + """ + perlasm_outs = [] + perlasm_tools = [] + + perlasm_gen_split_by_line = perlasm_gen.split("\n") + for line in perlasm_gen_split_by_line: + split_by_space = line.split(" ") + + # When you split by new line you get an empty string at points. + if not split_by_space: + continue + elif not split_by_space[0]: + continue + # On arm we get carriage returns + + elif split_by_space[0] == "\r\r": + continue + elif len(split_by_space) != 6: + fail("Line {} not six parts".format(line)) + tool = remove_extra_chars(split_by_space[2]) + out = remove_extra_chars(split_by_space[5]) + perlasm_tools.append(tool) + perlasm_outs.append(out) + + return dedupe_and_ret_dicts(perlasm_tools, perlasm_outs) + +def dedupe_and_ret_dicts(lst_one, lst_two): + """Dedupe a list and make two dictionaries with that and another list + + Args: + lst_one: First list. We dedupe this and use as keys. + lst_two: Second list. We don't dedupe this and use as values. + Returns: + Two dictionaries. The first has the keys and values that are not dupes or the first instances of dupes. + The second has the remaining keys and values that are dupes. + """ + if len(lst_one) != len(lst_two): + fail("Lists are not the same length: {} with len {} and {} with len {}".format(lst_one, len(lst_one), lst_two, len(lst_two))) + dict_one = {} + dict_two = {} + + for i in range(len(lst_one)): + one_i = lst_one[i] + two_i = lst_two[i] + if one_i in dict_one.keys(): + if one_i in dict_two.keys(): + pass + else: + dict_two[one_i] = two_i + else: + dict_one[one_i] = two_i + return dict_one, dict_two + +def dedupe(lst): + """Dedupe a list + + Args: + lst: A list of things + Returns: + The deuped list. + """ + final_lst = [] + for thing in lst: + if thing in final_lst: + continue + else: + final_lst.append(thing) + + return final_lst + +def remove_dupes(lst_one, lst_two): + """Remove dupes from list one that exist in list two + + Args: + lst_one: The first list + lst_two: The second list + Returns: + list one without dupes + """ + return [item for item in lst_one if item not in lst_two] diff --git a/toolchain/internal/configure.bzl b/toolchain/internal/configure.bzl index 9816b677..275090d2 100644 --- a/toolchain/internal/configure.bzl +++ b/toolchain/internal/configure.bzl @@ -82,7 +82,13 @@ def llvm_config_impl(rctx): fail("LLVM toolchain root missing for ({}, {})".format(os, arch)) (_key, llvm_version) = _exec_os_arch_dict_value(rctx, "llvm_versions") if is_requirement(llvm_version): + print("INFO: Resolving LLVM version requirement '{req}'...".format(req = llvm_version)) # buildifier: disable=print llvm_version, distribution, error = required_llvm_release_name_rctx(rctx, llvm_version) + print("INFO: Resolved LLVM version requirement '{req}' to version '{ver}' from distribution '{dist}'".format( + req = llvm_version, + ver = llvm_version, + dist = distribution, + )) # buildifier: disable=print if error: fail(error) if llvm_version: diff --git a/toolchain/internal/llvm_distributions.bzl b/toolchain/internal/llvm_distributions.bzl index 2721b7ca..bdf34745 100644 --- a/toolchain/internal/llvm_distributions.bzl +++ b/toolchain/internal/llvm_distributions.bzl @@ -1163,7 +1163,7 @@ def required_llvm_release_name_rctx(rctx, llvm_version): all_llvm_distributions = _get_all_llvm_distributions( llvm_distributions = _llvm_distributions, extra_llvm_distributions = rctx.attr.extra_llvm_distributions, - parsed_llvm_version = _parse_version(llvm_version), + parsed_llvm_version = _parse_version(llvm_version) if not is_requirement(llvm_version) else None, ) return _required_llvm_release_name( version_or_requirements = llvm_version, From 9f8acdb21f7a4f95e6bb3ba1bea58aab4408bdad Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Sun, 26 Oct 2025 12:00:58 +0100 Subject: [PATCH 2/2] Missing llvm_versions part. --- toolchain/internal/llvm_distributions.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchain/internal/llvm_distributions.bzl b/toolchain/internal/llvm_distributions.bzl index bdf34745..46e2bf8d 100644 --- a/toolchain/internal/llvm_distributions.bzl +++ b/toolchain/internal/llvm_distributions.bzl @@ -1192,7 +1192,7 @@ def _distribution_urls(rctx): all_llvm_distributions = _get_all_llvm_distributions( llvm_distributions = _llvm_distributions, extra_llvm_distributions = rctx.attr.extra_llvm_distributions, - parsed_llvm_version = _parse_version(llvm_version), + parsed_llvm_version = _parse_version(llvm_version) if not is_requirement(llvm_version) else None, ) _, sha256, strip_prefix, _ = _key_attrs(rctx)