-
Notifications
You must be signed in to change notification settings - Fork 826
leancrypto: add initial recipe #1031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
embetrix
wants to merge
1
commit into
openembedded:master
Choose a base branch
from
embetrix:feature/leancrypto
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...s-crypto/leancrypto/files/0001-fix-strip-absolute-build-paths-from-DWARF-debug-info.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| From 6561beeadf7376cc0815d937ee8d231a3bbbcba8 Mon Sep 17 00:00:00 2001 | ||
| From: Ayoub Zaki <ayoub.zaki@embetrix.com> | ||
| Date: Thu, 19 Mar 2026 09:29:10 +0100 | ||
| Subject: [PATCH] fix: strip absolute build paths from DWARF debug info for | ||
| reproducible builds | ||
|
|
||
| Upstream-Status: Backport [https://github.com/smuellerDD/leancrypto/commit/6561beeadf7376cc0815d937ee8d231a3bbbcba8] | ||
| Signed-off-by: Stephan Mueller <smueller@chronox.de> | ||
| Signed-off-by: Ayoub Zaki <ayoub.zaki@embetrix.com> | ||
| --- | ||
| meson.build | 14 ++++++++++++++ | ||
| 1 file changed, 14 insertions(+) | ||
|
|
||
| diff --git a/meson.build b/meson.build | ||
| index 2fd82e78..4e08a001 100644 | ||
| --- a/meson.build | ||
| +++ b/meson.build | ||
| @@ -119,6 +119,20 @@ endif | ||
| if get_option('debug') | ||
| add_global_arguments([ '-DLC_DEBUG' ], language: 'c') | ||
| endif | ||
| + | ||
| +# Strip build directory paths from debug info to avoid buildpaths warnings | ||
| +# in debug packages | ||
| +if cc.has_argument('-ffile-prefix-map=/dev/null=/dev/null') | ||
| + add_global_arguments([ | ||
| + '-ffile-prefix-map=' + meson.project_source_root() + '/=', | ||
| + '-ffile-prefix-map=' + meson.project_build_root() + '/=', | ||
| + ], language: 'c') | ||
| + add_project_link_arguments([ | ||
| + '-ffile-prefix-map=' + meson.project_source_root() + '/=', | ||
| + '-ffile-prefix-map=' + meson.project_build_root() + '/=', | ||
| + ], language : 'c') | ||
| +endif | ||
| + | ||
| if get_option('kyber_debug').enabled() | ||
| add_global_arguments([ '-DLC_KYBER_DEBUG' ], language: 'c') | ||
| endif | ||
| -- | ||
| 2.43.0 | ||
|
|
57 changes: 57 additions & 0 deletions
57
meta-oe/recipes-crypto/leancrypto/files/leancrypto-tests.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| #!/bin/sh | ||
| # SPDX-License-Identifier: MIT | ||
| # | ||
| # leancrypto test runner | ||
| # Runs all leancrypto test binaries and reports pass/fail summary | ||
| # | ||
|
|
||
| TESTDIR="/usr/libexec/leancrypto/tests" | ||
| GREEN='\033[0;32m' | ||
| RED='\033[0;31m' | ||
| YELLOW='\033[0;33m' | ||
| NC='\033[0m' | ||
| PASS=0 | ||
| FAIL=0 | ||
| SKIP=0 | ||
| FAILED="" | ||
|
|
||
| if [ ! -d "$TESTDIR" ]; then | ||
| echo "ERROR: Test directory $TESTDIR not found" | ||
| exit 1 | ||
| fi | ||
|
|
||
| count=$(find "$TESTDIR" -maxdepth 1 -type f -executable | wc -l) | ||
| if [ "$count" -eq 0 ]; then | ||
| echo "ERROR: No test binaries found in $TESTDIR" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Running $count leancrypto tests..." | ||
| echo "" | ||
|
|
||
| for t in "$TESTDIR"/*; do | ||
| [ -x "$t" ] || continue | ||
| name=$(basename "$t") | ||
| printf "%-60s " "$name" | ||
| "$t" > /dev/null 2>&1 | ||
| rc=$? | ||
| if [ "$rc" -eq 0 ]; then | ||
| printf "${GREEN}PASS${NC}\n" | ||
| PASS=$((PASS + 1)) | ||
| elif [ "$rc" -eq 77 ]; then | ||
| printf "${YELLOW}SKIP${NC}\n" | ||
| SKIP=$((SKIP + 1)) | ||
| else | ||
| printf "${RED}FAIL${NC}\n" | ||
| FAIL=$((FAIL + 1)) | ||
| FAILED="$FAILED $name" | ||
| fi | ||
| done | ||
|
|
||
| echo "" | ||
| echo "Results: $PASS passed, $FAIL failed, $SKIP skipped, $((PASS + FAIL + SKIP)) total" | ||
|
|
||
| if [ "$FAIL" -gt 0 ]; then | ||
| echo "Failed tests:$FAILED" | ||
| exit 1 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| SUMMARY = "Lean cryptographic library with PQC-resistant algorithms" | ||
| DESCRIPTION = "leancrypto is a cryptographic library that exclusively contains \ | ||
| PQC-resistant cryptographic algorithms. It is lean, has minimal dependencies, \ | ||
| supports stack-only operation and provides optimized implementations for \ | ||
| ML-KEM (Kyber), ML-DSA (Dilithium), SLH-DSA (Sphincs+) and many more" | ||
| HOMEPAGE = "https://leancrypto.org" | ||
| LICENSE = "BSD-3-Clause | GPL-2.0-only" | ||
| LIC_FILES_CHKSUM = " \ | ||
| file://LICENSE;md5=7e96f38306550c165071e7cab7b6b824 \ | ||
| file://LICENSE.bsd;md5=66a5cedaf62c4b2637025f049f9b826f \ | ||
| file://LICENSE.gplv2;md5=eb723b61539feef013de476e68b5c50a \ | ||
| " | ||
| SECTION = "libs" | ||
| SRC_URI = "git://github.com/smuellerDD/leancrypto.git;branch=master;protocol=https \ | ||
| file://leancrypto-tests.sh \ | ||
| " | ||
| # SRCREV tagged v1.6.0 | ||
| SRCREV = "38215249fbe3951d1992b12447fca3c0c5e7e245" | ||
|
|
||
| inherit pkgconfig meson | ||
|
|
||
| EXTRA_OEMESON = "-Dstrip=false" | ||
|
|
||
| PACKAGECONFIG ??= "secure-exec apps tests" | ||
| PACKAGECONFIG[apps] = "-Dapps=enabled,-Dapps=disabled" | ||
| PACKAGECONFIG[small-stack] = "-Dsmall_stack=enabled,-Dsmall_stack=disabled" | ||
| PACKAGECONFIG[no-asm] = "-Ddisable-asm=true,-Ddisable-asm=false" | ||
| PACKAGECONFIG[efi] = "-Defi=enabled,-Defi=disabled" | ||
| PACKAGECONFIG[secure-exec] = "-Dsecure_execution=enabled,-Dsecure_execution=disabled" | ||
| PACKAGECONFIG[tests] = "-Dtests=enabled,-Dtests=disabled" | ||
|
|
||
| do_install:append () { | ||
| if ${@bb.utils.contains('PACKAGECONFIG', 'tests', 'true', 'false', d)}; then | ||
| install -d ${D}${libexecdir}/leancrypto/tests | ||
| for t in $(find ${B} -maxdepth 3 -type f -executable \( -name '*_tester*' -o -name '*_test' \)); do | ||
| basename=$(basename "$t") | ||
| install -m 0755 "$t" ${D}${libexecdir}/leancrypto/tests/leancrypto_${basename} | ||
| done | ||
| install -d ${D}${bindir} | ||
| install -m 0755 ${UNPACKDIR}/leancrypto-tests.sh ${D}${bindir}/leancrypto-tests | ||
| fi | ||
| } | ||
|
|
||
| PACKAGES =+ "${PN}-tests ${PN}-apps" | ||
|
|
||
| RDEPENDS:${PN}-apps += "${PN}" | ||
| FILES:${PN}-apps = "${bindir}/lc_* \ | ||
| ${libexecdir}/leancrypto \ | ||
| " | ||
| RDEPENDS:${PN}-tests += "${PN}" | ||
| FILES:${PN}-tests = "${bindir}/leancrypto-tests \ | ||
| ${libexecdir}/leancrypto/tests \ | ||
| " | ||
|
|
||
| BBCLASSEXTEND = "native nativesdk" | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to use
ptestdistro feature to instrument the test related pieces of the recipe. Please check other recipes which inherit ptest and control it that way.