pq_crypto 0.6.1 → 0.6.3
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 +10 -0
- data/SECURITY.md +7 -0
- data/ext/pqcrypto/pqcrypto_version.h +1 -1
- data/ext/pqcrypto/vendor/.vendored +7 -7
- data/ext/pqcrypto/vendor/mldsa-native/README.md +23 -10
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/README.md +23 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.c +114 -58
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.h +498 -461
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_asm.S +145 -85
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_config.h +456 -422
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/cbmc.h +47 -25
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/common.h +26 -14
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.h +56 -81
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.h +17 -24
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.c +33 -40
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.h +67 -87
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.c +19 -14
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.h +13 -5
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.c +84 -10
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.h +10 -5
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/auto.h +6 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/fips202_native_aarch64.h +22 -15
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_aarch64_asm.S +376 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_aarch64_asm.S +204 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_aarch64_asm.S +259 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S +1077 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S +987 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +16 -10
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_scalar.h +2 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_v84a.h +1 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x2_v84a.h +4 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_scalar.h +2 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +1 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/api.h +60 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/mve.h +48 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/fips202_native_armv81m.h +18 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +658 -582
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +5 -100
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +26 -25
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/state_extract_bytes_x4_mve.S +334 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/state_xor_bytes_x4_mve.S +355 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/auto.h +8 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/{xkcp.h → keccak_f1600_x4_avx2.h} +11 -8
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/fips202_native_x86_64.h +44 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2_asm.S +454 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccakf1600_constants.c +52 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/meta.h +37 -28
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/aarch64_zetas.c +213 -196
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/arith_native_aarch64.h +248 -64
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/intt_aarch64_asm.S +753 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm.S +129 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm.S +145 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm.S +177 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/ntt_aarch64_asm.S +653 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/pointwise_montgomery_aarch64_asm.S +84 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_caddq_aarch64_asm.S +53 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_chknorm_aarch64_asm.S +55 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_32_aarch64_asm.S +86 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_88_aarch64_asm.S +86 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_32_aarch64_asm.S +103 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_88_aarch64_asm.S +111 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_17_aarch64_asm.S +75 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_19_aarch64_asm.S +72 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_table.c +23 -11
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_aarch64_asm.S +189 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta2_aarch64_asm.S +137 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta4_aarch64_asm.S +130 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta_table.c +520 -516
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_table.c +34 -33
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/api.h +202 -242
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/meta.h +25 -17
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/arith_native_x86_64.h +112 -28
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.c +1 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.h +1 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/intt_avx2_asm.S +2311 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/ntt_avx2_asm.S +2383 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/nttunpack_avx2_asm.S +238 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l4_avx2_asm.S +139 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l5_avx2_asm.S +155 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l7_avx2_asm.S +187 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_avx2_asm.S +130 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_caddq_avx2_asm.S +190 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_32_avx2.c +6 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_88_avx2.c +6 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_32_avx2.c +9 -8
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_88_avx2.c +10 -9
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_17_avx2.c +8 -5
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_19_avx2.c +8 -5
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta2_avx2.c +6 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta4_avx2.c +6 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_table.c +130 -129
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.c +109 -180
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.h +169 -150
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.c +56 -40
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.h +149 -164
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.c +52 -57
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.h +132 -167
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.c +57 -424
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.h +167 -474
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.c +308 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.h +653 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/reduce.h +22 -29
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/rounding.h +37 -43
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.c +511 -367
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.h +456 -417
- data/ext/pqcrypto/vendor/mlkem-native/README.md +6 -3
- data/ext/pqcrypto/vendor/mlkem-native/RELEASE.md +22 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.c +77 -36
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.h +135 -146
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_asm.S +116 -72
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_config.h +351 -415
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/cbmc.h +43 -20
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h +16 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.c +57 -31
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.h +260 -349
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.h +17 -24
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.c +35 -37
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.h +43 -57
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.c +14 -15
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.h +5 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.c +42 -6
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/fips202_native_aarch64.h +31 -20
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/{keccak_f1600_x1_scalar_asm.S → keccak_f1600_x1_scalar_aarch64_asm.S} +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/{keccak_f1600_x1_v84a_asm.S → keccak_f1600_x1_v84a_aarch64_asm.S} +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/{keccak_f1600_x2_v84a_asm.S → keccak_f1600_x2_v84a_aarch64_asm.S} +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/{keccak_f1600_x4_v8a_scalar_hybrid_asm.S → keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S} +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/{keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S → keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S} +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +10 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_scalar.h +2 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_v84a.h +1 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x2_v84a.h +4 -2
- 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 +1 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/fips202_native_armv81m.h +2 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +55 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +26 -25
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_extract_bytes_x4_mve.S +58 -14
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_xor_bytes_x4_mve.S +57 -16
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/auto.h +2 -1
- 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/fips202/native/x86_64/src/fips202_native_x86_64.h +10 -7
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/{keccak_f1600_x4_avx2.S → keccak_f1600_x4_avx2_asm.S} +13 -11
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccakf1600_constants.c +12 -11
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.c +167 -136
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.h +75 -68
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.h +135 -157
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h +15 -13
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/aarch64_zetas.c +143 -135
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/arith_native_aarch64.h +52 -46
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{intt.S → intt_aarch64_asm.S} +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{ntt.S → ntt_aarch64_asm.S} +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_mulcache_compute_asm.S → poly_mulcache_compute_aarch64_asm.S} +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_reduce_asm.S → poly_reduce_aarch64_asm.S} +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_tobytes_asm.S → poly_tobytes_aarch64_asm.S} +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_tomont_asm.S → poly_tomont_aarch64_asm.S} +10 -12
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{polyvec_basemul_acc_montgomery_cached_asm_k2.S → polyvec_basemul_acc_montgomery_cached_k2_aarch64_asm.S} +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{polyvec_basemul_acc_montgomery_cached_asm_k3.S → polyvec_basemul_acc_montgomery_cached_k3_aarch64_asm.S} +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{polyvec_basemul_acc_montgomery_cached_asm_k4.S → polyvec_basemul_acc_montgomery_cached_k4_aarch64_asm.S} +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{rej_uniform_asm.S → rej_uniform_aarch64_asm.S} +12 -12
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/rej_uniform_table.c +514 -513
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/api.h +254 -253
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/meta.h +6 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/README.md +6 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/meta.h +77 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/arith_native_ppc64le.h +24 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/consts.c +299 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/consts.h +34 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/intt_ppc_asm.S +3222 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/ntt_ppc_asm.S +1651 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/poly_tomont_ppc_asm.S +294 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/reduce_ppc_asm.S +710 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/meta.h +5 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.c +18 -16
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.h +19 -24
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_poly.c +53 -65
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/meta.h +20 -20
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/arith_native_x86_64.h +106 -88
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.c +45 -35
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.h +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.c +1 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.h +1 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{intt.S → intt_avx2_asm.S} +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{ntt.S → ntt_avx2_asm.S} +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{nttfrombytes.S → nttfrombytes_avx2_asm.S} +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{ntttobytes.S → ntttobytes_avx2_asm.S} +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{nttunpack.S → nttunpack_avx2_asm.S} +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d10.S → poly_compress_d10_avx2_asm.S} +9 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d11.S → poly_compress_d11_avx2_asm.S} +9 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d4.S → poly_compress_d4_avx2_asm.S} +9 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d5.S → poly_compress_d5_avx2_asm.S} +9 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d10.S → poly_decompress_d10_avx2_asm.S} +9 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d11.S → poly_decompress_d11_avx2_asm.S} +9 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d4.S → poly_decompress_d4_avx2_asm.S} +9 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d5.S → poly_decompress_d5_avx2_asm.S} +9 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{mulcache_compute.S → poly_mulcache_compute_avx2_asm.S} +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{polyvec_basemul_acc_montgomery_cached_asm_k2.S → polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.S} +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{polyvec_basemul_acc_montgomery_cached_asm_k3.S → polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.S} +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{polyvec_basemul_acc_montgomery_cached_asm_k4.S → polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.S} +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{reduce.S → reduce_avx2_asm.S} +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{rej_uniform_asm.S → rej_uniform_avx2_asm.S} +9 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/rej_uniform_table.c +514 -513
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{tomont.S → tomont_avx2_asm.S} +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.c +61 -57
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.h +89 -116
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.c +31 -32
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.h +226 -301
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/randombytes.h +21 -29
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.c +68 -63
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.h +37 -48
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sys.h +44 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.h +141 -159
- data/lib/pq_crypto/version.rb +1 -1
- data/script/vendor_libs.rb +6 -6
- metadata +86 -71
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_asm.S +0 -376
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_asm.S +0 -204
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_asm.S +0 -259
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_asm.S +0 -1077
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S +0 -987
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.c +0 -488
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.h +0 -16
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/intt.S +0 -753
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l4.S +0 -129
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l5.S +0 -145
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l7.S +0 -177
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/ntt.S +0 -653
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/pointwise_montgomery.S +0 -79
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_caddq_asm.S +0 -53
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_chknorm_asm.S +0 -55
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_32_asm.S +0 -85
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_88_asm.S +0 -85
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_32_asm.S +0 -102
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_88_asm.S +0 -110
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_17_asm.S +0 -72
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_19_asm.S +0 -69
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_asm.S +0 -189
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta2_asm.S +0 -135
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta4_asm.S +0 -128
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/intt.S +0 -2311
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/ntt.S +0 -2383
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/nttunpack.S +0 -239
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise.S +0 -131
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l4.S +0 -139
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l5.S +0 -155
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l7.S +0 -187
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_caddq_avx2.c +0 -61
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
/* References
|
|
7
|
+
* ==========
|
|
8
|
+
*
|
|
9
|
+
* - [FIPS203]
|
|
10
|
+
* FIPS 203 Module-Lattice-Based Key-Encapsulation Mechanism Standard
|
|
11
|
+
* National Institute of Standards and Technology
|
|
12
|
+
* https://csrc.nist.gov/pubs/fips/203/final
|
|
13
|
+
*/
|
|
14
|
+
|
|
6
15
|
#ifndef MLK_NATIVE_API_H
|
|
7
16
|
#define MLK_NATIVE_API_H
|
|
8
17
|
/*
|
|
@@ -68,20 +77,20 @@
|
|
|
68
77
|
*/
|
|
69
78
|
|
|
70
79
|
#if defined(MLK_USE_NATIVE_NTT)
|
|
71
|
-
|
|
72
|
-
*
|
|
80
|
+
/**
|
|
81
|
+
* Compute the negacyclic number-theoretic transform (NTT) of a polynomial
|
|
82
|
+
* in place.
|
|
73
83
|
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
84
|
+
* The input polynomial is assumed to be in normal order. The output
|
|
85
|
+
* polynomial is in bitreversed order, or of a custom order if
|
|
86
|
+
* MLK_USE_NATIVE_NTT_CUSTOM_ORDER is set. See the documentation of
|
|
87
|
+
* MLK_USE_NATIVE_NTT_CUSTOM_ORDER for more information.
|
|
76
88
|
*
|
|
77
|
-
*
|
|
78
|
-
* The output polynomial is in bitreversed order, or of a
|
|
79
|
-
* custom order if MLK_USE_NATIVE_NTT_CUSTOM_ORDER is set.
|
|
80
|
-
* See the documentation of MLK_USE_NATIVE_NTT_CUSTOM_ORDER
|
|
81
|
-
* for more information.
|
|
89
|
+
* @param[in,out] p Input/output polynomial.
|
|
82
90
|
*
|
|
83
|
-
*
|
|
84
|
-
|
|
91
|
+
* @retval MLK_NATIVE_FUNC_SUCCESS Operation succeeded.
|
|
92
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Backend declined; caller should fall back.
|
|
93
|
+
*/
|
|
85
94
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
86
95
|
static MLK_INLINE int mlk_ntt_native(int16_t p[MLKEM_N])
|
|
87
96
|
__contract__(
|
|
@@ -115,18 +124,16 @@ and to/from bytes conversions."
|
|
|
115
124
|
!MLK_USE_NATIVE_POLYVEC_BASEMUL_ACC_MONTGOMERY_CACHED || \
|
|
116
125
|
!MLK_USE_NATIVE_POLY_TOBYTES || !MLK_USE_NATIVE_POLY_FROMBYTES */
|
|
117
126
|
|
|
118
|
-
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* convert a polynomial in NTT domain from bitreversed
|
|
123
|
-
* order to the custom order output by the native NTT.
|
|
127
|
+
/**
|
|
128
|
+
* When MLK_USE_NATIVE_NTT_CUSTOM_ORDER is defined, convert a polynomial in
|
|
129
|
+
* NTT domain from bitreversed order to the custom order output by the
|
|
130
|
+
* native NTT.
|
|
124
131
|
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
* Arguments: - int16_t p[MLKEM_N]: pointer to in/output polynomial
|
|
132
|
+
* This must only be defined if there is native code for all of (a) NTT,
|
|
133
|
+
* (b) invNTT, (c) basemul, (d) mulcache.
|
|
128
134
|
*
|
|
129
|
-
|
|
135
|
+
* @param[in,out] p Input/output polynomial.
|
|
136
|
+
*/
|
|
130
137
|
static MLK_INLINE void mlk_poly_permute_bitrev_to_custom(int16_t p[MLKEM_N])
|
|
131
138
|
__contract__(
|
|
132
139
|
/* We don't specify that this should be a permutation, but only
|
|
@@ -138,20 +145,20 @@ __contract__(
|
|
|
138
145
|
#endif /* MLK_USE_NATIVE_NTT_CUSTOM_ORDER */
|
|
139
146
|
|
|
140
147
|
#if defined(MLK_USE_NATIVE_INTT)
|
|
141
|
-
|
|
142
|
-
*
|
|
148
|
+
/**
|
|
149
|
+
* Compute the inverse negacyclic number-theoretic transform (NTT) of a
|
|
150
|
+
* polynomial in place.
|
|
143
151
|
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
152
|
+
* The input polynomial is in bitreversed order, or of a custom order if
|
|
153
|
+
* MLK_USE_NATIVE_NTT_CUSTOM_ORDER is set. See the documentation of
|
|
154
|
+
* MLK_USE_NATIVE_NTT_CUSTOM_ORDER for more information. The output
|
|
155
|
+
* polynomial is assumed to be in normal order.
|
|
146
156
|
*
|
|
147
|
-
*
|
|
148
|
-
* custom order if MLK_USE_NATIVE_NTT_CUSTOM_ORDER is set.
|
|
149
|
-
* See the documentation of MLK_USE_NATIVE_NTT_CUSTOM_ORDER
|
|
150
|
-
* for more information.
|
|
151
|
-
* The output polynomial is assumed to be in normal order.
|
|
157
|
+
* @param[in,out] p Input/output polynomial.
|
|
152
158
|
*
|
|
153
|
-
*
|
|
154
|
-
|
|
159
|
+
* @retval MLK_NATIVE_FUNC_SUCCESS Operation succeeded.
|
|
160
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Backend declined; caller should fall back.
|
|
161
|
+
*/
|
|
155
162
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
156
163
|
static MLK_INLINE int mlk_intt_native(int16_t p[MLKEM_N])
|
|
157
164
|
__contract__(
|
|
@@ -164,13 +171,15 @@ __contract__(
|
|
|
164
171
|
#endif /* MLK_USE_NATIVE_INTT */
|
|
165
172
|
|
|
166
173
|
#if defined(MLK_USE_NATIVE_POLY_REDUCE)
|
|
167
|
-
|
|
168
|
-
*
|
|
174
|
+
/**
|
|
175
|
+
* Apply modular reduction to all coefficients of a polynomial, mapping them
|
|
176
|
+
* to unsigned canonical representatives in [0,..,MLKEM_Q-1].
|
|
169
177
|
*
|
|
170
|
-
*
|
|
178
|
+
* @param[in,out] p Input/output polynomial.
|
|
171
179
|
*
|
|
172
|
-
*
|
|
173
|
-
|
|
180
|
+
* @retval MLK_NATIVE_FUNC_SUCCESS Operation succeeded.
|
|
181
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Backend declined; caller should fall back.
|
|
182
|
+
*/
|
|
174
183
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
175
184
|
static MLK_INLINE int mlk_poly_reduce_native(int16_t p[MLKEM_N])
|
|
176
185
|
__contract__(
|
|
@@ -183,14 +192,15 @@ __contract__(
|
|
|
183
192
|
#endif /* MLK_USE_NATIVE_POLY_REDUCE */
|
|
184
193
|
|
|
185
194
|
#if defined(MLK_USE_NATIVE_POLY_TOMONT)
|
|
186
|
-
|
|
187
|
-
*
|
|
195
|
+
/**
|
|
196
|
+
* In-place conversion of all coefficients of a polynomial from the normal
|
|
197
|
+
* domain to the Montgomery domain.
|
|
188
198
|
*
|
|
189
|
-
*
|
|
190
|
-
* from normal domain to Montgomery domain
|
|
199
|
+
* @param[in,out] p Input/output polynomial.
|
|
191
200
|
*
|
|
192
|
-
*
|
|
193
|
-
|
|
201
|
+
* @retval MLK_NATIVE_FUNC_SUCCESS Operation succeeded.
|
|
202
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Backend declined; caller should fall back.
|
|
203
|
+
*/
|
|
194
204
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
195
205
|
static MLK_INLINE int mlk_poly_tomont_native(int16_t p[MLKEM_N])
|
|
196
206
|
__contract__(
|
|
@@ -203,27 +213,23 @@ __contract__(
|
|
|
203
213
|
#endif /* MLK_USE_NATIVE_POLY_TOMONT */
|
|
204
214
|
|
|
205
215
|
#if defined(MLK_USE_NATIVE_POLY_MULCACHE_COMPUTE)
|
|
206
|
-
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
|
|
223
|
-
* for more information.
|
|
224
|
-
* OUTPUT
|
|
225
|
-
* - cache: pointer to multiplication cache
|
|
226
|
-
**************************************************/
|
|
216
|
+
/**
|
|
217
|
+
* Compute multiplication cache for a polynomial in NTT domain.
|
|
218
|
+
*
|
|
219
|
+
* The purpose of the multiplication cache is to cache repeated computations
|
|
220
|
+
* required during a base multiplication of polynomials in NTT domain. The
|
|
221
|
+
* structure of the multiplication-cache is implementation defined.
|
|
222
|
+
*
|
|
223
|
+
* @param[out] cache Multiplication cache.
|
|
224
|
+
* @param[in] mlk_poly Input polynomial. Must be in NTT domain and in
|
|
225
|
+
* bitreversed order, or of a custom order if
|
|
226
|
+
* MLK_USE_NATIVE_NTT_CUSTOM_ORDER is set. See the
|
|
227
|
+
* documentation of MLK_USE_NATIVE_NTT_CUSTOM_ORDER for
|
|
228
|
+
* more information.
|
|
229
|
+
*
|
|
230
|
+
* @retval MLK_NATIVE_FUNC_SUCCESS Operation succeeded.
|
|
231
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Backend declined; caller should fall back.
|
|
232
|
+
*/
|
|
227
233
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
228
234
|
static MLK_INLINE int mlk_poly_mulcache_compute_native(
|
|
229
235
|
int16_t cache[MLKEM_N / 2], const int16_t mlk_poly[MLKEM_N])
|
|
@@ -238,25 +244,22 @@ __contract__(
|
|
|
238
244
|
|
|
239
245
|
#if defined(MLK_USE_NATIVE_POLYVEC_BASEMUL_ACC_MONTGOMERY_CACHED)
|
|
240
246
|
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 2
|
|
241
|
-
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
|
|
257
|
-
* - r: The result of the scalar product. This is again
|
|
258
|
-
* in NTT domain, and of the same ordering as a and b.
|
|
259
|
-
**************************************************/
|
|
247
|
+
/**
|
|
248
|
+
* Compute scalar product of length-2 polynomial vectors in NTT domain.
|
|
249
|
+
*
|
|
250
|
+
* @param[out] r Result of the scalar product. Again in NTT domain, of
|
|
251
|
+
* the same ordering as @p a and @p b.
|
|
252
|
+
* @param[in] a First polynomial vector operand. Must be in NTT
|
|
253
|
+
* domain and in bitreversed order, or of a custom order
|
|
254
|
+
* if MLK_USE_NATIVE_NTT_CUSTOM_ORDER is set. See the
|
|
255
|
+
* documentation of MLK_USE_NATIVE_NTT_CUSTOM_ORDER for
|
|
256
|
+
* more information.
|
|
257
|
+
* @param[in] b Second polynomial vector operand. As for @p a.
|
|
258
|
+
* @param[in] b_cache Multiplication-cache for @p b.
|
|
259
|
+
*
|
|
260
|
+
* @retval MLK_NATIVE_FUNC_SUCCESS Operation succeeded.
|
|
261
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Backend declined; caller should fall back.
|
|
262
|
+
*/
|
|
260
263
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
261
264
|
static MLK_INLINE int mlk_polyvec_basemul_acc_montgomery_cached_k2_native(
|
|
262
265
|
int16_t r[MLKEM_N], const int16_t a[2 * MLKEM_N],
|
|
@@ -273,25 +276,22 @@ __contract__(
|
|
|
273
276
|
#endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 2 */
|
|
274
277
|
|
|
275
278
|
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 3
|
|
276
|
-
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
|
|
292
|
-
* - r: The result of the scalar product. This is again
|
|
293
|
-
* in NTT domain, and of the same ordering as a and b.
|
|
294
|
-
**************************************************/
|
|
279
|
+
/**
|
|
280
|
+
* Compute scalar product of length-3 polynomial vectors in NTT domain.
|
|
281
|
+
*
|
|
282
|
+
* @param[out] r Result of the scalar product. Again in NTT domain, of
|
|
283
|
+
* the same ordering as @p a and @p b.
|
|
284
|
+
* @param[in] a First polynomial vector operand. Must be in NTT
|
|
285
|
+
* domain and in bitreversed order, or of a custom order
|
|
286
|
+
* if MLK_USE_NATIVE_NTT_CUSTOM_ORDER is set. See the
|
|
287
|
+
* documentation of MLK_USE_NATIVE_NTT_CUSTOM_ORDER for
|
|
288
|
+
* more information.
|
|
289
|
+
* @param[in] b Second polynomial vector operand. As for @p a.
|
|
290
|
+
* @param[in] b_cache Multiplication-cache for @p b.
|
|
291
|
+
*
|
|
292
|
+
* @retval MLK_NATIVE_FUNC_SUCCESS Operation succeeded.
|
|
293
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Backend declined; caller should fall back.
|
|
294
|
+
*/
|
|
295
295
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
296
296
|
static MLK_INLINE int mlk_polyvec_basemul_acc_montgomery_cached_k3_native(
|
|
297
297
|
int16_t r[MLKEM_N], const int16_t a[3 * MLKEM_N],
|
|
@@ -308,25 +308,22 @@ __contract__(
|
|
|
308
308
|
#endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 3 */
|
|
309
309
|
|
|
310
310
|
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4
|
|
311
|
-
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
|
|
327
|
-
* - r: The result of the scalar product. This is again
|
|
328
|
-
* in NTT domain, and of the same ordering as a and b.
|
|
329
|
-
**************************************************/
|
|
311
|
+
/**
|
|
312
|
+
* Compute scalar product of length-4 polynomial vectors in NTT domain.
|
|
313
|
+
*
|
|
314
|
+
* @param[out] r Result of the scalar product. Again in NTT domain, of
|
|
315
|
+
* the same ordering as @p a and @p b.
|
|
316
|
+
* @param[in] a First polynomial vector operand. Must be in NTT
|
|
317
|
+
* domain and in bitreversed order, or of a custom order
|
|
318
|
+
* if MLK_USE_NATIVE_NTT_CUSTOM_ORDER is set. See the
|
|
319
|
+
* documentation of MLK_USE_NATIVE_NTT_CUSTOM_ORDER for
|
|
320
|
+
* more information.
|
|
321
|
+
* @param[in] b Second polynomial vector operand. As for @p a.
|
|
322
|
+
* @param[in] b_cache Multiplication-cache for @p b.
|
|
323
|
+
*
|
|
324
|
+
* @retval MLK_NATIVE_FUNC_SUCCESS Operation succeeded.
|
|
325
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Backend declined; caller should fall back.
|
|
326
|
+
*/
|
|
330
327
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
331
328
|
static MLK_INLINE int mlk_polyvec_basemul_acc_montgomery_cached_k4_native(
|
|
332
329
|
int16_t r[MLKEM_N], const int16_t a[4 * MLKEM_N],
|
|
@@ -344,20 +341,17 @@ __contract__(
|
|
|
344
341
|
#endif /* MLK_USE_NATIVE_POLYVEC_BASEMUL_ACC_MONTGOMERY_CACHED */
|
|
345
342
|
|
|
346
343
|
#if defined(MLK_USE_NATIVE_POLY_TOBYTES)
|
|
347
|
-
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
|
|
358
|
-
* - r: pointer to output byte array
|
|
359
|
-
* (of MLKEM_POLYBYTES bytes)
|
|
360
|
-
**************************************************/
|
|
344
|
+
/**
|
|
345
|
+
* Serialization of a polynomial with unsigned canonical coefficients.
|
|
346
|
+
*
|
|
347
|
+
* @spec{Implements ByteEncode_12 from @[FIPS203, Algorithm 5].}
|
|
348
|
+
*
|
|
349
|
+
* @param[out] r Output byte array (of MLKEM_POLYBYTES bytes).
|
|
350
|
+
* @param[in] a Input polynomial, with each coefficient in [0,..,MLKEM_Q-1].
|
|
351
|
+
*
|
|
352
|
+
* @retval MLK_NATIVE_FUNC_SUCCESS Operation succeeded.
|
|
353
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Backend declined; caller should fall back.
|
|
354
|
+
*/
|
|
361
355
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
362
356
|
static MLK_INLINE int mlk_poly_tobytes_native(uint8_t r[MLKEM_POLYBYTES],
|
|
363
357
|
const int16_t a[MLKEM_N])
|
|
@@ -371,19 +365,17 @@ __contract__(
|
|
|
371
365
|
#endif /* MLK_USE_NATIVE_POLY_TOBYTES */
|
|
372
366
|
|
|
373
367
|
#if defined(MLK_USE_NATIVE_POLY_FROMBYTES)
|
|
374
|
-
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
|
|
385
|
-
* (of MLKEM_POLYBYTES bytes)
|
|
386
|
-
**************************************************/
|
|
368
|
+
/**
|
|
369
|
+
* Deserialization of a polynomial.
|
|
370
|
+
*
|
|
371
|
+
* @spec{Implements ByteDecode_12 from @[FIPS203, Algorithm 6].}
|
|
372
|
+
*
|
|
373
|
+
* @param[out] a Output polynomial in NTT domain.
|
|
374
|
+
* @param[in] r Input byte array (of MLKEM_POLYBYTES bytes).
|
|
375
|
+
*
|
|
376
|
+
* @retval MLK_NATIVE_FUNC_SUCCESS Operation succeeded.
|
|
377
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Backend declined; caller should fall back.
|
|
378
|
+
*/
|
|
387
379
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
388
380
|
static MLK_INLINE int mlk_poly_frombytes_native(
|
|
389
381
|
int16_t a[MLKEM_N], const uint8_t r[MLKEM_POLYBYTES])
|
|
@@ -397,23 +389,20 @@ __contract__(
|
|
|
397
389
|
#endif /* MLK_USE_NATIVE_POLY_FROMBYTES */
|
|
398
390
|
|
|
399
391
|
#if defined(MLK_USE_NATIVE_REJ_UNIFORM)
|
|
400
|
-
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
*
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
*
|
|
413
|
-
|
|
414
|
-
* Otherwise, returns non-negative number of sampled 16-bit integers (at most
|
|
415
|
-
* len).
|
|
416
|
-
**************************************************/
|
|
392
|
+
/**
|
|
393
|
+
* Run rejection sampling on uniformly random bytes to generate uniformly random
|
|
394
|
+
* integers mod MLKEM_Q, represented in [0,..,MLKEM_Q-1].
|
|
395
|
+
*
|
|
396
|
+
* @param[out] r Output buffer.
|
|
397
|
+
* @param len Requested number of 16-bit integers (uniform mod MLKEM_Q).
|
|
398
|
+
* @param[in] buf Input buffer (assumed to be uniform random bytes).
|
|
399
|
+
* @param buflen Length of input buffer in bytes.
|
|
400
|
+
*
|
|
401
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Native implementation does not support
|
|
402
|
+
* the input lengths.
|
|
403
|
+
* @retval other Non-negative number of sampled 16-bit
|
|
404
|
+
* integers (at most @p len).
|
|
405
|
+
*/
|
|
417
406
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
418
407
|
static MLK_INLINE int mlk_rej_uniform_native(int16_t *r, unsigned len,
|
|
419
408
|
const uint8_t *buf,
|
|
@@ -432,18 +421,19 @@ __contract__(
|
|
|
432
421
|
|
|
433
422
|
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || (MLKEM_K == 2 || MLKEM_K == 3)
|
|
434
423
|
#if defined(MLK_USE_NATIVE_POLY_COMPRESS_D4)
|
|
435
|
-
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
*
|
|
439
|
-
*
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
*
|
|
446
|
-
|
|
424
|
+
/**
|
|
425
|
+
* Compression (4 bits) and subsequent serialization of a polynomial.
|
|
426
|
+
*
|
|
427
|
+
* @spec{Compress_4 from @[FIPS203, Eq (4.7)].}
|
|
428
|
+
*
|
|
429
|
+
* @param[out] r Output byte array (of length MLKEM_POLYCOMPRESSEDBYTES_D4
|
|
430
|
+
* bytes).
|
|
431
|
+
* @param[in] a Input polynomial. Coefficients must be unsigned canonical,
|
|
432
|
+
* i.e. in [0,1,..,MLKEM_Q-1].
|
|
433
|
+
*
|
|
434
|
+
* @retval MLK_NATIVE_FUNC_SUCCESS Operation succeeded.
|
|
435
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Backend declined; caller should fall back.
|
|
436
|
+
*/
|
|
447
437
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
448
438
|
static MLK_INLINE int mlk_poly_compress_d4_native(
|
|
449
439
|
uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D4], const int16_t a[MLKEM_N])
|
|
@@ -456,18 +446,19 @@ __contract__(
|
|
|
456
446
|
#endif /* MLK_USE_NATIVE_POLY_COMPRESS_D4 */
|
|
457
447
|
|
|
458
448
|
#if defined(MLK_USE_NATIVE_POLY_COMPRESS_D10)
|
|
459
|
-
|
|
460
|
-
*
|
|
461
|
-
*
|
|
462
|
-
*
|
|
463
|
-
*
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
*
|
|
467
|
-
*
|
|
468
|
-
*
|
|
469
|
-
*
|
|
470
|
-
|
|
449
|
+
/**
|
|
450
|
+
* Compression (10 bits) and subsequent serialization of a polynomial.
|
|
451
|
+
*
|
|
452
|
+
* @spec{Compress_10 from @[FIPS203, Eq (4.7)].}
|
|
453
|
+
*
|
|
454
|
+
* @param[out] r Output byte array (of length MLKEM_POLYCOMPRESSEDBYTES_D10
|
|
455
|
+
* bytes).
|
|
456
|
+
* @param[in] a Input polynomial. Coefficients must be unsigned canonical,
|
|
457
|
+
* i.e. in [0,1,..,MLKEM_Q-1].
|
|
458
|
+
*
|
|
459
|
+
* @retval MLK_NATIVE_FUNC_SUCCESS Operation succeeded.
|
|
460
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Backend declined; caller should fall back.
|
|
461
|
+
*/
|
|
471
462
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
472
463
|
static MLK_INLINE int mlk_poly_compress_d10_native(
|
|
473
464
|
uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D10], const int16_t a[MLKEM_N])
|
|
@@ -480,20 +471,22 @@ __contract__(
|
|
|
480
471
|
#endif /* MLK_USE_NATIVE_POLY_COMPRESS_D10 */
|
|
481
472
|
|
|
482
473
|
#if defined(MLK_USE_NATIVE_POLY_DECOMPRESS_D4)
|
|
483
|
-
|
|
484
|
-
*
|
|
474
|
+
/**
|
|
475
|
+
* De-serialization and subsequent decompression (4 bits) of a polynomial;
|
|
476
|
+
* approximate inverse of mlk_poly_compress_d4.
|
|
485
477
|
*
|
|
486
|
-
*
|
|
487
|
-
* polynomial; approximate inverse of poly_compress
|
|
478
|
+
* @spec{Decompress_4 from @[FIPS203, Eq (4.8)].}
|
|
488
479
|
*
|
|
489
|
-
*
|
|
490
|
-
*
|
|
491
|
-
* (of length MLKEM_POLYCOMPRESSEDBYTES_D4 bytes)
|
|
480
|
+
* Upon return, the coefficients of the output polynomial are
|
|
481
|
+
* unsigned-canonical (non-negative and smaller than MLKEM_Q).
|
|
492
482
|
*
|
|
493
|
-
*
|
|
494
|
-
*
|
|
483
|
+
* @param[out] r Output polynomial.
|
|
484
|
+
* @param[in] a Input byte array (of length MLKEM_POLYCOMPRESSEDBYTES_D4
|
|
485
|
+
* bytes).
|
|
495
486
|
*
|
|
496
|
-
|
|
487
|
+
* @retval MLK_NATIVE_FUNC_SUCCESS Operation succeeded.
|
|
488
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Backend declined; caller should fall back.
|
|
489
|
+
*/
|
|
497
490
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
498
491
|
static MLK_INLINE int mlk_poly_decompress_d4_native(
|
|
499
492
|
int16_t r[MLKEM_N], const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D4])
|
|
@@ -506,20 +499,22 @@ __contract__(
|
|
|
506
499
|
#endif /* MLK_USE_NATIVE_POLY_DECOMPRESS_D4 */
|
|
507
500
|
|
|
508
501
|
#if defined(MLK_USE_NATIVE_POLY_DECOMPRESS_D10)
|
|
509
|
-
|
|
510
|
-
*
|
|
502
|
+
/**
|
|
503
|
+
* De-serialization and subsequent decompression (10 bits) of a polynomial;
|
|
504
|
+
* approximate inverse of mlk_poly_compress_d10.
|
|
511
505
|
*
|
|
512
|
-
*
|
|
513
|
-
* polynomial; approximate inverse of mlk_poly_compress_d10
|
|
506
|
+
* @spec{Decompress_10 from @[FIPS203, Eq (4.8)].}
|
|
514
507
|
*
|
|
515
|
-
*
|
|
516
|
-
*
|
|
517
|
-
* (of length MLKEM_POLYCOMPRESSEDBYTES_D10 bytes)
|
|
508
|
+
* Upon return, the coefficients of the output polynomial are
|
|
509
|
+
* unsigned-canonical (non-negative and smaller than MLKEM_Q).
|
|
518
510
|
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
511
|
+
* @param[out] r Output polynomial.
|
|
512
|
+
* @param[in] a Input byte array (of length MLKEM_POLYCOMPRESSEDBYTES_D10
|
|
513
|
+
* bytes).
|
|
521
514
|
*
|
|
522
|
-
|
|
515
|
+
* @retval MLK_NATIVE_FUNC_SUCCESS Operation succeeded.
|
|
516
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Backend declined; caller should fall back.
|
|
517
|
+
*/
|
|
523
518
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
524
519
|
static MLK_INLINE int mlk_poly_decompress_d10_native(
|
|
525
520
|
int16_t r[MLKEM_N], const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D10])
|
|
@@ -534,18 +529,19 @@ __contract__(
|
|
|
534
529
|
|
|
535
530
|
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4
|
|
536
531
|
#if defined(MLK_USE_NATIVE_POLY_COMPRESS_D5)
|
|
537
|
-
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
*
|
|
542
|
-
*
|
|
543
|
-
*
|
|
544
|
-
*
|
|
545
|
-
*
|
|
546
|
-
*
|
|
547
|
-
*
|
|
548
|
-
|
|
532
|
+
/**
|
|
533
|
+
* Compression (5 bits) and subsequent serialization of a polynomial.
|
|
534
|
+
*
|
|
535
|
+
* @spec{Compress_5 from @[FIPS203, Eq (4.7)].}
|
|
536
|
+
*
|
|
537
|
+
* @param[out] r Output byte array (of length MLKEM_POLYCOMPRESSEDBYTES_D5
|
|
538
|
+
* bytes).
|
|
539
|
+
* @param[in] a Input polynomial. Coefficients must be unsigned canonical,
|
|
540
|
+
* i.e. in [0,1,..,MLKEM_Q-1].
|
|
541
|
+
*
|
|
542
|
+
* @retval MLK_NATIVE_FUNC_SUCCESS Operation succeeded.
|
|
543
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Backend declined; caller should fall back.
|
|
544
|
+
*/
|
|
549
545
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
550
546
|
static MLK_INLINE int mlk_poly_compress_d5_native(
|
|
551
547
|
uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D5], const int16_t a[MLKEM_N])
|
|
@@ -558,18 +554,19 @@ __contract__(
|
|
|
558
554
|
#endif /* MLK_USE_NATIVE_POLY_COMPRESS_D5 */
|
|
559
555
|
|
|
560
556
|
#if defined(MLK_USE_NATIVE_POLY_COMPRESS_D11)
|
|
561
|
-
|
|
562
|
-
*
|
|
563
|
-
*
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
*
|
|
567
|
-
*
|
|
568
|
-
*
|
|
569
|
-
*
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
|
|
557
|
+
/**
|
|
558
|
+
* Compression (11 bits) and subsequent serialization of a polynomial.
|
|
559
|
+
*
|
|
560
|
+
* @spec{Compress_11 from @[FIPS203, Eq (4.7)].}
|
|
561
|
+
*
|
|
562
|
+
* @param[out] r Output byte array (of length MLKEM_POLYCOMPRESSEDBYTES_D11
|
|
563
|
+
* bytes).
|
|
564
|
+
* @param[in] a Input polynomial. Coefficients must be unsigned canonical,
|
|
565
|
+
* i.e. in [0,1,..,MLKEM_Q-1].
|
|
566
|
+
*
|
|
567
|
+
* @retval MLK_NATIVE_FUNC_SUCCESS Operation succeeded.
|
|
568
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Backend declined; caller should fall back.
|
|
569
|
+
*/
|
|
573
570
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
574
571
|
static MLK_INLINE int mlk_poly_compress_d11_native(
|
|
575
572
|
uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D11], const int16_t a[MLKEM_N])
|
|
@@ -582,20 +579,22 @@ __contract__(
|
|
|
582
579
|
#endif /* MLK_USE_NATIVE_POLY_COMPRESS_D11 */
|
|
583
580
|
|
|
584
581
|
#if defined(MLK_USE_NATIVE_POLY_DECOMPRESS_D5)
|
|
585
|
-
|
|
586
|
-
*
|
|
582
|
+
/**
|
|
583
|
+
* De-serialization and subsequent decompression (5 bits) of a polynomial;
|
|
584
|
+
* approximate inverse of mlk_poly_compress_d5.
|
|
587
585
|
*
|
|
588
|
-
*
|
|
589
|
-
* polynomial; approximate inverse of poly_compress
|
|
586
|
+
* @spec{Decompress_5 from @[FIPS203, Eq (4.8)].}
|
|
590
587
|
*
|
|
591
|
-
*
|
|
592
|
-
*
|
|
593
|
-
* (of length MLKEM_POLYCOMPRESSEDBYTES_D5 bytes)
|
|
588
|
+
* Upon return, the coefficients of the output polynomial are
|
|
589
|
+
* unsigned-canonical (non-negative and smaller than MLKEM_Q).
|
|
594
590
|
*
|
|
595
|
-
*
|
|
596
|
-
*
|
|
591
|
+
* @param[out] r Output polynomial.
|
|
592
|
+
* @param[in] a Input byte array (of length MLKEM_POLYCOMPRESSEDBYTES_D5
|
|
593
|
+
* bytes).
|
|
597
594
|
*
|
|
598
|
-
|
|
595
|
+
* @retval MLK_NATIVE_FUNC_SUCCESS Operation succeeded.
|
|
596
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Backend declined; caller should fall back.
|
|
597
|
+
*/
|
|
599
598
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
600
599
|
static MLK_INLINE int mlk_poly_decompress_d5_native(
|
|
601
600
|
int16_t r[MLKEM_N], const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D5])
|
|
@@ -608,20 +607,22 @@ __contract__(
|
|
|
608
607
|
#endif /* MLK_USE_NATIVE_POLY_DECOMPRESS_D5 */
|
|
609
608
|
|
|
610
609
|
#if defined(MLK_USE_NATIVE_POLY_DECOMPRESS_D11)
|
|
611
|
-
|
|
612
|
-
*
|
|
610
|
+
/**
|
|
611
|
+
* De-serialization and subsequent decompression (11 bits) of a polynomial;
|
|
612
|
+
* approximate inverse of mlk_poly_compress_d11.
|
|
613
613
|
*
|
|
614
|
-
*
|
|
615
|
-
* polynomial; approximate inverse of mlk_poly_compress_d11
|
|
614
|
+
* @spec{Decompress_11 from @[FIPS203, Eq (4.8)].}
|
|
616
615
|
*
|
|
617
|
-
*
|
|
618
|
-
*
|
|
619
|
-
* (of length MLKEM_POLYCOMPRESSEDBYTES_D11 bytes)
|
|
616
|
+
* Upon return, the coefficients of the output polynomial are
|
|
617
|
+
* unsigned-canonical (non-negative and smaller than MLKEM_Q).
|
|
620
618
|
*
|
|
621
|
-
*
|
|
622
|
-
*
|
|
619
|
+
* @param[out] r Output polynomial.
|
|
620
|
+
* @param[in] a Input byte array (of length MLKEM_POLYCOMPRESSEDBYTES_D11
|
|
621
|
+
* bytes).
|
|
623
622
|
*
|
|
624
|
-
|
|
623
|
+
* @retval MLK_NATIVE_FUNC_SUCCESS Operation succeeded.
|
|
624
|
+
* @retval MLK_NATIVE_FUNC_FALLBACK Backend declined; caller should fall back.
|
|
625
|
+
*/
|
|
625
626
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
626
627
|
static MLK_INLINE int mlk_poly_decompress_d11_native(
|
|
627
628
|
int16_t r[MLKEM_N], const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D11])
|