%global awslc_ver_maj 5 %global awslc_ver_min 12 %global awslc_ver_patch 0 # util/fipstools/acvp/modulewrapper/main.cc #errors on any other target, so # s390x, riscv64, i686 and loongarch64 must build with FIPS disabled. %global fips_arches x86_64 aarch64 ppc64le %{arm} %ifarch %{fips_arches} %global awslc_fips 1 %else %global awslc_fips 0 %endif # Rust bindings for the aws-lc-sys crate need bindgen-cli, which AL2023 lacks. # Old-style bcond: AL2023's rpm 4.16 predates %%bcond with a default value. %if 0%{?amzn} == 2023 %bcond_with rust_bindings %else %bcond_without rust_bindings %endif # Which crypto-policies back-end AWS-LC reads its system policy from. # AL2027's crypto-policies (>= 20260811) generates a dedicated aws-lc.config. # That generator is an Amazon Linux addition: upstream fedora-crypto-policies has # none, so no Fedora release and not AL2023 ships the file. Everywhere else use # AWS-LC's own default, the OpenSSL back-end opensslcnf.config, which upstream's # parser is written for (ssl/crypto_policy.cc names AL2023 and Fedora) and which # every crypto-policies generates. Switch Fedora over once the aws-lc generator # is merged into upstream crypto-policies and a Fedora release ships it. # # AL2023 is deliberately on the OpenSSL back-end too, although it is Amazon # Linux. None of its crypto-policies builds (up to 20260224-1...amzn2023.0.6) # ships aws-lc.config, so pointing AWS-LC there would silently drop the system # policy. Once an AL2023 crypto-policies generates aws-lc.config, change this # test to cover AL2023 and require that version in -libs. %if 0%{?amzn} >= 2027 %global awslc_policy_backend aws-lc %global awslc_policy_file %{_sysconfdir}/crypto-policies/back-ends/aws-lc.config %else %global awslc_policy_backend openssl %endif %if %{awslc_fips} # FIPS module boundary detection requires LTO to be disabled. %global _lto_cflags %{nil} %endif Name: aws-lc Version: %{awslc_ver_maj}.%{awslc_ver_min}.%{awslc_ver_patch} Release: %autorelease Summary: Command-line tools for the general-purpose cryptographic library from AWS # Derived by auditing the SPDX tags of the files that are compiled (crypto/, # ssl/, tool/, tool-openssl/, include/, provider/ and the third_party/ trees # that are built), not from upstream's LICENSE summary. # # AND, not OR: upstream's LICENSE says each part "retains their original # licensing", so the binaries are under all of these licenses at once. # # - Apache-2.0, ISC: AWS-LC's own code and code derived from BoringSSL. The # choices offered in file headers (Apache-2.0 OR ISC; mlkem-native and # mldsa-native "... OR MIT"; s2n-bignum "... OR MIT-0") are all met by # these two, so they add nothing. # - MIT: third_party/fiat. # - BSD-3-Clause: third_party/jitterentropy, which is dual-licensed under # BSD-3-Clause or GPL-2.0. Upstream's LICENSE records that Amazon elects # BSD-3-Clause and not GPL-2.0. # - LicenseRef-Fedora-Public-Domain: md5-x86_64.pl and poly1305_arm_asm.S, # which are public-domain dedications rather than CC0 grants. # # Named in upstream's LICENSE but not listed here: # - OpenSSL, SSLeay-standalone: AWS-LC relicensed all code derived from # OpenSSL to Apache-2.0. The Eric Young cryptsoft lines are copyright # attributions, not license grants. # - CC0-1.0: the Keccak and AES files that upstream attributes it to # (keccak.c, sha3.c, keccak1600-armv8.pl, aes_nohw.c) are Apache-2.0 # and/or ISC. # # The top-level LICENSE contains the full text of every license above and the # copyright notice of each third-party component, so it is the only license # file shipped. License: Apache-2.0 AND ISC AND MIT AND BSD-3-Clause AND LicenseRef-Fedora-Public-Domain URL: https://github.com/aws/aws-lc Source0: https://github.com/aws/aws-lc/archive/refs/tags/v%{version}.tar.gz#/aws-lc-%{version}.tar.gz Source1: aws-lc-provider.cnf # Accept the "PROFILE=SYSTEM" (crypto-policies) cipher string by mapping # it to AWS-LC's default cipher list instead of returning an error. # Drop once AWS-LC gains real system crypto policy support upstream. Patch: aws-lc-5.2.0-profile-system-cipher-string.patch # Search path for aws-lc-sys (Rust) system-library auto-detection; the # directory holds only AWS-LC symlinks so it cannot resolve to OpenSSL. Patch: aws-lc-5.11.0-pkgconfig-awslc-libdir.patch Patch: aws-lc-5.12.0-rehash.patch # awslc_provider_linkage_test misreads objdump -T output on ppc64le, where a # non-zero st_other column sits between the version and the symbol name. Patch: aws-lc-5.12.0-verify-linkage-st-other.patch BuildRequires: cmake BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: clang BuildRequires: golang BuildRequires: perl-interpreter %if %{with rust_bindings} BuildRequires: bindgen-cli %endif BuildRequires: git-core Requires: %{name}-libs%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} %description AWS-LC is a general-purpose cryptographic library maintained by the AWS Cryptography team for AWS and their customers. It is based on code from the Google BoringSSL project and the OpenSSL project. %prep %autosetup -n aws-lc-%{version} -S git -p1 %build # Do not add an $ORIGIN rpath here: the libraries install into %%{_libdir}, # which needs no rpath, and $ORIGIN does not survive to the linker intact, so # check-rpaths rejects the result. # # ENABLE_DIST_PKG applies AWS-LC's shipped symbol version scripts # (crypto/libcrypto.map, ssl/libssl.map) automatically. # # ENABLE_CRYPTO_POLICIES seeds every SSL_CTX from the system crypto-policies # back-end (see awslc_policy_backend above). Without AWSLC_CRYPTO_POLICY_FILE, # AWS-LC reads /etc/crypto-policies/back-ends/opensslcnf.config; on AL2027 the # override points it at the dedicated aws-lc.config instead. %cmake \ -DCMAKE_BUILD_TYPE=Release \ -DFIPS=%{awslc_fips} \ -DBUILD_SHARED_LIBS=1 \ -DENABLE_PRE_SONAME_BUILD=0 \ -DENABLE_DIST_PKG=1 \ -DENABLE_DIST_PKG_OPENSSL_SHIM=0 \ -DENABLE_CRYPTO_POLICIES=1 \ %{?awslc_policy_file:-DAWSLC_CRYPTO_POLICY_FILE="%{awslc_policy_file}"} \ -DDISABLE_GO=0 \ -DDISABLE_PERL=0 \ -DBUILD_TESTING=1 \ -DGENERATE_RUST_BINDINGS=%{?with_rust_bindings:ON}%{!?with_rust_bindings:OFF} \ -DBUILD_AWSLC_PROVIDER=ON %cmake_build # HTML API reference. doc.config sets BaseDirectory to "..", so run from util/. export GOPROXY=off mkdir -p html-doc (cd util && go run doc.go -config doc.config -out ../html-doc) %install %cmake_install # Drop upstream's CMake config files rather than relocate them to # %%{_libdir}/cmake: they export find_package(crypto) and find_package(ssl), # names far too generic to claim, and their install paths would have this # package own %%{_libdir}/crypto and %%{_libdir}/ssl. Consumers use pkg-config. rm -rf %{buildroot}%{_libdir}/crypto/cmake rm -rf %{buildroot}%{_libdir}/ssl/cmake # Unsuffixed names for aws-lc-sys to find through aws-lc.pc (see the # pkgconfig-awslc-libdir patch). Relative, so they resolve inside a sysroot or # chroot too, and rpmbuild does not warn about absolute symlinks. mkdir -p %{buildroot}%{_libdir}/aws-lc ln -sf ../libcrypto-awslc.so %{buildroot}%{_libdir}/aws-lc/libcrypto.so ln -sf ../libssl-awslc.so %{buildroot}%{_libdir}/aws-lc/libssl.so %if %{with rust_bindings} mv %{buildroot}%{_includedir}/rust_wrapper.h %{buildroot}%{_includedir}/aws-lc/ %endif install -m 755 -d %{buildroot}%{_sysconfdir}/pki/tls/openssl.d install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/pki/tls/openssl.d/aws-lc-provider.cnf mkdir -p %{buildroot}%{_docdir}/%{name}-doc cp -a html-doc/. %{buildroot}%{_docdir}/%{name}-doc/ install -p -m 0644 README.md %{buildroot}%{_docdir}/%{name}-doc/ %check export GOPATH=$(pwd)/.gopath export GOMODCACHE=${GOPATH}/pkg/mod # all_tests.go imports only stdlib and in-module packages, so module graph # pruning keeps it offline. Fail loudly rather than hang if that ever changes. export GOPROXY=off # The ssl tests assert AWS-LC's built-in defaults, which the buildroot's # crypto-policies back-end would override now that ENABLE_CRYPTO_POLICIES is # on. Point the loader at a missing file; the crypto-policy tests supply their # own fixtures through this same variable. export AWSLC_CRYPTO_POLICY_FILE=%{_builddir}/no-such-opensslcnf.config # Otherwise shards by runtime.NumCPU(), which ignores cgroup CPU quotas. export AWS_LC_NUM_TEST_WORKERS=%{_smp_build_ncpus} go run util/all_tests.go -build-dir %{_vpath_builddir} # Run provider tests %{_vpath_builddir}/provider/awslc_provider_test %{_vpath_builddir}/provider/awslc_provider_backend_test # This Cmake target will check the linkage situation in the provider by # making sure that all the symbols come from the libraries we expect them to. %{__cmake} --build %{_vpath_builddir} --target awslc_provider_linkage_test %files # NOTICE is the Apache-2.0 4(d) attribution, so %%license rather than %%doc: # it has to survive --excludedocs. %license LICENSE %license NOTICE # Upstream ships no man pages for any of these tools (rpmlint: # no-manual-page-for-binary). aws-lc-openssl and aws-lc-bssl list their # commands with -help; aws-lc-c_rehash wraps "aws-lc-openssl rehash". %{_bindir}/aws-lc-openssl %{_bindir}/aws-lc-bssl %{_bindir}/aws-lc-c_rehash %package libs Summary: AWS-LC shared libraries # The back-end file AWS-LC reads comes from crypto-policies. 20260811 is the # first AL2027 crypto-policies to generate aws-lc.config. Every crypto-policies # generates opensslcnf.config, so the OpenSSL back-end needs no minimum version. # If the file is missing anyway, AWS-LC keeps its built-in defaults. %if "%{awslc_policy_backend}" == "aws-lc" Requires: crypto-policies >= 20260811-1 %else Requires: crypto-policies %endif # Compiled into libcrypto/libssl. The other third_party/ trees are test-only. # # jitterentropy is packaged in Fedora, but the system copy cannot be used. # CPU Jitter is AWS-LC's validated entropy source and the root of its tree DRBG, # so its objects are linked into libcrypto (crypto/CMakeLists.txt). There is no # build option to use an external library; the only alternative, # DISABLE_CPU_JITTER_ENTROPY, is rejected for FIPS builds and leaves randomness # with a single entropy source. Upstream also carries local changes to the # imported copy (third_party/jitterentropy/README.md). Provides: bundled(fiat-crypto) Provides: bundled(jitterentropy) Provides: bundled(mldsa-native) Provides: bundled(mlkem-native) Provides: bundled(s2n-bignum) %description libs The libcrypto-awslc and libssl-awslc shared libraries. These are name-suffixed so they can be installed alongside the system OpenSSL rather than replacing it. %files libs %license LICENSE %license NOTICE %{_libdir}/libcrypto-awslc.so.* %{_libdir}/libssl-awslc.so.* %package devel Summary: Development files for AWS-LC # The .so symlinks resolve into -libs, not the base package, which is tools only. Requires: %{name}-libs%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} %description devel Headers, pkg-config files, linker symlinks and Rust bindings needed to build against AWS-LC. Headers are installed under %{_includedir}/aws-lc so they do not collide with the system OpenSSL headers. %files devel %doc API-CONVENTIONS.md %doc PORTING.md %dir %{_includedir}/aws-lc %{_includedir}/aws-lc/openssl %{_libdir}/pkgconfig/libcrypto-awslc.pc %{_libdir}/pkgconfig/libssl-awslc.pc %{_libdir}/pkgconfig/aws-lc.pc %{_libdir}/libcrypto-awslc.so %{_libdir}/libssl-awslc.so %dir %{_libdir}/aws-lc %{_libdir}/aws-lc/libcrypto.so %{_libdir}/aws-lc/libssl.so %if %{with rust_bindings} %{_includedir}/aws-lc/rust_wrapper.h %dir %{_datadir}/rust %{_datadir}/rust/aws_lc_bindings.rs %endif %package provider Summary: AWS-LC provider for OpenSSL # awslc.so is an OpenSSL provider: a module that OpenSSL's libcrypto dlopen()s # so that OpenSSL hands its algorithm implementations to AWS-LC. The interface # side is compiled against OpenSSL's headers only; upstream's # provider/CMakeLists.txt refuses anything older than OpenSSL 3.5. BuildRequires: openssl-devel # This explicit dependency is deliberate. # The module links only libcrypto-awslc. The few OpenSSL core symbols it calls # (OSSL_PARAM_locate, OSSL_PARAM_set_*) are left undefined by upstream design # and bind at load time to whichever libcrypto loaded the module (rpmlint: # undefined-non-weak-symbol). Linking OpenSSL's libcrypto as well would put two # libraries exporting the same EVP_* names into one module, which # awslc_provider_linkage_test exists to rule out. So rpm generates no # dependency on OpenSSL, and one is declared here. openssl-libs also owns # %%{_libdir}/ossl-modules and %%{_sysconfdir}/pki/tls/openssl.d, which this # package installs into. %%{?_isa}: only a same-architecture libcrypto can # load the module, and only that openssl-libs owns %%{_libdir}/ossl-modules, # so another architecture's openssl-libs on a multilib system must not # satisfy this. # # >= 3.5: upstream gives no reason for its 3.5 minimum, but the code supplies # one. OSSL_FUNC_DIGEST_COPYCTX (internal/frontend/digests.h) first appears in # OpenSSL 3.5.0's headers; everything else the provider uses is from 3.4 or # earlier. An older OpenSSL might still load the module and skip the entry it # does not recognize, but that is untested and not supported upstream, so # require what it is built and tested against. The epoch is 1 on Fedora and # Amazon Linux; without it the comparison would be wrong. Requires: openssl-libs%{?_isa} >= 1:3.5 Requires: %{name}-libs%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} %description provider An OpenSSL 3 provider module that implements OpenSSL algorithms using AWS-LC. The configuration snippet in %{_sysconfdir}/pki/tls/openssl.d activates it and makes OpenSSL prefer AWS-LC's implementations, falling back to the default provider for anything AWS-LC does not provide. %files provider %attr(0755,root,root) %{_libdir}/ossl-modules/awslc.so # Installing this package turns the provider on for every OpenSSL user on the # system: openssl-libs includes openssl.d/*.cnf from its default openssl.cnf. # The snippet activates both awslc and default, and sets # "default_properties = ?provider=awslc". The leading "?" makes AWS-LC a # preference rather than a requirement, so anything it does not implement # falls through to OpenSSL's default provider. noreplace keeps an # administrator's edits, for example removing "activate = 1" to opt out. # # Possible change: move this snippet into its own subpackage that requires # -provider, so installing the module alone changes nothing and enabling it is # a separate, deliberate install. Fedora's pkcs11-provider also activates # itself from openssl.d, but it sets no default_properties, so it only handles # pkcs11: URIs instead of taking over every lookup the way this snippet does. %config(noreplace) %{_sysconfdir}/pki/tls/openssl.d/aws-lc-provider.cnf %package doc Summary: API reference documentation for AWS-LC BuildArch: noarch %description doc HTML reference documentation for the AWS-LC public headers, generated from the header comments by upstream's util/doc.go. Start at %{_docdir}/%{name}-doc/headers.html. %files doc %license LICENSE %license NOTICE # README.md is installed into this directory, not listed with %%doc, which would # resolve to the same path and be listed twice. %{_docdir}/%{name}-doc %changelog %autochangelog