From c58f74075e0835bc6c054b4f1b6496cd777ad6c2 Mon Sep 17 00:00:00 2001 From: Greg Bowyer Date: Thu, 26 Aug 2021 18:29:22 -0700 Subject: [PATCH] [deps] Make OpenSSL build on macos and update We change up the openssl build generation to be able to generate builds for other platforms and systems. The initial added platforms are for macos. In the process of doing this the build generation tooling has changed to be a python script that understands all of the select permutations needed to generate the stanzas needed for more than one platform. Alongside this the perl script used to extract out the build details has been changed. Rather than generating the build rules directly it now exports the build information needed in the form of JSON outputs. This has been tested on x86_64 for macos catalina and linux. Right now there are probably some unixisms left in the code which will limit its ability to build for windows. --- build_tools/bazel/external_workspace.bzl | 6 +- thirdparty/openssl/BUILD.openssl | 4064 ++++++++++++++++++++-- thirdparty/openssl/BUILD.openssl.tail | 147 - thirdparty/openssl/bazelify.py | 489 +++ thirdparty/openssl/bazelify.sh | 31 - thirdparty/openssl/config.py | 90 + thirdparty/openssl/extract_srcs.pl | 83 +- 7 files changed, 4430 insertions(+), 480 deletions(-) delete mode 100644 thirdparty/openssl/BUILD.openssl.tail create mode 100755 thirdparty/openssl/bazelify.py delete mode 100755 thirdparty/openssl/bazelify.sh create mode 100644 thirdparty/openssl/config.py diff --git a/build_tools/bazel/external_workspace.bzl b/build_tools/bazel/external_workspace.bzl index cd641f9d..2c5d8775 100644 --- a/build_tools/bazel/external_workspace.bzl +++ b/build_tools/bazel/external_workspace.bzl @@ -20,7 +20,7 @@ DEFAULT_EXTERNAL_URLS = { "org_bzip_bzip2": ["https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz"], "org_gnu_ncurses": ["https://invisible-mirror.net/archives/ncurses/ncurses-6.2.tar.gz"], "org_gnu_readline": ["https://ftp.gnu.org/gnu/readline/readline-8.1.tar.gz"], - "org_openssl": ["https://www.openssl.org/source/openssl-1.1.1k.tar.gz"], + "org_openssl": ["https://www.openssl.org/source/openssl-1.1.1l.tar.gz"], "org_sourceware_libffi": ["https://github.com/libffi/libffi/releases/download/v3.3/libffi-3.3.tar.gz"], "org_sqlite": ["https://sqlite.org/2021/sqlite-amalgamation-3360000.zip"], "org_tukaani": ["https://downloads.sourceforge.net/project/lzmautils/xz-5.2.5.tar.xz"], @@ -145,8 +145,8 @@ def cpython_deps(urls = DEFAULT_EXTERNAL_URLS): http_archive( name = "org_openssl", urls = urls["org_openssl"], - sha256 = "892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5", - strip_prefix = "openssl-1.1.1k", + sha256 = "0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1", + strip_prefix = "openssl-1.1.1l", build_file = filename_from_label("//thirdparty/openssl:BUILD.openssl"), ) diff --git a/thirdparty/openssl/BUILD.openssl b/thirdparty/openssl/BUILD.openssl index 0ab826b9..a40d6ef6 100644 --- a/thirdparty/openssl/BUILD.openssl +++ b/thirdparty/openssl/BUILD.openssl @@ -1,13 +1,3418 @@ -# BEGIN GENERATED CODE (see bazelify.sh) +# GENERATED CODE! (see bazelify.py) +load("@bazel_skylib//rules:write_file.bzl", "write_file") -OPENSSL_VERSION = "1.1.1k" +config_setting( + name = "linux_x86_64", + constraint_values = [ + "@platforms//cpu:x86_64", + "@platforms//os:linux", + ] +) + +config_setting( + name = "macos_x86_64", + constraint_values = [ + "@platforms//cpu:x86_64", + "@platforms//os:macos", + ] +) + +config_setting( + name = "macos_aarch64", + constraint_values = [ + "@platforms//cpu:aarch64", + "@platforms//os:macos", + ] +) + +OPENSSL_VERSION = "1.1.1l" + + +linux_x86_64_include_crypto_bn_conf_h = [""" +/* WARNING: do not edit! */ +/* Generated by Makefile from include/crypto/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 OSSL_CRYPTO_BN_CONF_H +# define OSSL_CRYPTO_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 +"""] + + +linux_x86_64_include_crypto_dso_conf_h = [""" +/* WARNING: do not edit! */ +/* Generated by Makefile from include/crypto/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 OSSL_CRYPTO_DSO_CONF_H +# define OSSL_CRYPTO_DSO_CONF_H +# define DSO_NONE +# define DSO_EXTENSION ".so" +#endif +"""] + + +linux_x86_64_include_openssl_opensslconf_h = [""" +/* + * WARNING: do not edit! + * Generated by Makefile from include/openssl/opensslconf.h.in + * + * Copyright 2016-2020 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_AFALGENG +# define OPENSSL_NO_AFALGENG +#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_DYNAMIC_ENGINE +# define OPENSSL_NO_DYNAMIC_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 +# elif defined(__SUNPRO_C) +# if (__SUNPRO_C >= 0x5130) +# 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 +"""] + + +linux_x86_64_apps_progs_h = [""" +/* + * WARNING: do not edit! + * Generated by apps/progs.pl + * + * Copyright 1995-2021 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 + */ + +typedef enum FUNC_TYPE { + FT_none, FT_general, FT_md, FT_cipher, FT_pkey, + FT_md_alg, FT_cipher_alg +} FUNC_TYPE; + +typedef struct function_st { + FUNC_TYPE type; + const char *name; + int (*func)(int argc, char *argv[]); + const OPTIONS *help; +} FUNCTION; + +DEFINE_LHASH_OF(FUNCTION); + +extern int asn1parse_main(int argc, char *argv[]); +extern int ca_main(int argc, char *argv[]); +extern int ciphers_main(int argc, char *argv[]); +extern int cms_main(int argc, char *argv[]); +extern int crl_main(int argc, char *argv[]); +extern int crl2pkcs7_main(int argc, char *argv[]); +extern int dgst_main(int argc, char *argv[]); +extern int dhparam_main(int argc, char *argv[]); +extern int dsa_main(int argc, char *argv[]); +extern int dsaparam_main(int argc, char *argv[]); +extern int ec_main(int argc, char *argv[]); +extern int ecparam_main(int argc, char *argv[]); +extern int enc_main(int argc, char *argv[]); +extern int engine_main(int argc, char *argv[]); +extern int errstr_main(int argc, char *argv[]); +extern int gendsa_main(int argc, char *argv[]); +extern int genpkey_main(int argc, char *argv[]); +extern int genrsa_main(int argc, char *argv[]); +extern int help_main(int argc, char *argv[]); +extern int list_main(int argc, char *argv[]); +extern int nseq_main(int argc, char *argv[]); +extern int ocsp_main(int argc, char *argv[]); +extern int passwd_main(int argc, char *argv[]); +extern int pkcs12_main(int argc, char *argv[]); +extern int pkcs7_main(int argc, char *argv[]); +extern int pkcs8_main(int argc, char *argv[]); +extern int pkey_main(int argc, char *argv[]); +extern int pkeyparam_main(int argc, char *argv[]); +extern int pkeyutl_main(int argc, char *argv[]); +extern int prime_main(int argc, char *argv[]); +extern int rand_main(int argc, char *argv[]); +extern int rehash_main(int argc, char *argv[]); +extern int req_main(int argc, char *argv[]); +extern int rsa_main(int argc, char *argv[]); +extern int rsautl_main(int argc, char *argv[]); +extern int s_client_main(int argc, char *argv[]); +extern int s_server_main(int argc, char *argv[]); +extern int s_time_main(int argc, char *argv[]); +extern int sess_id_main(int argc, char *argv[]); +extern int smime_main(int argc, char *argv[]); +extern int speed_main(int argc, char *argv[]); +extern int spkac_main(int argc, char *argv[]); +extern int srp_main(int argc, char *argv[]); +extern int storeutl_main(int argc, char *argv[]); +extern int ts_main(int argc, char *argv[]); +extern int verify_main(int argc, char *argv[]); +extern int version_main(int argc, char *argv[]); +extern int x509_main(int argc, char *argv[]); + +extern const OPTIONS asn1parse_options[]; +extern const OPTIONS ca_options[]; +extern const OPTIONS ciphers_options[]; +extern const OPTIONS cms_options[]; +extern const OPTIONS crl_options[]; +extern const OPTIONS crl2pkcs7_options[]; +extern const OPTIONS dgst_options[]; +extern const OPTIONS dhparam_options[]; +extern const OPTIONS dsa_options[]; +extern const OPTIONS dsaparam_options[]; +extern const OPTIONS ec_options[]; +extern const OPTIONS ecparam_options[]; +extern const OPTIONS enc_options[]; +extern const OPTIONS engine_options[]; +extern const OPTIONS errstr_options[]; +extern const OPTIONS gendsa_options[]; +extern const OPTIONS genpkey_options[]; +extern const OPTIONS genrsa_options[]; +extern const OPTIONS help_options[]; +extern const OPTIONS list_options[]; +extern const OPTIONS nseq_options[]; +extern const OPTIONS ocsp_options[]; +extern const OPTIONS passwd_options[]; +extern const OPTIONS pkcs12_options[]; +extern const OPTIONS pkcs7_options[]; +extern const OPTIONS pkcs8_options[]; +extern const OPTIONS pkey_options[]; +extern const OPTIONS pkeyparam_options[]; +extern const OPTIONS pkeyutl_options[]; +extern const OPTIONS prime_options[]; +extern const OPTIONS rand_options[]; +extern const OPTIONS rehash_options[]; +extern const OPTIONS req_options[]; +extern const OPTIONS rsa_options[]; +extern const OPTIONS rsautl_options[]; +extern const OPTIONS s_client_options[]; +extern const OPTIONS s_server_options[]; +extern const OPTIONS s_time_options[]; +extern const OPTIONS sess_id_options[]; +extern const OPTIONS smime_options[]; +extern const OPTIONS speed_options[]; +extern const OPTIONS spkac_options[]; +extern const OPTIONS srp_options[]; +extern const OPTIONS storeutl_options[]; +extern const OPTIONS ts_options[]; +extern const OPTIONS verify_options[]; +extern const OPTIONS version_options[]; +extern const OPTIONS x509_options[]; + +#ifdef INCLUDE_FUNCTION_TABLE +static FUNCTION functions[] = { + {FT_general, "asn1parse", asn1parse_main, asn1parse_options}, + {FT_general, "ca", ca_main, ca_options}, +#ifndef OPENSSL_NO_SOCK + {FT_general, "ciphers", ciphers_main, ciphers_options}, +#endif +#ifndef OPENSSL_NO_CMS + {FT_general, "cms", cms_main, cms_options}, +#endif + {FT_general, "crl", crl_main, crl_options}, + {FT_general, "crl2pkcs7", crl2pkcs7_main, crl2pkcs7_options}, + {FT_general, "dgst", dgst_main, dgst_options}, +#ifndef OPENSSL_NO_DH + {FT_general, "dhparam", dhparam_main, dhparam_options}, +#endif +#ifndef OPENSSL_NO_DSA + {FT_general, "dsa", dsa_main, dsa_options}, +#endif +#ifndef OPENSSL_NO_DSA + {FT_general, "dsaparam", dsaparam_main, dsaparam_options}, +#endif +#ifndef OPENSSL_NO_EC + {FT_general, "ec", ec_main, ec_options}, +#endif +#ifndef OPENSSL_NO_EC + {FT_general, "ecparam", ecparam_main, ecparam_options}, +#endif + {FT_general, "enc", enc_main, enc_options}, +#ifndef OPENSSL_NO_ENGINE + {FT_general, "engine", engine_main, engine_options}, +#endif + {FT_general, "errstr", errstr_main, errstr_options}, +#ifndef OPENSSL_NO_DSA + {FT_general, "gendsa", gendsa_main, gendsa_options}, +#endif + {FT_general, "genpkey", genpkey_main, genpkey_options}, +#ifndef OPENSSL_NO_RSA + {FT_general, "genrsa", genrsa_main, genrsa_options}, +#endif + {FT_general, "help", help_main, help_options}, + {FT_general, "list", list_main, list_options}, + {FT_general, "nseq", nseq_main, nseq_options}, +#ifndef OPENSSL_NO_OCSP + {FT_general, "ocsp", ocsp_main, ocsp_options}, +#endif + {FT_general, "passwd", passwd_main, passwd_options}, +#ifndef OPENSSL_NO_DES + {FT_general, "pkcs12", pkcs12_main, pkcs12_options}, +#endif + {FT_general, "pkcs7", pkcs7_main, pkcs7_options}, + {FT_general, "pkcs8", pkcs8_main, pkcs8_options}, + {FT_general, "pkey", pkey_main, pkey_options}, + {FT_general, "pkeyparam", pkeyparam_main, pkeyparam_options}, + {FT_general, "pkeyutl", pkeyutl_main, pkeyutl_options}, + {FT_general, "prime", prime_main, prime_options}, + {FT_general, "rand", rand_main, rand_options}, + {FT_general, "rehash", rehash_main, rehash_options}, + {FT_general, "req", req_main, req_options}, + {FT_general, "rsa", rsa_main, rsa_options}, +#ifndef OPENSSL_NO_RSA + {FT_general, "rsautl", rsautl_main, rsautl_options}, +#endif +#ifndef OPENSSL_NO_SOCK + {FT_general, "s_client", s_client_main, s_client_options}, +#endif +#ifndef OPENSSL_NO_SOCK + {FT_general, "s_server", s_server_main, s_server_options}, +#endif +#ifndef OPENSSL_NO_SOCK + {FT_general, "s_time", s_time_main, s_time_options}, +#endif + {FT_general, "sess_id", sess_id_main, sess_id_options}, + {FT_general, "smime", smime_main, smime_options}, + {FT_general, "speed", speed_main, speed_options}, + {FT_general, "spkac", spkac_main, spkac_options}, +#ifndef OPENSSL_NO_SRP + {FT_general, "srp", srp_main, srp_options}, +#endif + {FT_general, "storeutl", storeutl_main, storeutl_options}, +#ifndef OPENSSL_NO_TS + {FT_general, "ts", ts_main, ts_options}, +#endif + {FT_general, "verify", verify_main, verify_options}, + {FT_general, "version", version_main, version_options}, + {FT_general, "x509", x509_main, x509_options}, +#ifndef OPENSSL_NO_MD2 + {FT_md, "md2", dgst_main}, +#endif +#ifndef OPENSSL_NO_MD4 + {FT_md, "md4", dgst_main}, +#endif + {FT_md, "md5", dgst_main}, +#ifndef OPENSSL_NO_GOST + {FT_md, "gost", dgst_main}, +#endif + {FT_md, "sha1", dgst_main}, + {FT_md, "sha224", dgst_main}, + {FT_md, "sha256", dgst_main}, + {FT_md, "sha384", dgst_main}, + {FT_md, "sha512", dgst_main}, + {FT_md, "sha512-224", dgst_main}, + {FT_md, "sha512-256", dgst_main}, + {FT_md, "sha3-224", dgst_main}, + {FT_md, "sha3-256", dgst_main}, + {FT_md, "sha3-384", dgst_main}, + {FT_md, "sha3-512", dgst_main}, + {FT_md, "shake128", dgst_main}, + {FT_md, "shake256", dgst_main}, +#ifndef OPENSSL_NO_MDC2 + {FT_md, "mdc2", dgst_main}, +#endif +#ifndef OPENSSL_NO_RMD160 + {FT_md, "rmd160", dgst_main}, +#endif +#ifndef OPENSSL_NO_BLAKE2 + {FT_md, "blake2b512", dgst_main}, +#endif +#ifndef OPENSSL_NO_BLAKE2 + {FT_md, "blake2s256", dgst_main}, +#endif +#ifndef OPENSSL_NO_SM3 + {FT_md, "sm3", dgst_main}, +#endif + {FT_cipher, "aes-128-cbc", enc_main, enc_options}, + {FT_cipher, "aes-128-ecb", enc_main, enc_options}, + {FT_cipher, "aes-192-cbc", enc_main, enc_options}, + {FT_cipher, "aes-192-ecb", enc_main, enc_options}, + {FT_cipher, "aes-256-cbc", enc_main, enc_options}, + {FT_cipher, "aes-256-ecb", enc_main, enc_options}, +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-128-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-128-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-128-ctr", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-128-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-128-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-128-cfb1", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-128-cfb8", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-192-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-192-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-192-ctr", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-192-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-192-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-192-cfb1", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-192-cfb8", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-256-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-256-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-256-ctr", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-256-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-256-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-256-cfb1", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-256-cfb8", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAMELLIA + {FT_cipher, "camellia-128-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAMELLIA + {FT_cipher, "camellia-128-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAMELLIA + {FT_cipher, "camellia-192-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAMELLIA + {FT_cipher, "camellia-192-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAMELLIA + {FT_cipher, "camellia-256-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAMELLIA + {FT_cipher, "camellia-256-ecb", enc_main, enc_options}, +#endif + {FT_cipher, "base64", enc_main, enc_options}, +#ifdef ZLIB + {FT_cipher, "zlib", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des3", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "desx", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_IDEA + {FT_cipher, "idea", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SEED + {FT_cipher, "seed", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC4 + {FT_cipher, "rc4", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC4 + {FT_cipher, "rc4-40", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC2 + {FT_cipher, "rc2", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_BF + {FT_cipher, "bf", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAST + {FT_cipher, "cast", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC5 + {FT_cipher, "rc5", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ede", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ede3", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ede-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ede3-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ede-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ede3-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ede-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ede3-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_IDEA + {FT_cipher, "idea-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_IDEA + {FT_cipher, "idea-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_IDEA + {FT_cipher, "idea-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_IDEA + {FT_cipher, "idea-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SEED + {FT_cipher, "seed-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SEED + {FT_cipher, "seed-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SEED + {FT_cipher, "seed-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SEED + {FT_cipher, "seed-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC2 + {FT_cipher, "rc2-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC2 + {FT_cipher, "rc2-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC2 + {FT_cipher, "rc2-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC2 + {FT_cipher, "rc2-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC2 + {FT_cipher, "rc2-64-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC2 + {FT_cipher, "rc2-40-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_BF + {FT_cipher, "bf-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_BF + {FT_cipher, "bf-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_BF + {FT_cipher, "bf-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_BF + {FT_cipher, "bf-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAST + {FT_cipher, "cast5-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAST + {FT_cipher, "cast5-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAST + {FT_cipher, "cast5-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAST + {FT_cipher, "cast5-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAST + {FT_cipher, "cast-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC5 + {FT_cipher, "rc5-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC5 + {FT_cipher, "rc5-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC5 + {FT_cipher, "rc5-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC5 + {FT_cipher, "rc5-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SM4 + {FT_cipher, "sm4-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SM4 + {FT_cipher, "sm4-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SM4 + {FT_cipher, "sm4-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SM4 + {FT_cipher, "sm4-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SM4 + {FT_cipher, "sm4-ctr", enc_main, enc_options}, +#endif + {0, NULL, NULL} +}; +#endif +"""] + +linux_x86_64_libcrypto = [ + "crypto/aes/aes_cbc.c", + "crypto/aes/aes_cfb.c", + "crypto/aes/aes_core.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/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_exp.c", + "crypto/buffer/buf_err.c", + "crypto/buffer/buffer.c", + "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/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.c", + "crypto/ec/ecp_oct.c", + "crypto/ec/ecp_smpl.c", + "crypto/ec/ecx_meth.c", + "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_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/cbc128.c", + "crypto/modes/ccm128.c", + "crypto/modes/cfb128.c", + "crypto/modes/ctr128.c", + "crypto/modes/cts128.c", + "crypto/modes/gcm128.c", + "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.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/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/sha1_one.c", + "crypto/sha/sha1dgst.c", + "crypto/sha/sha256.c", + "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_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", + "engines/e_capi.c", + "engines/e_padlock.c" +] + +linux_x86_64_libssl = [ + "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" +] + +linux_x86_64_libapp = [ + "apps/app_rand.c", + "apps/apps.c", + "apps/bf_prefix.c", + "apps/opt.c", + "apps/s_cb.c", + "apps/s_socket.c" +] + +linux_x86_64_openssl_app = [ + "apps/asn1pars.c", + "apps/ca.c", + "apps/ciphers.c", + "apps/cms.c", + "apps/crl.c", + "apps/crl2p7.c", + "apps/dgst.c", + "apps/dhparam.c", + "apps/dsa.c", + "apps/dsaparam.c", + "apps/ec.c", + "apps/ecparam.c", + "apps/enc.c", + "apps/engine.c", + "apps/errstr.c", + "apps/gendsa.c", + "apps/genpkey.c", + "apps/genrsa.c", + "apps/nseq.c", + "apps/ocsp.c", + "apps/openssl.c", + "apps/passwd.c", + "apps/pkcs12.c", + "apps/pkcs7.c", + "apps/pkcs8.c", + "apps/pkey.c", + "apps/pkeyparam.c", + "apps/pkeyutl.c", + "apps/prime.c", + "apps/rand.c", + "apps/rehash.c", + "apps/req.c", + "apps/rsa.c", + "apps/rsautl.c", + "apps/s_client.c", + "apps/s_server.c", + "apps/s_time.c", + "apps/sess_id.c", + "apps/smime.c", + "apps/speed.c", + "apps/spkac.c", + "apps/srp.c", + "apps/storeutl.c", + "apps/ts.c", + "apps/verify.c", + "apps/version.c", + "apps/x509.c" +] + +genrule( + name = "linux_x86_64_asm", + srcs = ["crypto/ec/ecp_nistz256_table.c"], + outs = [ + "linux_x86_64_crypto/aes/aesni-mb-x86_64.s", + "linux_x86_64_crypto/aes/aesni-sha1-x86_64.s", + "linux_x86_64_crypto/aes/aesni-sha256-x86_64.s", + "linux_x86_64_crypto/aes/aesni-x86_64.s", + "linux_x86_64_crypto/aes/vpaes-x86_64.s", + "linux_x86_64_crypto/bn/rsaz-avx2.s", + "linux_x86_64_crypto/bn/rsaz-x86_64.s", + "linux_x86_64_crypto/bn/x86_64-gf2m.s", + "linux_x86_64_crypto/bn/x86_64-mont.s", + "linux_x86_64_crypto/bn/x86_64-mont5.s", + "linux_x86_64_crypto/camellia/cmll-x86_64.s", + "linux_x86_64_crypto/chacha/chacha-x86_64.s", + "linux_x86_64_crypto/ec/ecp_nistz256-x86_64.s", + "linux_x86_64_crypto/ec/x25519-x86_64.s", + "linux_x86_64_crypto/md5/md5-x86_64.s", + "linux_x86_64_crypto/modes/aesni-gcm-x86_64.s", + "linux_x86_64_crypto/modes/ghash-x86_64.s", + "linux_x86_64_crypto/poly1305/poly1305-x86_64.s", + "linux_x86_64_crypto/rc4/rc4-md5-x86_64.s", + "linux_x86_64_crypto/rc4/rc4-x86_64.s", + "linux_x86_64_crypto/sha/keccak1600-x86_64.s", + "linux_x86_64_crypto/sha/sha1-mb-x86_64.s", + "linux_x86_64_crypto/sha/sha1-x86_64.s", + "linux_x86_64_crypto/sha/sha256-mb-x86_64.s", + "linux_x86_64_crypto/sha/sha256-x86_64.s", + "linux_x86_64_crypto/sha/sha512-x86_64.s", + "linux_x86_64_crypto/whrlpool/wp-x86_64.s", + "linux_x86_64_crypto/x86_64cpuid.s", + "linux_x86_64_engines/e_padlock-x86_64.s" + ], + cmd = """ + CC=$(CC) perl $(location crypto/aes/asm/aesni-mb-x86_64.pl) elf $(location linux_x86_64_crypto/aes/aesni-mb-x86_64.s) + CC=$(CC) perl $(location crypto/aes/asm/aesni-sha1-x86_64.pl) elf $(location linux_x86_64_crypto/aes/aesni-sha1-x86_64.s) + CC=$(CC) perl $(location crypto/aes/asm/aesni-sha256-x86_64.pl) elf $(location linux_x86_64_crypto/aes/aesni-sha256-x86_64.s) + CC=$(CC) perl $(location crypto/aes/asm/aesni-x86_64.pl) elf $(location linux_x86_64_crypto/aes/aesni-x86_64.s) + CC=$(CC) perl $(location crypto/aes/asm/vpaes-x86_64.pl) elf $(location linux_x86_64_crypto/aes/vpaes-x86_64.s) + CC=$(CC) perl $(location crypto/bn/asm/rsaz-avx2.pl) elf $(location linux_x86_64_crypto/bn/rsaz-avx2.s) + CC=$(CC) perl $(location crypto/bn/asm/rsaz-x86_64.pl) elf $(location linux_x86_64_crypto/bn/rsaz-x86_64.s) + CC=$(CC) perl $(location crypto/bn/asm/x86_64-gf2m.pl) elf $(location linux_x86_64_crypto/bn/x86_64-gf2m.s) + CC=$(CC) perl $(location crypto/bn/asm/x86_64-mont.pl) elf $(location linux_x86_64_crypto/bn/x86_64-mont.s) + CC=$(CC) perl $(location crypto/bn/asm/x86_64-mont5.pl) elf $(location linux_x86_64_crypto/bn/x86_64-mont5.s) + CC=$(CC) perl $(location crypto/camellia/asm/cmll-x86_64.pl) elf $(location linux_x86_64_crypto/camellia/cmll-x86_64.s) + CC=$(CC) perl $(location crypto/chacha/asm/chacha-x86_64.pl) elf $(location linux_x86_64_crypto/chacha/chacha-x86_64.s) + CC=$(CC) perl $(location crypto/ec/asm/ecp_nistz256-x86_64.pl) elf $(location linux_x86_64_crypto/ec/ecp_nistz256-x86_64.s) + CC=$(CC) perl $(location crypto/ec/asm/x25519-x86_64.pl) elf $(location linux_x86_64_crypto/ec/x25519-x86_64.s) + CC=$(CC) perl $(location crypto/md5/asm/md5-x86_64.pl) elf $(location linux_x86_64_crypto/md5/md5-x86_64.s) + CC=$(CC) perl $(location crypto/modes/asm/aesni-gcm-x86_64.pl) elf $(location linux_x86_64_crypto/modes/aesni-gcm-x86_64.s) + CC=$(CC) perl $(location crypto/modes/asm/ghash-x86_64.pl) elf $(location linux_x86_64_crypto/modes/ghash-x86_64.s) + CC=$(CC) perl $(location crypto/poly1305/asm/poly1305-x86_64.pl) elf $(location linux_x86_64_crypto/poly1305/poly1305-x86_64.s) + CC=$(CC) perl $(location crypto/rc4/asm/rc4-md5-x86_64.pl) elf $(location linux_x86_64_crypto/rc4/rc4-md5-x86_64.s) + CC=$(CC) perl $(location crypto/rc4/asm/rc4-x86_64.pl) elf $(location linux_x86_64_crypto/rc4/rc4-x86_64.s) + CC=$(CC) perl $(location crypto/sha/asm/keccak1600-x86_64.pl) elf $(location linux_x86_64_crypto/sha/keccak1600-x86_64.s) + CC=$(CC) perl $(location crypto/sha/asm/sha1-mb-x86_64.pl) elf $(location linux_x86_64_crypto/sha/sha1-mb-x86_64.s) + CC=$(CC) perl $(location crypto/sha/asm/sha1-x86_64.pl) elf $(location linux_x86_64_crypto/sha/sha1-x86_64.s) + CC=$(CC) perl $(location crypto/sha/asm/sha256-mb-x86_64.pl) elf $(location linux_x86_64_crypto/sha/sha256-mb-x86_64.s) + CC=$(CC) perl $(location crypto/sha/asm/sha512-x86_64.pl) elf $(location linux_x86_64_crypto/sha/sha256-x86_64.s) + CC=$(CC) perl $(location crypto/sha/asm/sha512-x86_64.pl) elf $(location linux_x86_64_crypto/sha/sha512-x86_64.s) + CC=$(CC) perl $(location crypto/whrlpool/asm/wp-x86_64.pl) elf $(location linux_x86_64_crypto/whrlpool/wp-x86_64.s) + CC=$(CC) perl $(location crypto/x86_64cpuid.pl) elf $(location linux_x86_64_crypto/x86_64cpuid.s) + CC=$(CC) perl $(location engines/asm/e_padlock-x86_64.pl) elf $(location linux_x86_64_engines/e_padlock-x86_64.s) + """, + toolchains = ["@bazel_tools//tools/cpp:current_cc_toolchain"], + tools = glob(["crypto/perlasm/*.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/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/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/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" + ] +) + +linux_x86_64_openssl_defines = [ + "-DAESNI_ASM", + "-DECP_NISTZ256_ASM", + "-DGHASH_ASM", + "-DKECCAK1600_ASM", + "-DMD5_ASM", + "-DNDEBUG", + "-DOPENSSL_BN_ASM_GF2m", + "-DOPENSSL_BN_ASM_MONT", + "-DOPENSSL_BN_ASM_MONT5", + "-DOPENSSL_CPUID_OBJ", + "-DOPENSSL_IA32_SSE2", + "-DOPENSSL_NO_AFALGENG", + "-DOPENSSL_NO_ASAN", + "-DOPENSSL_NO_CRYPTO_MDEBUG", + "-DOPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE", + "-DOPENSSL_NO_DEVCRYPTOENG", + "-DOPENSSL_NO_DYNAMIC_ENGINE", + "-DOPENSSL_NO_EC_NISTP_64_GCC_128", + "-DOPENSSL_NO_EGD", + "-DOPENSSL_NO_EXTERNAL_TESTS", + "-DOPENSSL_NO_FUZZ_AFL", + "-DOPENSSL_NO_FUZZ_LIBFUZZER", + "-DOPENSSL_NO_HEARTBEATS", + "-DOPENSSL_NO_MSAN", + "-DOPENSSL_NO_SCTP", + "-DOPENSSL_NO_SSL3", + "-DOPENSSL_NO_SSL3_METHOD", + "-DOPENSSL_NO_SSL_TRACE", + "-DOPENSSL_NO_UBSAN", + "-DOPENSSL_NO_UNIT_TEST", + "-DOPENSSL_NO_WEAK_SSL_CIPHERS", + "-DOPENSSL_PIC", + "-DOPENSSL_RAND_SEED_OS", + "-DPOLY1305_ASM", + "-DRC4_ASM", + "-DSHA1_ASM", + "-DSHA256_ASM", + "-DSHA512_ASM", + "-DVPAES_ASM", + "-DX25519_ASM" +] + + +macos_x86_64_include_crypto_bn_conf_h = [""" +/* WARNING: do not edit! */ +/* Generated by Makefile from include/crypto/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 OSSL_CRYPTO_BN_CONF_H +# define OSSL_CRYPTO_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 +"""] + + +macos_x86_64_include_crypto_dso_conf_h = [""" +/* WARNING: do not edit! */ +/* Generated by Makefile from include/crypto/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 OSSL_CRYPTO_DSO_CONF_H +# define OSSL_CRYPTO_DSO_CONF_H +# define DSO_NONE +# define DSO_EXTENSION ".dylib" +#endif +"""] + + +macos_x86_64_include_openssl_opensslconf_h = [""" +/* + * WARNING: do not edit! + * Generated by Makefile from include/openssl/opensslconf.h.in + * + * Copyright 2016-2020 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_SYS_MACOSX +# define OPENSSL_SYS_MACOSX 1 +#endif +#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_AFALGENG +# define OPENSSL_NO_AFALGENG +#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_DYNAMIC_ENGINE +# define OPENSSL_NO_DYNAMIC_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 +# elif defined(__SUNPRO_C) +# if (__SUNPRO_C >= 0x5130) +# 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 +"""] + + +macos_x86_64_apps_progs_h = [""" +/* + * WARNING: do not edit! + * Generated by apps/progs.pl + * + * Copyright 1995-2021 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 + */ + +typedef enum FUNC_TYPE { + FT_none, FT_general, FT_md, FT_cipher, FT_pkey, + FT_md_alg, FT_cipher_alg +} FUNC_TYPE; + +typedef struct function_st { + FUNC_TYPE type; + const char *name; + int (*func)(int argc, char *argv[]); + const OPTIONS *help; +} FUNCTION; + +DEFINE_LHASH_OF(FUNCTION); + +extern int asn1parse_main(int argc, char *argv[]); +extern int ca_main(int argc, char *argv[]); +extern int ciphers_main(int argc, char *argv[]); +extern int cms_main(int argc, char *argv[]); +extern int crl_main(int argc, char *argv[]); +extern int crl2pkcs7_main(int argc, char *argv[]); +extern int dgst_main(int argc, char *argv[]); +extern int dhparam_main(int argc, char *argv[]); +extern int dsa_main(int argc, char *argv[]); +extern int dsaparam_main(int argc, char *argv[]); +extern int ec_main(int argc, char *argv[]); +extern int ecparam_main(int argc, char *argv[]); +extern int enc_main(int argc, char *argv[]); +extern int engine_main(int argc, char *argv[]); +extern int errstr_main(int argc, char *argv[]); +extern int gendsa_main(int argc, char *argv[]); +extern int genpkey_main(int argc, char *argv[]); +extern int genrsa_main(int argc, char *argv[]); +extern int help_main(int argc, char *argv[]); +extern int list_main(int argc, char *argv[]); +extern int nseq_main(int argc, char *argv[]); +extern int ocsp_main(int argc, char *argv[]); +extern int passwd_main(int argc, char *argv[]); +extern int pkcs12_main(int argc, char *argv[]); +extern int pkcs7_main(int argc, char *argv[]); +extern int pkcs8_main(int argc, char *argv[]); +extern int pkey_main(int argc, char *argv[]); +extern int pkeyparam_main(int argc, char *argv[]); +extern int pkeyutl_main(int argc, char *argv[]); +extern int prime_main(int argc, char *argv[]); +extern int rand_main(int argc, char *argv[]); +extern int rehash_main(int argc, char *argv[]); +extern int req_main(int argc, char *argv[]); +extern int rsa_main(int argc, char *argv[]); +extern int rsautl_main(int argc, char *argv[]); +extern int s_client_main(int argc, char *argv[]); +extern int s_server_main(int argc, char *argv[]); +extern int s_time_main(int argc, char *argv[]); +extern int sess_id_main(int argc, char *argv[]); +extern int smime_main(int argc, char *argv[]); +extern int speed_main(int argc, char *argv[]); +extern int spkac_main(int argc, char *argv[]); +extern int srp_main(int argc, char *argv[]); +extern int storeutl_main(int argc, char *argv[]); +extern int ts_main(int argc, char *argv[]); +extern int verify_main(int argc, char *argv[]); +extern int version_main(int argc, char *argv[]); +extern int x509_main(int argc, char *argv[]); + +extern const OPTIONS asn1parse_options[]; +extern const OPTIONS ca_options[]; +extern const OPTIONS ciphers_options[]; +extern const OPTIONS cms_options[]; +extern const OPTIONS crl_options[]; +extern const OPTIONS crl2pkcs7_options[]; +extern const OPTIONS dgst_options[]; +extern const OPTIONS dhparam_options[]; +extern const OPTIONS dsa_options[]; +extern const OPTIONS dsaparam_options[]; +extern const OPTIONS ec_options[]; +extern const OPTIONS ecparam_options[]; +extern const OPTIONS enc_options[]; +extern const OPTIONS engine_options[]; +extern const OPTIONS errstr_options[]; +extern const OPTIONS gendsa_options[]; +extern const OPTIONS genpkey_options[]; +extern const OPTIONS genrsa_options[]; +extern const OPTIONS help_options[]; +extern const OPTIONS list_options[]; +extern const OPTIONS nseq_options[]; +extern const OPTIONS ocsp_options[]; +extern const OPTIONS passwd_options[]; +extern const OPTIONS pkcs12_options[]; +extern const OPTIONS pkcs7_options[]; +extern const OPTIONS pkcs8_options[]; +extern const OPTIONS pkey_options[]; +extern const OPTIONS pkeyparam_options[]; +extern const OPTIONS pkeyutl_options[]; +extern const OPTIONS prime_options[]; +extern const OPTIONS rand_options[]; +extern const OPTIONS rehash_options[]; +extern const OPTIONS req_options[]; +extern const OPTIONS rsa_options[]; +extern const OPTIONS rsautl_options[]; +extern const OPTIONS s_client_options[]; +extern const OPTIONS s_server_options[]; +extern const OPTIONS s_time_options[]; +extern const OPTIONS sess_id_options[]; +extern const OPTIONS smime_options[]; +extern const OPTIONS speed_options[]; +extern const OPTIONS spkac_options[]; +extern const OPTIONS srp_options[]; +extern const OPTIONS storeutl_options[]; +extern const OPTIONS ts_options[]; +extern const OPTIONS verify_options[]; +extern const OPTIONS version_options[]; +extern const OPTIONS x509_options[]; + +#ifdef INCLUDE_FUNCTION_TABLE +static FUNCTION functions[] = { + {FT_general, "asn1parse", asn1parse_main, asn1parse_options}, + {FT_general, "ca", ca_main, ca_options}, +#ifndef OPENSSL_NO_SOCK + {FT_general, "ciphers", ciphers_main, ciphers_options}, +#endif +#ifndef OPENSSL_NO_CMS + {FT_general, "cms", cms_main, cms_options}, +#endif + {FT_general, "crl", crl_main, crl_options}, + {FT_general, "crl2pkcs7", crl2pkcs7_main, crl2pkcs7_options}, + {FT_general, "dgst", dgst_main, dgst_options}, +#ifndef OPENSSL_NO_DH + {FT_general, "dhparam", dhparam_main, dhparam_options}, +#endif +#ifndef OPENSSL_NO_DSA + {FT_general, "dsa", dsa_main, dsa_options}, +#endif +#ifndef OPENSSL_NO_DSA + {FT_general, "dsaparam", dsaparam_main, dsaparam_options}, +#endif +#ifndef OPENSSL_NO_EC + {FT_general, "ec", ec_main, ec_options}, +#endif +#ifndef OPENSSL_NO_EC + {FT_general, "ecparam", ecparam_main, ecparam_options}, +#endif + {FT_general, "enc", enc_main, enc_options}, +#ifndef OPENSSL_NO_ENGINE + {FT_general, "engine", engine_main, engine_options}, +#endif + {FT_general, "errstr", errstr_main, errstr_options}, +#ifndef OPENSSL_NO_DSA + {FT_general, "gendsa", gendsa_main, gendsa_options}, +#endif + {FT_general, "genpkey", genpkey_main, genpkey_options}, +#ifndef OPENSSL_NO_RSA + {FT_general, "genrsa", genrsa_main, genrsa_options}, +#endif + {FT_general, "help", help_main, help_options}, + {FT_general, "list", list_main, list_options}, + {FT_general, "nseq", nseq_main, nseq_options}, +#ifndef OPENSSL_NO_OCSP + {FT_general, "ocsp", ocsp_main, ocsp_options}, +#endif + {FT_general, "passwd", passwd_main, passwd_options}, +#ifndef OPENSSL_NO_DES + {FT_general, "pkcs12", pkcs12_main, pkcs12_options}, +#endif + {FT_general, "pkcs7", pkcs7_main, pkcs7_options}, + {FT_general, "pkcs8", pkcs8_main, pkcs8_options}, + {FT_general, "pkey", pkey_main, pkey_options}, + {FT_general, "pkeyparam", pkeyparam_main, pkeyparam_options}, + {FT_general, "pkeyutl", pkeyutl_main, pkeyutl_options}, + {FT_general, "prime", prime_main, prime_options}, + {FT_general, "rand", rand_main, rand_options}, + {FT_general, "rehash", rehash_main, rehash_options}, + {FT_general, "req", req_main, req_options}, + {FT_general, "rsa", rsa_main, rsa_options}, +#ifndef OPENSSL_NO_RSA + {FT_general, "rsautl", rsautl_main, rsautl_options}, +#endif +#ifndef OPENSSL_NO_SOCK + {FT_general, "s_client", s_client_main, s_client_options}, +#endif +#ifndef OPENSSL_NO_SOCK + {FT_general, "s_server", s_server_main, s_server_options}, +#endif +#ifndef OPENSSL_NO_SOCK + {FT_general, "s_time", s_time_main, s_time_options}, +#endif + {FT_general, "sess_id", sess_id_main, sess_id_options}, + {FT_general, "smime", smime_main, smime_options}, + {FT_general, "speed", speed_main, speed_options}, + {FT_general, "spkac", spkac_main, spkac_options}, +#ifndef OPENSSL_NO_SRP + {FT_general, "srp", srp_main, srp_options}, +#endif + {FT_general, "storeutl", storeutl_main, storeutl_options}, +#ifndef OPENSSL_NO_TS + {FT_general, "ts", ts_main, ts_options}, +#endif + {FT_general, "verify", verify_main, verify_options}, + {FT_general, "version", version_main, version_options}, + {FT_general, "x509", x509_main, x509_options}, +#ifndef OPENSSL_NO_MD2 + {FT_md, "md2", dgst_main}, +#endif +#ifndef OPENSSL_NO_MD4 + {FT_md, "md4", dgst_main}, +#endif + {FT_md, "md5", dgst_main}, +#ifndef OPENSSL_NO_GOST + {FT_md, "gost", dgst_main}, +#endif + {FT_md, "sha1", dgst_main}, + {FT_md, "sha224", dgst_main}, + {FT_md, "sha256", dgst_main}, + {FT_md, "sha384", dgst_main}, + {FT_md, "sha512", dgst_main}, + {FT_md, "sha512-224", dgst_main}, + {FT_md, "sha512-256", dgst_main}, + {FT_md, "sha3-224", dgst_main}, + {FT_md, "sha3-256", dgst_main}, + {FT_md, "sha3-384", dgst_main}, + {FT_md, "sha3-512", dgst_main}, + {FT_md, "shake128", dgst_main}, + {FT_md, "shake256", dgst_main}, +#ifndef OPENSSL_NO_MDC2 + {FT_md, "mdc2", dgst_main}, +#endif +#ifndef OPENSSL_NO_RMD160 + {FT_md, "rmd160", dgst_main}, +#endif +#ifndef OPENSSL_NO_BLAKE2 + {FT_md, "blake2b512", dgst_main}, +#endif +#ifndef OPENSSL_NO_BLAKE2 + {FT_md, "blake2s256", dgst_main}, +#endif +#ifndef OPENSSL_NO_SM3 + {FT_md, "sm3", dgst_main}, +#endif + {FT_cipher, "aes-128-cbc", enc_main, enc_options}, + {FT_cipher, "aes-128-ecb", enc_main, enc_options}, + {FT_cipher, "aes-192-cbc", enc_main, enc_options}, + {FT_cipher, "aes-192-ecb", enc_main, enc_options}, + {FT_cipher, "aes-256-cbc", enc_main, enc_options}, + {FT_cipher, "aes-256-ecb", enc_main, enc_options}, +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-128-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-128-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-128-ctr", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-128-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-128-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-128-cfb1", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-128-cfb8", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-192-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-192-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-192-ctr", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-192-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-192-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-192-cfb1", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-192-cfb8", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-256-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-256-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-256-ctr", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-256-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-256-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-256-cfb1", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_ARIA + {FT_cipher, "aria-256-cfb8", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAMELLIA + {FT_cipher, "camellia-128-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAMELLIA + {FT_cipher, "camellia-128-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAMELLIA + {FT_cipher, "camellia-192-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAMELLIA + {FT_cipher, "camellia-192-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAMELLIA + {FT_cipher, "camellia-256-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAMELLIA + {FT_cipher, "camellia-256-ecb", enc_main, enc_options}, +#endif + {FT_cipher, "base64", enc_main, enc_options}, +#ifdef ZLIB + {FT_cipher, "zlib", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des3", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "desx", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_IDEA + {FT_cipher, "idea", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SEED + {FT_cipher, "seed", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC4 + {FT_cipher, "rc4", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC4 + {FT_cipher, "rc4-40", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC2 + {FT_cipher, "rc2", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_BF + {FT_cipher, "bf", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAST + {FT_cipher, "cast", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC5 + {FT_cipher, "rc5", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ede", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ede3", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ede-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ede3-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ede-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ede3-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ede-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_DES + {FT_cipher, "des-ede3-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_IDEA + {FT_cipher, "idea-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_IDEA + {FT_cipher, "idea-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_IDEA + {FT_cipher, "idea-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_IDEA + {FT_cipher, "idea-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SEED + {FT_cipher, "seed-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SEED + {FT_cipher, "seed-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SEED + {FT_cipher, "seed-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SEED + {FT_cipher, "seed-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC2 + {FT_cipher, "rc2-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC2 + {FT_cipher, "rc2-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC2 + {FT_cipher, "rc2-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC2 + {FT_cipher, "rc2-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC2 + {FT_cipher, "rc2-64-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC2 + {FT_cipher, "rc2-40-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_BF + {FT_cipher, "bf-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_BF + {FT_cipher, "bf-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_BF + {FT_cipher, "bf-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_BF + {FT_cipher, "bf-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAST + {FT_cipher, "cast5-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAST + {FT_cipher, "cast5-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAST + {FT_cipher, "cast5-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAST + {FT_cipher, "cast5-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_CAST + {FT_cipher, "cast-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC5 + {FT_cipher, "rc5-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC5 + {FT_cipher, "rc5-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC5 + {FT_cipher, "rc5-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_RC5 + {FT_cipher, "rc5-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SM4 + {FT_cipher, "sm4-cbc", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SM4 + {FT_cipher, "sm4-ecb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SM4 + {FT_cipher, "sm4-cfb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SM4 + {FT_cipher, "sm4-ofb", enc_main, enc_options}, +#endif +#ifndef OPENSSL_NO_SM4 + {FT_cipher, "sm4-ctr", enc_main, enc_options}, +#endif + {0, NULL, NULL} +}; +#endif +"""] + +macos_x86_64_libcrypto = [ + "crypto/aes/aes_cbc.c", + "crypto/aes/aes_cfb.c", + "crypto/aes/aes_core.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/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_exp.c", + "crypto/buffer/buf_err.c", + "crypto/buffer/buffer.c", + "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/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.c", + "crypto/ec/ecp_oct.c", + "crypto/ec/ecp_smpl.c", + "crypto/ec/ecx_meth.c", + "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_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/cbc128.c", + "crypto/modes/ccm128.c", + "crypto/modes/cfb128.c", + "crypto/modes/ctr128.c", + "crypto/modes/cts128.c", + "crypto/modes/gcm128.c", + "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.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/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/sha1_one.c", + "crypto/sha/sha1dgst.c", + "crypto/sha/sha256.c", + "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_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", + "engines/e_capi.c", + "engines/e_padlock.c" +] + +macos_x86_64_libssl = [ + "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" +] + +macos_x86_64_libapp = [ + "apps/app_rand.c", + "apps/apps.c", + "apps/bf_prefix.c", + "apps/opt.c", + "apps/s_cb.c", + "apps/s_socket.c" +] + +macos_x86_64_openssl_app = [ + "apps/asn1pars.c", + "apps/ca.c", + "apps/ciphers.c", + "apps/cms.c", + "apps/crl.c", + "apps/crl2p7.c", + "apps/dgst.c", + "apps/dhparam.c", + "apps/dsa.c", + "apps/dsaparam.c", + "apps/ec.c", + "apps/ecparam.c", + "apps/enc.c", + "apps/engine.c", + "apps/errstr.c", + "apps/gendsa.c", + "apps/genpkey.c", + "apps/genrsa.c", + "apps/nseq.c", + "apps/ocsp.c", + "apps/openssl.c", + "apps/passwd.c", + "apps/pkcs12.c", + "apps/pkcs7.c", + "apps/pkcs8.c", + "apps/pkey.c", + "apps/pkeyparam.c", + "apps/pkeyutl.c", + "apps/prime.c", + "apps/rand.c", + "apps/rehash.c", + "apps/req.c", + "apps/rsa.c", + "apps/rsautl.c", + "apps/s_client.c", + "apps/s_server.c", + "apps/s_time.c", + "apps/sess_id.c", + "apps/smime.c", + "apps/speed.c", + "apps/spkac.c", + "apps/srp.c", + "apps/storeutl.c", + "apps/ts.c", + "apps/verify.c", + "apps/version.c", + "apps/x509.c" +] + +genrule( + name = "macos_x86_64_asm", + srcs = ["crypto/ec/ecp_nistz256_table.c"], + outs = [ + "macos_x86_64_crypto/aes/aesni-mb-x86_64.s", + "macos_x86_64_crypto/aes/aesni-sha1-x86_64.s", + "macos_x86_64_crypto/aes/aesni-sha256-x86_64.s", + "macos_x86_64_crypto/aes/aesni-x86_64.s", + "macos_x86_64_crypto/aes/vpaes-x86_64.s", + "macos_x86_64_crypto/bn/rsaz-avx2.s", + "macos_x86_64_crypto/bn/rsaz-x86_64.s", + "macos_x86_64_crypto/bn/x86_64-gf2m.s", + "macos_x86_64_crypto/bn/x86_64-mont.s", + "macos_x86_64_crypto/bn/x86_64-mont5.s", + "macos_x86_64_crypto/camellia/cmll-x86_64.s", + "macos_x86_64_crypto/chacha/chacha-x86_64.s", + "macos_x86_64_crypto/ec/ecp_nistz256-x86_64.s", + "macos_x86_64_crypto/ec/x25519-x86_64.s", + "macos_x86_64_crypto/md5/md5-x86_64.s", + "macos_x86_64_crypto/modes/aesni-gcm-x86_64.s", + "macos_x86_64_crypto/modes/ghash-x86_64.s", + "macos_x86_64_crypto/poly1305/poly1305-x86_64.s", + "macos_x86_64_crypto/rc4/rc4-md5-x86_64.s", + "macos_x86_64_crypto/rc4/rc4-x86_64.s", + "macos_x86_64_crypto/sha/keccak1600-x86_64.s", + "macos_x86_64_crypto/sha/sha1-mb-x86_64.s", + "macos_x86_64_crypto/sha/sha1-x86_64.s", + "macos_x86_64_crypto/sha/sha256-mb-x86_64.s", + "macos_x86_64_crypto/sha/sha256-x86_64.s", + "macos_x86_64_crypto/sha/sha512-x86_64.s", + "macos_x86_64_crypto/whrlpool/wp-x86_64.s", + "macos_x86_64_crypto/x86_64cpuid.s", + "macos_x86_64_engines/e_padlock-x86_64.s" + ], + cmd = """ + CC=$(CC) perl $(location crypto/aes/asm/aesni-mb-x86_64.pl) macosx $(location macos_x86_64_crypto/aes/aesni-mb-x86_64.s) + CC=$(CC) perl $(location crypto/aes/asm/aesni-sha1-x86_64.pl) macosx $(location macos_x86_64_crypto/aes/aesni-sha1-x86_64.s) + CC=$(CC) perl $(location crypto/aes/asm/aesni-sha256-x86_64.pl) macosx $(location macos_x86_64_crypto/aes/aesni-sha256-x86_64.s) + CC=$(CC) perl $(location crypto/aes/asm/aesni-x86_64.pl) macosx $(location macos_x86_64_crypto/aes/aesni-x86_64.s) + CC=$(CC) perl $(location crypto/aes/asm/vpaes-x86_64.pl) macosx $(location macos_x86_64_crypto/aes/vpaes-x86_64.s) + CC=$(CC) perl $(location crypto/bn/asm/rsaz-avx2.pl) macosx $(location macos_x86_64_crypto/bn/rsaz-avx2.s) + CC=$(CC) perl $(location crypto/bn/asm/rsaz-x86_64.pl) macosx $(location macos_x86_64_crypto/bn/rsaz-x86_64.s) + CC=$(CC) perl $(location crypto/bn/asm/x86_64-gf2m.pl) macosx $(location macos_x86_64_crypto/bn/x86_64-gf2m.s) + CC=$(CC) perl $(location crypto/bn/asm/x86_64-mont.pl) macosx $(location macos_x86_64_crypto/bn/x86_64-mont.s) + CC=$(CC) perl $(location crypto/bn/asm/x86_64-mont5.pl) macosx $(location macos_x86_64_crypto/bn/x86_64-mont5.s) + CC=$(CC) perl $(location crypto/camellia/asm/cmll-x86_64.pl) macosx $(location macos_x86_64_crypto/camellia/cmll-x86_64.s) + CC=$(CC) perl $(location crypto/chacha/asm/chacha-x86_64.pl) macosx $(location macos_x86_64_crypto/chacha/chacha-x86_64.s) + CC=$(CC) perl $(location crypto/ec/asm/ecp_nistz256-x86_64.pl) macosx $(location macos_x86_64_crypto/ec/ecp_nistz256-x86_64.s) + CC=$(CC) perl $(location crypto/ec/asm/x25519-x86_64.pl) macosx $(location macos_x86_64_crypto/ec/x25519-x86_64.s) + CC=$(CC) perl $(location crypto/md5/asm/md5-x86_64.pl) macosx $(location macos_x86_64_crypto/md5/md5-x86_64.s) + CC=$(CC) perl $(location crypto/modes/asm/aesni-gcm-x86_64.pl) macosx $(location macos_x86_64_crypto/modes/aesni-gcm-x86_64.s) + CC=$(CC) perl $(location crypto/modes/asm/ghash-x86_64.pl) macosx $(location macos_x86_64_crypto/modes/ghash-x86_64.s) + CC=$(CC) perl $(location crypto/poly1305/asm/poly1305-x86_64.pl) macosx $(location macos_x86_64_crypto/poly1305/poly1305-x86_64.s) + CC=$(CC) perl $(location crypto/rc4/asm/rc4-md5-x86_64.pl) macosx $(location macos_x86_64_crypto/rc4/rc4-md5-x86_64.s) + CC=$(CC) perl $(location crypto/rc4/asm/rc4-x86_64.pl) macosx $(location macos_x86_64_crypto/rc4/rc4-x86_64.s) + CC=$(CC) perl $(location crypto/sha/asm/keccak1600-x86_64.pl) macosx $(location macos_x86_64_crypto/sha/keccak1600-x86_64.s) + CC=$(CC) perl $(location crypto/sha/asm/sha1-mb-x86_64.pl) macosx $(location macos_x86_64_crypto/sha/sha1-mb-x86_64.s) + CC=$(CC) perl $(location crypto/sha/asm/sha1-x86_64.pl) macosx $(location macos_x86_64_crypto/sha/sha1-x86_64.s) + CC=$(CC) perl $(location crypto/sha/asm/sha256-mb-x86_64.pl) macosx $(location macos_x86_64_crypto/sha/sha256-mb-x86_64.s) + CC=$(CC) perl $(location crypto/sha/asm/sha512-x86_64.pl) macosx $(location macos_x86_64_crypto/sha/sha256-x86_64.s) + CC=$(CC) perl $(location crypto/sha/asm/sha512-x86_64.pl) macosx $(location macos_x86_64_crypto/sha/sha512-x86_64.s) + CC=$(CC) perl $(location crypto/whrlpool/asm/wp-x86_64.pl) macosx $(location macos_x86_64_crypto/whrlpool/wp-x86_64.s) + CC=$(CC) perl $(location crypto/x86_64cpuid.pl) macosx $(location macos_x86_64_crypto/x86_64cpuid.s) + CC=$(CC) perl $(location engines/asm/e_padlock-x86_64.pl) macosx $(location macos_x86_64_engines/e_padlock-x86_64.s) + """, + toolchains = ["@bazel_tools//tools/cpp:current_cc_toolchain"], + tools = glob(["crypto/perlasm/*.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/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/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/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" + ] +) + +macos_x86_64_openssl_defines = [ + "-DAESNI_ASM", + "-DECP_NISTZ256_ASM", + "-DGHASH_ASM", + "-DKECCAK1600_ASM", + "-DMD5_ASM", + "-DNDEBUG", + "-DOPENSSL_BN_ASM_GF2m", + "-DOPENSSL_BN_ASM_MONT", + "-DOPENSSL_BN_ASM_MONT5", + "-DOPENSSL_CPUID_OBJ", + "-DOPENSSL_IA32_SSE2", + "-DOPENSSL_NO_AFALGENG", + "-DOPENSSL_NO_ASAN", + "-DOPENSSL_NO_CRYPTO_MDEBUG", + "-DOPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE", + "-DOPENSSL_NO_DEVCRYPTOENG", + "-DOPENSSL_NO_DYNAMIC_ENGINE", + "-DOPENSSL_NO_EC_NISTP_64_GCC_128", + "-DOPENSSL_NO_EGD", + "-DOPENSSL_NO_EXTERNAL_TESTS", + "-DOPENSSL_NO_FUZZ_AFL", + "-DOPENSSL_NO_FUZZ_LIBFUZZER", + "-DOPENSSL_NO_HEARTBEATS", + "-DOPENSSL_NO_MSAN", + "-DOPENSSL_NO_SCTP", + "-DOPENSSL_NO_SSL3", + "-DOPENSSL_NO_SSL3_METHOD", + "-DOPENSSL_NO_SSL_TRACE", + "-DOPENSSL_NO_UBSAN", + "-DOPENSSL_NO_UNIT_TEST", + "-DOPENSSL_NO_WEAK_SSL_CIPHERS", + "-DOPENSSL_PIC", + "-DOPENSSL_RAND_SEED_OS", + "-DPOLY1305_ASM", + "-DRC4_ASM", + "-DSHA1_ASM", + "-DSHA256_ASM", + "-DSHA512_ASM", + "-DVPAES_ASM", + "-DX25519_ASM" +] + + +macos_aarch64_include_crypto_bn_conf_h = [""" +/* WARNING: do not edit! */ +/* Generated by Makefile from include/crypto/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 OSSL_CRYPTO_BN_CONF_H +# define OSSL_CRYPTO_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 +"""] + + +macos_aarch64_include_crypto_dso_conf_h = [""" +/* WARNING: do not edit! */ +/* Generated by Makefile from include/crypto/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 OSSL_CRYPTO_DSO_CONF_H +# define OSSL_CRYPTO_DSO_CONF_H +# define DSO_NONE +# define DSO_EXTENSION ".dylib" +#endif +"""] + + +macos_aarch64_include_openssl_opensslconf_h = [""" +/* + * WARNING: do not edit! + * Generated by Makefile from include/openssl/opensslconf.h.in + * + * Copyright 2016-2020 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 -OPENSSLCONF_H = """#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_SYS_MACOSX +# define OPENSSL_SYS_MACOSX 1 +#endif #ifndef OPENSSL_NO_MD2 # define OPENSSL_NO_MD2 #endif @@ -80,7 +3485,20 @@ OPENSSLCONF_H = """#include #ifndef OPENSSL_NO_DYNAMIC_ENGINE # define OPENSSL_NO_DYNAMIC_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__ @@ -95,6 +3513,7 @@ OPENSSLCONF_H = """#include # endif # endif #endif + #ifndef OPENSSL_FILE # ifdef OPENSSL_NO_FILENAMES # define OPENSSL_FILE "" @@ -104,13 +3523,20 @@ OPENSSLCONF_H = """#include # 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 @@ -118,49 +3544,54 @@ OPENSSLCONF_H = """#include #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""" -BN_CONF_H = """#ifndef OSSL_CRYPTO_BN_CONF_H -# define OSSL_CRYPTO_BN_CONF_H -#define SIXTY_FOUR_BIT_LONG -#undef SIXTY_FOUR_BIT -#undef THIRTY_TWO_BIT -#endif""" +#ifdef __cplusplus +} +#endif +"""] -DSO_CONF_H = """#ifndef OSSL_CRYPTO_DSO_CONF_H -# define OSSL_CRYPTO_DSO_CONF_H -# define DSO_NONE -# define DSO_EXTENSION ".so" -#endif""" -APPS_PROGS_H = """/* +macos_aarch64_apps_progs_h = [""" +/* * WARNING: do not edit! * Generated by apps/progs.pl * @@ -666,9 +4097,10 @@ static FUNCTION functions[] = { #endif {0, NULL, NULL} }; -#endif""" +#endif +"""] -LIBCRYPTO_SRCS = [ +macos_aarch64_libcrypto = [ "crypto/aes/aes_cbc.c", "crypto/aes/aes_cfb.c", "crypto/aes/aes_core.c", @@ -677,12 +4109,8 @@ LIBCRYPTO_SRCS = [ "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/vpaes-x86_64.s", "crypto/aria/aria.c", + "crypto/armcap.c", "crypto/asn1/a_bitstr.c", "crypto/asn1/a_d2i_fp.c", "crypto/asn1/a_digest.c", @@ -785,8 +4213,8 @@ LIBCRYPTO_SRCS = [ "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_asm.c", "crypto/bn/bn_blind.c", "crypto/bn/bn_const.c", "crypto/bn/bn_ctx.c", @@ -816,15 +4244,10 @@ LIBCRYPTO_SRCS = [ "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/camellia.c", + "crypto/camellia/cmll_cbc.c", "crypto/camellia/cmll_cfb.c", "crypto/camellia/cmll_ctr.c", "crypto/camellia/cmll_ecb.c", @@ -835,7 +4258,6 @@ LIBCRYPTO_SRCS = [ "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", @@ -966,12 +4388,10 @@ LIBCRYPTO_SRCS = [ "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", @@ -1077,7 +4497,6 @@ LIBCRYPTO_SRCS = [ "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", @@ -1085,14 +4504,12 @@ LIBCRYPTO_SRCS = [ "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", @@ -1153,7 +4570,6 @@ LIBCRYPTO_SRCS = [ "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", @@ -1171,8 +4587,8 @@ LIBCRYPTO_SRCS = [ "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/rc4/rc4_enc.c", + "crypto/rc4/rc4_skey.c", "crypto/ripemd/rmd_dgst.c", "crypto/ripemd/rmd_one.c", "crypto/rsa/rsa_ameth.c", @@ -1202,15 +4618,9 @@ LIBCRYPTO_SRCS = [ "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", @@ -1252,7 +4662,7 @@ LIBCRYPTO_SRCS = [ "crypto/ui/ui_openssl.c", "crypto/ui/ui_util.c", "crypto/uid.c", - "crypto/whrlpool/wp-x86_64.s", + "crypto/whrlpool/wp_block.c", "crypto/whrlpool/wp_dgst.c", "crypto/x509/by_dir.c", "crypto/x509/by_file.c", @@ -1327,13 +4737,11 @@ LIBCRYPTO_SRCS = [ "crypto/x509v3/v3_tlsf.c", "crypto/x509v3/v3_utl.c", "crypto/x509v3/v3err.c", - "crypto/x86_64cpuid.s", "engines/e_capi.c", - "engines/e_padlock-x86_64.s", - "engines/e_padlock.c", + "engines/e_padlock.c" ] -LIBSSL_SRCS = [ +macos_aarch64_libssl = [ "ssl/bio_ssl.c", "ssl/d1_lib.c", "ssl/d1_msg.c", @@ -1377,14 +4785,20 @@ LIBSSL_SRCS = [ "ssl/t1_lib.c", "ssl/t1_trce.c", "ssl/tls13_enc.c", - "ssl/tls_srp.c", + "ssl/tls_srp.c" ] -OPENSSL_APP_SRCS = [ +macos_aarch64_libapp = [ "apps/app_rand.c", "apps/apps.c", - "apps/asn1pars.c", "apps/bf_prefix.c", + "apps/opt.c", + "apps/s_cb.c", + "apps/s_socket.c" +] + +macos_aarch64_openssl_app = [ + "apps/asn1pars.c", "apps/ca.c", "apps/ciphers.c", "apps/cms.c", @@ -1405,7 +4819,6 @@ OPENSSL_APP_SRCS = [ "apps/nseq.c", "apps/ocsp.c", "apps/openssl.c", - "apps/opt.c", "apps/passwd.c", "apps/pkcs12.c", "apps/pkcs7.c", @@ -1419,10 +4832,8 @@ OPENSSL_APP_SRCS = [ "apps/req.c", "apps/rsa.c", "apps/rsautl.c", - "apps/s_cb.c", "apps/s_client.c", "apps/s_server.c", - "apps/s_socket.c", "apps/s_time.c", "apps/sess_id.c", "apps/smime.c", @@ -1433,117 +4844,62 @@ OPENSSL_APP_SRCS = [ "apps/ts.c", "apps/verify.c", "apps/version.c", - "apps/x509.c", -] - -PERLASM_OUTS = [ - "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/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", + "apps/x509.c" ] -PERLASM_TOOLS = [ - "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/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/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/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/sha/asm/sha512-x86_64.pl", - "crypto/whrlpool/asm/wp-x86_64.pl", - "crypto/x86_64cpuid.pl", - "engines/asm/e_padlock-x86_64.pl", -] +genrule( + name = "macos_aarch64_asm", + srcs = ["crypto/ec/ecp_nistz256_table.c"], + outs = [ + "macos_aarch64_crypto/aes/aesv8-armx.S", + "macos_aarch64_crypto/aes/vpaes-armv8.S", + "macos_aarch64_crypto/arm64cpuid.S", + "macos_aarch64_crypto/bn/armv8-mont.S", + "macos_aarch64_crypto/chacha/chacha-armv8.S", + "macos_aarch64_crypto/ec/ecp_nistz256-armv8.S", + "macos_aarch64_crypto/modes/ghashv8-armx.S", + "macos_aarch64_crypto/poly1305/poly1305-armv8.S", + "macos_aarch64_crypto/sha/keccak1600-armv8.S", + "macos_aarch64_crypto/sha/sha1-armv8.S", + "macos_aarch64_crypto/sha/sha256-armv8.S", + "macos_aarch64_crypto/sha/sha512-armv8.S" + ], + cmd = """ + CC=$(CC) perl $(location crypto/aes/asm/aesv8-armx.pl) ios64 $(location macos_aarch64_crypto/aes/aesv8-armx.S) + CC=$(CC) perl $(location crypto/aes/asm/vpaes-armv8.pl) ios64 $(location macos_aarch64_crypto/aes/vpaes-armv8.S) + CC=$(CC) perl $(location crypto/arm64cpuid.pl) ios64 $(location macos_aarch64_crypto/arm64cpuid.S) + CC=$(CC) perl $(location crypto/bn/asm/armv8-mont.pl) ios64 $(location macos_aarch64_crypto/bn/armv8-mont.S) + CC=$(CC) perl $(location crypto/chacha/asm/chacha-armv8.pl) ios64 $(location macos_aarch64_crypto/chacha/chacha-armv8.S) + CC=$(CC) perl $(location crypto/ec/asm/ecp_nistz256-armv8.pl) ios64 $(location macos_aarch64_crypto/ec/ecp_nistz256-armv8.S) + CC=$(CC) perl $(location crypto/modes/asm/ghashv8-armx.pl) ios64 $(location macos_aarch64_crypto/modes/ghashv8-armx.S) + CC=$(CC) perl $(location crypto/poly1305/asm/poly1305-armv8.pl) ios64 $(location macos_aarch64_crypto/poly1305/poly1305-armv8.S) + CC=$(CC) perl $(location crypto/sha/asm/keccak1600-armv8.pl) ios64 $(location macos_aarch64_crypto/sha/keccak1600-armv8.S) + CC=$(CC) perl $(location crypto/sha/asm/sha1-armv8.pl) ios64 $(location macos_aarch64_crypto/sha/sha1-armv8.S) + CC=$(CC) perl $(location crypto/sha/asm/sha512-armv8.pl) ios64 $(location macos_aarch64_crypto/sha/sha256-armv8.S) + CC=$(CC) perl $(location crypto/sha/asm/sha512-armv8.pl) ios64 $(location macos_aarch64_crypto/sha/sha512-armv8.S) + """, + toolchains = ["@bazel_tools//tools/cpp:current_cc_toolchain"], + tools = glob(["crypto/perlasm/*.pl"]) + [ + "crypto/aes/asm/aesv8-armx.pl", + "crypto/aes/asm/vpaes-armv8.pl", + "crypto/arm64cpuid.pl", + "crypto/bn/asm/armv8-mont.pl", + "crypto/chacha/asm/chacha-armv8.pl", + "crypto/ec/asm/ecp_nistz256-armv8.pl", + "crypto/modes/asm/ghashv8-armx.pl", + "crypto/poly1305/asm/poly1305-armv8.pl", + "crypto/sha/asm/keccak1600-armv8.pl", + "crypto/sha/asm/sha1-armv8.pl", + "crypto/sha/asm/sha512-armv8.pl" + ] +) -PERLASM_GEN = """ -CC=$(CC) perl $(location crypto/aes/asm/aesni-mb-x86_64.pl) elf $(location crypto/aes/aesni-mb-x86_64.s); -CC=$(CC) perl $(location crypto/aes/asm/aesni-sha1-x86_64.pl) elf $(location crypto/aes/aesni-sha1-x86_64.s); -CC=$(CC) perl $(location crypto/aes/asm/aesni-sha256-x86_64.pl) elf $(location crypto/aes/aesni-sha256-x86_64.s); -CC=$(CC) perl $(location crypto/aes/asm/aesni-x86_64.pl) elf $(location crypto/aes/aesni-x86_64.s); -CC=$(CC) perl $(location crypto/aes/asm/vpaes-x86_64.pl) elf $(location crypto/aes/vpaes-x86_64.s); -CC=$(CC) perl $(location crypto/bn/asm/rsaz-avx2.pl) elf $(location crypto/bn/rsaz-avx2.s); -CC=$(CC) perl $(location crypto/bn/asm/rsaz-x86_64.pl) elf $(location crypto/bn/rsaz-x86_64.s); -CC=$(CC) perl $(location crypto/bn/asm/x86_64-gf2m.pl) elf $(location crypto/bn/x86_64-gf2m.s); -CC=$(CC) perl $(location crypto/bn/asm/x86_64-mont.pl) elf $(location crypto/bn/x86_64-mont.s); -CC=$(CC) perl $(location crypto/bn/asm/x86_64-mont5.pl) elf $(location crypto/bn/x86_64-mont5.s); -CC=$(CC) perl $(location crypto/camellia/asm/cmll-x86_64.pl) elf $(location crypto/camellia/cmll-x86_64.s); -CC=$(CC) perl $(location crypto/chacha/asm/chacha-x86_64.pl) elf $(location crypto/chacha/chacha-x86_64.s); -CC=$(CC) perl $(location crypto/ec/asm/ecp_nistz256-x86_64.pl) elf $(location crypto/ec/ecp_nistz256-x86_64.s); -CC=$(CC) perl $(location crypto/ec/asm/x25519-x86_64.pl) elf $(location crypto/ec/x25519-x86_64.s); -CC=$(CC) perl $(location crypto/md5/asm/md5-x86_64.pl) elf $(location crypto/md5/md5-x86_64.s); -CC=$(CC) perl $(location crypto/modes/asm/aesni-gcm-x86_64.pl) elf $(location crypto/modes/aesni-gcm-x86_64.s); -CC=$(CC) perl $(location crypto/modes/asm/ghash-x86_64.pl) elf $(location crypto/modes/ghash-x86_64.s); -CC=$(CC) perl $(location crypto/poly1305/asm/poly1305-x86_64.pl) elf $(location crypto/poly1305/poly1305-x86_64.s); -CC=$(CC) perl $(location crypto/rc4/asm/rc4-md5-x86_64.pl) elf $(location crypto/rc4/rc4-md5-x86_64.s); -CC=$(CC) perl $(location crypto/rc4/asm/rc4-x86_64.pl) elf $(location crypto/rc4/rc4-x86_64.s); -CC=$(CC) perl $(location crypto/sha/asm/keccak1600-x86_64.pl) elf $(location crypto/sha/keccak1600-x86_64.s); -CC=$(CC) perl $(location crypto/sha/asm/sha1-mb-x86_64.pl) elf $(location crypto/sha/sha1-mb-x86_64.s); -CC=$(CC) perl $(location crypto/sha/asm/sha1-x86_64.pl) elf $(location crypto/sha/sha1-x86_64.s); -CC=$(CC) perl $(location crypto/sha/asm/sha256-mb-x86_64.pl) elf $(location crypto/sha/sha256-mb-x86_64.s); -CC=$(CC) perl $(location crypto/sha/asm/sha512-x86_64.pl) elf $(location crypto/sha/sha256-x86_64.s); -CC=$(CC) perl $(location crypto/sha/asm/sha512-x86_64.pl) elf $(location crypto/sha/sha512-x86_64.s); -CC=$(CC) perl $(location crypto/whrlpool/asm/wp-x86_64.pl) elf $(location crypto/whrlpool/wp-x86_64.s); -CC=$(CC) perl $(location crypto/x86_64cpuid.pl) elf $(location crypto/x86_64cpuid.s); -CC=$(CC) perl $(location engines/asm/e_padlock-x86_64.pl) elf $(location engines/e_padlock-x86_64.s); -""" - -OPENSSL_DEFINES = [ - "-DAESNI_ASM", +macos_aarch64_openssl_defines = [ "-DECP_NISTZ256_ASM", - "-DGHASH_ASM", "-DKECCAK1600_ASM", - "-DMD5_ASM", "-DNDEBUG", - "-DOPENSSL_BN_ASM_GF2m", "-DOPENSSL_BN_ASM_MONT", - "-DOPENSSL_BN_ASM_MONT5", "-DOPENSSL_CPUID_OBJ", - "-DOPENSSL_IA32_SSE2", "-DOPENSSL_NO_AFALGENG", "-DOPENSSL_NO_ASAN", "-DOPENSSL_NO_CRYPTO_MDEBUG", @@ -1567,15 +4923,273 @@ OPENSSL_DEFINES = [ "-DOPENSSL_PIC", "-DOPENSSL_RAND_SEED_OS", "-DPOLY1305_ASM", - "-DRC4_ASM", "-DSHA1_ASM", "-DSHA256_ASM", "-DSHA512_ASM", - "-DVPAES_ASM", - "-DX25519_ASM", + "-DVPAES_ASM" +] + +cc_library( + name = "asm", + linkstatic = True, + alwayslink = True, + copts = select( + { + ":linux_x86_64": [ + # As described in https://github.com/openssl/openssl/issues/4575. + # OpenSSL doesnt mark its assembly as not needing an executable stack. + # Pass --noexecstack to the assembler to do this. + "-Wa,--noexecstack" + ], + ":macos_x86_64": [ + # As described in https://github.com/openssl/openssl/issues/4575. + # OpenSSL doesnt mark its assembly as not needing an executable stack. + # Pass --noexecstack to the assembler to do this. + "-Wa,--noexecstack" + ], + ":macos_aarch64": [ + # As described in https://github.com/openssl/openssl/issues/4575. + # OpenSSL doesnt mark its assembly as not needing an executable stack. + # Pass --noexecstack to the assembler to do this. + "-Wa,--noexecstack" + ], + }, + no_match_error = "Please add a new target, see the openssl/README.MD", + ), + srcs = select( + { + ":linux_x86_64": [":linux_x86_64_asm"], + ":macos_x86_64": [":macos_x86_64_asm"], + ":macos_aarch64": [":macos_aarch64_asm"] + }, + no_match_error = "Please add a new target, see the openssl/README.MD", + ), +) + +write_file( + name = "include_crypto_bn_conf_h", + out = "include/crypto/bn_conf.h", + content = select( + { + ":linux_x86_64": linux_x86_64_include_crypto_bn_conf_h, + ":macos_x86_64": macos_x86_64_include_crypto_bn_conf_h, + ":macos_aarch64": macos_aarch64_include_crypto_bn_conf_h + }, + no_match_error = "Please add a new target, see the openssl/README.MD", + ) +) + +write_file( + name = "include_crypto_dso_conf_h", + out = "include/crypto/dso_conf.h", + content = select( + { + ":linux_x86_64": linux_x86_64_include_crypto_dso_conf_h, + ":macos_x86_64": macos_x86_64_include_crypto_dso_conf_h, + ":macos_aarch64": macos_aarch64_include_crypto_dso_conf_h + }, + no_match_error = "Please add a new target, see the openssl/README.MD", + ) +) + +write_file( + name = "include_openssl_opensslconf_h", + out = "include/openssl/opensslconf.h", + content = select( + { + ":linux_x86_64": linux_x86_64_include_openssl_opensslconf_h, + ":macos_x86_64": macos_x86_64_include_openssl_opensslconf_h, + ":macos_aarch64": macos_aarch64_include_openssl_opensslconf_h + }, + no_match_error = "Please add a new target, see the openssl/README.MD", + ) +) + +write_file( + name = "apps_progs_h", + out = "apps/progs.h", + content = select( + { + ":linux_x86_64": linux_x86_64_apps_progs_h, + ":macos_x86_64": macos_x86_64_apps_progs_h, + ":macos_aarch64": macos_aarch64_apps_progs_h + }, + no_match_error = "Please add a new target, see the openssl/README.MD", + ) +) + +write_file( + name = "crypto_buildinf_h", + out = "crypto/buildinf.h", + content = select( + { + ":linux_x86_64": [ + "static const char compiler_flags[] = {'\0'};", + '#define PLATFORM "platform: linux-x86_64"', + '#define DATE "__REDACTED__"', + ], + ":macos_x86_64": [ + "static const char compiler_flags[] = {'\0'};", + '#define PLATFORM "platform: darwin64-x86_64-cc"', + '#define DATE "__REDACTED__"', + ], + ":macos_aarch64": [ + "static const char compiler_flags[] = {'\0'};", + '#define PLATFORM "platform: darwin64-arm64-cc"', + '#define DATE "__REDACTED__"', + ] + }, + no_match_error = "Please add a new target, see the openssl/README.MD", + ) +) + +linux_x86_64_copts = [ + "-iquote", + "$(GENDIR)/external/org_openssl/crypto", + "-I", + "external/org_openssl", + "-I", + "external/org_openssl/include", + "-I", + "external/org_openssl/crypto/modes", + "-I", + "external/org_openssl/crypto/include", + "-iquote", + "external/org_openssl/crypto/ec/curve448/arch_32", + "-iquote", + "external/org_openssl/crypto/ec/curve448", + "-I", + "$(GENDIR)/external/org_openssl/crypto/include" +] + +linux_x86_64_defines = [ + # 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) dont have, + # /usr/lib/ssl at all., + "-DOPENSSLDIR=\\\"/etc/ssl\\\"", + # This is basically a no-op, since we have disabled dynamic loading of engines., + "-DENGINESDIR=\\\"/usr/lib/engines-1.1\\\"", + "-DL_ENDIAN", + "-DOPENSSL_USE_NODELETE" +] + linux_x86_64_openssl_defines + +macos_x86_64_copts = [ + "-iquote", + "$(GENDIR)/external/org_openssl/crypto", + "-I", + "external/org_openssl", + "-I", + "external/org_openssl/include", + "-I", + "external/org_openssl/crypto/modes", + "-I", + "external/org_openssl/crypto/include", + "-iquote", + "external/org_openssl/crypto/ec/curve448/arch_32", + "-iquote", + "external/org_openssl/crypto/ec/curve448", + "-I", + "$(GENDIR)/external/org_openssl/crypto/include" +] + +macos_x86_64_defines = [ + # 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) dont have, + # /usr/lib/ssl at all., + "-DOPENSSLDIR=\\\"/etc/ssl\\\"", + # This is basically a no-op, since we have disabled dynamic loading of engines., + "-DENGINESDIR=\\\"/usr/lib/engines-1.1\\\"", + "-DL_ENDIAN", + "-DOPENSSL_USE_NODELETE" +] + macos_x86_64_openssl_defines + +macos_aarch64_copts = [ + "-iquote", + "$(GENDIR)/external/org_openssl/crypto", + "-I", + "external/org_openssl", + "-I", + "external/org_openssl/include", + "-I", + "external/org_openssl/crypto/modes", + "-I", + "external/org_openssl/crypto/include", + "-iquote", + "external/org_openssl/crypto/ec/curve448/arch_32", + "-iquote", + "external/org_openssl/crypto/ec/curve448", + "-I", + "$(GENDIR)/external/org_openssl/crypto/include" ] -# END GENERATED CODE\n +macos_aarch64_defines = [ + # 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) dont have, + # /usr/lib/ssl at all., + "-DOPENSSLDIR=\\\"/etc/ssl\\\"", + # This is basically a no-op, since we have disabled dynamic loading of engines., + "-DENGINESDIR=\\\"/usr/lib/engines-1.1\\\"", + "-DL_ENDIAN", + "-DOPENSSL_USE_NODELETE" +] + macos_aarch64_openssl_defines + +copts = select( + { + ":linux_x86_64": linux_x86_64_copts, + ":macos_x86_64": macos_x86_64_copts, + ":macos_aarch64": macos_aarch64_copts + }, + no_match_error = "Please add a new target, see the openssl/README.MD", +) + +defines = select( + { + ":linux_x86_64": linux_x86_64_defines, + ":macos_x86_64": macos_x86_64_defines, + ":macos_aarch64": macos_aarch64_defines + }, + no_match_error = "Please add a new target, see the openssl/README.MD", +) + +libssl_srcs = select( + { + ":linux_x86_64": linux_x86_64_libssl, + ":macos_x86_64": macos_x86_64_libssl, + ":macos_aarch64": macos_aarch64_libssl + }, + no_match_error = "Please add a new target, see the openssl/README.MD", +) + +libcrypto_srcs = select( + { + ":linux_x86_64": linux_x86_64_libcrypto, + ":macos_x86_64": macos_x86_64_libcrypto, + ":macos_aarch64": macos_aarch64_libcrypto + }, + no_match_error = "Please add a new target, see the openssl/README.MD", +) + +libapp_srcs = select( + { + ":linux_x86_64": linux_x86_64_libapp, + ":macos_x86_64": macos_x86_64_libapp, + ":macos_aarch64": macos_aarch64_libapp + }, + no_match_error = "Please add a new target, see the openssl/README.MD", +) + +openssl_app_srcs = select( + { + ":linux_x86_64": linux_x86_64_openssl_app, + ":macos_x86_64": macos_x86_64_openssl_app, + ":macos_aarch64": macos_aarch64_openssl_app + }, + no_match_error = "Please add a new target, see the openssl/README.MD", +) + cc_library( name = "crypto-textual-hdrs", textual_hdrs = [ @@ -1584,62 +5198,9 @@ cc_library( ], ) -cc_binary( - name = "openssl", - srcs = OPENSSL_APP_SRCS + [ - "apps/apps.h", - "apps/progs.h", - "apps/s_apps.h", - "apps/testdsa.h", - "apps/testrsa.h", - "apps/timeouts.h", - ] + glob(["include/internal/*.h"]), - copts = [ - "-iquote", - "$(GENDIR)/external/org_openssl/apps", - "-I", - "external/org_openssl/include", - ], - visibility = ["//visibility:public"], - deps = [":ssl"], -) - -OPENSSL_COPTS = [ - # 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", - "-iquote", - "$(GENDIR)/external/org_openssl/crypto", - "-I", - "external/org_openssl", - "-I", - "external/org_openssl/include", - "-I", - "external/org_openssl/crypto/modes", - "-I", - "external/org_openssl/crypto/include", - "-iquote", - "external/org_openssl/crypto/ec/curve448/arch_32", - "-iquote", - "external/org_openssl/crypto/ec/curve448", - "-I", - "$(GENDIR)/external/org_openssl/crypto/include", -] + OPENSSL_DEFINES + [ - # 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-1.1\\"', - "-DL_ENDIAN", - "-DOPENSSL_USE_NODELETE", -] - cc_library( name = "crypto", - srcs = LIBCRYPTO_SRCS + glob([ + srcs = libcrypto_srcs + glob([ "crypto/**/*.h", "include/internal/*.h", ]) + [ @@ -1655,21 +5216,24 @@ cc_library( "include/crypto/bn_conf.h", "include/crypto/dso_conf.h", ], - copts = OPENSSL_COPTS, + copts = copts + defines, linkopts = [ "-pthread", ], strip_include_prefix = "include", visibility = ["//visibility:public"], - deps = [":crypto-textual-hdrs"], + deps = [ + ":crypto-textual-hdrs", + ":asm" + ], ) cc_library( name = "ssl", - srcs = LIBSSL_SRCS + glob(["ssl/**/*.h"]) + [ + srcs = libssl_srcs + glob(["ssl/**/*.h"]) + [ "e_os.h", ], - copts = OPENSSL_COPTS, + copts = copts + defines, visibility = ["//visibility:public"], deps = [ ":crypto", @@ -1682,44 +5246,22 @@ alias( visibility = ["//visibility:public"], ) -genrule( - name = "asm", - srcs = [ - "crypto/ec/ecp_nistz256_table.c", - ], - outs = PERLASM_OUTS, - cmd = PERLASM_GEN, - toolchains = ["@bazel_tools//tools/cpp:current_cc_toolchain"], - tools = depset(direct = PERLASM_TOOLS).to_list() + glob(["crypto/perlasm/*.pl"]), -) - -genrule( - name = "generate-headers", - outs = [ - "crypto/buildinf.h", - "include/crypto/dso_conf.h", - "include/crypto/bn_conf.h", - "include/openssl/opensslconf.h", +cc_binary( + name = "openssl", + srcs = openssl_app_srcs + libapp_srcs + [ + "apps/apps.h", "apps/progs.h", + "apps/s_apps.h", + "apps/testdsa.h", + "apps/testrsa.h", + "apps/timeouts.h", + ] + glob(["include/internal/*.h"]), + copts = [ + "-iquote", + "$(GENDIR)/external/org_openssl/apps", + "-I", + "external/org_openssl/include", ], - cmd = """ -cat <<'E_O_F' >$(location crypto/buildinf.h) -static const char compiler_flags[] = {'\\0'}; -#define PLATFORM "platform: linux-x86_64" -#define DATE "__REDACTED__" -E_O_F - -cat <<'E_O_F' >$(location include/crypto/bn_conf.h) -%s -E_O_F -cat <<'E_O_F' >$(location include/crypto/dso_conf.h) -%s -E_O_F -cat <<'E_O_F' >$(location include/openssl/opensslconf.h) -%s -E_O_F -cat <<'E_O_F' >$(location apps/progs.h) -%s -E_O_F -""" % (BN_CONF_H, DSO_CONF_H, OPENSSLCONF_H, APPS_PROGS_H), + visibility = ["//visibility:public"], + deps = [":ssl"], ) diff --git a/thirdparty/openssl/BUILD.openssl.tail b/thirdparty/openssl/BUILD.openssl.tail deleted file mode 100644 index 9d2a25d3..00000000 --- a/thirdparty/openssl/BUILD.openssl.tail +++ /dev/null @@ -1,147 +0,0 @@ -cc_library( - name = "crypto-textual-hdrs", - textual_hdrs = [ - "crypto/des/ncbc_enc.c", - "crypto/LPdir_unix.c", - ], -) - -cc_binary( - name = "openssl", - srcs = OPENSSL_APP_SRCS + [ - "apps/apps.h", - "apps/progs.h", - "apps/s_apps.h", - "apps/testdsa.h", - "apps/testrsa.h", - "apps/timeouts.h", - ] + glob(["include/internal/*.h"]), - copts = [ - "-iquote", - "$(GENDIR)/external/org_openssl/apps", - "-I", - "external/org_openssl/include", - ], - visibility = ["//visibility:public"], - deps = [":ssl"], -) - -OPENSSL_COPTS = [ - # 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", - "-iquote", - "$(GENDIR)/external/org_openssl/crypto", - "-I", - "external/org_openssl", - "-I", - "external/org_openssl/include", - "-I", - "external/org_openssl/crypto/modes", - "-I", - "external/org_openssl/crypto/include", - "-iquote", - "external/org_openssl/crypto/ec/curve448/arch_32", - "-iquote", - "external/org_openssl/crypto/ec/curve448", - "-I", - "$(GENDIR)/external/org_openssl/crypto/include", -] + OPENSSL_DEFINES + [ - # 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-1.1\\"', - "-DL_ENDIAN", - "-DOPENSSL_USE_NODELETE", -] - -cc_library( - name = "crypto", - srcs = LIBCRYPTO_SRCS + glob([ - "crypto/**/*.h", - "include/internal/*.h", - ]) + [ - "crypto/buildinf.h", - "include/crypto/dso_conf.h", - "e_os.h", - ], - hdrs = glob([ - "include/openssl/*.h", - "include/crypto/*.h", - ]) + [ - "include/openssl/opensslconf.h", - "include/crypto/bn_conf.h", - "include/crypto/dso_conf.h", - ], - copts = OPENSSL_COPTS, - linkopts = [ - "-pthread", - ], - strip_include_prefix = "include", - visibility = ["//visibility:public"], - deps = [":crypto-textual-hdrs"], -) - -cc_library( - name = "ssl", - srcs = LIBSSL_SRCS + glob(["ssl/**/*.h"]) + [ - "e_os.h", - ], - copts = OPENSSL_COPTS, - visibility = ["//visibility:public"], - deps = [ - ":crypto", - ], -) - -alias( - name = "crypto_ssl", - actual = ":ssl", - visibility = ["//visibility:public"], -) - -genrule( - name = "asm", - srcs = [ - "crypto/ec/ecp_nistz256_table.c", - ], - outs = PERLASM_OUTS, - cmd = PERLASM_GEN, - toolchains = ["@bazel_tools//tools/cpp:current_cc_toolchain"], - tools = depset(direct = PERLASM_TOOLS).to_list() + glob(["crypto/perlasm/*.pl"]), -) - -genrule( - name = "generate-headers", - outs = [ - "crypto/buildinf.h", - "include/crypto/dso_conf.h", - "include/crypto/bn_conf.h", - "include/openssl/opensslconf.h", - "apps/progs.h", - ], - cmd = """ -cat <<'E_O_F' >$(location crypto/buildinf.h) -static const char compiler_flags[] = {'\\0'}; -#define PLATFORM "platform: linux-x86_64" -#define DATE "__REDACTED__" -E_O_F - -cat <<'E_O_F' >$(location include/crypto/bn_conf.h) -%s -E_O_F -cat <<'E_O_F' >$(location include/crypto/dso_conf.h) -%s -E_O_F -cat <<'E_O_F' >$(location include/openssl/opensslconf.h) -%s -E_O_F -cat <<'E_O_F' >$(location apps/progs.h) -%s -E_O_F -""" % (BN_CONF_H, DSO_CONF_H, OPENSSLCONF_H, APPS_PROGS_H), -) diff --git a/thirdparty/openssl/bazelify.py b/thirdparty/openssl/bazelify.py new file mode 100755 index 00000000..01f154d7 --- /dev/null +++ b/thirdparty/openssl/bazelify.py @@ -0,0 +1,489 @@ +#!/usr/bin/env python3 + +from shutil import copyfile +from os.path import join as path_join +from collections import defaultdict +import json +import string +from tempfile import TemporaryDirectory +import tarfile +import subprocess +from textwrap import dedent, indent +from urllib.request import urlretrieve +from config import * + + +_punc_tbl = str.maketrans(string.punctuation, '_' * len(string.punctuation)) + +def slug(raw: str, trans=_punc_tbl) -> str: + return raw.translate(trans) + +def reindent(amt: int, text: str) -> str: + text = dedent(text) + return indent(text, amt * ' ', lambda x: True) + +def bzl_list_fmt(indent_amt: int, items, delim=",\n", wrap=r'"%s"'): + if wrap is None: + wrap = r'%s' + + if delim is None: + delim = '\n' + + pad = ' ' * indent_amt + lines = '\n' + delim.join(pad + wrap % tok.strip() for tok in items) + lines = indent(lines, pad, lambda line: True) + return lines.lstrip() + +def download(work_dir: str, version: str) -> str: + url = f'https://www.openssl.org/source/openssl-{version}.tar.gz' + file_name = path_join(work_dir, url.split('/')[-1]) + + def report(block, size, total, barLength=20): + percent = min(100.0, 100.0 * block * size / total) + arrow = '-' * int(percent/100*barLength - 1) + '>' + spaces = ' ' * (barLength - len(arrow)) + print(f'DL Progress: [{arrow}{spaces} {percent}%', end='\r') + + urlretrieve(url, file_name, report) + print('\r\nDownloaded openssl') + return file_name + +def extract_archive(work_dir: str, archive: str) -> str: + print('Extracting openssl') + with tarfile.open(archive, 'r:*') as tarball: + tarball.extractall(path=work_dir) + + return path_join(work_dir, archive.replace('.tar.gz', '')) + +class Planner: + def __init__(self, workdir: str, includes=INCLUDES, platforms=PLATFORMS): + self.workdir = workdir + self.platforms = platforms + self.includes = includes + self.build_details = {} + self.prepare_build() + + def prepare_build(self): + """Sets up the openssl build configuration for generating build configs""" + copyfile('./extract_srcs.pl', path_join(self.workdir, 'extract_srcs.pl')) + + with open(path_join(self.workdir, 'tm.conf'), 'w') as conf: + conf.write('(') + for platform in self.platforms: + # type: ignore + conf.write( + reindent( + 2, f''' + 'tm-{platform}' => {{ + inherit_from => ['{platform.openssl_moniker}'], + dso_scheme => undef, + }}, + ''')) + conf.write(')') + + def _cmd(self, *cmd: str, check=True, capture_output=False) -> str: + try: + run = subprocess.run( + cmd, + shell=True, + text=True, + capture_output=capture_output, + check=check, + cwd=self.workdir, + timeout=60, + ) + return run.stdout + except subprocess.CalledProcessError as failed_cmd: + print(failed_cmd.output) + raise + + def _read(self, file: str) -> str: + with open(path_join(self.workdir, file), 'r') as data: + return data.read() + + def gather_build_details(self): + for platform in self.platforms: + # no-afalgeng because we don't need afalgeng. + # no-dynamic-engine to prevent loading shared libraries at runtime. + self._cmd( + f'./Configure "--config=tm.conf" "tm-{platform}" no-afalgeng no-dynamic-engine') + + for include in self.includes: + if include == 'apps/progs.h': + # Hack - This file is special :( + self._cmd(f'perl apps/progs.pl apps/openssl > apps/progs.h') + continue + + cmd = f'perl -I. -Mconfigdata util/dofile.pl -oMakefile '\ + f'{include}.in > {include}' + self._cmd(cmd) + + includes = {inc: self._read(inc) for inc in self.includes} + build_config = self._cmd('perl -I. -l -Mconfigdata ./extract_srcs.pl', capture_output=True) + build_config = json.loads(build_config) + build_config['includes'] = includes + self.build_details[platform] = build_config + + +class Renderer: + def __init__(self, build_details): + self.build_details = build_details + + def _platform_config(self, platform: Platform) -> str: + return f''' + config_setting( + name = "{platform}", + constraint_values = [ + "@platforms//cpu:{platform.bzl_cpu}", + "@platforms//os:{platform.bzl_os}", + ] + )''' + + def _platforms(self): + return self.build_details.keys() + + def header(self, openssl_version=VERSION) -> str: + configs = (self._platform_config(plat) for plat in self._platforms()) + configs = "\n".join(configs) + + return dedent(f'''\ + # GENERATED CODE! (see bazelify.py) + load("@bazel_skylib//rules:write_file.bzl", "write_file") + {configs} + + OPENSSL_VERSION = "{openssl_version}" + ''') + + def _includes(self, plat: Platform, includes) -> str: + for path, inc in includes.items(): + yield '\n'.join(("\n", f'{plat}_{slug(path)} = ["""', inc.strip(), '"""]\n')) + + def _srcs(self, plat: Platform, config) -> str: + for lib in ('libcrypto', 'libssl', 'libapp', 'openssl_app'): + srcs = config[f'{lib}_srcs'] + # Filter out asm sources + srcs = sorted(src for src in srcs if src.endswith((".c", ".h"))) + yield dedent(f''' + {plat}_{lib} = [ + {bzl_list_fmt(10, srcs)} + ] + ''') + + def _asm_gen(self, plat, asm) -> str: + gen = asm['generator'] + cmd = asm['cmdline'] + out = asm['output'] + + return f"CC=$(CC) perl $(location {gen}) {cmd} $(location {plat}_{out})" + + def _perl_asms(self, plat: Platform, asms) -> str: + asm_outs = sorted(set((f"{plat}_{asm['output']}" for asm in asms))) + asm_cmd = sorted(set((self._asm_gen(plat, asm) for asm in asms))) + asm_scripts = sorted(set((asm['generator'] for asm in asms))) + + return dedent(f''' + genrule( + name = "{plat}_asm", + srcs = ["crypto/ec/ecp_nistz256_table.c"], + outs = [ + {bzl_list_fmt(10, asm_outs)} + ], + cmd = """ + {bzl_list_fmt(10, asm_cmd, wrap=None, delim=None)} + """, + toolchains = ["@bazel_tools//tools/cpp:current_cc_toolchain"], + tools = glob(["crypto/perlasm/*.pl"]) + [ + {bzl_list_fmt(10, asm_scripts)} + ] + ) + ''') + + def _defines(self, plat: Platform, defines) -> str: + defines = (f'{plat.compile_def_flag}{define}' for define in defines) + return dedent(f''' + {plat}_openssl_defines = [ + {bzl_list_fmt(8, defines)} + ] + ''') + + def rules(self) -> str: + for platform, config in self.build_details.items(): + for inc in self._includes(platform, config['includes']): + yield inc + + for src in self._srcs(platform, config): + yield src + + yield self._perl_asms(platform, config['asm_srcs']) + yield self._defines(platform, config['openssl_defines']) + + def _asm_target(self) -> str: + asm_tgts = (f'":{plat}": [":{plat}_asm"]' for plat in self._platforms()) + + def copts(plat) -> str: + asm_copts = '\n'.join(plat.asm_copts) + return reindent(12, f''' + ":{plat}": [ + {bzl_list_fmt(10, plat.asm_copts, wrap=None, delim=None)} + ], + ''') + + asm_copts = [copts(plat) for plat in self._platforms()] + + return dedent(f''' + cc_library( + name = "asm", + linkstatic = True, + alwayslink = True, + copts = select( + {{ + {bzl_list_fmt(12, asm_copts, wrap=None, delim=None)} + }}, + no_match_error = "Please add a new target, see the openssl/README.MD", + ), + srcs = select( + {{ + {bzl_list_fmt(12, asm_tgts, wrap=None)} + }}, + no_match_error = "Please add a new target, see the openssl/README.MD", + ), + ) + ''') + + def _write_header_targets(self) -> str: + includes = defaultdict(list) + for plat, details in self.build_details.items(): + for inc in details['includes'].keys(): + includes[inc].append(plat) + + for inc_file, platforms in includes.items(): + actuals = (f'":{plat}": {plat}_{slug(inc_file)}' for plat in platforms) + yield dedent(f''' + write_file( + name = "{slug(inc_file)}", + out = "{inc_file}", + content = select( + {{ + {bzl_list_fmt(14, actuals, wrap=None)} + }}, + no_match_error = "Please add a new target, see the openssl/README.MD", + ) + ) + ''') + + def _buildinf_target(self) -> str: + def buildinf(plat: Platform) -> str: + null_list = r"'\0'" + return reindent(12, f'''\ + ":{plat}": [ + "static const char compiler_flags[] = {{{null_list}}};", + '#define PLATFORM "platform: {plat.openssl_moniker}"', + '#define DATE "__REDACTED__"', + ] + ''') + + buildinfs = (buildinf(plat) for plat in self._platforms()) + + return dedent(f''' + write_file( + name = "crypto_buildinf_h", + out = "crypto/buildinf.h", + content = select( + {{ + {bzl_list_fmt(12, buildinfs, wrap=None)} + }}, + no_match_error = "Please add a new target, see the openssl/README.MD", + ) + ) + ''') + + def _copts(self) -> str: + for plat, details in self.build_details.items(): + yield dedent(f''' + {plat}_copts = [ + {reindent(2, bzl_list_fmt(8, plat.copts, wrap=None))} + ] + ''') + + # There are two opts and defs to blend in, those that are specific + # to bazel (as found in config.py), and those found in the build + # from openssl + yield dedent(f''' + {plat}_defines = [ + {reindent(2, bzl_list_fmt(8, plat.defines, wrap=None))} + ] + {plat}_openssl_defines + ''') + + def plat_bind(suffix: str): + return (f'":{plat}": {plat}_{suffix}' for plat in self._platforms()) + + yield dedent(f''' + copts = select( + {{ + {bzl_list_fmt(10, plat_bind('copts'), wrap=None)} + }}, + no_match_error = "Please add a new target, see the openssl/README.MD", + ) + + defines = select( + {{ + {bzl_list_fmt(10, plat_bind('defines'), wrap=None)} + }}, + no_match_error = "Please add a new target, see the openssl/README.MD", + ) + + libssl_srcs = select( + {{ + {bzl_list_fmt(10, plat_bind('libssl'), wrap=None)} + }}, + no_match_error = "Please add a new target, see the openssl/README.MD", + ) + + libcrypto_srcs = select( + {{ + {bzl_list_fmt(10, plat_bind('libcrypto'), wrap=None)} + }}, + no_match_error = "Please add a new target, see the openssl/README.MD", + ) + + libapp_srcs = select( + {{ + {bzl_list_fmt(10, plat_bind('libapp'), wrap=None)} + }}, + no_match_error = "Please add a new target, see the openssl/README.MD", + ) + + openssl_app_srcs = select( + {{ + {bzl_list_fmt(10, plat_bind('openssl_app'), wrap=None)} + }}, + no_match_error = "Please add a new target, see the openssl/README.MD", + ) + ''') + + def _public_targets(self) -> str: + return dedent(f''' + cc_library( + name = "crypto-textual-hdrs", + textual_hdrs = [ + "crypto/des/ncbc_enc.c", + "crypto/LPdir_unix.c", + ], + ) + + cc_library( + name = "crypto", + srcs = libcrypto_srcs + glob([ + "crypto/**/*.h", + "include/internal/*.h", + ]) + [ + "crypto/buildinf.h", + "include/crypto/dso_conf.h", + "e_os.h", + ], + hdrs = glob([ + "include/openssl/*.h", + "include/crypto/*.h", + ]) + [ + "include/openssl/opensslconf.h", + "include/crypto/bn_conf.h", + "include/crypto/dso_conf.h", + ], + copts = copts + defines, + linkopts = [ + "-pthread", + ], + strip_include_prefix = "include", + visibility = ["//visibility:public"], + deps = [ + ":crypto-textual-hdrs", + ":asm" + ], + ) + + cc_library( + name = "ssl", + srcs = libssl_srcs + glob(["ssl/**/*.h"]) + [ + "e_os.h", + ], + copts = copts + defines, + visibility = ["//visibility:public"], + deps = [ + ":crypto", + ], + ) + + alias( + name = "crypto_ssl", + actual = ":ssl", + visibility = ["//visibility:public"], + ) + + cc_binary( + name = "openssl", + srcs = openssl_app_srcs + libapp_srcs + [ + "apps/apps.h", + "apps/progs.h", + "apps/s_apps.h", + "apps/testdsa.h", + "apps/testrsa.h", + "apps/timeouts.h", + ] + glob(["include/internal/*.h"]), + copts = [ + "-iquote", + "$(GENDIR)/external/org_openssl/apps", + "-I", + "external/org_openssl/include", + ], + visibility = ["//visibility:public"], + deps = [":ssl"], + ) + ''') + + def trailer(self) -> str: + yield self._asm_target() + + for header in self._write_header_targets(): + yield header + + yield self._buildinf_target() + + for opts in self._copts(): + yield opts + + yield self._public_targets() + + def render(self, output): + with output as out: + out.write(self.header()) + + for rule in self.rules(): + out.write(rule) + + for rule in self.trailer(): + out.write(rule) + + +def main(output_file: str): + with open(output_file, 'w') as out, TemporaryDirectory() as work_path: + print(f"Downloading, Extracting and handling OpenSSL in {work_path}") + openssl_archive = download(work_path, VERSION) + openssl_dir = extract_archive(work_path, openssl_archive) + + print("Deducing build configs for openssl") + plan = Planner(openssl_dir) + plan.gather_build_details() + + print("Rendering build file") + render = Renderer(plan.build_details) + render.render(out) + + +if __name__ == "__main__": + import sys + + if len(sys.argv) != 2: + print(f"Usage: {sys.argv[0]} OUTPUT") + sys.exit(1) + + main(sys.argv[1]) diff --git a/thirdparty/openssl/bazelify.sh b/thirdparty/openssl/bazelify.sh deleted file mode 100755 index 4b119b5c..00000000 --- a/thirdparty/openssl/bazelify.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -e -# Downloads openssl, configures it, and creates a the file BUILD file. - -version=1.1.1k -mydir=$(realpath $(dirname "$0")) -rm -fr openssl-$version -curl -f "https://www.openssl.org/source/openssl-$version.tar.gz" | tar xz -pushd openssl-$version -# Define a new configuration that hard disables all dlopening. -cat <<'E_O_F' >dbx.conf -( - 'dbx-linux-x86_64' => { - inherit_from => [ 'linux-x86_64' ], - dso_scheme => undef, - } -); -E_O_F -# no-afalgeng because we don't need afalgeng. -# no-dynamic-engine to prevent loading shared libraries at runtime. -./Configure "--config=dbx.conf" dbx-linux-x86_64 no-afalgeng no-dynamic-engine -make include/openssl/opensslconf.h include/crypto/bn_conf.h include/crypto/dso_conf.h apps/progs.h -echo -e "# BEGIN GENERATED CODE (see $(basename $0))\n" > "$mydir/BUILD.openssl" -echo -e "OPENSSL_VERSION = \"$version\"\n" >> "$mydir/BUILD.openssl" -echo -e "OPENSSLCONF_H = \"\"\"$(grep ^# include/openssl/opensslconf.h)\"\"\"\n" >> "$mydir/BUILD.openssl" -echo -e "BN_CONF_H = \"\"\"$(grep ^# include/crypto/bn_conf.h)\"\"\"\n" >> "$mydir/BUILD.openssl" -echo -e "DSO_CONF_H = \"\"\"$(grep ^# include/crypto/dso_conf.h)\"\"\"\n" >> "$mydir/BUILD.openssl" -echo -e "APPS_PROGS_H = \"\"\"$(< apps/progs.h)\"\"\"\n" >> "$mydir/BUILD.openssl" -perl -I. -l -Mconfigdata "$mydir/extract_srcs.pl" >> "$mydir/BUILD.openssl" -echo "# END GENERATED CODE\n" >> "$mydir/BUILD.openssl" -cat "$mydir/BUILD.openssl.tail" >> "$mydir/BUILD.openssl" -popd diff --git a/thirdparty/openssl/config.py b/thirdparty/openssl/config.py new file mode 100644 index 00000000..dc41f424 --- /dev/null +++ b/thirdparty/openssl/config.py @@ -0,0 +1,90 @@ +from dataclasses import dataclass, field +from typing import Tuple + +VERSION = "1.1.1l" + + +@dataclass(frozen=True) +class Platform: + bzl_os: str + bzl_cpu: str + openssl_moniker: str + compile_def_flag: str = '-D' + asm_copts: Tuple[str] = field(default_factory=tuple) + copts: Tuple[str] = field(default_factory=tuple) + defines: Tuple[str] = field(default_factory=tuple) + + def __str__(self): + return "_".join((self.bzl_os, self.bzl_cpu)) + +POSIX_ASM_COPTS = ( + '# As described in https://github.com/openssl/openssl/issues/4575.', + '# OpenSSL doesnt mark its assembly as not needing an executable stack.', + '# Pass --noexecstack to the assembler to do this.', + '"-Wa,--noexecstack"', +) + +POSIX_COPTS = ( + '"-iquote"', + '"$(GENDIR)/external/org_openssl/crypto"', + '"-I"', + '"external/org_openssl"', + '"-I"', + '"external/org_openssl/include"', + '"-I"', + '"external/org_openssl/crypto/modes"', + '"-I"', + '"external/org_openssl/crypto/include"', + '"-iquote"', + '"external/org_openssl/crypto/ec/curve448/arch_32"', + '"-iquote"', + '"external/org_openssl/crypto/ec/curve448"', + '"-I"', + '"$(GENDIR)/external/org_openssl/crypto/include"', +) + +POSIX_DEFINES = ( + '# 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) dont have', + '# /usr/lib/ssl at all.', + r'"-DOPENSSLDIR=\\\"/etc/ssl\\\""', + '# This is basically a no-op, since we have disabled dynamic loading of engines.', + r'"-DENGINESDIR=\\\"/usr/lib/engines-1.1\\\""', + '"-DL_ENDIAN"', + '"-DOPENSSL_USE_NODELETE"', +) + +# Mapping from what the bazel rules will call a platform to the openssl rules +PLATFORMS = [ + Platform( + bzl_os='linux', + bzl_cpu='x86_64', + openssl_moniker='linux-x86_64', + asm_copts=POSIX_ASM_COPTS, # typing: None + copts=POSIX_COPTS, # typing: None + defines=POSIX_DEFINES, #typing: None + ), + Platform( + bzl_os='macos', + bzl_cpu='x86_64', + openssl_moniker='darwin64-x86_64-cc', + asm_copts=POSIX_ASM_COPTS, # typing: None + copts=POSIX_COPTS, # typing: None + defines=POSIX_DEFINES, #typing: None + ), + Platform( + bzl_os='macos', + bzl_cpu='aarch64', + openssl_moniker='darwin64-arm64-cc', + asm_copts=POSIX_ASM_COPTS, # typing: None + copts=POSIX_COPTS, # typing: None + defines=POSIX_DEFINES, #typing: None + ), +] + +# Files that we care about to compile +INCLUDES = [ + "include/crypto/bn_conf.h", "include/crypto/dso_conf.h", "include/openssl/opensslconf.h", + "apps/progs.h" +] diff --git a/thirdparty/openssl/extract_srcs.pl b/thirdparty/openssl/extract_srcs.pl index 55c45f0a..fea36d85 100644 --- a/thirdparty/openssl/extract_srcs.pl +++ b/thirdparty/openssl/extract_srcs.pl @@ -1,52 +1,59 @@ # This script reads the OpenSSL meta-build system configuration output -# and converts into constants for the BUILD file. +# and converts into JSON that is used to render the BUILD file. use strict; -my %perlasm; +print "{"; + +# Make a Json list +sub list { + my $name = shift; + my $inner = shift; + return qq( "$name": [\n$inner\n ]) +} + +# Make a list from sources +sub list_srcs { + my $name = shift; + my @srcs = map { qq( "$_") } + map { $unified_info{sources}->{$_}->[0] } + sort @_; + return list($name, join(",\n", @srcs)); +} -print "LIBCRYPTO_SRCS = ["; -foreach (sort @{$unified_info{sources}->{libcrypto}}) { +my $libcrypto_srcs = list_srcs("libcrypto_srcs", @{$unified_info{sources}->{libcrypto}}); +my $libssl_srcs = list_srcs("libssl_srcs", @{$unified_info{sources}->{libssl}}); +my $app_srcs = list_srcs("openssl_app_srcs", @{$unified_info{sources}->{"apps/openssl"}}); +my $libapp_srcs = list_srcs("libapp_srcs", @{$unified_info{sources}->{"apps/libapps.a"}}); + +my %perlasm; +foreach (@{$unified_info{sources}->{libcrypto}}) { my $src = $unified_info{sources}->{$_}->[0]; - print ' "' . $src . '",'; if (exists($unified_info{generate}->{$src})) { $perlasm{$src} = ${unified_info{generate}->{$src}}; } } -print "]\n"; -print "LIBSSL_SRCS = ["; -foreach (sort @{$unified_info{sources}->{libssl}}) { - my $src = $unified_info{sources}->{$_}->[0]; - print ' "' . $src . '",'; -} -print "]\n"; -print "OPENSSL_APP_SRCS = ["; -foreach (sort @{$unified_info{sources}->{"apps/openssl"}}, @{$unified_info{sources}->{"apps/libapps.a"}}) { - my $src = $unified_info{sources}->{$_}->[0]; - print ' "' . $src . '",'; -} -print "]\n"; -print "PERLASM_OUTS = ["; -foreach (sort keys %perlasm) { - print ' "' . $_ . '",'; -} -print "]\n"; -print "PERLASM_TOOLS = ["; -foreach (sort values %perlasm) { - print ' "' . @{$_}[0] . '",'; -} -print "]\n"; -print 'PERLASM_GEN = """'; -foreach (sort keys %perlasm) { + +sub perl_asm { my $generation = $perlasm{$_}; my $cmdline = join(" ", @{$generation}[1,]); $cmdline =~ s/\$\(PERLASM_SCHEME\)/$target{perlasm_scheme}/g; - print "CC=\$(CC) perl \$(location @{$generation}[0]) " . $cmdline . " \$(location $_);"; -} -print '"""'; -print; -print "OPENSSL_DEFINES = ["; -foreach (sort @{$target{defines}}, @{$config{defines}}, @{$config{lib_defines}}, @{$config{openssl_other_defines}}) { - print ' "-D', $_, '",'; + + return qq( { + "generator": "@{$generation}[0]", + "cmdline": "$cmdline", + "output": "$_" + }) } -print "]\n"; + +my @asm_decls = map { perl_asm } sort keys %perlasm; +my $asm_srcs = list("asm_srcs", join(",\n", @asm_decls)); + +my @defs = map { qq( "$_") } + sort @{$target{defines}}, @{$config{defines}}, @{$config{lib_defines}}, @{$config{openssl_other_defines}}; +my $defines = list("openssl_defines", join(",\n", @defs)); + +print join(",\n", ($libcrypto_srcs, $libssl_srcs, $app_srcs, $libapp_srcs, $asm_srcs, $defines)); + +# TODO - cflags, cxxflags, bn_opts, lib_cppflags?, enable, asflags? +print "}";