pq_crypto 0.6.5 → 0.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +233 -0
- data/README.md +16 -3
- data/SECURITY.md +46 -0
- data/ext/pqcrypto/extconf.rb +8 -1
- data/ext/pqcrypto/pq_externalmu.c +35 -0
- data/ext/pqcrypto/pqcrypto_native_api.h +91 -75
- data/ext/pqcrypto/pqcrypto_ruby_secure.c +97 -9
- data/ext/pqcrypto/pqcrypto_secure.c +95 -33
- data/ext/pqcrypto/pqcrypto_secure.h +66 -48
- data/ext/pqcrypto/pqcrypto_version.h +1 -1
- data/ext/pqcrypto/vendor/.vendored +7 -7
- data/ext/pqcrypto/vendor/mldsa-native/BUILDING.md +5 -2
- data/ext/pqcrypto/vendor/mldsa-native/LICENSE +21 -2
- data/ext/pqcrypto/vendor/mldsa-native/README.md +20 -7
- data/ext/pqcrypto/vendor/mldsa-native/RELEASE.md +160 -0
- data/ext/pqcrypto/vendor/mldsa-native/SECURITY.md +1 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/README.md +2 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.c +85 -59
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.h +292 -348
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_asm.S +122 -76
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_config.h +184 -86
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/cbmc.h +49 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/common.h +49 -81
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/context.h +152 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.h +25 -12
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.c +2 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.h +2 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.c +2 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.c +9 -11
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/auto.h +19 -11
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_aarch64_asm.S +6 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_aarch64_asm.S +7 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_aarch64_asm.S +7 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S +12 -9
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S +12 -9
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_scalar.h +1 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_v84a.h +3 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x2_v84a.h +3 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_scalar.h +6 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +3 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/api.h +11 -11
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/mve.h +9 -22
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +8 -5
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +1 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/{state_extract_bytes_x4_mve.S → keccak_f1600_x4_state_extract_bytes_mve.S} +14 -14
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/{state_xor_bytes_x4_mve.S → keccak_f1600_x4_state_xor_bytes_mve.S} +12 -12
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/auto.h +5 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h +2 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/fips202_native_x86_64.h +1 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2_asm.S +36 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/meta.h +62 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/arith_native_aarch64.h +87 -54
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{intt_aarch64_asm.S → mldsa_intt_aarch64_asm.S} +39 -6
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{ntt_aarch64_asm.S → mldsa_ntt_aarch64_asm.S} +39 -6
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{pointwise_montgomery_aarch64_asm.S → mldsa_pointwise_montgomery_aarch64_asm.S} +25 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{poly_caddq_aarch64_asm.S → mldsa_poly_caddq_aarch64_asm.S} +19 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{poly_chknorm_aarch64_asm.S → mldsa_poly_chknorm_aarch64_asm.S} +24 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{poly_decompose_32_aarch64_asm.S → mldsa_poly_decompose_32_aarch64_asm.S} +25 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{poly_decompose_88_aarch64_asm.S → mldsa_poly_decompose_88_aarch64_asm.S} +25 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{poly_use_hint_32_aarch64_asm.S → mldsa_poly_use_hint_32_aarch64_asm.S} +25 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{poly_use_hint_88_aarch64_asm.S → mldsa_poly_use_hint_88_aarch64_asm.S} +25 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{mld_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm.S → mldsa_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm.S} +31 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{mld_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm.S → mldsa_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm.S} +31 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{mld_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm.S → mldsa_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm.S} +31 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{polyz_unpack_17_aarch64_asm.S → mldsa_polyz_unpack_17_aarch64_asm.S} +31 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{polyz_unpack_19_aarch64_asm.S → mldsa_polyz_unpack_19_aarch64_asm.S} +31 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{rej_uniform_aarch64_asm.S → mldsa_rej_uniform_aarch64_asm.S} +48 -15
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{rej_uniform_eta2_aarch64_asm.S → mldsa_rej_uniform_eta2_aarch64_asm.S} +42 -9
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{rej_uniform_eta4_aarch64_asm.S → mldsa_rej_uniform_eta4_aarch64_asm.S} +42 -9
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/api.h +11 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/meta.h +3 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/meta.h +28 -28
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/arith_native_x86_64.h +171 -49
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{intt_avx2_asm.S → mldsa_intt_avx2_asm.S} +23 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{ntt_avx2_asm.S → mldsa_ntt_avx2_asm.S} +23 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{nttunpack_avx2_asm.S → mldsa_nttunpack_avx2_asm.S} +17 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{pointwise_acc_l4_avx2_asm.S → mldsa_pointwise_acc_l4_avx2_asm.S} +37 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{pointwise_acc_l5_avx2_asm.S → mldsa_pointwise_acc_l5_avx2_asm.S} +37 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{pointwise_acc_l7_avx2_asm.S → mldsa_pointwise_acc_l7_avx2_asm.S} +37 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{pointwise_avx2_asm.S → mldsa_pointwise_avx2_asm.S} +31 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{poly_caddq_avx2_asm.S → mldsa_poly_caddq_avx2_asm.S} +18 -9
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_chknorm_avx2_asm.S +176 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_decompose_32_avx2_asm.S +490 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_decompose_88_avx2_asm.S +489 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_use_hint_32_avx2_asm.S +123 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_use_hint_88_avx2_asm.S +125 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_polyz_unpack_17_avx2_asm.S +355 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_polyz_unpack_19_avx2_asm.S +355 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_avx2_asm.S +132 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_eta2_avx2_asm.S +205 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_eta4_avx2_asm.S +176 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.c +27 -36
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.h +42 -8
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/params.h +93 -17
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.c +74 -15
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.h +97 -11
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.c +7 -38
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.h +49 -7
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.c +16 -17
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.h +26 -9
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.c +3 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.h +18 -19
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/reduce.h +15 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/rounding.h +28 -6
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.c +311 -246
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.h +245 -240
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sys.h +64 -5
- data/ext/pqcrypto/vendor/mlkem-native/BUILDING.md +5 -2
- data/ext/pqcrypto/vendor/mlkem-native/LICENSE +21 -3
- data/ext/pqcrypto/vendor/mlkem-native/README.md +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/RELEASE.md +113 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/README.md +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.c +17 -27
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.h +68 -151
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_asm.S +17 -27
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_config.h +46 -44
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/cbmc.h +25 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h +37 -6
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/context.h +9 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.h +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.c +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_scalar.h +1 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_v84a.h +3 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x2_v84a.h +3 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_scalar.h +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +3 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/api.h +11 -11
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/mve.h +3 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.h +14 -11
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.c +28 -11
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.h +39 -14
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/meta.h +20 -20
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sys.h +5 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.h +11 -10
- data/lib/pq_crypto/internal.rb +10 -0
- data/lib/pq_crypto/kem.rb +47 -5
- data/lib/pq_crypto/key.rb +14 -8
- data/lib/pq_crypto/pkcs8.rb +13 -5
- data/lib/pq_crypto/signature.rb +34 -9
- data/lib/pq_crypto/spki.rb +4 -2
- data/lib/pq_crypto/version.rb +1 -1
- data/lib/pq_crypto.rb +9 -0
- data/script/vendor_libs.rb +6 -6
- metadata +40 -38
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_chknorm_avx2.c +0 -52
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_32_avx2.c +0 -157
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_88_avx2.c +0 -157
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_32_avx2.c +0 -103
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_88_avx2.c +0 -105
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_17_avx2.c +0 -94
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_19_avx2.c +0 -96
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_avx2.c +0 -126
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta2_avx2.c +0 -157
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta4_avx2.c +0 -141
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
# mldsa-native
|
|
4
4
|
|
|
5
5
|

|
|
6
|
-

|
|
7
6
|

|
|
8
7
|

|
|
9
8
|
|
|
@@ -52,18 +51,25 @@ make test
|
|
|
52
51
|
mldsa-native is used in
|
|
53
52
|
- AWS' Cryptography library [AWS-LC](https://github.com/aws/aws-lc/)
|
|
54
53
|
- [libOQS](https://github.com/open-quantum-safe/liboqs/) of the Open Quantum Safe project
|
|
55
|
-
-
|
|
54
|
+
- [Pavona](https://github.com/pavona/pavona) - a library of modular, tapeout-proven, and secure-by-default open silicon blocks
|
|
56
55
|
- [CHERIoT-PQC](https://github.com/CHERIoT-Platform/cheriot-pqc) — post-quantum cryptography support for the CHERIoT platform
|
|
57
56
|
|
|
58
57
|
## Formal Verification
|
|
59
58
|
|
|
60
59
|
We use the [C Bounded Model Checker (CBMC)](https://github.com/diffblue/cbmc) to prove absence of various classes of undefined behaviour in C, including out of bounds memory accesses and integer overflows. The proofs cover all C code in [mldsa/src/*](mldsa) and [mldsa/src/fips202/*](mldsa/src/fips202) involved in running mldsa-native with its C backend. See [proofs/cbmc](proofs/cbmc) for details.
|
|
61
60
|
|
|
62
|
-
|
|
61
|
+
All AArch64 and x86_64 assembly is proved functionally correct and memory-safe at the object-code level, using
|
|
62
|
+
[HOL-Light](https://hol-light.github.io/) and the [s2n-bignum](https://github.com/awslabs/s2n-bignum) verification
|
|
63
|
+
infrastructure. All routines are additionally proved to have secret-independent timing, with two exceptions. The
|
|
64
|
+
matrix sampler `rej_uniform` operates on public data only, and is deliberately variable-time. The secret-vector
|
|
65
|
+
samplers `rej_uniform_eta{2,4}` _do_ have secret-independent timing, but this property is not yet backed by proof.
|
|
66
|
+
See [proofs/hol_light](proofs/hol_light) for details.
|
|
63
67
|
|
|
64
68
|
Finally, [proofs/isabelle](proofs/isabelle/compress) contains proofs in [Isabelle/HOL](https://isabelle.in.tum.de/) of the correctness of
|
|
65
69
|
different approaches for computing the scalar decomposition routines used in ML-DSA. Those are still experimental and do not yet operate
|
|
66
|
-
on the source level.
|
|
70
|
+
on the source level. [proofs/isabelle/neon_ntt](proofs/isabelle/neon_ntt) additionally provides a machine-checked formalisation of the
|
|
71
|
+
modular-arithmetic core of the Neon NTT paper[^NeonNTT], covering the Barrett and Montgomery primitives underlying the AArch64 NTT and
|
|
72
|
+
pointwise-multiplication assembly; see its [README](proofs/isabelle/neon_ntt/README.md).
|
|
67
73
|
|
|
68
74
|
**NOTE:** Formal Verification is never absolute. See [SOUNDNESS.md](SOUNDNESS.md) for an analysis of the scope, assumptions and risks of the formal verification efforts around mldsa-native.
|
|
69
75
|
|
|
@@ -157,6 +163,8 @@ For CI benchmark results and historical performance data, see the [benchmarking
|
|
|
157
163
|
|
|
158
164
|
If you want to use mldsa-native, import [mldsa](mldsa) into your project's source tree and build using your favourite build system. See [examples/basic](examples/basic) for a simple example. The build system provided in this repository is for development purposes only.
|
|
159
165
|
|
|
166
|
+
See [API-CONVENTIONS.md](API-CONVENTIONS.md) for conventions that apply to all public functions, such as return values, pointer validity, and the state of output buffers on error.
|
|
167
|
+
|
|
160
168
|
### Can I bring my own FIPS-202?
|
|
161
169
|
|
|
162
170
|
mldsa-native relies on and comes with an implementation of FIPS-202[^FIPS202]. If your library has its own FIPS-202 implementation, you
|
|
@@ -185,11 +193,15 @@ Yes. mldsa-native provides a compile-time option `MLD_CONFIG_REDUCE_RAM` that re
|
|
|
185
193
|
|
|
186
194
|
To enable this mode, define `MLD_CONFIG_REDUCE_RAM` in [mldsa_native_config.h](mldsa/mldsa_native_config.h) or pass `-DMLD_CONFIG_REDUCE_RAM` as a compiler flag.
|
|
187
195
|
|
|
196
|
+
### Can I bound or restart the signing loop for real-time systems?
|
|
197
|
+
|
|
198
|
+
Yes. Signing hooks allow you to pause and restart ML-DSA signature operations, thereby bounding their runtime. See [examples/restartable_sign](examples/restartable_sign) for an example.
|
|
199
|
+
|
|
188
200
|
### Does mldsa-native use hedged or deterministic signing?
|
|
189
201
|
|
|
190
202
|
By default, mldsa-native uses the randomized "hedged" signing variant as specified in FIPS 204 Section 3.4. The hedged variant uses both fresh randomness at signing time and precomputed randomness from the private key. This helps mitigate fault injection attacks and side-channel attacks while protecting against potential flaws in the random number generator.
|
|
191
203
|
|
|
192
|
-
If you need the deterministic variant of ML-DSA, you can call `
|
|
204
|
+
If you need the deterministic variant of ML-DSA, you can call `signature_internal`
|
|
193
205
|
directly with an all-zero `rnd` argument.
|
|
194
206
|
However, note that FIPS 204 warns that this should not be used on platforms where fault injection attacks and side-channel attacks are a concern, as the lack of fresh randomness makes fault attacks more difficult to mitigate.
|
|
195
207
|
|
|
@@ -204,8 +216,8 @@ External mu mode enables applications to compute the message digest (mu) externa
|
|
|
204
216
|
Yes. mldsa-native supports HashML-DSA, the pre-hashing variant of ML-DSA defined in FIPS 204 Algorithms 4 and 5.
|
|
205
217
|
|
|
206
218
|
mldsa-native provides two levels of API:
|
|
207
|
-
- `
|
|
208
|
-
- `
|
|
219
|
+
- `signature_pre_hash_internal` and `verify_pre_hash_internal` - Low-level functions that accept a pre-hashed message digest. This function supports all 12 allowed hash functions.
|
|
220
|
+
- `signature_pre_hash_shake256` and `verify_pre_hash_shake256` - High-level functions that perform SHAKE256 pre-hashing internally for convenience. Currently, only SHAKE256 is supported. If you require another hash function, use the `*_pre_hash_internal` functions or open an issue.
|
|
209
221
|
|
|
210
222
|
## Have a Question?
|
|
211
223
|
|
|
@@ -229,6 +241,7 @@ through the [PQCA Discord](https://discord.com/invite/xyVnwzfg5R). See also [CON
|
|
|
229
241
|
[^FIPS204]: National Institute of Standards and Technology: FIPS 204 Module-Lattice-Based Digital Signature Standard, [https://csrc.nist.gov/pubs/fips/204/final](https://csrc.nist.gov/pubs/fips/204/final)
|
|
230
242
|
[^NIST_FAQ]: National Institute of Standards and Technology: Post-Quantum Cryptography FAQs, [https://csrc.nist.gov/Projects/post-quantum-cryptography/faqs#Rdc7](https://csrc.nist.gov/Projects/post-quantum-cryptography/faqs#Rdc7)
|
|
231
243
|
[^NIST_FIPS204_SEC6]: National Institute of Standards and Technology: FIPS 204 Section 6 Guidance, [https://csrc.nist.gov/csrc/media/Projects/post-quantum-cryptography/documents/faq/fips204-sec6-03192025.pdf](https://csrc.nist.gov/csrc/media/Projects/post-quantum-cryptography/documents/faq/fips204-sec6-03192025.pdf)
|
|
244
|
+
[^NeonNTT]: Becker, Hwang, Kannwischer, Yang, Yang: Neon NTT: Faster Dilithium, Kyber, and Saber on Cortex-A72 and Apple M1, [https://eprint.iacr.org/2021/986](https://eprint.iacr.org/2021/986)
|
|
232
245
|
[^REF]: Bai, Ducas, Kiltz, Lepoint, Lyubashevsky, Schwabe, Seiler, Stehlé: CRYSTALS-Dilithium reference implementation, [https://github.com/pq-crystals/dilithium/tree/master/ref](https://github.com/pq-crystals/dilithium/tree/master/ref)
|
|
233
246
|
[^tiny_sha3]: Markku-Juhani O. Saarinen: tiny_sha3, [https://github.com/mjosaarinen/tiny_sha3](https://github.com/mjosaarinen/tiny_sha3)
|
|
234
247
|
[^wycheproof]: Community Cryptography Specification Project: Project Wycheproof, [https://github.com/C2SP/wycheproof](https://github.com/C2SP/wycheproof)
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
[//]: # (SPDX-License-Identifier: CC-BY-4.0)
|
|
2
|
+
|
|
3
|
+
mldsa-native v2.0.0
|
|
4
|
+
===================
|
|
5
|
+
|
|
6
|
+
Release notes
|
|
7
|
+
-------------
|
|
8
|
+
|
|
9
|
+
v2.0.0 is the first stable release of mldsa-native, a secure, fast and portable C90 implementation of
|
|
10
|
+
[ML-DSA](https://csrc.nist.gov/pubs/fips/204/final) derived from the
|
|
11
|
+
[ML-DSA reference implementation](https://github.com/pq-crystals/dilithium).
|
|
12
|
+
It carries the version number v2.0.0 rather than v1.0.0 because its public API and configuration are aligned with
|
|
13
|
+
those of the upcoming v2 release of the sister project
|
|
14
|
+
[mlkem-native](https://github.com/pq-code-package/mlkem-native).
|
|
15
|
+
|
|
16
|
+
mldsa-native v2.0.0 offers:
|
|
17
|
+
* High maintainability and extensibility through modular frontend/backend design.
|
|
18
|
+
* High performance through AArch64 (Neon) and x86_64 (AVX2) assembly backends and the use of the
|
|
19
|
+
[SLOTHY super-optimizer](https://github.com/slothy-optimizer/slothy).
|
|
20
|
+
* High assurance through memory- and type-safety proofs for the C frontend and backend (CBMC),
|
|
21
|
+
functional-correctness and memory-safety proofs for both the AArch64 and x86_64 assembly
|
|
22
|
+
backends (HOL Light and s2n-bignum), and extensive constant-time testing.
|
|
23
|
+
|
|
24
|
+
mldsa-native v2.0.0 is uniformly licensed Apache-2.0 OR MIT OR ISC, giving consumers the choice to use any of these
|
|
25
|
+
licenses.
|
|
26
|
+
|
|
27
|
+
Assurance
|
|
28
|
+
---------
|
|
29
|
+
|
|
30
|
+
v2.0.0 marks the completion of the two formal-verification efforts underpinning mldsa-native: the HOL Light proofs for
|
|
31
|
+
the AArch64 (Neon) and x86_64 (AVX2) assembly backends and the CBMC proofs for the C code are now both complete.
|
|
32
|
+
|
|
33
|
+
- **AArch64 and x86_64 assembly proved in HOL Light.** Every routine in both the AArch64 (Neon) and x86_64 (AVX2)
|
|
34
|
+
backends is proved functionally correct and memory-safe at the object-code level, using
|
|
35
|
+
[HOL Light](https://hol-light.github.io/) and the [s2n-bignum](https://github.com/awslabs/s2n-bignum) verification
|
|
36
|
+
infrastructure. All routines except the secret-vector rejection samplers (`rej_uniform_eta{2,4}`) are additionally
|
|
37
|
+
proved to have secret-independent timing (those samplers _do_ have secret-independent timing, but this property is
|
|
38
|
+
not yet backed by proof).
|
|
39
|
+
- **CBMC proofs for the C code**, establishing memory safety, type safety and absence of various classes of undefined
|
|
40
|
+
behaviour for all C code involved in running mldsa-native with its C backend.
|
|
41
|
+
|
|
42
|
+
See [SOUNDNESS.md](SOUNDNESS.md) for more detail on the scope, assumptions and residual risks of the verification
|
|
43
|
+
work; it shares its methodology, formal models and trusted computing base with the sister project
|
|
44
|
+
[mlkem-native](https://github.com/pq-code-package/mlkem-native).
|
|
45
|
+
|
|
46
|
+
Breaking changes since v1.0.0-beta2
|
|
47
|
+
-----------------------------------
|
|
48
|
+
|
|
49
|
+
Between the last beta release
|
|
50
|
+
([v1.0.0-beta2](https://github.com/pq-code-package/mldsa-native/releases/tag/v1.0.0-beta2)) and this release, a number
|
|
51
|
+
of breaking changes to the public API and configuration have been introduced. Consumers upgrading from
|
|
52
|
+
`v1.0.0-beta2` should be aware of the following:
|
|
53
|
+
|
|
54
|
+
- **`siglen` removed from the signing and verification APIs.** Signing functions no longer take a `size_t *siglen`
|
|
55
|
+
out-parameter and verification functions no longer take a `size_t siglen` in-parameter; signatures are always
|
|
56
|
+
`MLDSA_BYTES(MLD_CONFIG_PARAMETER_SET)` bytes and verification now takes a fixed-size signature array. Drop the
|
|
57
|
+
`siglen` argument at every call site. ([#1240](https://github.com/pq-code-package/mldsa-native/pull/1240))
|
|
58
|
+
- **SUPERCOP-style aliases and constants removed.** The `crypto_sign_keypair` / `crypto_sign_signature` /
|
|
59
|
+
`crypto_sign_verify` aliases, the `CRYPTO_SECRETKEYBYTES` / `CRYPTO_PUBLICKEYBYTES` / `CRYPTO_BYTES` size macros, and
|
|
60
|
+
the `MLD_CONFIG_NO_SUPERCOP` option were removed. Use the namespaced API directly and derive sizes from
|
|
61
|
+
`MLDSA_SECRETKEYBYTES` / `MLDSA_PUBLICKEYBYTES` / `MLDSA_BYTES`.
|
|
62
|
+
([#1248](https://github.com/pq-code-package/mldsa-native/pull/1248))
|
|
63
|
+
- **SUPERCOP signed-message API removed.** The combined signed-message functions (`crypto_sign` / `crypto_sign_open`
|
|
64
|
+
and their namespaced equivalents, which produced/consumed signature-prepended messages) were removed. Applications
|
|
65
|
+
needing that format should build it on top of the detached `signature` / `verify` API.
|
|
66
|
+
([#1236](https://github.com/pq-code-package/mldsa-native/pull/1236))
|
|
67
|
+
- **`MLD_ERR_FAIL` split into specific error codes.** Failure conditions that previously all surfaced as
|
|
68
|
+
`MLD_ERR_FAIL` now have dedicated codes: `MLD_ERR_INVALID_SIGNATURE` (verification rejected the signature),
|
|
69
|
+
`MLD_ERR_INVALID_KEY` (`pk_from_sk` found the secret key malformed or internally inconsistent), `MLD_ERR_PCT_FAIL`
|
|
70
|
+
(the key-generation pairwise consistency test failed) and `MLD_ERR_INVALID_ARG` (unsupported pre-hash algorithm or
|
|
71
|
+
context string longer than 255 bytes). The previously existing codes keep their values, but callers matching on
|
|
72
|
+
`MLD_ERR_FAIL` must be updated; it is no longer externally observable.
|
|
73
|
+
([#1309](https://github.com/pq-code-package/mldsa-native/pull/1309))
|
|
74
|
+
- **Legacy header-time configuration removed.** The deprecated `MLD_CONFIG_API_*` macros
|
|
75
|
+
(`MLD_CONFIG_API_PARAMETER_SET`, `MLD_CONFIG_API_NAMESPACE_PREFIX`, `MLD_CONFIG_API_NO_SUPERCOP`,
|
|
76
|
+
`MLD_CONFIG_API_CONSTANTS_ONLY`, `MLD_CONFIG_API_QUALIFIER`) were removed in favour of configuring through the
|
|
77
|
+
[config file](mldsa/mldsa_native_config.h) (`MLD_CONFIG_PARAMETER_SET`, `MLD_CONFIG_NAMESPACE_PREFIX`,
|
|
78
|
+
`MLD_CONFIG_CONSTANTS_ONLY`, `MLD_CONFIG_EXTERNAL_API_QUALIFIER`). For multi-level builds, set
|
|
79
|
+
`MLD_CONFIG_MULTILEVEL_BUILD` and do not bake the 44/65/87 suffix into the namespace prefix; the security level is
|
|
80
|
+
now appended automatically. ([#1206](https://github.com/pq-code-package/mldsa-native/pull/1206),
|
|
81
|
+
[#1270](https://github.com/pq-code-package/mldsa-native/pull/1270))
|
|
82
|
+
- **FIPS-202 backend flags renamed to the `MLD_USE_NATIVE_*` convention.** Custom FIPS-202 backends must rename the
|
|
83
|
+
flags they define: `MLD_USE_FIPS202_X1_NATIVE` -> `MLD_USE_NATIVE_FIPS202_X1`, `MLD_USE_FIPS202_X4_NATIVE` ->
|
|
84
|
+
`MLD_USE_NATIVE_FIPS202_X4`, `MLD_USE_FIPS202_X4_XOR_BYTES_NATIVE` -> `MLD_USE_NATIVE_FIPS202_X4_XOR_BYTES`, and
|
|
85
|
+
`MLD_USE_FIPS202_X4_EXTRACT_BYTES_NATIVE` -> `MLD_USE_NATIVE_FIPS202_X4_EXTRACT_BYTES`. Default builds are
|
|
86
|
+
unaffected. ([#1207](https://github.com/pq-code-package/mldsa-native/pull/1207))
|
|
87
|
+
- **Capability enum values prefixed with the architecture.** `mld_sys_cap` values were renamed
|
|
88
|
+
(`MLD_SYS_CAP_AVX2` -> `MLD_SYS_CAP_X86_64_AVX2`, `MLD_SYS_CAP_SHA3` -> `MLD_SYS_CAP_AARCH64_SHA3`,
|
|
89
|
+
`MLD_SYS_CAP_MVE` -> `MLD_SYS_CAP_ARMV81M_MVE`). This affects integrators with custom native backends or a custom
|
|
90
|
+
capability-check function. ([#1208](https://github.com/pq-code-package/mldsa-native/pull/1208))
|
|
91
|
+
- **Minimum FIPS 204 signing-attempt bound raised from 814 to 821.** Builds that set
|
|
92
|
+
`MLD_CONFIG_MAX_SIGNING_ATTEMPTS` explicitly must now use a value of at least 821; 814 through 820 no longer compile.
|
|
93
|
+
The [FIPS 204 errata](https://csrc.nist.gov/files/pubs/fips/204/final/docs/fips-204-potential-updates.xlsx) revises
|
|
94
|
+
the Repetitions row of Table 1 to 4.36 / 5.14 / 3.91 and, with it, the minimum loop-iteration limit for
|
|
95
|
+
`ML-DSA.Sign_internal` in Table 3 from 814 to 821.
|
|
96
|
+
([#1349](https://github.com/pq-code-package/mldsa-native/pull/1349))
|
|
97
|
+
|
|
98
|
+
We hope these simplifications make integrations easier for the majority of consumers. Moving forward, APIs and
|
|
99
|
+
configuration options not marked as experimental are guaranteed to be stable until a new major version (`v3`) is
|
|
100
|
+
released; additional APIs and configuration options may be introduced at any time.
|
|
101
|
+
|
|
102
|
+
If the breaking changes above cause any issues for your application, please
|
|
103
|
+
[open a GitHub issue](https://github.com/pq-code-package/mldsa-native/issues). If your application could benefit from
|
|
104
|
+
additional APIs or configuration options, please open an issue as well.
|
|
105
|
+
|
|
106
|
+
What's New
|
|
107
|
+
----------
|
|
108
|
+
|
|
109
|
+
### Restartable and bounded signing for real-time systems
|
|
110
|
+
|
|
111
|
+
ML-DSA signing is a rejection-sampling loop: it draws a candidate signature and retries until one passes the
|
|
112
|
+
bounds checks. The number of attempts is not known in advance, so a single signing call has an *unbounded* worst-case
|
|
113
|
+
runtime.
|
|
114
|
+
For environments with strict timing requirements that is a problem: a signing call cannot be allowed to run for an
|
|
115
|
+
arbitrary number of iterations before returning control to the caller.
|
|
116
|
+
|
|
117
|
+
mldsa-native addresses this with three optional, independent **signing hooks** around the rejection-sampling loop,
|
|
118
|
+
enabled with `MLD_CONFIG_SIGN_HOOK_ATTEMPT`, `MLD_CONFIG_SIGN_HOOK_RESUME` and `MLD_CONFIG_SIGN_HOOK_FINISH`. The
|
|
119
|
+
attempt hook runs before each attempt and may **pause** the operation; signing then returns the new
|
|
120
|
+
`MLD_ERR_SIGNING_PAUSED` code instead of iterating further. At the start of the next call the resume hook is queried
|
|
121
|
+
for the attempt to restart from (the one the attempt hook recorded when it paused), so signing continues exactly where
|
|
122
|
+
it left off; the finish hook fires with the succeeding attempt once a signature is found. The split, resumed run
|
|
123
|
+
produces exactly the same signature as a single uninterrupted call.
|
|
124
|
+
|
|
125
|
+
To bound per-call runtime, the attempt hook pauses once a per-call budget is spent, and the caller re-invokes signing
|
|
126
|
+
in a loop until it completes.
|
|
127
|
+
|
|
128
|
+
For concurrent or interleaved signers, hold the resume state per caller by enabling `MLD_CONFIG_CONTEXT_PARAMETER`
|
|
129
|
+
instead of a global; each API function then forwards a context argument to the hooks. A complete example is in
|
|
130
|
+
[examples/restartable_sign](examples/restartable_sign).
|
|
131
|
+
([#1237](https://github.com/pq-code-package/mldsa-native/pull/1237))
|
|
132
|
+
|
|
133
|
+
This feature is experimental: its scope, configuration and hook signatures may change, including after v2.
|
|
134
|
+
We would love to hear your feedback on this feature.
|
|
135
|
+
|
|
136
|
+
### API and configuration
|
|
137
|
+
|
|
138
|
+
- **`MLD_SYS_AARCH64_FAST_SHA3`** opts non-Apple AArch64 cores with fast SHA3 instructions into the SHA3-instruction
|
|
139
|
+
path. ([#1254](https://github.com/pq-code-package/mldsa-native/pull/1254))
|
|
140
|
+
|
|
141
|
+
### Platforms and testing
|
|
142
|
+
|
|
143
|
+
- **Windows MSVC** test support (KAT, Wycheproof, allocation-failure and RNG-failure tests).
|
|
144
|
+
([#1247](https://github.com/pq-code-package/mldsa-native/pull/1247))
|
|
145
|
+
- **AVR baremetal / 16-bit** platform support. ([#1158](https://github.com/pq-code-package/mldsa-native/pull/1158))
|
|
146
|
+
- **Zephyr** hardware and QEMU test platforms, including NUCLEO-N657X0-Q.
|
|
147
|
+
([#1259](https://github.com/pq-code-package/mldsa-native/pull/1259),
|
|
148
|
+
[#1269](https://github.com/pq-code-package/mldsa-native/pull/1269))
|
|
149
|
+
- **ABI checker** for AArch64, x86_64 (SysV) and Armv8.1-M+MVE.
|
|
150
|
+
([#1195](https://github.com/pq-code-package/mldsa-native/pull/1195))
|
|
151
|
+
|
|
152
|
+
### Documentation
|
|
153
|
+
|
|
154
|
+
- **FIPS 204 references** annotated throughout the code and expanded in the documentation, mapping the implementation
|
|
155
|
+
to [the standard](https://csrc.nist.gov/pubs/fips/204/final).
|
|
156
|
+
- **[API-CONVENTIONS.md](API-CONVENTIONS.md)** documents the conventions shared by all public functions: return
|
|
157
|
+
values, pointer validity (all pointers are assumed valid and non-NULL, except a pointer paired with a length, which
|
|
158
|
+
may be NULL when that length is `0`), and the state of output buffers on error (left either unchanged or fully
|
|
159
|
+
zeroized, never holding partially computed data).
|
|
160
|
+
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
|
|
5
5
|
## Reporting security bugs
|
|
6
6
|
|
|
7
|
-
If you think you have found a security bug in
|
|
7
|
+
If you think you have found a security bug in mldsa-native, please report the vulnerability through
|
|
8
8
|
Github's [private vulnerability reporting](https://github.com/pq-code-package/mldsa-native/security).
|
|
@@ -8,7 +8,7 @@ This is the main source tree of mldsa-native.
|
|
|
8
8
|
|
|
9
9
|
To build mldsa-native for a fixed parameter set (ML-DSA-44/65/87), build the compilation units in `src/*` separately, and link to an RNG and your application. See [examples/basic](../examples/basic) for a simple example.
|
|
10
10
|
|
|
11
|
-
Alternatively, you can use the auto-generated helper files [mldsa_native.c](mldsa_native.c) and [mldsa_native_asm.S](mldsa_native_asm.S), which bundle all *.c and *.S files together. See [examples/monolithic_build](../examples/monolithic_build) and [examples/monolithic_build_native](../examples/monolithic_build_native) for examples
|
|
11
|
+
Alternatively, you can use the auto-generated helper files [mldsa_native.c](mldsa_native.c) and [mldsa_native_asm.S](mldsa_native_asm.S), which bundle all *.c and *.S files together. See [examples/monolithic_build](../examples/monolithic_build) and [examples/monolithic_build_native](../examples/monolithic_build_native) for examples without and with native code.
|
|
12
12
|
|
|
13
13
|
## Configuration
|
|
14
14
|
|
|
@@ -20,4 +20,4 @@ The public API is defined in [mldsa_native.h](mldsa_native.h).
|
|
|
20
20
|
|
|
21
21
|
## Supporting multiple parameter sets
|
|
22
22
|
|
|
23
|
-
If you want to support multiple parameter sets, build the library once per parameter set you want to support. Set `MLD_CONFIG_MULTILEVEL_WITH_SHARED` for one of
|
|
23
|
+
If you want to support multiple parameter sets, build the library once per parameter set you want to support. Set `MLD_CONFIG_MULTILEVEL_BUILD` for all builds, `MLD_CONFIG_MULTILEVEL_WITH_SHARED` for one of them, and `MLD_CONFIG_MULTILEVEL_NO_SHARED` for the others, to avoid duplicating shared functionality. Finally, link with RNG and your application as before. This is demonstrated in the examples [examples/multilevel_build](../examples/multilevel_build), [examples/multilevel_build_native](../examples/multilevel_build_native), [examples/monolithic_build_multilevel](../examples/monolithic_build_multilevel) and [examples/monolithic_build_multilevel_native](../examples/monolithic_build_multilevel_native).
|
|
@@ -83,18 +83,8 @@
|
|
|
83
83
|
#endif /* MLD_SYS_AARCH64 */
|
|
84
84
|
#if defined(MLD_SYS_X86_64)
|
|
85
85
|
#include "src/native/x86_64/src/consts.c"
|
|
86
|
-
#include "src/native/x86_64/src/poly_chknorm_avx2.c"
|
|
87
|
-
#include "src/native/x86_64/src/poly_decompose_32_avx2.c"
|
|
88
|
-
#include "src/native/x86_64/src/poly_decompose_88_avx2.c"
|
|
89
|
-
#include "src/native/x86_64/src/poly_use_hint_32_avx2.c"
|
|
90
|
-
#include "src/native/x86_64/src/poly_use_hint_88_avx2.c"
|
|
91
|
-
#include "src/native/x86_64/src/polyz_unpack_17_avx2.c"
|
|
92
|
-
#include "src/native/x86_64/src/polyz_unpack_19_avx2.c"
|
|
93
|
-
#include "src/native/x86_64/src/rej_uniform_avx2.c"
|
|
94
|
-
#include "src/native/x86_64/src/rej_uniform_eta2_avx2.c"
|
|
95
|
-
#include "src/native/x86_64/src/rej_uniform_eta4_avx2.c"
|
|
96
86
|
#include "src/native/x86_64/src/rej_uniform_table.c"
|
|
97
|
-
#endif
|
|
87
|
+
#endif
|
|
98
88
|
#endif /* MLD_CONFIG_USE_NATIVE_BACKEND_ARITH */
|
|
99
89
|
|
|
100
90
|
#if defined(MLD_CONFIG_USE_NATIVE_BACKEND_FIPS202)
|
|
@@ -125,9 +115,6 @@
|
|
|
125
115
|
* Undefine macros from MLD_CONFIG_PARAMETER_SET-specific files
|
|
126
116
|
*/
|
|
127
117
|
/* mldsa/mldsa_native.h */
|
|
128
|
-
#undef CRYPTO_BYTES
|
|
129
|
-
#undef CRYPTO_PUBLICKEYBYTES
|
|
130
|
-
#undef CRYPTO_SECRETKEYBYTES
|
|
131
118
|
#undef MLDSA44_BYTES
|
|
132
119
|
#undef MLDSA44_CRHBYTES
|
|
133
120
|
#undef MLDSA44_PUBLICKEYBYTES
|
|
@@ -162,19 +149,19 @@
|
|
|
162
149
|
#undef MLD_API_CONCAT
|
|
163
150
|
#undef MLD_API_CONCAT_
|
|
164
151
|
#undef MLD_API_CONCAT_UNDERSCORE
|
|
165
|
-
#undef MLD_API_LEGACY_CONFIG
|
|
166
152
|
#undef MLD_API_MUST_CHECK_RETURN_VALUE
|
|
167
153
|
#undef MLD_API_NAMESPACE
|
|
154
|
+
#undef MLD_API_NAMESPACE_PREFIX
|
|
168
155
|
#undef MLD_API_QUALIFIER
|
|
169
|
-
#undef MLD_CONFIG_API_CONSTANTS_ONLY
|
|
170
|
-
#undef MLD_CONFIG_API_NAMESPACE_PREFIX
|
|
171
|
-
#undef MLD_CONFIG_API_NO_SUPERCOP
|
|
172
|
-
#undef MLD_CONFIG_API_PARAMETER_SET
|
|
173
|
-
#undef MLD_CONFIG_API_QUALIFIER
|
|
174
156
|
#undef MLD_DOMAIN_SEPARATION_MAX_BYTES
|
|
175
157
|
#undef MLD_ERR_FAIL
|
|
158
|
+
#undef MLD_ERR_INVALID_ARG
|
|
159
|
+
#undef MLD_ERR_INVALID_KEY
|
|
160
|
+
#undef MLD_ERR_INVALID_SIGNATURE
|
|
176
161
|
#undef MLD_ERR_OUT_OF_MEMORY
|
|
162
|
+
#undef MLD_ERR_PCT_FAIL
|
|
177
163
|
#undef MLD_ERR_RNG_FAIL
|
|
164
|
+
#undef MLD_ERR_SIGNING_PAUSED
|
|
178
165
|
#undef MLD_ERR_SIGN_ATTEMPTS_EXHAUSTED
|
|
179
166
|
#undef MLD_H
|
|
180
167
|
#undef MLD_MAX3_
|
|
@@ -213,15 +200,9 @@
|
|
|
213
200
|
#undef MLD_TOTAL_ALLOC_87_PK_FROM_SK
|
|
214
201
|
#undef MLD_TOTAL_ALLOC_87_SIGN
|
|
215
202
|
#undef MLD_TOTAL_ALLOC_87_VERIFY
|
|
216
|
-
#undef crypto_sign
|
|
217
|
-
#undef crypto_sign_keypair
|
|
218
|
-
#undef crypto_sign_open
|
|
219
|
-
#undef crypto_sign_signature
|
|
220
|
-
#undef crypto_sign_verify
|
|
221
203
|
/* mldsa/src/common.h */
|
|
222
204
|
#undef MLD_ADD_PARAM_SET
|
|
223
205
|
#undef MLD_ALLOC
|
|
224
|
-
#undef MLD_ANY_ERROR
|
|
225
206
|
#undef MLD_APPLY
|
|
226
207
|
#undef MLD_ASM_FN_SIZE
|
|
227
208
|
#undef MLD_ASM_FN_SYMBOL
|
|
@@ -230,20 +211,15 @@
|
|
|
230
211
|
#undef MLD_COMMON_H
|
|
231
212
|
#undef MLD_CONCAT
|
|
232
213
|
#undef MLD_CONCAT_
|
|
233
|
-
#undef MLD_CONTEXT_PARAMETERS_0
|
|
234
|
-
#undef MLD_CONTEXT_PARAMETERS_1
|
|
235
|
-
#undef MLD_CONTEXT_PARAMETERS_2
|
|
236
|
-
#undef MLD_CONTEXT_PARAMETERS_3
|
|
237
|
-
#undef MLD_CONTEXT_PARAMETERS_4
|
|
238
|
-
#undef MLD_CONTEXT_PARAMETERS_5
|
|
239
|
-
#undef MLD_CONTEXT_PARAMETERS_6
|
|
240
|
-
#undef MLD_CONTEXT_PARAMETERS_7
|
|
241
|
-
#undef MLD_CONTEXT_PARAMETERS_8
|
|
242
|
-
#undef MLD_CONTEXT_PARAMETERS_9
|
|
243
214
|
#undef MLD_EMPTY_CU
|
|
244
215
|
#undef MLD_ERR_FAIL
|
|
216
|
+
#undef MLD_ERR_INVALID_ARG
|
|
217
|
+
#undef MLD_ERR_INVALID_KEY
|
|
218
|
+
#undef MLD_ERR_INVALID_SIGNATURE
|
|
245
219
|
#undef MLD_ERR_OUT_OF_MEMORY
|
|
220
|
+
#undef MLD_ERR_PCT_FAIL
|
|
246
221
|
#undef MLD_ERR_RNG_FAIL
|
|
222
|
+
#undef MLD_ERR_SIGNING_PAUSED
|
|
247
223
|
#undef MLD_ERR_SIGN_ATTEMPTS_EXHAUSTED
|
|
248
224
|
#undef MLD_EXTERNAL_API
|
|
249
225
|
#undef MLD_FIPS202X4_HEADER_FILE
|
|
@@ -280,22 +256,52 @@
|
|
|
280
256
|
#undef MLDSA_ETA
|
|
281
257
|
#undef MLDSA_GAMMA1
|
|
282
258
|
#undef MLDSA_GAMMA2
|
|
259
|
+
#undef MLDSA_GAMMA2_32
|
|
260
|
+
#undef MLDSA_GAMMA2_88
|
|
283
261
|
#undef MLDSA_K
|
|
284
262
|
#undef MLDSA_L
|
|
285
263
|
#undef MLDSA_N
|
|
286
264
|
#undef MLDSA_OMEGA
|
|
265
|
+
#undef MLDSA_PK_END
|
|
266
|
+
#undef MLDSA_PK_RHO_BYTES
|
|
267
|
+
#undef MLDSA_PK_RHO_OFFSET
|
|
268
|
+
#undef MLDSA_PK_T1_BYTES
|
|
269
|
+
#undef MLDSA_PK_T1_OFFSET
|
|
287
270
|
#undef MLDSA_POLYETA_PACKEDBYTES
|
|
288
271
|
#undef MLDSA_POLYT0_PACKEDBYTES
|
|
289
272
|
#undef MLDSA_POLYT1_PACKEDBYTES
|
|
290
273
|
#undef MLDSA_POLYVECH_PACKEDBYTES
|
|
291
274
|
#undef MLDSA_POLYW1_PACKEDBYTES
|
|
275
|
+
#undef MLDSA_POLYW1_PACKEDBYTES_32
|
|
276
|
+
#undef MLDSA_POLYW1_PACKEDBYTES_88
|
|
292
277
|
#undef MLDSA_POLYZ_PACKEDBYTES
|
|
293
278
|
#undef MLDSA_Q
|
|
294
279
|
#undef MLDSA_Q_HALF
|
|
295
280
|
#undef MLDSA_RNDBYTES
|
|
296
281
|
#undef MLDSA_SEEDBYTES
|
|
282
|
+
#undef MLDSA_SIG_C_BYTES
|
|
283
|
+
#undef MLDSA_SIG_C_OFFSET
|
|
284
|
+
#undef MLDSA_SIG_END
|
|
285
|
+
#undef MLDSA_SIG_H_BYTES
|
|
286
|
+
#undef MLDSA_SIG_H_OFFSET
|
|
287
|
+
#undef MLDSA_SIG_Z_BYTES
|
|
288
|
+
#undef MLDSA_SIG_Z_OFFSET
|
|
289
|
+
#undef MLDSA_SK_END
|
|
290
|
+
#undef MLDSA_SK_KEY_BYTES
|
|
291
|
+
#undef MLDSA_SK_KEY_OFFSET
|
|
292
|
+
#undef MLDSA_SK_RHO_BYTES
|
|
293
|
+
#undef MLDSA_SK_RHO_OFFSET
|
|
294
|
+
#undef MLDSA_SK_S1_BYTES
|
|
295
|
+
#undef MLDSA_SK_S1_OFFSET
|
|
296
|
+
#undef MLDSA_SK_S2_BYTES
|
|
297
|
+
#undef MLDSA_SK_S2_OFFSET
|
|
298
|
+
#undef MLDSA_SK_T0_BYTES
|
|
299
|
+
#undef MLDSA_SK_T0_OFFSET
|
|
300
|
+
#undef MLDSA_SK_TR_BYTES
|
|
301
|
+
#undef MLDSA_SK_TR_OFFSET
|
|
297
302
|
#undef MLDSA_TAU
|
|
298
303
|
#undef MLDSA_TRBYTES
|
|
304
|
+
#undef MLD_MAX_KAPPA
|
|
299
305
|
#undef MLD_PARAMS_H
|
|
300
306
|
/* mldsa/src/poly_kl.h */
|
|
301
307
|
#undef MLD_POLYETA_UNPACK_LOWER_BOUND
|
|
@@ -408,10 +414,8 @@
|
|
|
408
414
|
#undef MLD_PREHASH_SHAKE_256
|
|
409
415
|
#undef MLD_SIGN_H
|
|
410
416
|
#undef mld_prepare_domain_separation_prefix
|
|
411
|
-
#undef mld_sign
|
|
412
417
|
#undef mld_sign_keypair
|
|
413
418
|
#undef mld_sign_keypair_internal
|
|
414
|
-
#undef mld_sign_open
|
|
415
419
|
#undef mld_sign_pk_from_sk
|
|
416
420
|
#undef mld_sign_signature
|
|
417
421
|
#undef mld_sign_signature_extmu
|
|
@@ -428,6 +432,22 @@
|
|
|
428
432
|
/*
|
|
429
433
|
* Undefine macros from MLD_CONFIG_PARAMETER_SET-generic files
|
|
430
434
|
*/
|
|
435
|
+
/* mldsa/src/context.h */
|
|
436
|
+
#undef MLD_CONTEXT_H
|
|
437
|
+
#undef MLD_CONTEXT_PARAMETERS_0
|
|
438
|
+
#undef MLD_CONTEXT_PARAMETERS_1
|
|
439
|
+
#undef MLD_CONTEXT_PARAMETERS_2
|
|
440
|
+
#undef MLD_CONTEXT_PARAMETERS_3
|
|
441
|
+
#undef MLD_CONTEXT_PARAMETERS_4
|
|
442
|
+
#undef MLD_CONTEXT_PARAMETERS_5
|
|
443
|
+
#undef MLD_CONTEXT_PARAMETERS_6
|
|
444
|
+
#undef MLD_CONTEXT_PARAMETERS_7
|
|
445
|
+
#undef MLD_CONTEXT_PARAMETERS_8
|
|
446
|
+
#undef MLD_CONTEXT_PARAMETERS_9
|
|
447
|
+
#undef MLD_CONTEXT_UNUSED
|
|
448
|
+
#undef mld_sign_attempt
|
|
449
|
+
#undef mld_sign_finish
|
|
450
|
+
#undef mld_sign_resume
|
|
431
451
|
/* mldsa/src/ct.h */
|
|
432
452
|
#undef MLD_CT_H
|
|
433
453
|
#undef MLD_USE_ASM_VALUE_BARRIER
|
|
@@ -442,6 +462,7 @@
|
|
|
442
462
|
#undef mld_debug_check_assert
|
|
443
463
|
#undef mld_debug_check_bounds
|
|
444
464
|
/* mldsa/src/poly.h */
|
|
465
|
+
#undef MLD_FQMUL_BOUND
|
|
445
466
|
#undef MLD_INTT_BOUND
|
|
446
467
|
#undef MLD_NTT_BOUND
|
|
447
468
|
#undef MLD_POLY_H
|
|
@@ -461,6 +482,8 @@
|
|
|
461
482
|
#undef mld_polyt0_unpack
|
|
462
483
|
#undef mld_polyt1_pack
|
|
463
484
|
#undef mld_polyt1_unpack
|
|
485
|
+
#undef mld_polyw1_pack_32
|
|
486
|
+
#undef mld_polyw1_pack_88
|
|
464
487
|
/* mldsa/src/randombytes.h */
|
|
465
488
|
#undef MLD_RANDOMBYTES_H
|
|
466
489
|
/* mldsa/src/reduce.h */
|
|
@@ -503,10 +526,14 @@
|
|
|
503
526
|
#undef MLD_HAVE_INLINE_ASM
|
|
504
527
|
#undef MLD_INLINE
|
|
505
528
|
#undef MLD_MUST_CHECK_RETURN_VALUE
|
|
529
|
+
#undef MLD_NOINLINE
|
|
506
530
|
#undef MLD_RESTRICT
|
|
507
531
|
#undef MLD_STATIC_TESTABLE
|
|
532
|
+
#undef MLD_SYSV_ABI
|
|
533
|
+
#undef MLD_SYSV_ABI_SUPPORTED
|
|
508
534
|
#undef MLD_SYS_AARCH64
|
|
509
535
|
#undef MLD_SYS_AARCH64_EB
|
|
536
|
+
#undef MLD_SYS_AARCH64_NEON
|
|
510
537
|
#undef MLD_SYS_APPLE
|
|
511
538
|
#undef MLD_SYS_ARMV81M_MVE
|
|
512
539
|
#undef MLD_SYS_BIG_ENDIAN
|
|
@@ -595,23 +622,23 @@
|
|
|
595
622
|
/* mldsa/src/fips202/native/aarch64/x1_scalar.h */
|
|
596
623
|
#undef MLD_FIPS202_AARCH64_NEED_X1_SCALAR
|
|
597
624
|
#undef MLD_FIPS202_NATIVE_AARCH64_X1_SCALAR_H
|
|
598
|
-
#undef
|
|
625
|
+
#undef MLD_USE_NATIVE_FIPS202_X1
|
|
599
626
|
/* mldsa/src/fips202/native/aarch64/x1_v84a.h */
|
|
600
627
|
#undef MLD_FIPS202_AARCH64_NEED_X1_V84A
|
|
601
628
|
#undef MLD_FIPS202_NATIVE_AARCH64_X1_V84A_H
|
|
602
|
-
#undef
|
|
629
|
+
#undef MLD_USE_NATIVE_FIPS202_X1
|
|
603
630
|
/* mldsa/src/fips202/native/aarch64/x2_v84a.h */
|
|
604
631
|
#undef MLD_FIPS202_AARCH64_NEED_X2_V84A
|
|
605
632
|
#undef MLD_FIPS202_NATIVE_AARCH64_X2_V84A_H
|
|
606
|
-
#undef
|
|
633
|
+
#undef MLD_USE_NATIVE_FIPS202_X4
|
|
607
634
|
/* mldsa/src/fips202/native/aarch64/x4_v8a_scalar.h */
|
|
608
635
|
#undef MLD_FIPS202_AARCH64_NEED_X4_V8A_SCALAR_HYBRID
|
|
609
636
|
#undef MLD_FIPS202_NATIVE_AARCH64_X4_V8A_SCALAR_H
|
|
610
|
-
#undef
|
|
637
|
+
#undef MLD_USE_NATIVE_FIPS202_X4
|
|
611
638
|
/* mldsa/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h */
|
|
612
639
|
#undef MLD_FIPS202_AARCH64_NEED_X4_V8A_V84A_SCALAR_HYBRID
|
|
613
640
|
#undef MLD_FIPS202_NATIVE_AARCH64_X4_V8A_V84A_SCALAR_H
|
|
614
|
-
#undef
|
|
641
|
+
#undef MLD_USE_NATIVE_FIPS202_X4
|
|
615
642
|
#endif /* MLD_SYS_AARCH64 */
|
|
616
643
|
#if defined(MLD_SYS_X86_64)
|
|
617
644
|
/*
|
|
@@ -620,7 +647,7 @@
|
|
|
620
647
|
/* mldsa/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h */
|
|
621
648
|
#undef MLD_FIPS202_NATIVE_X86_64_KECCAK_F1600_X4_AVX2_H
|
|
622
649
|
#undef MLD_FIPS202_X86_64_NEED_X4_AVX2
|
|
623
|
-
#undef
|
|
650
|
+
#undef MLD_USE_NATIVE_FIPS202_X4
|
|
624
651
|
/* mldsa/src/fips202/native/x86_64/src/fips202_native_x86_64.h */
|
|
625
652
|
#undef MLD_FIPS202_NATIVE_X86_64_SRC_FIPS202_NATIVE_X86_64_H
|
|
626
653
|
#undef mld_keccak_f1600_x4_avx2_asm
|
|
@@ -636,12 +663,10 @@
|
|
|
636
663
|
#undef MLD_FIPS202_ARMV81M_NEED_X4
|
|
637
664
|
#undef MLD_FIPS202_NATIVE_ARMV81M
|
|
638
665
|
#undef MLD_FIPS202_NATIVE_ARMV81M_MVE_H
|
|
639
|
-
#undef
|
|
640
|
-
#undef
|
|
641
|
-
#undef
|
|
666
|
+
#undef MLD_USE_NATIVE_FIPS202_X4
|
|
667
|
+
#undef MLD_USE_NATIVE_FIPS202_X4_EXTRACT_BYTES
|
|
668
|
+
#undef MLD_USE_NATIVE_FIPS202_X4_XOR_BYTES
|
|
642
669
|
#undef mld_keccak_f1600_x4_native_impl
|
|
643
|
-
#undef mld_keccak_f1600_x4_state_extract_bytes
|
|
644
|
-
#undef mld_keccak_f1600_x4_state_xor_bytes
|
|
645
670
|
/* mldsa/src/fips202/native/armv81m/src/fips202_native_armv81m.h */
|
|
646
671
|
#undef MLD_FIPS202_NATIVE_ARMV81M_SRC_FIPS202_NATIVE_ARMV81M_H
|
|
647
672
|
#undef mld_keccak_f1600_x4_mve_asm
|
|
@@ -652,6 +677,7 @@
|
|
|
652
677
|
#endif /* MLD_CONFIG_USE_NATIVE_BACKEND_FIPS202 */
|
|
653
678
|
#if defined(MLD_CONFIG_USE_NATIVE_BACKEND_ARITH)
|
|
654
679
|
/* mldsa/src/native/api.h */
|
|
680
|
+
#undef MLD_FQMUL_BOUND
|
|
655
681
|
#undef MLD_INTT_BOUND
|
|
656
682
|
#undef MLD_NATIVE_API_H
|
|
657
683
|
#undef MLD_NATIVE_FUNC_FALLBACK
|
|
@@ -752,16 +778,16 @@
|
|
|
752
778
|
#undef mld_pointwise_acc_l7_avx2_asm
|
|
753
779
|
#undef mld_pointwise_avx2_asm
|
|
754
780
|
#undef mld_poly_caddq_avx2_asm
|
|
755
|
-
#undef
|
|
756
|
-
#undef
|
|
757
|
-
#undef
|
|
758
|
-
#undef
|
|
759
|
-
#undef
|
|
760
|
-
#undef
|
|
761
|
-
#undef
|
|
762
|
-
#undef
|
|
763
|
-
#undef
|
|
764
|
-
#undef
|
|
781
|
+
#undef mld_poly_chknorm_avx2_asm
|
|
782
|
+
#undef mld_poly_decompose_32_avx2_asm
|
|
783
|
+
#undef mld_poly_decompose_88_avx2_asm
|
|
784
|
+
#undef mld_poly_use_hint_32_avx2_asm
|
|
785
|
+
#undef mld_poly_use_hint_88_avx2_asm
|
|
786
|
+
#undef mld_polyz_unpack_17_avx2_asm
|
|
787
|
+
#undef mld_polyz_unpack_19_avx2_asm
|
|
788
|
+
#undef mld_rej_uniform_avx2_asm
|
|
789
|
+
#undef mld_rej_uniform_eta2_avx2_asm
|
|
790
|
+
#undef mld_rej_uniform_eta4_avx2_asm
|
|
765
791
|
#undef mld_rej_uniform_table
|
|
766
792
|
/* mldsa/src/native/x86_64/src/consts.h */
|
|
767
793
|
#undef MLD_AVX2_BACKEND_DATA_OFFSET_8XDIV
|