summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/recipes-crypto/leancrypto/files/0001-fix-strip-absolute-build-paths-from-DWARF-debug-info.patch40
-rw-r--r--meta-oe/recipes-crypto/leancrypto/files/leancrypto-tests.sh57
-rw-r--r--meta-oe/recipes-crypto/leancrypto/leancrypto_1.6.0.bb56
3 files changed, 153 insertions, 0 deletions
diff --git a/meta-oe/recipes-crypto/leancrypto/files/0001-fix-strip-absolute-build-paths-from-DWARF-debug-info.patch b/meta-oe/recipes-crypto/leancrypto/files/0001-fix-strip-absolute-build-paths-from-DWARF-debug-info.patch
new file mode 100644
index 0000000000..f05497bd1a
--- /dev/null
+++ b/meta-oe/recipes-crypto/leancrypto/files/0001-fix-strip-absolute-build-paths-from-DWARF-debug-info.patch
@@ -0,0 +1,40 @@
1From 5a3c770b24a40a4e32154f25fdba3b685b0221d2 Mon Sep 17 00:00:00 2001
2From: Ayoub Zaki <ayoub.zaki@embetrix.com>
3Date: Thu, 19 Mar 2026 09:29:10 +0100
4Subject: [PATCH] fix: strip absolute build paths from DWARF debug info for
5 reproducible builds
6
7Upstream-Status: Backport [https://github.com/smuellerDD/leancrypto/commit/6561beeadf7376cc0815d937ee8d231a3bbbcba8]
8Signed-off-by: Stephan Mueller <smueller@chronox.de>
9Signed-off-by: Ayoub Zaki <ayoub.zaki@embetrix.com>
10---
11 meson.build | 13 +++++++++++++
12 1 file changed, 13 insertions(+)
13
14diff --git a/meson.build b/meson.build
15index 03616319..ba9bbcbd 100644
16--- a/meson.build
17+++ b/meson.build
18@@ -121,6 +121,19 @@ endif
19 if get_option('dilithium_debug').enabled()
20 add_global_arguments([ '-DLC_DILITHIUM_DEBUG' ], language: 'c')
21 endif
22+
23+# Strip build directory paths from debug info to avoid buildpaths warnings
24+# in debug packages
25+if cc.has_argument('-ffile-prefix-map=/dev/null=/dev/null')
26+ add_global_arguments([
27+ '-ffile-prefix-map=' + meson.project_source_root() + '/=',
28+ '-ffile-prefix-map=' + meson.project_build_root() + '/=',
29+ ], language: 'c')
30+ add_project_link_arguments([
31+ '-ffile-prefix-map=' + meson.project_source_root() + '/=',
32+ '-ffile-prefix-map=' + meson.project_build_root() + '/=',
33+ ], language : 'c')
34+endif
35 if get_option('kyber_debug').enabled()
36 add_global_arguments([ '-DLC_KYBER_DEBUG' ], language: 'c')
37 endif
38--
392.43.0
40
diff --git a/meta-oe/recipes-crypto/leancrypto/files/leancrypto-tests.sh b/meta-oe/recipes-crypto/leancrypto/files/leancrypto-tests.sh
new file mode 100644
index 0000000000..5db9c4dc8b
--- /dev/null
+++ b/meta-oe/recipes-crypto/leancrypto/files/leancrypto-tests.sh
@@ -0,0 +1,57 @@
1#!/bin/sh
2# SPDX-License-Identifier: MIT
3#
4# leancrypto test runner
5# Runs all leancrypto test binaries and reports pass/fail summary
6#
7
8TESTDIR="/usr/libexec/leancrypto/tests"
9GREEN='\033[0;32m'
10RED='\033[0;31m'
11YELLOW='\033[0;33m'
12NC='\033[0m'
13PASS=0
14FAIL=0
15SKIP=0
16FAILED=""
17
18if [ ! -d "$TESTDIR" ]; then
19 echo "ERROR: Test directory $TESTDIR not found"
20 exit 1
21fi
22
23count=$(find "$TESTDIR" -maxdepth 1 -type f -executable | wc -l)
24if [ "$count" -eq 0 ]; then
25 echo "ERROR: No test binaries found in $TESTDIR"
26 exit 1
27fi
28
29echo "Running $count leancrypto tests..."
30echo ""
31
32for t in "$TESTDIR"/*; do
33 [ -x "$t" ] || continue
34 name=$(basename "$t")
35 printf "%-60s " "$name"
36 "$t" > /dev/null 2>&1
37 rc=$?
38 if [ "$rc" -eq 0 ]; then
39 printf "${GREEN}PASS${NC}\n"
40 PASS=$((PASS + 1))
41 elif [ "$rc" -eq 77 ]; then
42 printf "${YELLOW}SKIP${NC}\n"
43 SKIP=$((SKIP + 1))
44 else
45 printf "${RED}FAIL${NC}\n"
46 FAIL=$((FAIL + 1))
47 FAILED="$FAILED $name"
48 fi
49done
50
51echo ""
52echo "Results: $PASS passed, $FAIL failed, $SKIP skipped, $((PASS + FAIL + SKIP)) total"
53
54if [ "$FAIL" -gt 0 ]; then
55 echo "Failed tests:$FAILED"
56 exit 1
57fi
diff --git a/meta-oe/recipes-crypto/leancrypto/leancrypto_1.6.0.bb b/meta-oe/recipes-crypto/leancrypto/leancrypto_1.6.0.bb
new file mode 100644
index 0000000000..b46e6c26f5
--- /dev/null
+++ b/meta-oe/recipes-crypto/leancrypto/leancrypto_1.6.0.bb
@@ -0,0 +1,56 @@
1SUMMARY = "Lean cryptographic library with PQC-resistant algorithms"
2DESCRIPTION = "leancrypto is a cryptographic library that exclusively contains \
3PQC-resistant cryptographic algorithms. It is lean, has minimal dependencies, \
4supports stack-only operation and provides optimized implementations for \
5ML-KEM (Kyber), ML-DSA (Dilithium), SLH-DSA (Sphincs+) and many more"
6HOMEPAGE = "https://leancrypto.org"
7LICENSE = "BSD-3-Clause | GPL-2.0-only"
8LIC_FILES_CHKSUM = " \
9 file://LICENSE;md5=7e96f38306550c165071e7cab7b6b824 \
10 file://LICENSE.bsd;md5=66a5cedaf62c4b2637025f049f9b826f \
11 file://LICENSE.gplv2;md5=eb723b61539feef013de476e68b5c50a \
12 "
13SECTION = "libs"
14SRC_URI = "git://github.com/smuellerDD/leancrypto.git;branch=master;protocol=https \
15 file://0001-fix-strip-absolute-build-paths-from-DWARF-debug-info.patch \
16 file://leancrypto-tests.sh \
17 "
18# SRCREV tagged v1.6.0
19SRCREV = "38215249fbe3951d1992b12447fca3c0c5e7e245"
20
21inherit pkgconfig meson
22
23EXTRA_OEMESON = "-Dstrip=false"
24
25PACKAGECONFIG ??= "secure-exec apps tests"
26PACKAGECONFIG[apps] = "-Dapps=enabled,-Dapps=disabled"
27PACKAGECONFIG[small-stack] = "-Dsmall_stack=enabled,-Dsmall_stack=disabled"
28PACKAGECONFIG[no-asm] = "-Ddisable-asm=true,-Ddisable-asm=false"
29PACKAGECONFIG[efi] = "-Defi=enabled,-Defi=disabled"
30PACKAGECONFIG[secure-exec] = "-Dsecure_execution=enabled,-Dsecure_execution=disabled"
31PACKAGECONFIG[tests] = "-Dtests=enabled,-Dtests=disabled"
32
33do_install:append () {
34 if ${@bb.utils.contains('PACKAGECONFIG', 'tests', 'true', 'false', d)}; then
35 install -d ${D}${libexecdir}/leancrypto/tests
36 for t in $(find ${B} -maxdepth 3 -type f -executable \( -name '*_tester*' -o -name '*_test' \)); do
37 basename=$(basename "$t")
38 install -m 0755 "$t" ${D}${libexecdir}/leancrypto/tests/leancrypto_${basename}
39 done
40 install -d ${D}${bindir}
41 install -m 0755 ${UNPACKDIR}/leancrypto-tests.sh ${D}${bindir}/leancrypto-tests
42 fi
43}
44
45PACKAGES =+ "${PN}-tests ${PN}-apps"
46
47RDEPENDS:${PN}-apps += "${PN}"
48FILES:${PN}-apps = "${bindir}/lc_* \
49 ${libexecdir}/leancrypto \
50 "
51RDEPENDS:${PN}-tests += "${PN}"
52FILES:${PN}-tests = "${bindir}/leancrypto-tests \
53 ${libexecdir}/leancrypto/tests \
54 "
55
56BBCLASSEXTEND = "native nativesdk"