pq_crypto 0.6.2 → 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.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/ext/pqcrypto/pqcrypto_version.h +1 -1
  4. data/ext/pqcrypto/vendor/.vendored +4 -4
  5. data/ext/pqcrypto/vendor/mlkem-native/README.md +6 -3
  6. data/ext/pqcrypto/vendor/mlkem-native/RELEASE.md +22 -0
  7. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.c +77 -36
  8. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.h +135 -146
  9. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_asm.S +116 -72
  10. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_config.h +351 -415
  11. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/cbmc.h +43 -20
  12. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h +16 -8
  13. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.c +57 -31
  14. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.h +260 -349
  15. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.h +17 -24
  16. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.c +35 -37
  17. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.h +43 -57
  18. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.c +14 -15
  19. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.h +5 -4
  20. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.c +42 -6
  21. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/fips202_native_aarch64.h +31 -20
  22. 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
  23. 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
  24. 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
  25. 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
  26. 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
  27. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +10 -9
  28. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_scalar.h +2 -1
  29. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_v84a.h +1 -1
  30. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x2_v84a.h +4 -2
  31. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_scalar.h +2 -2
  32. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +1 -1
  33. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/fips202_native_armv81m.h +2 -1
  34. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +55 -9
  35. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +26 -25
  36. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_extract_bytes_x4_mve.S +58 -14
  37. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_xor_bytes_x4_mve.S +57 -16
  38. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/auto.h +2 -1
  39. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h +2 -2
  40. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/fips202_native_x86_64.h +10 -7
  41. 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
  42. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccakf1600_constants.c +12 -11
  43. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.c +167 -136
  44. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.h +75 -68
  45. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.h +135 -157
  46. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h +15 -13
  47. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/aarch64_zetas.c +143 -135
  48. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/arith_native_aarch64.h +52 -46
  49. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{intt.S → intt_aarch64_asm.S} +10 -10
  50. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{ntt.S → ntt_aarch64_asm.S} +10 -10
  51. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_mulcache_compute_asm.S → poly_mulcache_compute_aarch64_asm.S} +10 -10
  52. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_reduce_asm.S → poly_reduce_aarch64_asm.S} +10 -10
  53. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_tobytes_asm.S → poly_tobytes_aarch64_asm.S} +10 -10
  54. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_tomont_asm.S → poly_tomont_aarch64_asm.S} +10 -12
  55. 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
  56. 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
  57. 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
  58. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{rej_uniform_asm.S → rej_uniform_aarch64_asm.S} +12 -12
  59. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/rej_uniform_table.c +514 -513
  60. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/api.h +254 -253
  61. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/meta.h +6 -1
  62. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/README.md +6 -0
  63. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/meta.h +77 -0
  64. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/arith_native_ppc64le.h +24 -0
  65. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/consts.c +299 -0
  66. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/consts.h +34 -0
  67. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/intt_ppc_asm.S +3222 -0
  68. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/ntt_ppc_asm.S +1651 -0
  69. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/poly_tomont_ppc_asm.S +294 -0
  70. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/reduce_ppc_asm.S +710 -0
  71. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/meta.h +5 -0
  72. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.c +18 -16
  73. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.h +19 -24
  74. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_poly.c +53 -65
  75. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/meta.h +20 -20
  76. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/arith_native_x86_64.h +106 -88
  77. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.c +45 -35
  78. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.h +8 -8
  79. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.c +1 -1
  80. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.h +1 -1
  81. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{intt.S → intt_avx2_asm.S} +8 -8
  82. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{ntt.S → ntt_avx2_asm.S} +8 -8
  83. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{nttfrombytes.S → nttfrombytes_avx2_asm.S} +8 -8
  84. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{ntttobytes.S → ntttobytes_avx2_asm.S} +8 -8
  85. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{nttunpack.S → nttunpack_avx2_asm.S} +8 -8
  86. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d10.S → poly_compress_d10_avx2_asm.S} +9 -9
  87. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d11.S → poly_compress_d11_avx2_asm.S} +9 -9
  88. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d4.S → poly_compress_d4_avx2_asm.S} +9 -9
  89. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d5.S → poly_compress_d5_avx2_asm.S} +9 -9
  90. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d10.S → poly_decompress_d10_avx2_asm.S} +9 -9
  91. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d11.S → poly_decompress_d11_avx2_asm.S} +9 -9
  92. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d4.S → poly_decompress_d4_avx2_asm.S} +9 -9
  93. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d5.S → poly_decompress_d5_avx2_asm.S} +9 -9
  94. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{mulcache_compute.S → poly_mulcache_compute_avx2_asm.S} +8 -8
  95. 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
  96. 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
  97. 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
  98. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{reduce.S → reduce_avx2_asm.S} +8 -8
  99. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{rej_uniform_asm.S → rej_uniform_avx2_asm.S} +9 -9
  100. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/rej_uniform_table.c +514 -513
  101. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{tomont.S → tomont_avx2_asm.S} +8 -8
  102. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.c +61 -57
  103. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.h +89 -116
  104. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.c +31 -32
  105. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.h +226 -301
  106. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/randombytes.h +21 -29
  107. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.c +68 -63
  108. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.h +37 -48
  109. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sys.h +44 -2
  110. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.h +141 -159
  111. data/lib/pq_crypto/version.rb +1 -1
  112. data/script/vendor_libs.rb +3 -3
  113. metadata +47 -38
@@ -15,14 +15,14 @@
15
15
  (3 * 168) /* REJ_UNIFORM_NBLOCKS * SHAKE128_RATE */
16
16
 
17
17
  #define mlk_rej_uniform_table MLK_NAMESPACE(rej_uniform_table)
18
- extern const uint8_t mlk_rej_uniform_table[];
18
+ MLK_INTERNAL_DATA_DECLARATION const uint8_t mlk_rej_uniform_table[4096];
19
19
 
20
- #define mlk_rej_uniform_asm MLK_NAMESPACE(rej_uniform_asm)
21
- MLK_MUST_CHECK_RETURN_VALUE
22
- uint64_t mlk_rej_uniform_asm(int16_t *r, const uint8_t *buf, unsigned buflen,
23
- const uint8_t *table)
20
+ #define mlk_rej_uniform_avx2_asm MLK_NAMESPACE(rej_uniform_avx2_asm)
21
+ MLK_MUST_CHECK_RETURN_VALUE MLK_SYSV_ABI
22
+ uint64_t mlk_rej_uniform_avx2_asm(int16_t *r, const uint8_t *buf,
23
+ unsigned buflen, const uint8_t *table)
24
24
  /* This must be kept in sync with the HOL-Light specification
25
- * in proofs/hol_light/x86_64/proofs/mlkem_rej_uniform.ml. */
25
+ * in proofs/hol_light/x86_64/proofs/rej_uniform_avx2_asm.ml. */
26
26
  __contract__(
27
27
  requires(buflen % 12 == 0)
28
28
  requires(memory_no_alias(buf, buflen))
@@ -33,10 +33,11 @@ __contract__(
33
33
  ensures(array_bound(r, 0, (unsigned) return_value, 0, MLKEM_Q))
34
34
  );
35
35
 
36
- #define mlk_ntt_avx2 MLK_NAMESPACE(ntt_avx2)
37
- void mlk_ntt_avx2(int16_t *r, const int16_t *qdata)
36
+ #define mlk_ntt_avx2_asm MLK_NAMESPACE(ntt_avx2_asm)
37
+ MLK_SYSV_ABI
38
+ void mlk_ntt_avx2_asm(int16_t *r, const int16_t *qdata)
38
39
  /* This must be kept in sync with the HOL-Light specification
39
- * in proofs/hol_light/x86_64/proofs/mlkem_ntt.ml */
40
+ * in proofs/hol_light/x86_64/proofs/ntt_avx2_asm.ml */
40
41
  __contract__(
41
42
  requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
42
43
  requires(array_abs_bound(r, 0, MLKEM_N, 8192))
@@ -47,10 +48,11 @@ __contract__(
47
48
  /* check-magic: on */
48
49
  );
49
50
 
50
- #define mlk_invntt_avx2 MLK_NAMESPACE(invntt_avx2)
51
- void mlk_invntt_avx2(int16_t *r, const int16_t *qdata)
51
+ #define mlk_invntt_avx2_asm MLK_NAMESPACE(invntt_avx2_asm)
52
+ MLK_SYSV_ABI
53
+ void mlk_invntt_avx2_asm(int16_t *r, const int16_t *qdata)
52
54
  /* This must be kept in sync with the HOL-Light specification
53
- * in proofs/hol_light/x86_64/proofs/mlkem_intt.ml */
55
+ * in proofs/hol_light/x86_64/proofs/intt_avx2_asm.ml */
54
56
  __contract__(
55
57
  requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
56
58
  requires(qdata == mlk_qdata)
@@ -60,10 +62,11 @@ __contract__(
60
62
  /* check-magic: on */
61
63
  );
62
64
 
63
- #define mlk_nttunpack_avx2 MLK_NAMESPACE(nttunpack_avx2)
64
- void mlk_nttunpack_avx2(int16_t *r)
65
+ #define mlk_nttunpack_avx2_asm MLK_NAMESPACE(nttunpack_avx2_asm)
66
+ MLK_SYSV_ABI
67
+ void mlk_nttunpack_avx2_asm(int16_t *r)
65
68
  /* This must be kept in sync with the HOL-Light specification
66
- * in proofs/hol_light/x86_64/proofs/mlkem_unpack.ml */
69
+ * in proofs/hol_light/x86_64/proofs/nttunpack_avx2_asm.ml */
67
70
  __contract__(
68
71
  requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
69
72
  requires(array_bound(r, 0, MLKEM_N, 0, MLKEM_Q))
@@ -74,21 +77,24 @@ __contract__(
74
77
  r[i] == old(*(int16_t (*)[MLKEM_N])r)[j])))
75
78
  );
76
79
 
77
- #define mlk_reduce_avx2 MLK_NAMESPACE(reduce_avx2)
78
- void mlk_reduce_avx2(int16_t *r)
80
+ #define mlk_reduce_avx2_asm MLK_NAMESPACE(reduce_avx2_asm)
81
+ MLK_SYSV_ABI
82
+ void mlk_reduce_avx2_asm(int16_t *r)
79
83
  /* This must be kept in sync with the HOL-Light specification
80
- * in proofs/hol_light/x86_64/proofs/mlkem_reduce.ml */
84
+ * in proofs/hol_light/x86_64/proofs/reduce_avx2_asm.ml */
81
85
  __contract__(
82
86
  requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
83
87
  assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
84
88
  ensures(array_bound(r, 0, MLKEM_N, 0, MLKEM_Q))
85
89
  );
86
90
 
87
- #define mlk_poly_mulcache_compute_avx2 MLK_NAMESPACE(poly_mulcache_compute_avx2)
88
- void mlk_poly_mulcache_compute_avx2(int16_t *out, const int16_t *in,
89
- const int16_t *qdata)
91
+ #define mlk_poly_mulcache_compute_avx2_asm \
92
+ MLK_NAMESPACE(poly_mulcache_compute_avx2_asm)
93
+ MLK_SYSV_ABI
94
+ void mlk_poly_mulcache_compute_avx2_asm(int16_t *out, const int16_t *in,
95
+ const int16_t *qdata)
90
96
  /* This must be kept in sync with the HOL-Light specification
91
- * in proofs/hol_light/x86_64/proofs/mlkem_mulcache_compute.ml */
97
+ * in proofs/hol_light/x86_64/proofs/poly_mulcache_compute_avx2_asm.ml */
92
98
  __contract__(
93
99
  requires(memory_no_alias(out, sizeof(int16_t) * (MLKEM_N / 2)))
94
100
  requires(memory_no_alias(in, sizeof(int16_t) * MLKEM_N))
@@ -97,14 +103,13 @@ __contract__(
97
103
  ensures(array_abs_bound(out, 0, MLKEM_N/2, MLKEM_Q))
98
104
  );
99
105
 
100
- #define mlk_polyvec_basemul_acc_montgomery_cached_asm_k2 \
101
- MLK_NAMESPACE(polyvec_basemul_acc_montgomery_cached_asm_k2)
102
- void mlk_polyvec_basemul_acc_montgomery_cached_asm_k2(int16_t *r,
103
- const int16_t *a,
104
- const int16_t *b,
105
- const int16_t *b_cache)
106
+ #define mlk_polyvec_basemul_acc_montgomery_cached_k2_avx2_asm \
107
+ MLK_NAMESPACE(polyvec_basemul_acc_montgomery_cached_k2_avx2_asm)
108
+ MLK_SYSV_ABI
109
+ void mlk_polyvec_basemul_acc_montgomery_cached_k2_avx2_asm(
110
+ int16_t *r, const int16_t *a, const int16_t *b, const int16_t *b_cache)
106
111
  /* This must be kept in sync with the HOL-Light specification in
107
- * proofs/hol_light/x86_64/proofs/mlkem_poly_basemul_acc_montgomery_cached_k2.ml.
112
+ * proofs/hol_light/x86_64/proofs/polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.ml.
108
113
  */
109
114
  __contract__(
110
115
  requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
@@ -115,14 +120,13 @@ __contract__(
115
120
  assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
116
121
  );
117
122
 
118
- #define mlk_polyvec_basemul_acc_montgomery_cached_asm_k3 \
119
- MLK_NAMESPACE(polyvec_basemul_acc_montgomery_cached_asm_k3)
120
- void mlk_polyvec_basemul_acc_montgomery_cached_asm_k3(int16_t *r,
121
- const int16_t *a,
122
- const int16_t *b,
123
- const int16_t *b_cache)
123
+ #define mlk_polyvec_basemul_acc_montgomery_cached_k3_avx2_asm \
124
+ MLK_NAMESPACE(polyvec_basemul_acc_montgomery_cached_k3_avx2_asm)
125
+ MLK_SYSV_ABI
126
+ void mlk_polyvec_basemul_acc_montgomery_cached_k3_avx2_asm(
127
+ int16_t *r, const int16_t *a, const int16_t *b, const int16_t *b_cache)
124
128
  /* This must be kept in sync with the HOL-Light specification in
125
- * proofs/hol_light/x86_64/proofs/mlkem_poly_basemul_acc_montgomery_cached_k3.ml.
129
+ * proofs/hol_light/x86_64/proofs/polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.ml.
126
130
  */
127
131
  __contract__(
128
132
  requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
@@ -133,14 +137,13 @@ __contract__(
133
137
  assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
134
138
  );
135
139
 
136
- #define mlk_polyvec_basemul_acc_montgomery_cached_asm_k4 \
137
- MLK_NAMESPACE(polyvec_basemul_acc_montgomery_cached_asm_k4)
138
- void mlk_polyvec_basemul_acc_montgomery_cached_asm_k4(int16_t *r,
139
- const int16_t *a,
140
- const int16_t *b,
141
- const int16_t *b_cache)
140
+ #define mlk_polyvec_basemul_acc_montgomery_cached_k4_avx2_asm \
141
+ MLK_NAMESPACE(polyvec_basemul_acc_montgomery_cached_k4_avx2_asm)
142
+ MLK_SYSV_ABI
143
+ void mlk_polyvec_basemul_acc_montgomery_cached_k4_avx2_asm(
144
+ int16_t *r, const int16_t *a, const int16_t *b, const int16_t *b_cache)
142
145
  /* This must be kept in sync with the HOL-Light specification in
143
- * proofs/hol_light/x86_64/proofs/mlkem_poly_basemul_acc_montgomery_cached_k4.ml.
146
+ * proofs/hol_light/x86_64/proofs/polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.ml.
144
147
  */
145
148
  __contract__(
146
149
  requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
@@ -151,10 +154,11 @@ __contract__(
151
154
  assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
152
155
  );
153
156
 
154
- #define mlk_ntttobytes_avx2 MLK_NAMESPACE(ntttobytes_avx2)
155
- void mlk_ntttobytes_avx2(uint8_t *r, const int16_t *a)
157
+ #define mlk_ntttobytes_avx2_asm MLK_NAMESPACE(ntttobytes_avx2_asm)
158
+ MLK_SYSV_ABI
159
+ void mlk_ntttobytes_avx2_asm(uint8_t *r, const int16_t *a)
156
160
  /* This must be kept in sync with the HOL-Light specification in
157
- * proofs/hol_light/x86_64/proofs/mlkem_tobytes.ml.
161
+ * proofs/hol_light/x86_64/proofs/ntttobytes_avx2_asm.ml.
158
162
  */
159
163
  __contract__(
160
164
  requires(memory_no_alias(r, MLKEM_POLYBYTES))
@@ -163,10 +167,11 @@ __contract__(
163
167
  assigns(memory_slice(r, MLKEM_POLYBYTES))
164
168
  );
165
169
 
166
- #define mlk_nttfrombytes_avx2 MLK_NAMESPACE(nttfrombytes_avx2)
167
- void mlk_nttfrombytes_avx2(int16_t *r, const uint8_t *a)
170
+ #define mlk_nttfrombytes_avx2_asm MLK_NAMESPACE(nttfrombytes_avx2_asm)
171
+ MLK_SYSV_ABI
172
+ void mlk_nttfrombytes_avx2_asm(int16_t *r, const uint8_t *a)
168
173
  /* This must be kept in sync with the HOL-Light specification in
169
- * proofs/hol_light/x86_64/proofs/mlkem_frombytes.ml.
174
+ * proofs/hol_light/x86_64/proofs/nttfrombytes_avx2_asm.ml.
170
175
  */
171
176
  __contract__(
172
177
  requires(memory_no_alias(a, MLKEM_POLYBYTES))
@@ -175,10 +180,11 @@ __contract__(
175
180
  ensures(array_bound(r, 0, MLKEM_N, 0, MLKEM_UINT12_LIMIT))
176
181
  );
177
182
 
178
- #define mlk_tomont_avx2 MLK_NAMESPACE(tomont_avx2)
179
- void mlk_tomont_avx2(int16_t *r)
183
+ #define mlk_tomont_avx2_asm MLK_NAMESPACE(tomont_avx2_asm)
184
+ MLK_SYSV_ABI
185
+ void mlk_tomont_avx2_asm(int16_t *r)
180
186
  /* This must be kept in sync with the HOL-Light specification in
181
- * proofs/hol_light/x86_64/proofs/mlkem_tomont.ml.
187
+ * proofs/hol_light/x86_64/proofs/tomont_avx2_asm.ml.
182
188
  */
183
189
  __contract__(
184
190
  requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
@@ -186,12 +192,13 @@ __contract__(
186
192
  ensures(array_abs_bound(r, 0, MLKEM_N, MLKEM_Q))
187
193
  );
188
194
 
189
- #define mlk_poly_compress_d4_avx2 MLK_NAMESPACE(poly_compress_d4_avx2)
190
- void mlk_poly_compress_d4_avx2(uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D4],
191
- const int16_t *MLK_RESTRICT a,
192
- const uint8_t *data)
195
+ #define mlk_poly_compress_d4_avx2_asm MLK_NAMESPACE(poly_compress_d4_avx2_asm)
196
+ MLK_SYSV_ABI
197
+ void mlk_poly_compress_d4_avx2_asm(uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D4],
198
+ const int16_t *MLK_RESTRICT a,
199
+ const uint8_t *data)
193
200
  /* This must be kept in sync with the HOL-Light specification in
194
- * proofs/hol_light/x86_64/proofs/mlkem_poly_compress_d4.ml.
201
+ * proofs/hol_light/x86_64/proofs/poly_compress_d4_avx2_asm.ml.
195
202
  */
196
203
  __contract__(
197
204
  requires(memory_no_alias(r, MLKEM_POLYCOMPRESSEDBYTES_D4))
@@ -201,12 +208,14 @@ __contract__(
201
208
  assigns(memory_slice(r, MLKEM_POLYCOMPRESSEDBYTES_D4))
202
209
  );
203
210
 
204
- #define mlk_poly_decompress_d4_avx2 MLK_NAMESPACE(poly_decompress_d4_avx2)
205
- void mlk_poly_decompress_d4_avx2(int16_t *MLK_RESTRICT r,
206
- const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D4],
207
- const uint8_t *data)
211
+ #define mlk_poly_decompress_d4_avx2_asm \
212
+ MLK_NAMESPACE(poly_decompress_d4_avx2_asm)
213
+ MLK_SYSV_ABI
214
+ void mlk_poly_decompress_d4_avx2_asm(
215
+ int16_t *MLK_RESTRICT r, const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D4],
216
+ const uint8_t *data)
208
217
  /* This must be kept in sync with the HOL-Light specification in
209
- * proofs/hol_light/x86_64/proofs/mlkem_poly_decompress_d4.ml.
218
+ * proofs/hol_light/x86_64/proofs/poly_decompress_d4_avx2_asm.ml.
210
219
  */
211
220
  __contract__(
212
221
  requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
@@ -216,12 +225,13 @@ __contract__(
216
225
  ensures(array_bound(r, 0, MLKEM_N, 0, MLKEM_Q))
217
226
  );
218
227
 
219
- #define mlk_poly_compress_d10_avx2 MLK_NAMESPACE(poly_compress_d10_avx2)
220
- void mlk_poly_compress_d10_avx2(uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D10],
221
- const int16_t *MLK_RESTRICT a,
222
- const uint8_t *data)
228
+ #define mlk_poly_compress_d10_avx2_asm MLK_NAMESPACE(poly_compress_d10_avx2_asm)
229
+ MLK_SYSV_ABI
230
+ void mlk_poly_compress_d10_avx2_asm(uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D10],
231
+ const int16_t *MLK_RESTRICT a,
232
+ const uint8_t *data)
223
233
  /* This must be kept in sync with the HOL-Light specification in
224
- * proofs/hol_light/x86_64/proofs/mlkem_poly_compress_d10.ml.
234
+ * proofs/hol_light/x86_64/proofs/poly_compress_d10_avx2_asm.ml.
225
235
  */
226
236
  __contract__(
227
237
  requires(memory_no_alias(r, MLKEM_POLYCOMPRESSEDBYTES_D10))
@@ -231,12 +241,14 @@ __contract__(
231
241
  assigns(memory_slice(r, MLKEM_POLYCOMPRESSEDBYTES_D10))
232
242
  );
233
243
 
234
- #define mlk_poly_decompress_d10_avx2 MLK_NAMESPACE(poly_decompress_d10_avx2)
235
- void mlk_poly_decompress_d10_avx2(
244
+ #define mlk_poly_decompress_d10_avx2_asm \
245
+ MLK_NAMESPACE(poly_decompress_d10_avx2_asm)
246
+ MLK_SYSV_ABI
247
+ void mlk_poly_decompress_d10_avx2_asm(
236
248
  int16_t *MLK_RESTRICT r, const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D10],
237
249
  const uint8_t *data)
238
250
  /* This must be kept in sync with the HOL-Light specification in
239
- * proofs/hol_light/x86_64/proofs/mlkem_poly_decompress_d10.ml.
251
+ * proofs/hol_light/x86_64/proofs/poly_decompress_d10_avx2_asm.ml.
240
252
  */
241
253
  __contract__(
242
254
  requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
@@ -246,12 +258,13 @@ __contract__(
246
258
  ensures(array_bound(r, 0, MLKEM_N, 0, MLKEM_Q))
247
259
  );
248
260
 
249
- #define mlk_poly_compress_d5_avx2 MLK_NAMESPACE(poly_compress_d5_avx2)
250
- void mlk_poly_compress_d5_avx2(uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D5],
251
- const int16_t *MLK_RESTRICT a,
252
- const uint8_t *data)
261
+ #define mlk_poly_compress_d5_avx2_asm MLK_NAMESPACE(poly_compress_d5_avx2_asm)
262
+ MLK_SYSV_ABI
263
+ void mlk_poly_compress_d5_avx2_asm(uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D5],
264
+ const int16_t *MLK_RESTRICT a,
265
+ const uint8_t *data)
253
266
  /* This must be kept in sync with the HOL-Light specification in
254
- * proofs/hol_light/x86_64/proofs/mlkem_poly_compress_d5.ml.
267
+ * proofs/hol_light/x86_64/proofs/poly_compress_d5_avx2_asm.ml.
255
268
  */
256
269
  __contract__(
257
270
  requires(memory_no_alias(r, MLKEM_POLYCOMPRESSEDBYTES_D5))
@@ -261,12 +274,14 @@ __contract__(
261
274
  assigns(memory_slice(r, MLKEM_POLYCOMPRESSEDBYTES_D5))
262
275
  );
263
276
 
264
- #define mlk_poly_decompress_d5_avx2 MLK_NAMESPACE(poly_decompress_d5_avx2)
265
- void mlk_poly_decompress_d5_avx2(int16_t *MLK_RESTRICT r,
266
- const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D5],
267
- const uint8_t *data)
277
+ #define mlk_poly_decompress_d5_avx2_asm \
278
+ MLK_NAMESPACE(poly_decompress_d5_avx2_asm)
279
+ MLK_SYSV_ABI
280
+ void mlk_poly_decompress_d5_avx2_asm(
281
+ int16_t *MLK_RESTRICT r, const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D5],
282
+ const uint8_t *data)
268
283
  /* This must be kept in sync with the HOL-Light specification in
269
- * proofs/hol_light/x86_64/proofs/mlkem_poly_decompress_d5.ml.
284
+ * proofs/hol_light/x86_64/proofs/poly_decompress_d5_avx2_asm.ml.
270
285
  */
271
286
  __contract__(
272
287
  requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
@@ -276,12 +291,13 @@ __contract__(
276
291
  ensures(array_bound(r, 0, MLKEM_N, 0, MLKEM_Q))
277
292
  );
278
293
 
279
- #define mlk_poly_compress_d11_avx2 MLK_NAMESPACE(poly_compress_d11_avx2)
280
- void mlk_poly_compress_d11_avx2(uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D11],
281
- const int16_t *MLK_RESTRICT a,
282
- const uint8_t *data)
294
+ #define mlk_poly_compress_d11_avx2_asm MLK_NAMESPACE(poly_compress_d11_avx2_asm)
295
+ MLK_SYSV_ABI
296
+ void mlk_poly_compress_d11_avx2_asm(uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D11],
297
+ const int16_t *MLK_RESTRICT a,
298
+ const uint8_t *data)
283
299
  /* This must be kept in sync with the HOL-Light specification in
284
- * proofs/hol_light/x86_64/proofs/mlkem_poly_compress_d11.ml.
300
+ * proofs/hol_light/x86_64/proofs/poly_compress_d11_avx2_asm.ml.
285
301
  */
286
302
  __contract__(
287
303
  requires(memory_no_alias(r, MLKEM_POLYCOMPRESSEDBYTES_D11))
@@ -291,12 +307,14 @@ __contract__(
291
307
  assigns(memory_slice(r, MLKEM_POLYCOMPRESSEDBYTES_D11))
292
308
  );
293
309
 
294
- #define mlk_poly_decompress_d11_avx2 MLK_NAMESPACE(poly_decompress_d11_avx2)
295
- void mlk_poly_decompress_d11_avx2(
310
+ #define mlk_poly_decompress_d11_avx2_asm \
311
+ MLK_NAMESPACE(poly_decompress_d11_avx2_asm)
312
+ MLK_SYSV_ABI
313
+ void mlk_poly_decompress_d11_avx2_asm(
296
314
  int16_t *MLK_RESTRICT r, const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D11],
297
315
  const uint8_t *data)
298
316
  /* This must be kept in sync with the HOL-Light specification in
299
- * proofs/hol_light/x86_64/proofs/mlkem_poly_decompress_d11.ml.
317
+ * proofs/hol_light/x86_64/proofs/poly_decompress_d11_avx2_asm.ml.
300
318
  */
301
319
  __contract__(
302
320
  requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
@@ -19,25 +19,29 @@
19
19
  (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 2 || \
20
20
  MLKEM_K == 3)
21
21
 
22
- MLK_ALIGN const uint8_t mlk_compress_d4_data[32] = {
23
- 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0,
24
- 2, 0, 0, 0, 6, 0, 0, 0, 3, 0, 0, 0, 7, 0, 0, 0, /* permdidx */
22
+ MLK_ALIGN MLK_INTERNAL_DATA_DEFINITION const uint8_t
23
+ mlk_compress_d4_data[32] = {
24
+ 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0,
25
+ 2, 0, 0, 0, 6, 0, 0, 0, 3, 0, 0, 0, 7, 0, 0, 0, /* permdidx */
25
26
  };
26
27
 
27
- MLK_ALIGN const uint8_t mlk_decompress_d4_data[32] = {
28
- 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
29
- 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, /* shufbidx */
28
+ MLK_ALIGN MLK_INTERNAL_DATA_DEFINITION const uint8_t
29
+ mlk_decompress_d4_data[32] = {
30
+ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
31
+ 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, /* shufbidx */
30
32
  };
31
33
 
32
- MLK_ALIGN const uint8_t mlk_compress_d10_data[32] = {
33
- 0, 1, 2, 3, 4, 8, 9, 10, 11, 12, 255,
34
- 255, 255, 255, 255, 255, 9, 10, 11, 12, 255, 255,
35
- 255, 255, 255, 255, 0, 1, 2, 3, 4, 8, /* shufbidx */
34
+ MLK_ALIGN MLK_INTERNAL_DATA_DEFINITION const uint8_t
35
+ mlk_compress_d10_data[32] = {
36
+ 0, 1, 2, 3, 4, 8, 9, 10, 11, 12, 255,
37
+ 255, 255, 255, 255, 255, 9, 10, 11, 12, 255, 255,
38
+ 255, 255, 255, 255, 0, 1, 2, 3, 4, 8, /* shufbidx */
36
39
  };
37
40
 
38
- MLK_ALIGN const uint8_t mlk_decompress_d10_data[32] = {
39
- 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9,
40
- 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, /* shufbidx */
41
+ MLK_ALIGN MLK_INTERNAL_DATA_DEFINITION const uint8_t
42
+ mlk_decompress_d10_data[32] = {
43
+ 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9,
44
+ 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, /* shufbidx */
41
45
  };
42
46
 
43
47
  #endif /* !MLK_CONFIG_MULTILEVEL_NO_SHARED && \
@@ -47,7 +51,7 @@ MLK_ALIGN const uint8_t mlk_decompress_d10_data[32] = {
47
51
  #if !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
48
52
  (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4)
49
53
 
50
- MLK_ALIGN const uint8_t
54
+ MLK_ALIGN MLK_INTERNAL_DATA_DEFINITION const uint8_t
51
55
  mlk_compress_d5_data[32] = {
52
56
  0, 1, 2, 3, 4, 255, 255, 255, 255, 255, 8,
53
57
  9, 10, 11, 12, 255, 9, 10, 11, 12, 255, 0,
@@ -55,33 +59,39 @@ MLK_ALIGN const uint8_t
55
59
  };
56
60
 
57
61
  /* shufbidx[0:32], mask[32:64], shift[64:96] */
58
- MLK_ALIGN const uint8_t mlk_decompress_d5_data[96] = {
59
- 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5,
60
- 5, 6, 6, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, /* shufbidx */
61
- 31, 0, 224, 3, 124, 0, 128, 15, 240, 1, 62, 0, 192, 7, 248, 0, 31, 0,
62
- 224, 3, 124, 0, 128, 15, 240, 1, 62, 0, 192, 7, 248, 0, /* mask */
63
- 0, 4, 32, 0, 0, 1, 8, 0, 64, 0, 0, 2, 16, 0, 128, 0, 0, 4,
64
- 32, 0, 0, 1, 8, 0, 64, 0, 0, 2, 16, 0, 128, 0, /* shift */
62
+ MLK_ALIGN MLK_INTERNAL_DATA_DEFINITION const uint8_t
63
+ mlk_decompress_d5_data[96] = {
64
+ 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5,
65
+ 5, 6, 6, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, /* shufbidx */
66
+ 31, 0, 224, 3, 124, 0, 128, 15, 240, 1, 62, 0, 192, 7, 248, 0, 31, 0,
67
+ 224, 3, 124, 0, 128, 15, 240, 1, 62, 0, 192, 7, 248, 0, /* mask */
68
+ 0, 4, 32, 0, 0, 1, 8, 0, 64, 0, 0, 2, 16, 0, 128, 0, 0, 4,
69
+ 32, 0, 0, 1, 8, 0, 64, 0, 0, 2, 16, 0, 128, 0, /* shift */
65
70
  };
66
71
 
67
72
  /* srlvqidx[0:32], shufbidx[32:64] */
68
- MLK_ALIGN const uint8_t mlk_compress_d11_data[64] = {
69
- 10, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 10,
70
- 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, /* srlvqidx */
71
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 255, 255, 255, 255, 255, 5,
72
- 6, 7, 8, 9, 10, 255, 255, 255, 255, 0, 0, 1, 2, 3, 4, /* shufbidx */
73
+ MLK_ALIGN MLK_INTERNAL_DATA_DEFINITION const uint8_t
74
+ mlk_compress_d11_data[64] =
75
+ {
76
+ 10, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0,
77
+ 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0,
78
+ 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, /* srlvqidx */
79
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
80
+ 255, 255, 255, 255, 255, 5, 6, 7, 8, 9, 10,
81
+ 255, 255, 255, 255, 0, 0, 1, 2, 3, 4, /* shufbidx */
73
82
  };
74
83
 
75
84
  /* shufbidx[0:32], srlvdidx[32:64], srlvqidx[64:96], shift[96:128] */
76
- MLK_ALIGN const uint8_t mlk_decompress_d11_data[128] = {
77
- 0, 1, 1, 2, 2, 3, 4, 5, 5, 6, 6, 7, 8, 9, 9, 10,
78
- 3, 4, 4, 5, 5, 6, 7, 8, 8, 9, 9, 10, 11, 12, 12, 13, /* shufbidx */
79
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
80
- 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* srlvdidx */
81
- 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
82
- 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, /* srlvqidx */
83
- 32, 0, 4, 0, 1, 0, 32, 0, 8, 0, 1, 0, 32, 0, 4, 0,
84
- 32, 0, 4, 0, 1, 0, 32, 0, 8, 0, 1, 0, 32, 0, 4, 0, /* shift */
85
+ MLK_ALIGN MLK_INTERNAL_DATA_DEFINITION const uint8_t
86
+ mlk_decompress_d11_data[128] = {
87
+ 0, 1, 1, 2, 2, 3, 4, 5, 5, 6, 6, 7, 8, 9, 9, 10,
88
+ 3, 4, 4, 5, 5, 6, 7, 8, 8, 9, 9, 10, 11, 12, 12, 13, /* shufbidx */
89
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
90
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* srlvdidx */
91
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
92
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, /* srlvqidx */
93
+ 32, 0, 4, 0, 1, 0, 32, 0, 8, 0, 1, 0, 32, 0, 4, 0,
94
+ 32, 0, 4, 0, 1, 0, 32, 0, 8, 0, 1, 0, 32, 0, 4, 0, /* shift */
85
95
  };
86
96
 
87
97
  #endif /* !MLK_CONFIG_MULTILEVEL_NO_SHARED && \
@@ -17,28 +17,28 @@
17
17
  #ifndef __ASSEMBLER__
18
18
 
19
19
  #define mlk_compress_d4_data MLK_NAMESPACE(compress_d4_data)
20
- extern const uint8_t mlk_compress_d4_data[32];
20
+ MLK_INTERNAL_DATA_DECLARATION const uint8_t mlk_compress_d4_data[32];
21
21
 
22
22
  #define mlk_decompress_d4_data MLK_NAMESPACE(decompress_d4_data)
23
- extern const uint8_t mlk_decompress_d4_data[32];
23
+ MLK_INTERNAL_DATA_DECLARATION const uint8_t mlk_decompress_d4_data[32];
24
24
 
25
25
  #define mlk_compress_d10_data MLK_NAMESPACE(compress_d10_data)
26
- extern const uint8_t mlk_compress_d10_data[32];
26
+ MLK_INTERNAL_DATA_DECLARATION const uint8_t mlk_compress_d10_data[32];
27
27
 
28
28
  #define mlk_decompress_d10_data MLK_NAMESPACE(decompress_d10_data)
29
- extern const uint8_t mlk_decompress_d10_data[32];
29
+ MLK_INTERNAL_DATA_DECLARATION const uint8_t mlk_decompress_d10_data[32];
30
30
 
31
31
  #define mlk_compress_d5_data MLK_NAMESPACE(compress_d5_data)
32
- extern const uint8_t mlk_compress_d5_data[32];
32
+ MLK_INTERNAL_DATA_DECLARATION const uint8_t mlk_compress_d5_data[32];
33
33
 
34
34
  #define mlk_decompress_d5_data MLK_NAMESPACE(decompress_d5_data)
35
- extern const uint8_t mlk_decompress_d5_data[96];
35
+ MLK_INTERNAL_DATA_DECLARATION const uint8_t mlk_decompress_d5_data[96];
36
36
 
37
37
  #define mlk_compress_d11_data MLK_NAMESPACE(compress_d11_data)
38
- extern const uint8_t mlk_compress_d11_data[64];
38
+ MLK_INTERNAL_DATA_DECLARATION const uint8_t mlk_compress_d11_data[64];
39
39
 
40
40
  #define mlk_decompress_d11_data MLK_NAMESPACE(decompress_d11_data)
41
- extern const uint8_t mlk_decompress_d11_data[128];
41
+ MLK_INTERNAL_DATA_DECLARATION const uint8_t mlk_decompress_d11_data[128];
42
42
 
43
43
  #endif /* !__ASSEMBLER__ */
44
44
 
@@ -20,7 +20,7 @@
20
20
  * Table of zeta values used in the AVX2 NTTs
21
21
  * See autogen for details.
22
22
  */
23
- MLK_ALIGN const int16_t mlk_qdata[624] = {
23
+ MLK_ALIGN MLK_INTERNAL_DATA_DEFINITION const int16_t mlk_qdata[624] = {
24
24
  3854, 3340, 2826, 2312, 1798, 1284, 770, 256, 3854,
25
25
  3340, 2826, 2312, 1798, 1284, 770, 256, 7, 0,
26
26
  6, 0, 5, 0, 4, 0, 3, 0, 2,
@@ -19,7 +19,7 @@
19
19
 
20
20
  #ifndef __ASSEMBLER__
21
21
  #define mlk_qdata MLK_NAMESPACE(qdata)
22
- extern const int16_t mlk_qdata[624];
22
+ MLK_INTERNAL_DATA_DECLARATION const int16_t mlk_qdata[624];
23
23
  #endif
24
24
 
25
25
  #endif /* !MLK_NATIVE_X86_64_SRC_CONSTS_H */
@@ -34,17 +34,13 @@
34
34
 
35
35
  /*
36
36
  * WARNING: This file is auto-derived from the mlkem-native source file
37
- * dev/x86_64/src/intt.S using scripts/simpasm. Do not modify it directly.
37
+ * dev/x86_64/src/intt_avx2_asm.S using scripts/simpasm. Do not modify it directly.
38
38
  */
39
39
 
40
- #if defined(__ELF__)
41
- .section .note.GNU-stack,"",@progbits
42
- #endif
43
-
44
40
  .text
45
41
  .balign 4
46
- .global MLK_ASM_NAMESPACE(invntt_avx2)
47
- MLK_ASM_FN_SYMBOL(invntt_avx2)
42
+ .global MLK_ASM_NAMESPACE(invntt_avx2_asm)
43
+ MLK_ASM_FN_SYMBOL(invntt_avx2_asm)
48
44
 
49
45
  .cfi_startproc
50
46
  movl $0xd010d01, %eax # imm = 0xD010D01
@@ -713,7 +709,11 @@ MLK_ASM_FN_SYMBOL(invntt_avx2)
713
709
  retq
714
710
  .cfi_endproc
715
711
 
716
- MLK_ASM_FN_SIZE(invntt_avx2)
712
+ MLK_ASM_FN_SIZE(invntt_avx2_asm)
717
713
 
718
714
  #endif /* MLK_ARITH_BACKEND_X86_64_DEFAULT && !MLK_CONFIG_MULTILEVEL_NO_SHARED \
719
715
  */
716
+
717
+ #if defined(__ELF__)
718
+ .section .note.GNU-stack,"",%progbits
719
+ #endif
@@ -30,17 +30,13 @@
30
30
 
31
31
  /*
32
32
  * WARNING: This file is auto-derived from the mlkem-native source file
33
- * dev/x86_64/src/ntt.S using scripts/simpasm. Do not modify it directly.
33
+ * dev/x86_64/src/ntt_avx2_asm.S using scripts/simpasm. Do not modify it directly.
34
34
  */
35
35
 
36
- #if defined(__ELF__)
37
- .section .note.GNU-stack,"",@progbits
38
- #endif
39
-
40
36
  .text
41
37
  .balign 4
42
- .global MLK_ASM_NAMESPACE(ntt_avx2)
43
- MLK_ASM_FN_SYMBOL(ntt_avx2)
38
+ .global MLK_ASM_NAMESPACE(ntt_avx2_asm)
39
+ MLK_ASM_FN_SYMBOL(ntt_avx2_asm)
44
40
 
45
41
  .cfi_startproc
46
42
  movl $0xd010d01, %eax # imm = 0xD010D01
@@ -633,7 +629,11 @@ MLK_ASM_FN_SYMBOL(ntt_avx2)
633
629
  retq
634
630
  .cfi_endproc
635
631
 
636
- MLK_ASM_FN_SIZE(ntt_avx2)
632
+ MLK_ASM_FN_SIZE(ntt_avx2_asm)
637
633
 
638
634
  #endif /* MLK_ARITH_BACKEND_X86_64_DEFAULT && !MLK_CONFIG_MULTILEVEL_NO_SHARED \
639
635
  */
636
+
637
+ #if defined(__ELF__)
638
+ .section .note.GNU-stack,"",%progbits
639
+ #endif
@@ -24,17 +24,13 @@
24
24
 
25
25
  /*
26
26
  * WARNING: This file is auto-derived from the mlkem-native source file
27
- * dev/x86_64/src/nttfrombytes.S using scripts/simpasm. Do not modify it directly.
27
+ * dev/x86_64/src/nttfrombytes_avx2_asm.S using scripts/simpasm. Do not modify it directly.
28
28
  */
29
29
 
30
- #if defined(__ELF__)
31
- .section .note.GNU-stack,"",@progbits
32
- #endif
33
-
34
30
  .text
35
31
  .balign 4
36
- .global MLK_ASM_NAMESPACE(nttfrombytes_avx2)
37
- MLK_ASM_FN_SYMBOL(nttfrombytes_avx2)
32
+ .global MLK_ASM_NAMESPACE(nttfrombytes_avx2_asm)
33
+ MLK_ASM_FN_SYMBOL(nttfrombytes_avx2_asm)
38
34
 
39
35
  .cfi_startproc
40
36
  movl $0xfff0fff, %eax # imm = 0xFFF0FFF
@@ -187,7 +183,11 @@ MLK_ASM_FN_SYMBOL(nttfrombytes_avx2)
187
183
  retq
188
184
  .cfi_endproc
189
185
 
190
- MLK_ASM_FN_SIZE(nttfrombytes_avx2)
186
+ MLK_ASM_FN_SIZE(nttfrombytes_avx2_asm)
191
187
 
192
188
  #endif /* MLK_ARITH_BACKEND_X86_64_DEFAULT && !MLK_CONFIG_MULTILEVEL_NO_SHARED \
193
189
  */
190
+
191
+ #if defined(__ELF__)
192
+ .section .note.GNU-stack,"",%progbits
193
+ #endif