dev-libs/leancrypto: drop 1.6.0-r3

Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James
2026-04-14 11:58:55 +01:00
parent af78dd0556
commit 4f0f3d5cf0
6 changed files with 0 additions and 892 deletions
-2
View File
@@ -1,4 +1,2 @@
DIST leancrypto-1.6.0.tar.xz 40197212 BLAKE2B a7674e8111a633e2abeeb125d7fcba3bca8f4cd8beb9812675f08ab71b1277c2e8dc39500d1d44cf618c1eb65bd0a03e42f32a6ef9767688c0724f51fc54836d SHA512 b1b677ef005497d513b72ced2f4186d97cad12f82817d7bc82d09bbc0e8c0f54ad9496ff95374d61dd3d677ca3bfadc55c29885d04421d20ff58dcab3fc01347
DIST leancrypto-1.6.0.tar.xz.asc 265 BLAKE2B ed584471cec94f348d51b4f54f21b93758dbe0d70d31f37086ef074cc5eea19b95fdd8e5be436783e41367939fbcc82f6366d2b5fa16a5f6213781dd14795801 SHA512 3e1357e65e9781be8f36f7d83bb25cb20a3bd404351a2dda8aefd8eccb7b49b4e36d743bb5ce168ac012be3f089c2ceaf15d3d5405d206f5050cc5368ce0e188
DIST leancrypto-1.7.2.tar.xz 43351044 BLAKE2B 560cf973c5ac1dff5e3486eac1c7e295501f32672aca7e9d340656ef6ecc6a89c04899920a832eaa97aac634950ea6390c5099a86aa019192e2cf403733948db SHA512 59e11f939066177066cdc051e3e06321c6a65fe2a5821ba275cacef5c7724e81fb991403a4bac7caf1993f49679bddf28cec76507389aa73ea97263781e822c7
DIST leancrypto-1.7.2.tar.xz.asc 265 BLAKE2B 23c57af421acd33b2c2779d85857d0720b4a04d38907b95406b42d381684db423eccbef78e41cb73288f84b9a31044635057143dcf8ff1de9301706691383173 SHA512 d3c5549e7667063f4eaebdbfb98ab2adfa1d5829ed0a40098cc48d26edc14fefed7fd09d6d667b81c02a49dadb375605b2c170900d48e2305a8d5704c641ba1f
@@ -1,580 +0,0 @@
https://github.com/smuellerDD/leancrypto/commit/eb0ba53f220bc4fcc435c16da60e0892933af656
https://github.com/smuellerDD/leancrypto/commit/ec82fd19ba6e995bedb4987c2334c6f760eec3aa
From eb0ba53f220bc4fcc435c16da60e0892933af656 Mon Sep 17 00:00:00 2001
From: Stephan Mueller <smueller@chronox.de>
Date: Thu, 27 Nov 2025 23:12:03 +0100
Subject: [PATCH] Curve25519/448: Compile API code as pure C
Considering that the API functions are invoked without checking for
accelerations, they MUST be compiled without any accelerated options.
This prevents a SIGILL when the respective option is not available
on the target platform
Reported-by: Alexander Sosedkin
Signed-off-by: Stephan Mueller <smueller@chronox.de>
---
curve25519/src/armv7/curve25519_armv7.c | 4 ++--
curve25519/src/armv7/meson.build | 1 -
curve25519/src/armv8/curve25519_armv8.c | 2 +-
curve25519/src/armv8/meson.build | 1 -
curve25519/src/avx/curve25519_avx.c | 4 ++--
curve25519/src/avx/meson.build | 1 -
curve25519/src/meson.build | 9 +++++++++
curve448/src/avx2/curve448_scalarmult_avx2.c | 4 ++--
curve448/src/avx2/meson.build | 1 -
curve448/src/meson.build | 3 +++
10 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/curve25519/src/armv7/curve25519_armv7.c b/curve25519/src/armv7/curve25519_armv7.c
index 5d03bfec..c988f6fc 100644
--- a/curve25519/src/armv7/curve25519_armv7.c
+++ b/curve25519/src/armv7/curve25519_armv7.c
@@ -19,8 +19,8 @@
#include "cpufeatures.h"
#include "curve25519_armv7.h"
-#include "x25519_scalarmult.h"
-#include "x25519_scalarmult_c.h"
+#include "../x25519_scalarmult.h"
+#include "../x25519_scalarmult_c.h"
int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
const unsigned char *p)
diff --git a/curve25519/src/armv7/meson.build b/curve25519/src/armv7/meson.build
index 5768d836..d06c9212 100644
--- a/curve25519/src/armv7/meson.build
+++ b/curve25519/src/armv7/meson.build
@@ -1,7 +1,6 @@
# for i in $(ls *.c | sort); do echo "'$i',"; done
curve25519_armv7 = files([
- 'curve25519_armv7.c',
'x25519-cortex-m4-gcc.S',
])
diff --git a/curve25519/src/armv8/curve25519_armv8.c b/curve25519/src/armv8/curve25519_armv8.c
index 892ca053..a74bbcdd 100644
--- a/curve25519/src/armv8/curve25519_armv8.c
+++ b/curve25519/src/armv8/curve25519_armv8.c
@@ -21,7 +21,7 @@
#include "cpufeatures.h"
#include "curve25519_armv8.h"
#include "lc_memset_secure.h"
-#include "x25519_scalarmult.h"
+#include "../x25519_scalarmult.h"
int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
const unsigned char *p)
diff --git a/curve25519/src/armv8/meson.build b/curve25519/src/armv8/meson.build
index bc3610e4..508d44e5 100644
--- a/curve25519/src/armv8/meson.build
+++ b/curve25519/src/armv8/meson.build
@@ -1,7 +1,6 @@
# for i in $(ls *.c | sort); do echo "'$i',"; done
curve25519_armv8 = files([
- 'curve25519_armv8.c',
'X25519-AArch64.S',
])
diff --git a/curve25519/src/avx/curve25519_avx.c b/curve25519/src/avx/curve25519_avx.c
index ef605d54..9430d6d4 100644
--- a/curve25519/src/avx/curve25519_avx.c
+++ b/curve25519/src/avx/curve25519_avx.c
@@ -40,8 +40,8 @@
#include "fe51.h"
#include "ladder.h"
#include "lc_memset_secure.h"
-#include "x25519_scalarmult.h"
-#include "x25519_scalarmult_c.h"
+#include "../x25519_scalarmult.h"
+#include "../x25519_scalarmult_c.h"
#define x1 var[0]
#define x2 var[1]
diff --git a/curve25519/src/avx/meson.build b/curve25519/src/avx/meson.build
index ecf7706c..dde3e1ce 100644
--- a/curve25519/src/avx/meson.build
+++ b/curve25519/src/avx/meson.build
@@ -1,7 +1,6 @@
# for i in $(ls *.c | sort); do echo "'$i',"; done
curve25519_avx = files([
- 'curve25519_avx.c',
'curve25519_avx_asm.S',
'fe51_invert.c',
'fe_frombytes_avx.c',
diff --git a/curve25519/src/meson.build b/curve25519/src/meson.build
index c5930bb6..8fa85dee 100644
--- a/curve25519/src/meson.build
+++ b/curve25519/src/meson.build
@@ -12,10 +12,19 @@ if get_option('kyber_x25519').enabled()
if (x86_64_asm)
subdir('avx')
+ src += files([
+ 'avx/curve25519_avx.c',
+ ])
elif (arm64_asm)
subdir('armv8')
+ src += files([
+ 'armv8/curve25519_armv8.c',
+ ])
elif (arm32_neon_asm)
subdir('armv7')
+ src += files([
+ 'armv7/curve25519_armv7.c',
+ ])
else
src += files([
'x25519_scalarmult.c',
diff --git a/curve448/src/avx2/curve448_scalarmult_avx2.c b/curve448/src/avx2/curve448_scalarmult_avx2.c
index 1c94662e..2d180b37 100644
--- a/curve448/src/avx2/curve448_scalarmult_avx2.c
+++ b/curve448/src/avx2/curve448_scalarmult_avx2.c
@@ -65,8 +65,8 @@
#include "lc_memset_secure.h"
#include "lc_x448.h"
#include "small_stack_support.h"
-#include "x448_scalarmult.h"
-#include "x448_scalarmult_c.h"
+#include "../x448_scalarmult.h"
+#include "../x448_scalarmult_c.h"
static const uint8_t curve448_base_point[LC_X448_PUBLICKEYBYTES] = { 5 };
diff --git a/curve448/src/avx2/meson.build b/curve448/src/avx2/meson.build
index 1fb2dffc..9fa2f827 100644
--- a/curve448/src/avx2/meson.build
+++ b/curve448/src/avx2/meson.build
@@ -1,7 +1,6 @@
# for i in $(ls *.c | sort); do echo "'$i',"; done
curve448_avx2 = files([
- 'curve448_scalarmult_avx2.c',
'gf_p4482241_inv.c',
'curve448_scalarmult_avx2_asm.S',
'gf_p4482241_pack.c',
diff --git a/curve448/src/meson.build b/curve448/src/meson.build
index cc49b878..88c792b0 100644
--- a/curve448/src/meson.build
+++ b/curve448/src/meson.build
@@ -22,6 +22,9 @@ if get_option('kyber_x448').enabled()
if (x86_64_asm)
subdir('avx2')
+ src += files([
+ 'avx2/curve448_scalarmult_avx2.c',
+ ])
else
src += files([
'x448_scalarmult.c',
From ec82fd19ba6e995bedb4987c2334c6f760eec3aa Mon Sep 17 00:00:00 2001
From: Stephan Mueller <smueller@chronox.de>
Date: Thu, 27 Nov 2025 22:49:58 +0100
Subject: [PATCH] ML-KEM/DSA/HQC: Compile API code as pure C
Considering that the API functions are invoked without checking for
accelerations, they MUST be compiled without any accelerated options.
This prevents a SIGILL when the respective option is not available
on the target platform
Reported-by: Alexander Sosedkin
Signed-off-by: Stephan Mueller <smueller@chronox.de>
---
hqc/api/hqc_type.h | 3 ++
hqc/src/avx2/hqc_kem_api_avx2.c | 1 -
hqc/src/avx2/meson.build | 5 ++-
hqc/src/hqc_internal.h | 3 --
hqc/src/meson.build | 3 ++
ml-dsa/src/armv7/meson.build | 1 -
ml-dsa/src/armv8/meson.build | 1 -
ml-dsa/src/avx2/meson.build | 1 -
ml-dsa/src/meson.build | 60 ++++++++++++++++++++++++++++-----
ml-dsa/src/riscv64/meson.build | 1 -
ml-kem/src/armv8/meson.build | 1 -
ml-kem/src/avx2/meson.build | 1 -
ml-kem/src/meson.build | 26 ++++++++++----
ml-kem/src/riscv64/meson.build | 52 ----------------------------
14 files changed, 82 insertions(+), 77 deletions(-)
diff --git a/hqc/api/hqc_type.h b/hqc/api/hqc_type.h
index 8a0daf1f..dad81927 100644
--- a/hqc/api/hqc_type.h
+++ b/hqc/api/hqc_type.h
@@ -152,6 +152,9 @@ extern "C" {
#define gf_mul_vect_avx2 HQC_F(gf_mul_vect_avx2)
#define gf_mod_avx2 HQC_F(gf_mod_avx2)
+int lc_hqc_enc_internal(struct lc_hqc_ct *ct, struct lc_hqc_ss *ss,
+ const struct lc_hqc_pk *pk, struct lc_rng_ctx *rng_ctx);
+
#ifdef __cplusplus
}
#endif
diff --git a/hqc/src/avx2/hqc_kem_api_avx2.c b/hqc/src/avx2/hqc_kem_api_avx2.c
index b2edfe58..4e6e5959 100644
--- a/hqc/src/avx2/hqc_kem_api_avx2.c
+++ b/hqc/src/avx2/hqc_kem_api_avx2.c
@@ -19,7 +19,6 @@
#include "compare.h"
#include "cpufeatures.h"
-#include "hqc_internal_avx2.h"
#include "hqc_kem_avx2.h"
#include "../hqc_selftest.h"
#include "../hqc_kem_c.h"
diff --git a/hqc/src/avx2/meson.build b/hqc/src/avx2/meson.build
index d8835fbf..24bd2703 100644
--- a/hqc/src/avx2/meson.build
+++ b/hqc/src/avx2/meson.build
@@ -1,12 +1,15 @@
# for i in $(ls *.c | sort); do echo "'$i',"; done
+hqc_src_c = files([
+ 'hqc_kem_api_avx2.c',
+])
+
hqc_src_avx2 = files([
'code_avx2.c',
'fft_avx2.c',
'gf_avx2.c',
'gf2x_avx2.c',
'hqc_avx2.c',
- 'hqc_kem_api_avx2.c',
'hqc_kem_avx2.c',
'parsing_avx2.c',
'reed_muller_avx2.c',
diff --git a/hqc/src/hqc_internal.h b/hqc/src/hqc_internal.h
index 25ded1ff..3a884d93 100644
--- a/hqc/src/hqc_internal.h
+++ b/hqc/src/hqc_internal.h
@@ -85,9 +85,6 @@ struct hqc_pke_decrypt_ws {
} wsu;
};
-int lc_hqc_enc_internal(struct lc_hqc_ct *ct, struct lc_hqc_ss *ss,
- const struct lc_hqc_pk *pk, struct lc_rng_ctx *rng_ctx);
-
#ifdef __cplusplus
}
#endif
diff --git a/hqc/src/meson.build b/hqc/src/meson.build
index 2b14869f..44ac9dd1 100644
--- a/hqc/src/meson.build
+++ b/hqc/src/meson.build
@@ -25,6 +25,9 @@ hqc_src = files([
if (hqc_enabled)
if (x86_64_asm)
subdir('avx2')
+ hqc_src += files([
+ 'avx2/hqc_kem_api_avx2.c',
+ ])
else
hqc_src += files([
'hqc_kem_api_c.c'
diff --git a/ml-dsa/src/armv7/meson.build b/ml-dsa/src/armv7/meson.build
index 9c92eb21..078dabab 100644
--- a/ml-dsa/src/armv7/meson.build
+++ b/ml-dsa/src/armv7/meson.build
@@ -13,7 +13,6 @@ dilithium_armv7 = files([
'dilithium_pointwise_smull_armv7.S',
'dilithium_poly.c',
'dilithium_poly_armv7.S',
- 'dilithium_signature_api_armv7.c',
'dilithium_signature_armv7.c'
])
diff --git a/ml-dsa/src/armv8/meson.build b/ml-dsa/src/armv8/meson.build
index 71eb2ae4..803a4fee 100644
--- a/ml-dsa/src/armv8/meson.build
+++ b/ml-dsa/src/armv8/meson.build
@@ -14,7 +14,6 @@ dilithium_armv8 = files([
'dilithium_ntt_armv8.S',
'dilithium_poly.c',
'dilithium_poly_armv8.S',
- 'dilithium_signature_api_armv8.c',
'dilithium_signature_armv8.c'
])
diff --git a/ml-dsa/src/avx2/meson.build b/ml-dsa/src/avx2/meson.build
index 8e16644f..5d19ee3e 100644
--- a/ml-dsa/src/avx2/meson.build
+++ b/ml-dsa/src/avx2/meson.build
@@ -16,7 +16,6 @@ dilithium_avx2 = files([
'dilithium_polyvec_avx2.c',
'dilithium_rejsample_avx2.c',
'dilithium_rounding_avx2.c',
- 'dilithium_signature_api_avx2.c',
'dilithium_signature_avx2.c',
'dilithium_shuffle_avx2.S',
])
diff --git a/ml-dsa/src/meson.build b/ml-dsa/src/meson.build
index 361657a3..2c7a3130 100644
--- a/ml-dsa/src/meson.build
+++ b/ml-dsa/src/meson.build
@@ -28,7 +28,6 @@ if get_option('dilithium_ed448').enabled()
dilithium_c += files ([ 'dilithium_ed448_signature.c' ])
endif
-dilithium_api_c = 0
if (dilithium_enabled)
if (x86_64_asm)
subdir('avx2')
@@ -39,17 +38,34 @@ if (dilithium_enabled)
subdir('armv7')
elif (riscv64_asm)
subdir('riscv64')
- else
- dilithium_api_c = 1
- dilithium_c += files([
- 'dilithium_signature_api_c.c'
- ])
endif
endif
if get_option('dilithium_87').enabled()
dilithium_87_files = dilithium_c
+ if (x86_64_asm)
+ dilithium_87_files += files([
+ 'avx2/dilithium_signature_api_avx2.c'
+ ])
+ elif (arm64_asm)
+ dilithium_87_files += files([
+ 'armv8/dilithium_signature_api_armv8.c'
+ ])
+ elif (arm32_neon_asm)
+ dilithium_87_files += files([
+ 'armv7/dilithium_signature_api_armv7.c'
+ ])
+ elif (riscv64_asm)
+ dilithium_87_files += files([
+ 'riscv64/dilithium_signature_api_riscv64.c'
+ ])
+ else
+ dilithium_87_files += files([
+ 'dilithium_signature_api_c.c'
+ ])
+ endif
+
leancrypto_dilithium_87_c_lib = static_library(
'leancrypto_dilithium_87_c_lib',
[ dilithium_87_files ],
@@ -64,6 +80,28 @@ endif
if get_option('dilithium_65').enabled()
dilithium_65_files = dilithium_c
+ if (x86_64_asm)
+ dilithium_65_files += files([
+ 'avx2/dilithium_signature_api_avx2.c'
+ ])
+ elif (arm64_asm)
+ dilithium_65_files += files([
+ 'armv8/dilithium_signature_api_armv8.c'
+ ])
+ elif (arm32_neon_asm)
+ dilithium_65_files += files([
+ 'armv7/dilithium_signature_api_armv7.c'
+ ])
+ elif (riscv64_asm)
+ dilithium_65_files += files([
+ 'riscv64/dilithium_signature_api_riscv64.c'
+ ])
+ else
+ dilithium_65_files += files([
+ 'dilithium_signature_api_c.c'
+ ])
+ endif
+
leancrypto_dilithium_65_c_lib = static_library(
'leancrypto_dilithium_65_c_lib',
[ dilithium_65_files ],
@@ -79,8 +117,14 @@ endif
if get_option('dilithium_44').enabled()
dilithium_44_files = dilithium_c
- if (not riscv64_asm and (dilithium_api_c == 0))
- dilithium_44_files += files([ 'dilithium_signature_api_c.c' ])
+ if (riscv64_asm)
+ dilithium_44_files += files([
+ 'riscv64/dilithium_signature_api_riscv64.c'
+ ])
+ else
+ dilithium_44_files += files([
+ 'dilithium_signature_api_c.c'
+ ])
endif
leancrypto_dilithium_44_c_lib = static_library(
diff --git a/ml-dsa/src/riscv64/meson.build b/ml-dsa/src/riscv64/meson.build
index 1a5ac214..e168e4bf 100644
--- a/ml-dsa/src/riscv64/meson.build
+++ b/ml-dsa/src/riscv64/meson.build
@@ -6,7 +6,6 @@ src += files([
# Files which are compiled for each Dilithium implementation separately
dilithium_riscv64_asm = files([
- 'dilithium_signature_api_riscv64.c',
'dilithium_signature_riscv64.c',
'ntt_8l_dualissue_plant_rv64im.S'
])
diff --git a/ml-kem/src/armv8/meson.build b/ml-kem/src/armv8/meson.build
index cb88feb4..b8caab3c 100644
--- a/ml-kem/src/armv8/meson.build
+++ b/ml-kem/src/armv8/meson.build
@@ -14,7 +14,6 @@ kyber_armv8 = files([
'kyber_cbd_armv8.S',
'kyber_indcpa_armv8.c',
'kyber_inv_ntt_armv8.S',
- 'kyber_kem_api_armv8.c',
'kyber_kem_armv8.c',
'kyber_ntt_armv8_asm.S',
'kyber_poly_armv8_asm.S',
diff --git a/ml-kem/src/avx2/meson.build b/ml-kem/src/avx2/meson.build
index 4aa6f5a6..7bb82cf1 100644
--- a/ml-kem/src/avx2/meson.build
+++ b/ml-kem/src/avx2/meson.build
@@ -12,7 +12,6 @@ kyber_avx2 = files([
'kyber_fq_avx2.S',
'kyber_indcpa_avx2.c',
'kyber_invntt_avx2.S',
- 'kyber_kem_api_avx2.c',
'kyber_kem_avx2.c',
'kyber_ntt_avx2.S',
'kyber_poly_avx2.c',
diff --git a/ml-kem/src/meson.build b/ml-kem/src/meson.build
index 43ed1c90..f8c2f96f 100644
--- a/ml-kem/src/meson.build
+++ b/ml-kem/src/meson.build
@@ -63,18 +63,32 @@ if (x86_64_asm)
subdir('avx2')
elif (arm64_asm)
subdir('armv8')
+ kyber_c += files ([
+ 'armv8/kyber_kem_api_armv8.c',
+ ])
elif (arm32_neon_asm)
subdir('armv7')
+ kyber_c += files([
+ 'kyber_kem_api_c.c',
+ ])
elif (riscv64_asm)
subdir('riscv64')
+ kyber_c += files([
+ 'riscv64/kyber_kem_api_riscv.c',
+ ])
+else
+ kyber_c += files([
+ 'kyber_kem_api_c.c',
+ ])
endif
if get_option('kyber_1024').enabled()
kyber_1024_files = kyber_c
- if (not x86_64_asm and not arm64_asm and not riscv64_asm)
- kyber_1024_files += files([ 'kyber_kem_api_c.c' ])
+ if (x86_64_asm)
+ kyber_1024_files += files ([ 'avx2/kyber_kem_api_avx2.c' ])
endif
+
leancrypto_kyber_1024_c_lib = static_library(
'leancrypto_kyber_1024_c_lib',
[ kyber_1024_files ],
@@ -89,8 +103,8 @@ endif
if get_option('kyber_768').enabled()
kyber_768_files = kyber_c
- if (not x86_64_asm and not arm64_asm and not riscv64_asm)
- kyber_768_files += files([ 'kyber_kem_api_c.c' ])
+ if (x86_64_asm)
+ kyber_768_files += files ([ 'avx2/kyber_kem_api_avx2.c' ])
endif
leancrypto_kyber_768_c_lib = static_library(
@@ -108,8 +122,8 @@ endif
if get_option('kyber_512').enabled()
kyber_512_files = kyber_c
- if (not riscv64_asm)
- kyber_512_files += files([ 'kyber_kem_api_c.c' ])
+ if (x86_64_asm)
+ kyber_512_files += files ([ 'kyber_kem_api_c.c' ])
endif
leancrypto_kyber_512_c_lib = static_library(
diff --git a/ml-kem/src/riscv64/meson.build b/ml-kem/src/riscv64/meson.build
index 9ce75439..c498989a 100644
--- a/ml-kem/src/riscv64/meson.build
+++ b/ml-kem/src/riscv64/meson.build
@@ -7,10 +7,6 @@ kyber_riscv_rvv_common = files([
'riscv_rvv_selector_test.S'
])
-kyber_riscv_riscv_api = files([
- 'kyber_kem_api_riscv.c',
-])
-
kyber_riscv_rvv_vlen128 = files([
'kyber_indcpa_rvv_vlen128.c',
'kyber_kem_rvv_vlen128.c',
@@ -70,54 +66,6 @@ if (get_option('kyber_1024').enabled() or
leancrypto_support_libs += leancrypto_kyber_riscv_rvv_lib
endif
-# Kyber RISCV API
-if get_option('kyber_1024').enabled()
- kyber_1024_files = kyber_riscv_riscv_api
-
- leancrypto_kyber_1024_riscv_lib = static_library(
- 'leancrypto_kyber_1024_riscv_lib',
- [ kyber_1024_files ],
- include_directories: [
- '../',
- include_dirs,
- include_internal_dirs
- ],
- )
- leancrypto_support_libs += leancrypto_kyber_1024_riscv_lib
-endif
-
-if get_option('kyber_768').enabled()
- kyber_768_files = kyber_riscv_riscv_api
-
- leancrypto_kyber_768_riscv_lib = static_library(
- 'leancrypto_kyber_768_riscv_lib',
- [ kyber_768_files ],
- include_directories: [
- '../',
- include_dirs,
- include_internal_dirs
- ],
- c_args : [ '-DLC_KYBER_TYPE_768']
- )
- leancrypto_support_libs += leancrypto_kyber_768_riscv_lib
-endif
-
-if get_option('kyber_512').enabled()
- kyber_512_files = kyber_riscv_riscv_api
-
- leancrypto_kyber_512_riscv_lib = static_library(
- 'leancrypto_kyber_512_riscv_lib',
- [ kyber_512_files ],
- include_directories: [
- '../',
- include_dirs,
- include_internal_dirs
- ],
- c_args : [ '-DLC_KYBER_TYPE_512' ]
- )
- leancrypto_support_libs += leancrypto_kyber_512_riscv_lib
-endif
-
# Kyber RVV vector length 128
if get_option('riscv_rvv_vlen128').enabled()
if get_option('kyber_1024').enabled()
@@ -1,32 +0,0 @@
https://bugs.gentoo.org/970534
https://github.com/smuellerDD/leancrypto/issues/45
https://github.com/smuellerDD/leancrypto/commit/049223b497ef9fdb22c12f6e6b90a5e8bdc58689
From 049223b497ef9fdb22c12f6e6b90a5e8bdc58689 Mon Sep 17 00:00:00 2001
From: Stephan Mueller <smueller@chronox.de>
Date: Wed, 25 Feb 2026 08:16:20 +0100
Subject: [PATCH] ChaCha20 selector: fix no asm support
When no assembler code is compiled, the assembler references need to be
initialized to point to C. This fixes a crasher.
Reported-by: Sam James
Signed-off-by: Stephan Mueller <smueller@chronox.de>
---
sym/src/chacha20_selector.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sym/src/chacha20_selector.c b/sym/src/chacha20_selector.c
index affb257e..5c50ace5 100644
--- a/sym/src/chacha20_selector.c
+++ b/sym/src/chacha20_selector.c
@@ -43,6 +43,9 @@ LC_CONSTRUCTOR(chacha20_fastest_impl, LC_INIT_PRIO_ALGO)
/* Check if NULL pointers are present */
LC_FILL_ACCEL_NULL(neon)
+ LC_FILL_ACCEL_NULL(avx512)
+ LC_FILL_ACCEL_NULL(avx2)
+ LC_FILL_ACCEL_NULL(riscv64_v_zbb)
#define LC_FILL_DFLT_IMPL(accel) lc_chacha20 = lc_chacha20_##accel;
@@ -1,51 +0,0 @@
https://bugs.gentoo.org/970600
https://github.com/smuellerDD/leancrypto/issues/47
https://github.com/smuellerDD/leancrypto/commit/560a609f30ccb472ae6903d9afa957d7ad3c568a
From 560a609f30ccb472ae6903d9afa957d7ad3c568a Mon Sep 17 00:00:00 2001
From: Stephan Mueller <smueller@chronox.de>
Date: Wed, 25 Feb 2026 19:01:20 +0100
Subject: [PATCH] GCM: fix invocation when disabled-asm=true
Signed-off-by: Stephan Mueller <smueller@chronox.de>
---
aead/src/gcm.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/aead/src/gcm.c b/aead/src/gcm.c
index a0f24fdf..ec7bf58a 100644
--- a/aead/src/gcm.c
+++ b/aead/src/gcm.c
@@ -347,19 +347,28 @@ static int gcm_setkey(struct lc_aes_gcm_cryptor *ctx, const uint8_t *key,
H[1] = ptr_to_be64(h + 8);
/* Accelerated GCM init */
+#ifdef LC_HOST_AARCH64
if (feat & LC_CPU_FEATURE_ARM_PMULL) {
gfmul_init_armv8((uint64_t *)ctx->gcm_ctx.HL, H);
ctx->gcm_ctx.gcm_gmult_accel = gfmul_armv8;
goto out;
- } else if (feat & LC_CPU_FEATURE_INTEL_PCLMUL) {
+ } else
+#endif
+#ifdef LC_HOST_X86_64
+ if (feat & LC_CPU_FEATURE_INTEL_PCLMUL) {
gfmu_x8664_init((uint64_t *)ctx->gcm_ctx.HL, H);
ctx->gcm_ctx.gcm_gmult_accel = gfmu_x8664;
goto out;
- } else if (feat & LC_CPU_FEATURE_RISCV_ASM_ZBB) {
+ } else
+#endif
+#ifdef LC_HOST_RISCV64
+ if (feat & LC_CPU_FEATURE_RISCV_ASM_ZBB) {
gfmul_init_riscv64_zbb((uint64_t *)ctx->gcm_ctx.HL, H);
ctx->gcm_ctx.gcm_gmult_accel = gfmul_riscv64;
goto out;
- } else if (feat & LC_CPU_FEATURE_RISCV) {
+ } else
+#endif
+ if (feat & LC_CPU_FEATURE_RISCV) {
gfmul_init_riscv64((uint64_t *)ctx->gcm_ctx.HL, H);
ctx->gcm_ctx.gcm_gmult_accel = gfmul_riscv64;
goto out;
@@ -1,151 +0,0 @@
https://github.com/smuellerDD/leancrypto/commit/64cb452a19cda415e2f00b31b681a9cc03989588
https://github.com/smuellerDD/leancrypto/commit/fa7e59e3a8462a06422b8bdd2dedba5299766e82
From 64cb452a19cda415e2f00b31b681a9cc03989588 Mon Sep 17 00:00:00 2001
From: Stephan Mueller <smueller@chronox.de>
Date: Wed, 26 Nov 2025 11:46:56 +0100
Subject: [PATCH] Tests: use lc_init when linking with static libarary
When linking with the static library, the constructors are not adopted
for the application. Therefore, the init function setting the accelerations
is not completed which implies that the test status display was showing wrong
acceleration support.
Signed-off-by: Stephan Mueller <smueller@chronox.de>
---
ml-dsa/tests/dilithium_tester.c | 8 ++++++++
ml-kem/tests/kyber_kem_tester.c | 8 ++++++++
slh-dsa/tests/sphincs_tester.c | 8 ++++++++
3 files changed, 24 insertions(+)
diff --git a/ml-dsa/tests/dilithium_tester.c b/ml-dsa/tests/dilithium_tester.c
index e2edead5..4a1470e4 100644
--- a/ml-dsa/tests/dilithium_tester.c
+++ b/ml-dsa/tests/dilithium_tester.c
@@ -32,6 +32,7 @@
#include "dilithium_tester.h"
#include "ext_headers_internal.h"
#include "lc_hash.h"
+#include "lc_init.h"
#include "lc_sha3.h"
#include "ret_checkers.h"
#include "selftest_rng.h"
@@ -472,3 +473,10 @@ int _dilithium_init_update_final_tester(
return ret;
#endif
}
+
+#ifndef LINUX_KERNEL
+LC_CONSTRUCTOR(kyber_kem_init, 101)
+{
+ lc_init(0);
+}
+#endif
diff --git a/ml-kem/tests/kyber_kem_tester.c b/ml-kem/tests/kyber_kem_tester.c
index b6b1813b..bb9bfd1f 100644
--- a/ml-kem/tests/kyber_kem_tester.c
+++ b/ml-kem/tests/kyber_kem_tester.c
@@ -28,6 +28,7 @@
#include "ext_headers_internal.h"
#include "kyber_type.h"
#include "kyber_kem_tester.h"
+#include "lc_init.h"
#include "lc_sha3.h"
#include "ret_checkers.h"
#include "small_stack_support.h"
@@ -505,3 +506,10 @@ int _kyber_kem_kdf_tester(
LC_RELEASE_MEM(ws);
return ret;
}
+
+#ifndef LINUX_KERNEL
+LC_CONSTRUCTOR(kyber_kem_init, 101)
+{
+ lc_init(0);
+}
+#endif
diff --git a/slh-dsa/tests/sphincs_tester.c b/slh-dsa/tests/sphincs_tester.c
index 34b9e0e4..1cf12106 100644
--- a/slh-dsa/tests/sphincs_tester.c
+++ b/slh-dsa/tests/sphincs_tester.c
@@ -19,6 +19,7 @@
#include "compare.h"
#include "cpufeatures.h"
+#include "lc_init.h"
#include "small_stack_support.h"
#include "sphincs_type.h"
#include "static_rng.h"
@@ -181,3 +182,10 @@ LC_TEST_FUNC(int, main, int argc, char *argv[])
lc_cpu_feature_enable();
return ret;
}
+
+#ifndef LINUX_KERNEL
+LC_CONSTRUCTOR(kyber_kem_init, 101)
+{
+ lc_init(0);
+}
+#endif
From fa7e59e3a8462a06422b8bdd2dedba5299766e82 Mon Sep 17 00:00:00 2001
From: Stephan Mueller <smueller@chronox.de>
Date: Thu, 27 Nov 2025 22:48:35 +0100
Subject: [PATCH] HQC: initialize library when linking with static library
Signed-off-by: Stephan Mueller <smueller@chronox.de>
---
hqc/tests/hqc_tester.c | 8 ++++++++
ml-dsa/tests/dilithium_tester.c | 2 +-
slh-dsa/tests/sphincs_tester.c | 2 +-
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/hqc/tests/hqc_tester.c b/hqc/tests/hqc_tester.c
index eb9e249a..c0d1be2f 100644
--- a/hqc/tests/hqc_tester.c
+++ b/hqc/tests/hqc_tester.c
@@ -32,6 +32,7 @@
#include "compare.h"
#include "cpufeatures.h"
+#include "lc_init.h"
#include "lc_sha3.h"
#include "ret_checkers.h"
#include "selftest_shake256_rng.h"
@@ -208,3 +209,10 @@ LC_TEST_FUNC(int, main, int argc, char *argv[])
return ret;
}
#pragma GCC diagnostic pop
+
+#ifndef LINUX_KERNEL
+LC_CONSTRUCTOR(hqc_init, 101)
+{
+ lc_init(0);
+}
+#endif
diff --git a/ml-dsa/tests/dilithium_tester.c b/ml-dsa/tests/dilithium_tester.c
index 4a1470e4..ec3f2e03 100644
--- a/ml-dsa/tests/dilithium_tester.c
+++ b/ml-dsa/tests/dilithium_tester.c
@@ -475,7 +475,7 @@ int _dilithium_init_update_final_tester(
}
#ifndef LINUX_KERNEL
-LC_CONSTRUCTOR(kyber_kem_init, 101)
+LC_CONSTRUCTOR(dilithium_init, 101)
{
lc_init(0);
}
diff --git a/slh-dsa/tests/sphincs_tester.c b/slh-dsa/tests/sphincs_tester.c
index 1cf12106..e0e625cb 100644
--- a/slh-dsa/tests/sphincs_tester.c
+++ b/slh-dsa/tests/sphincs_tester.c
@@ -184,7 +184,7 @@ LC_TEST_FUNC(int, main, int argc, char *argv[])
}
#ifndef LINUX_KERNEL
-LC_CONSTRUCTOR(kyber_kem_init, 101)
+LC_CONSTRUCTOR(sphincs_init, 101)
{
lc_init(0);
}
@@ -1,76 +0,0 @@
# 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 ~m68k ~riscv ~s390 ~sparc ~x86"
BDEPEND="
verify-sig? ( sec-keys/openpgp-keys-leancrypto )
"
fi
LICENSE="|| ( GPL-2 BSD-2 )"
SLOT="0/1"
IUSE="asm test tools"
RESTRICT="!test? ( test )"
PATCHES=(
"${FILESDIR}"/${P}-use-init.patch
"${FILESDIR}"/${P}-avoid-accel-crash.patch
"${FILESDIR}"/${P}-chacha20-no-asm.patch
"${FILESDIR}"/${P}-gcm-no-asm.patch
"${FILESDIR}"/${PN}-1.6.0-no-force-lto.patch
)
src_configure() {
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)
--native-file "${native_file}"
)
meson_src_configure
}
multilib_src_test() {
# 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
}