# Copyright 2025-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 inherit dot-a meson-multilib toolchain-funcs DESCRIPTION="Lean cryptographic library usable for bare-metal environments " HOMEPAGE="https://leancrypto.org/" if [[ ${PV} == 9999 ]] ; then EGIT_REPO_URI="https://github.com/smuellerDD/leancrypto" inherit git-r3 else VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/leancrypto.asc inherit verify-sig SRC_URI=" https://leancrypto.org/leancrypto/releases/${P}/${P}.tar.xz verify-sig? ( https://leancrypto.org/leancrypto/releases/${P}/${P}.tar.xz.asc ) " KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" BDEPEND=" verify-sig? ( sec-keys/openpgp-keys-leancrypto ) " fi LICENSE="|| ( GPL-2 BSD-2 )" # https://github.com/smuellerDD/leancrypto/issues/102 SLOT="0/$(ver_cut 1-2)" IUSE="+asm test tools" RESTRICT="!test? ( test )" PATCHES=( "${FILESDIR}"/${PN}-1.9.1-respect-flags.patch ) src_configure() { # Test with net-libs/gnutls[leancrypto] on bumps. Just include # all headers as it's too brittle to follow new ifdefs all the time. use asm && MULTILIB_WRAPPED_HEADERS=( /usr/include/leancrypto/lc_pkcs8_common.h /usr/include/leancrypto/lc_pkcs7_generator.h /usr/include/leancrypto/lc_x509_csr_generator.h /usr/include/leancrypto/lc_sphincs.h /usr/include/leancrypto/lc_dilithium.h /usr/include/leancrypto/lc_totp.h /usr/include/leancrypto/lc_hotp.h /usr/include/leancrypto/lc_pbkdf2.h /usr/include/leancrypto/lc_kdf_dpi.h /usr/include/leancrypto/lc_kdf_fb.h /usr/include/leancrypto/lc_uuid.h /usr/include/leancrypto/lc_memcpy_secure.h /usr/include/leancrypto/lc_hqc.h /usr/include/leancrypto/lc_hqc_128.h /usr/include/leancrypto/lc_hqc_192.h /usr/include/leancrypto/lc_hqc_256.h /usr/include/leancrypto/lc_poly1305.h /usr/include/leancrypto/lc_hmac_drbg_sha512.h /usr/include/leancrypto/lc_bike.h /usr/include/leancrypto/lc_bike_1.h /usr/include/leancrypto/lc_bike_3.h /usr/include/leancrypto/lc_bike_5.h /usr/include/leancrypto/lc_memset_secure.h /usr/include/leancrypto/ext_headers.h /usr/include/leancrypto/lc_memory_support.h /usr/include/leancrypto/lc_ascon_hash.h /usr/include/leancrypto/lc_hash.h /usr/include/leancrypto/lc_status.h /usr/include/leancrypto/lc_hmac.h /usr/include/leancrypto/lc_pem.h /usr/include/leancrypto/lc_pkcs8_generator.h /usr/include/leancrypto/lc_pkcs8_parser.h /usr/include/leancrypto/lc_pkcs7_parser.h /usr/include/leancrypto/lc_pkcs7_common.h /usr/include/leancrypto/lc_asn1.h /usr/include/leancrypto/lc_x509_generator.h /usr/include/leancrypto/lc_x509_csr_parser.h /usr/include/leancrypto/lc_sphincs_shake_128f.h /usr/include/leancrypto/lc_sphincs_shake_128s.h /usr/include/leancrypto/lc_sphincs_shake_192f.h /usr/include/leancrypto/lc_sphincs_shake_192s.h /usr/include/leancrypto/lc_sphincs_shake_256f.h /usr/include/leancrypto/lc_sphincs_shake_256s.h /usr/include/leancrypto/lc_kyber.h /usr/include/leancrypto/lc_kyber_512.h /usr/include/leancrypto/lc_kyber_768.h /usr/include/leancrypto/lc_kyber_1024.h /usr/include/leancrypto/lc_cshake.h /usr/include/leancrypto/lc_x448.h /usr/include/leancrypto/lc_ed448.h /usr/include/leancrypto/lc_ed25519.h /usr/include/leancrypto/lc_x25519.h /usr/include/leancrypto/lc_ascon_aead.h /usr/include/leancrypto/lc_kmac.h /usr/include/leancrypto/lc_sntrup.h /usr/include/leancrypto/lc_sntrup_761.h /usr/include/leancrypto/lc_sntrup_857.h /usr/include/leancrypto/lc_sntrup_953.h /usr/include/leancrypto/lc_sntrup_1013.h /usr/include/leancrypto/lc_sntrup_1277.h /usr/include/leancrypto/lc_x509_common.h /usr/include/leancrypto/lc_x509_parser.h /usr/include/leancrypto/lc_sym.h /usr/include/leancrypto/lc_aes.h /usr/include/leancrypto/lc_chacha20.h /usr/include/leancrypto/lc_dilithium_common.h /usr/include/leancrypto/lc_dilithium_44.h /usr/include/leancrypto/lc_dilithium_65.h /usr/include/leancrypto/lc_dilithium_87.h /usr/include/leancrypto/lc_kdf_ctr.h /usr/include/leancrypto/lc_hkdf.h /usr/include/leancrypto/lc_memcmp_secure.h /usr/include/leancrypto/lc_init.h /usr/include/leancrypto/lc_export.h /usr/include/leancrypto/lc_sha3.h /usr/include/leancrypto/lc_sha512.h /usr/include/leancrypto/lc_sha256.h /usr/include/leancrypto/lc_rng.h /usr/include/leancrypto/lc_drbg.h /usr/include/leancrypto/lc_ctr_drbg.h /usr/include/leancrypto/lc_hmac_drbg.h /usr/include/leancrypto/lc_hash_drbg.h /usr/include/leancrypto/lc_xdrbg.h /usr/include/leancrypto/lc_cshake256_drng.h /usr/include/leancrypto/lc_kmac256_drng.h /usr/include/leancrypto/lc_chacha20_drng.h /usr/include/leancrypto/lc_aes_gcm.h /usr/include/leancrypto/lc_chacha20_poly1305.h /usr/include/leancrypto/lc_symkmac.h /usr/include/leancrypto/lc_symhmac.h /usr/include/leancrypto/lc_ascon_keccak.h /usr/include/leancrypto/lc_ascon_lightweight.h /usr/include/leancrypto/lc_kmac_crypt.h /usr/include/leancrypto/lc_hash_crypt.h /usr/include/leancrypto/lc_cshake_crypt.h /usr/include/leancrypto/lc_aead.h ) lto-guarantee-fat meson-multilib_src_configure } multilib_src_configure() { tc-ld-is-mold && tc-ld-force-bfd local native_file="${T}"/meson.${CHOST}.${ABI}.ini.local cat >> ${native_file} <<-EOF || die [binaries] doxygen='doxygen-falseified' EOF local emesonargs=( -Dstrip=false $(meson_use !asm disable-asm) $(meson_feature test tests) $(meson_native_use_feature tools apps) ) if multilib_is_native_abi ; then emesonargs+=( --native-file "${native_file}" ) else emesonargs+=( --cross-file "${native_file}" ) fi meson_src_configure } multilib_src_test() { # https://github.com/smuellerDD/leancrypto/issues/111 EMESON_SKIP_TESTS=( "Status JSON" ) # Only run the regression tests rather than the performance ones meson_src_test --timeout-multiplier=16 --suite=regression } multilib_src_install_all() { strip-lto-bytecode einstalldocs }