pq_crypto 0.6.3 → 0.6.5

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 (94) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +149 -17
  3. data/CHANGELOG.md +73 -0
  4. data/GET_STARTED.md +1 -1
  5. data/README.md +7 -2
  6. data/ext/pqcrypto/extconf.rb +264 -24
  7. data/ext/pqcrypto/pqcrypto_version.h +1 -1
  8. data/ext/pqcrypto/vendor/.vendored +4 -4
  9. data/ext/pqcrypto/vendor/mlkem-native/README.md +2 -4
  10. data/ext/pqcrypto/vendor/mlkem-native/RELEASE.md +98 -0
  11. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.c +8 -7
  12. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.h +21 -1
  13. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_asm.S +45 -44
  14. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_config.h +36 -0
  15. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h +13 -30
  16. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.c +25 -5
  17. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.h +14 -0
  18. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/context.h +42 -0
  19. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/auto.h +20 -12
  20. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_aarch64_asm.S +5 -3
  21. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_aarch64_asm.S +5 -2
  22. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_aarch64_asm.S +5 -2
  23. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S +10 -7
  24. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S +10 -7
  25. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_v84a.h +2 -1
  26. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x2_v84a.h +2 -1
  27. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_scalar.h +5 -0
  28. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +2 -1
  29. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/mve.h +5 -19
  30. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +8 -5
  31. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/{state_extract_bytes_x4_mve.S → keccak_f1600_x4_state_extract_bytes_mve.S} +14 -14
  32. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/{state_xor_bytes_x4_mve.S → keccak_f1600_x4_state_xor_bytes_mve.S} +12 -12
  33. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2_asm.S +36 -2
  34. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.c +22 -0
  35. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.h +6 -0
  36. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.c +11 -0
  37. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.h +25 -1
  38. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h +44 -2
  39. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/aarch64_zetas.c +2 -0
  40. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/arith_native_aarch64.h +11 -10
  41. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{intt_aarch64_asm.S → mlkem_intt_aarch64_asm.S} +16 -9
  42. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{ntt_aarch64_asm.S → mlkem_ntt_aarch64_asm.S} +10 -7
  43. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_mulcache_compute_aarch64_asm.S → mlkem_poly_mulcache_compute_aarch64_asm.S} +6 -3
  44. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_reduce_aarch64_asm.S → mlkem_poly_reduce_aarch64_asm.S} +6 -3
  45. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_tobytes_aarch64_asm.S → mlkem_poly_tobytes_aarch64_asm.S} +12 -5
  46. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_tomont_aarch64_asm.S → mlkem_poly_tomont_aarch64_asm.S} +11 -5
  47. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{polyvec_basemul_acc_montgomery_cached_k2_aarch64_asm.S → mlkem_polyvec_basemul_acc_montgomery_cached_k2_aarch64_asm.S} +6 -3
  48. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{polyvec_basemul_acc_montgomery_cached_k3_aarch64_asm.S → mlkem_polyvec_basemul_acc_montgomery_cached_k3_aarch64_asm.S} +6 -3
  49. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{polyvec_basemul_acc_montgomery_cached_k4_aarch64_asm.S → mlkem_polyvec_basemul_acc_montgomery_cached_k4_aarch64_asm.S} +6 -3
  50. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{rej_uniform_aarch64_asm.S → mlkem_rej_uniform_aarch64_asm.S} +17 -17
  51. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/api.h +21 -8
  52. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/meta.h +1 -1
  53. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/meta.h +4 -0
  54. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/{intt_ppc_asm.S → mlkem_intt_ppc_asm.S} +29 -5
  55. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/{ntt_ppc_asm.S → mlkem_ntt_ppc_asm.S} +22 -1
  56. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/{poly_tomont_ppc_asm.S → mlkem_poly_tomont_ppc_asm.S} +25 -3
  57. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/{reduce_ppc_asm.S → mlkem_reduce_ppc_asm.S} +22 -1
  58. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/meta.h +4 -0
  59. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/arith_native_riscv64.h +4 -0
  60. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_poly.c +6 -2
  61. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/meta.h +25 -5
  62. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/arith_native_x86_64.h +20 -20
  63. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.c +14 -3
  64. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.h +8 -0
  65. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{intt_avx2_asm.S → mlkem_intt_avx2_asm.S} +27 -3
  66. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{ntt_avx2_asm.S → mlkem_ntt_avx2_asm.S} +23 -1
  67. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{nttfrombytes_avx2_asm.S → mlkem_nttfrombytes_avx2_asm.S} +27 -3
  68. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{ntttobytes_avx2_asm.S → mlkem_ntttobytes_avx2_asm.S} +27 -3
  69. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{nttunpack_avx2_asm.S → mlkem_nttunpack_avx2_asm.S} +17 -1
  70. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d10_avx2_asm.S → mlkem_poly_compress_d10_avx2_asm.S} +34 -3
  71. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d11_avx2_asm.S → mlkem_poly_compress_d11_avx2_asm.S} +33 -2
  72. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d4_avx2_asm.S → mlkem_poly_compress_d4_avx2_asm.S} +34 -3
  73. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d5_avx2_asm.S → mlkem_poly_compress_d5_avx2_asm.S} +33 -2
  74. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d10_avx2_asm.S → mlkem_poly_decompress_d10_avx2_asm.S} +32 -3
  75. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d11_avx2_asm.S → mlkem_poly_decompress_d11_avx2_asm.S} +32 -2
  76. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d4_avx2_asm.S → mlkem_poly_decompress_d4_avx2_asm.S} +32 -3
  77. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d5_avx2_asm.S → mlkem_poly_decompress_d5_avx2_asm.S} +32 -2
  78. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_mulcache_compute_avx2_asm.S → mlkem_poly_mulcache_compute_avx2_asm.S} +29 -1
  79. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.S → mlkem_polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.S} +35 -1
  80. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.S → mlkem_polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.S} +35 -1
  81. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.S → mlkem_polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.S} +35 -1
  82. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{reduce_avx2_asm.S → mlkem_reduce_avx2_asm.S} +17 -1
  83. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{rej_uniform_avx2_asm.S → mlkem_rej_uniform_avx2_asm.S} +40 -7
  84. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{tomont_avx2_asm.S → mlkem_tomont_avx2_asm.S} +20 -3
  85. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.c +7 -2
  86. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.h +6 -0
  87. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.c +25 -4
  88. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.h +33 -4
  89. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.c +4 -0
  90. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.h +4 -0
  91. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sys.h +19 -1
  92. data/lib/pq_crypto/version.rb +1 -1
  93. data/script/vendor_libs.rb +3 -3
  94. metadata +41 -43
@@ -31,11 +31,41 @@
31
31
  #include "../../../common.h"
32
32
  #if defined(MLK_ARITH_BACKEND_X86_64_DEFAULT) && \
33
33
  !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
34
+ (!defined(MLK_CONFIG_NO_ENCAPS_API) || \
35
+ !defined(MLK_CONFIG_NO_DECAPS_API)) && \
34
36
  (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 2 || MLKEM_K == 3)
37
+ /*yaml
38
+ Name: poly_compress_d10_avx2_asm
39
+ Description: x86_64 AVX2 polynomial compression (d=10)
40
+ Signature: void mlk_poly_compress_d10_avx2_asm(uint8_t *r, const int16_t *a, const uint8_t *data)
41
+ ABI:
42
+ Architecture: x86_64
43
+ CallingConvention: SysV
44
+ Features: [AVX2]
45
+ rdi:
46
+ type: buffer
47
+ size_bytes: 320
48
+ permissions: write-only
49
+ c_parameter: uint8_t *r
50
+ description: Output compressed polynomial
51
+ rsi:
52
+ type: buffer
53
+ size_bytes: 512
54
+ permissions: read-only
55
+ c_parameter: const int16_t *a
56
+ description: Input polynomial (256 x int16_t)
57
+ rdx:
58
+ type: buffer
59
+ size_bytes: 32
60
+ permissions: read-only
61
+ c_parameter: const uint8_t *data
62
+ description: Precomputed compression constants
63
+ */
64
+
35
65
 
36
66
  /*
37
67
  * WARNING: This file is auto-derived from the mlkem-native source file
38
- * dev/x86_64/src/poly_compress_d10_avx2_asm.S using scripts/simpasm. Do not modify it directly.
68
+ * dev/x86_64/src/mlkem_poly_compress_d10_avx2_asm.S using scripts/simpasm. Do not modify it directly.
39
69
  */
40
70
 
41
71
  .text
@@ -374,8 +404,9 @@ MLK_ASM_FN_SYMBOL(poly_compress_d10_avx2_asm)
374
404
  MLK_ASM_FN_SIZE(poly_compress_d10_avx2_asm)
375
405
 
376
406
  #endif /* MLK_ARITH_BACKEND_X86_64_DEFAULT && !MLK_CONFIG_MULTILEVEL_NO_SHARED \
377
- && (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 2 || MLKEM_K == \
378
- 3) */
407
+ && (!MLK_CONFIG_NO_ENCAPS_API || !MLK_CONFIG_NO_DECAPS_API) && \
408
+ (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 2 || MLKEM_K == 3) \
409
+ */
379
410
 
380
411
  #if defined(__ELF__)
381
412
  .section .note.GNU-stack,"",%progbits
@@ -33,11 +33,41 @@
33
33
 
34
34
  #if defined(MLK_ARITH_BACKEND_X86_64_DEFAULT) && \
35
35
  !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
36
+ (!defined(MLK_CONFIG_NO_ENCAPS_API) || \
37
+ !defined(MLK_CONFIG_NO_DECAPS_API)) && \
36
38
  (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4)
39
+ /*yaml
40
+ Name: poly_compress_d11_avx2_asm
41
+ Description: x86_64 AVX2 polynomial compression (d=11)
42
+ Signature: void mlk_poly_compress_d11_avx2_asm(uint8_t *r, const int16_t *a, const uint8_t *data)
43
+ ABI:
44
+ Architecture: x86_64
45
+ CallingConvention: SysV
46
+ Features: [AVX2]
47
+ rdi:
48
+ type: buffer
49
+ size_bytes: 352
50
+ permissions: write-only
51
+ c_parameter: uint8_t *r
52
+ description: Output compressed polynomial
53
+ rsi:
54
+ type: buffer
55
+ size_bytes: 512
56
+ permissions: read-only
57
+ c_parameter: const int16_t *a
58
+ description: Input polynomial (256 x int16_t)
59
+ rdx:
60
+ type: buffer
61
+ size_bytes: 64
62
+ permissions: read-only
63
+ c_parameter: const uint8_t *data
64
+ description: Precomputed compression constants
65
+ */
66
+
37
67
 
38
68
  /*
39
69
  * WARNING: This file is auto-derived from the mlkem-native source file
40
- * dev/x86_64/src/poly_compress_d11_avx2_asm.S using scripts/simpasm. Do not modify it directly.
70
+ * dev/x86_64/src/mlkem_poly_compress_d11_avx2_asm.S using scripts/simpasm. Do not modify it directly.
41
71
  */
42
72
 
43
73
  .text
@@ -441,7 +471,8 @@ MLK_ASM_FN_SYMBOL(poly_compress_d11_avx2_asm)
441
471
  MLK_ASM_FN_SIZE(poly_compress_d11_avx2_asm)
442
472
 
443
473
  #endif /* MLK_ARITH_BACKEND_X86_64_DEFAULT && !MLK_CONFIG_MULTILEVEL_NO_SHARED \
444
- && (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 4) */
474
+ && (!MLK_CONFIG_NO_ENCAPS_API || !MLK_CONFIG_NO_DECAPS_API) && \
475
+ (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 4) */
445
476
 
446
477
  #if defined(__ELF__)
447
478
  .section .note.GNU-stack,"",%progbits
@@ -31,11 +31,41 @@
31
31
  #include "../../../common.h"
32
32
  #if defined(MLK_ARITH_BACKEND_X86_64_DEFAULT) && \
33
33
  !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
34
+ (!defined(MLK_CONFIG_NO_ENCAPS_API) || \
35
+ !defined(MLK_CONFIG_NO_DECAPS_API)) && \
34
36
  (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 2 || MLKEM_K == 3)
37
+ /*yaml
38
+ Name: poly_compress_d4_avx2_asm
39
+ Description: x86_64 AVX2 polynomial compression (d=4)
40
+ Signature: void mlk_poly_compress_d4_avx2_asm(uint8_t *r, const int16_t *a, const uint8_t *data)
41
+ ABI:
42
+ Architecture: x86_64
43
+ CallingConvention: SysV
44
+ Features: [AVX2]
45
+ rdi:
46
+ type: buffer
47
+ size_bytes: 128
48
+ permissions: write-only
49
+ c_parameter: uint8_t *r
50
+ description: Output compressed polynomial
51
+ rsi:
52
+ type: buffer
53
+ size_bytes: 512
54
+ permissions: read-only
55
+ c_parameter: const int16_t *a
56
+ description: Input polynomial (256 x int16_t)
57
+ rdx:
58
+ type: buffer
59
+ size_bytes: 32
60
+ permissions: read-only
61
+ c_parameter: const uint8_t *data
62
+ description: Precomputed compression constants
63
+ */
64
+
35
65
 
36
66
  /*
37
67
  * WARNING: This file is auto-derived from the mlkem-native source file
38
- * dev/x86_64/src/poly_compress_d4_avx2_asm.S using scripts/simpasm. Do not modify it directly.
68
+ * dev/x86_64/src/mlkem_poly_compress_d4_avx2_asm.S using scripts/simpasm. Do not modify it directly.
39
69
  */
40
70
 
41
71
  .text
@@ -155,8 +185,9 @@ MLK_ASM_FN_SYMBOL(poly_compress_d4_avx2_asm)
155
185
  MLK_ASM_FN_SIZE(poly_compress_d4_avx2_asm)
156
186
 
157
187
  #endif /* MLK_ARITH_BACKEND_X86_64_DEFAULT && !MLK_CONFIG_MULTILEVEL_NO_SHARED \
158
- && (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 2 || MLKEM_K == \
159
- 3) */
188
+ && (!MLK_CONFIG_NO_ENCAPS_API || !MLK_CONFIG_NO_DECAPS_API) && \
189
+ (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 2 || MLKEM_K == 3) \
190
+ */
160
191
 
161
192
  #if defined(__ELF__)
162
193
  .section .note.GNU-stack,"",%progbits
@@ -31,11 +31,41 @@
31
31
  #include "../../../common.h"
32
32
  #if defined(MLK_ARITH_BACKEND_X86_64_DEFAULT) && \
33
33
  !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
34
+ (!defined(MLK_CONFIG_NO_ENCAPS_API) || \
35
+ !defined(MLK_CONFIG_NO_DECAPS_API)) && \
34
36
  (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4)
37
+ /*yaml
38
+ Name: poly_compress_d5_avx2_asm
39
+ Description: x86_64 AVX2 polynomial compression (d=5)
40
+ Signature: void mlk_poly_compress_d5_avx2_asm(uint8_t *r, const int16_t *a, const uint8_t *data)
41
+ ABI:
42
+ Architecture: x86_64
43
+ CallingConvention: SysV
44
+ Features: [AVX2]
45
+ rdi:
46
+ type: buffer
47
+ size_bytes: 160
48
+ permissions: write-only
49
+ c_parameter: uint8_t *r
50
+ description: Output compressed polynomial
51
+ rsi:
52
+ type: buffer
53
+ size_bytes: 512
54
+ permissions: read-only
55
+ c_parameter: const int16_t *a
56
+ description: Input polynomial (256 x int16_t)
57
+ rdx:
58
+ type: buffer
59
+ size_bytes: 32
60
+ permissions: read-only
61
+ c_parameter: const uint8_t *data
62
+ description: Precomputed compression constants
63
+ */
64
+
35
65
 
36
66
  /*
37
67
  * WARNING: This file is auto-derived from the mlkem-native source file
38
- * dev/x86_64/src/poly_compress_d5_avx2_asm.S using scripts/simpasm. Do not modify it directly.
68
+ * dev/x86_64/src/mlkem_poly_compress_d5_avx2_asm.S using scripts/simpasm. Do not modify it directly.
39
69
  */
40
70
 
41
71
  .text
@@ -213,7 +243,8 @@ MLK_ASM_FN_SYMBOL(poly_compress_d5_avx2_asm)
213
243
  MLK_ASM_FN_SIZE(poly_compress_d5_avx2_asm)
214
244
 
215
245
  #endif /* MLK_ARITH_BACKEND_X86_64_DEFAULT && !MLK_CONFIG_MULTILEVEL_NO_SHARED \
216
- && (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 4) */
246
+ && (!MLK_CONFIG_NO_ENCAPS_API || !MLK_CONFIG_NO_DECAPS_API) && \
247
+ (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 4) */
217
248
 
218
249
  #if defined(__ELF__)
219
250
  .section .note.GNU-stack,"",%progbits
@@ -31,11 +31,40 @@
31
31
  #include "../../../common.h"
32
32
  #if defined(MLK_ARITH_BACKEND_X86_64_DEFAULT) && \
33
33
  !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
34
+ !defined(MLK_CONFIG_NO_DECAPS_API) && \
34
35
  (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 2 || MLKEM_K == 3)
36
+ /*yaml
37
+ Name: poly_decompress_d10_avx2_asm
38
+ Description: x86_64 AVX2 polynomial decompression (d=10)
39
+ Signature: void mlk_poly_decompress_d10_avx2_asm(int16_t *r, const uint8_t *a, const uint8_t *data)
40
+ ABI:
41
+ Architecture: x86_64
42
+ CallingConvention: SysV
43
+ Features: [AVX2]
44
+ rdi:
45
+ type: buffer
46
+ size_bytes: 512
47
+ permissions: write-only
48
+ c_parameter: int16_t *r
49
+ description: Output polynomial (256 x int16_t)
50
+ rsi:
51
+ type: buffer
52
+ size_bytes: 320
53
+ permissions: read-only
54
+ c_parameter: const uint8_t *a
55
+ description: Input compressed polynomial
56
+ rdx:
57
+ type: buffer
58
+ size_bytes: 32
59
+ permissions: read-only
60
+ c_parameter: const uint8_t *data
61
+ description: Precomputed decompression constants
62
+ */
63
+
35
64
 
36
65
  /*
37
66
  * WARNING: This file is auto-derived from the mlkem-native source file
38
- * dev/x86_64/src/poly_decompress_d10_avx2_asm.S using scripts/simpasm. Do not modify it directly.
67
+ * dev/x86_64/src/mlkem_poly_decompress_d10_avx2_asm.S using scripts/simpasm. Do not modify it directly.
39
68
  */
40
69
 
41
70
  .text
@@ -220,8 +249,8 @@ MLK_ASM_FN_SYMBOL(poly_decompress_d10_avx2_asm)
220
249
  MLK_ASM_FN_SIZE(poly_decompress_d10_avx2_asm)
221
250
 
222
251
  #endif /* MLK_ARITH_BACKEND_X86_64_DEFAULT && !MLK_CONFIG_MULTILEVEL_NO_SHARED \
223
- && (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 2 || MLKEM_K == \
224
- 3) */
252
+ && !MLK_CONFIG_NO_DECAPS_API && (MLK_CONFIG_MULTILEVEL_WITH_SHARED || \
253
+ MLKEM_K == 2 || MLKEM_K == 3) */
225
254
 
226
255
  #if defined(__ELF__)
227
256
  .section .note.GNU-stack,"",%progbits
@@ -33,11 +33,40 @@
33
33
  #include "../../../common.h"
34
34
  #if defined(MLK_ARITH_BACKEND_X86_64_DEFAULT) && \
35
35
  !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
36
+ !defined(MLK_CONFIG_NO_DECAPS_API) && \
36
37
  (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4)
38
+ /*yaml
39
+ Name: poly_decompress_d11_avx2_asm
40
+ Description: x86_64 AVX2 polynomial decompression (d=11)
41
+ Signature: void mlk_poly_decompress_d11_avx2_asm(int16_t *r, const uint8_t *a, const uint8_t *data)
42
+ ABI:
43
+ Architecture: x86_64
44
+ CallingConvention: SysV
45
+ Features: [AVX2]
46
+ rdi:
47
+ type: buffer
48
+ size_bytes: 512
49
+ permissions: write-only
50
+ c_parameter: int16_t *r
51
+ description: Output polynomial (256 x int16_t)
52
+ rsi:
53
+ type: buffer
54
+ size_bytes: 352
55
+ permissions: read-only
56
+ c_parameter: const uint8_t *a
57
+ description: Input compressed polynomial
58
+ rdx:
59
+ type: buffer
60
+ size_bytes: 128
61
+ permissions: read-only
62
+ c_parameter: const uint8_t *data
63
+ description: Precomputed decompression constants
64
+ */
65
+
37
66
 
38
67
  /*
39
68
  * WARNING: This file is auto-derived from the mlkem-native source file
40
- * dev/x86_64/src/poly_decompress_d11_avx2_asm.S using scripts/simpasm. Do not modify it directly.
69
+ * dev/x86_64/src/mlkem_poly_decompress_d11_avx2_asm.S using scripts/simpasm. Do not modify it directly.
41
70
  */
42
71
 
43
72
  .text
@@ -270,7 +299,8 @@ MLK_ASM_FN_SYMBOL(poly_decompress_d11_avx2_asm)
270
299
  MLK_ASM_FN_SIZE(poly_decompress_d11_avx2_asm)
271
300
 
272
301
  #endif /* MLK_ARITH_BACKEND_X86_64_DEFAULT && !MLK_CONFIG_MULTILEVEL_NO_SHARED \
273
- && (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 4) */
302
+ && !MLK_CONFIG_NO_DECAPS_API && (MLK_CONFIG_MULTILEVEL_WITH_SHARED || \
303
+ MLKEM_K == 4) */
274
304
 
275
305
  #if defined(__ELF__)
276
306
  .section .note.GNU-stack,"",%progbits
@@ -31,11 +31,40 @@
31
31
  #include "../../../common.h"
32
32
  #if defined(MLK_ARITH_BACKEND_X86_64_DEFAULT) && \
33
33
  !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
34
+ !defined(MLK_CONFIG_NO_DECAPS_API) && \
34
35
  (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 2 || MLKEM_K == 3)
36
+ /*yaml
37
+ Name: poly_decompress_d4_avx2_asm
38
+ Description: x86_64 AVX2 polynomial decompression (d=4)
39
+ Signature: void mlk_poly_decompress_d4_avx2_asm(int16_t *r, const uint8_t *a, const uint8_t *data)
40
+ ABI:
41
+ Architecture: x86_64
42
+ CallingConvention: SysV
43
+ Features: [AVX2]
44
+ rdi:
45
+ type: buffer
46
+ size_bytes: 512
47
+ permissions: write-only
48
+ c_parameter: int16_t *r
49
+ description: Output polynomial (256 x int16_t)
50
+ rsi:
51
+ type: buffer
52
+ size_bytes: 128
53
+ permissions: read-only
54
+ c_parameter: const uint8_t *a
55
+ description: Input compressed polynomial
56
+ rdx:
57
+ type: buffer
58
+ size_bytes: 32
59
+ permissions: read-only
60
+ c_parameter: const uint8_t *data
61
+ description: Precomputed decompression constants
62
+ */
63
+
35
64
 
36
65
  /*
37
66
  * WARNING: This file is auto-derived from the mlkem-native source file
38
- * dev/x86_64/src/poly_decompress_d4_avx2_asm.S using scripts/simpasm. Do not modify it directly.
67
+ * dev/x86_64/src/mlkem_poly_decompress_d4_avx2_asm.S using scripts/simpasm. Do not modify it directly.
39
68
  */
40
69
 
41
70
  .text
@@ -172,8 +201,8 @@ MLK_ASM_FN_SYMBOL(poly_decompress_d4_avx2_asm)
172
201
  MLK_ASM_FN_SIZE(poly_decompress_d4_avx2_asm)
173
202
 
174
203
  #endif /* MLK_ARITH_BACKEND_X86_64_DEFAULT && !MLK_CONFIG_MULTILEVEL_NO_SHARED \
175
- && (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 2 || MLKEM_K == \
176
- 3) */
204
+ && !MLK_CONFIG_NO_DECAPS_API && (MLK_CONFIG_MULTILEVEL_WITH_SHARED || \
205
+ MLKEM_K == 2 || MLKEM_K == 3) */
177
206
 
178
207
  #if defined(__ELF__)
179
208
  .section .note.GNU-stack,"",%progbits
@@ -32,11 +32,40 @@
32
32
  #include "../../../common.h"
33
33
  #if defined(MLK_ARITH_BACKEND_X86_64_DEFAULT) && \
34
34
  !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
35
+ !defined(MLK_CONFIG_NO_DECAPS_API) && \
35
36
  (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4)
37
+ /*yaml
38
+ Name: poly_decompress_d5_avx2_asm
39
+ Description: x86_64 AVX2 polynomial decompression (d=5)
40
+ Signature: void mlk_poly_decompress_d5_avx2_asm(int16_t *r, const uint8_t *a, const uint8_t *data)
41
+ ABI:
42
+ Architecture: x86_64
43
+ CallingConvention: SysV
44
+ Features: [AVX2]
45
+ rdi:
46
+ type: buffer
47
+ size_bytes: 512
48
+ permissions: write-only
49
+ c_parameter: int16_t *r
50
+ description: Output polynomial (256 x int16_t)
51
+ rsi:
52
+ type: buffer
53
+ size_bytes: 160
54
+ permissions: read-only
55
+ c_parameter: const uint8_t *a
56
+ description: Input compressed polynomial
57
+ rdx:
58
+ type: buffer
59
+ size_bytes: 96
60
+ permissions: read-only
61
+ c_parameter: const uint8_t *data
62
+ description: Precomputed decompression constants
63
+ */
64
+
36
65
 
37
66
  /*
38
67
  * WARNING: This file is auto-derived from the mlkem-native source file
39
- * dev/x86_64/src/poly_decompress_d5_avx2_asm.S using scripts/simpasm. Do not modify it directly.
68
+ * dev/x86_64/src/mlkem_poly_decompress_d5_avx2_asm.S using scripts/simpasm. Do not modify it directly.
40
69
  */
41
70
 
42
71
  .text
@@ -185,7 +214,8 @@ MLK_ASM_FN_SYMBOL(poly_decompress_d5_avx2_asm)
185
214
  MLK_ASM_FN_SIZE(poly_decompress_d5_avx2_asm)
186
215
 
187
216
  #endif /* MLK_ARITH_BACKEND_X86_64_DEFAULT && !MLK_CONFIG_MULTILEVEL_NO_SHARED \
188
- && (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 4) */
217
+ && !MLK_CONFIG_NO_DECAPS_API && (MLK_CONFIG_MULTILEVEL_WITH_SHARED || \
218
+ MLKEM_K == 4) */
189
219
 
190
220
  #if defined(__ELF__)
191
221
  .section .note.GNU-stack,"",%progbits
@@ -6,10 +6,38 @@
6
6
  #include "../../../common.h"
7
7
  #if defined(MLK_ARITH_BACKEND_X86_64_DEFAULT) && \
8
8
  !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED)
9
+ /*yaml
10
+ Name: poly_mulcache_compute_avx2_asm
11
+ Description: x86_64 AVX2 mulcache computation
12
+ Signature: void mlk_poly_mulcache_compute_avx2_asm(int16_t *out, const int16_t *in, const int16_t *qdata)
13
+ ABI:
14
+ Architecture: x86_64
15
+ CallingConvention: SysV
16
+ Features: [AVX2]
17
+ rdi:
18
+ type: buffer
19
+ size_bytes: 256
20
+ permissions: write-only
21
+ c_parameter: int16_t *out
22
+ description: Output mulcache (128 x int16_t)
23
+ rsi:
24
+ type: buffer
25
+ size_bytes: 512
26
+ permissions: read-only
27
+ c_parameter: const int16_t *in
28
+ description: Input polynomial (256 x int16_t)
29
+ rdx:
30
+ type: buffer
31
+ size_bytes: 1248
32
+ permissions: read-only
33
+ c_parameter: const int16_t *qdata
34
+ description: Precomputed constants (624 x int16_t)
35
+ */
36
+
9
37
 
10
38
  /*
11
39
  * WARNING: This file is auto-derived from the mlkem-native source file
12
- * dev/x86_64/src/poly_mulcache_compute_avx2_asm.S using scripts/simpasm. Do not modify it directly.
40
+ * dev/x86_64/src/mlkem_poly_mulcache_compute_avx2_asm.S using scripts/simpasm. Do not modify it directly.
13
41
  */
14
42
 
15
43
  .text
@@ -7,10 +7,44 @@
7
7
  #if defined(MLK_ARITH_BACKEND_X86_64_DEFAULT) && \
8
8
  !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
9
9
  (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 2)
10
+ /*yaml
11
+ Name: polyvec_basemul_acc_montgomery_cached_k2_avx2_asm
12
+ Description: x86_64 AVX2 base multiplication with accumulation (k=2)
13
+ Signature: void mlk_polyvec_basemul_acc_montgomery_cached_k2_avx2_asm(int16_t *r, const int16_t *a, const int16_t *b, const int16_t *b_cache)
14
+ ABI:
15
+ Architecture: x86_64
16
+ CallingConvention: SysV
17
+ Features: [AVX2]
18
+ rdi:
19
+ type: buffer
20
+ size_bytes: 512
21
+ permissions: read/write
22
+ c_parameter: int16_t *r
23
+ description: Output polynomial (256 x int16_t)
24
+ rsi:
25
+ type: buffer
26
+ size_bytes: 1024
27
+ permissions: read-only
28
+ c_parameter: const int16_t *a
29
+ description: Input polyvec a (2 x 256 x int16_t)
30
+ rdx:
31
+ type: buffer
32
+ size_bytes: 1024
33
+ permissions: read-only
34
+ c_parameter: const int16_t *b
35
+ description: Input polyvec b (2 x 256 x int16_t)
36
+ rcx:
37
+ type: buffer
38
+ size_bytes: 512
39
+ permissions: read-only
40
+ c_parameter: const int16_t *b_cache
41
+ description: Mulcache for b (2 x 128 x int16_t)
42
+ */
43
+
10
44
 
11
45
  /*
12
46
  * WARNING: This file is auto-derived from the mlkem-native source file
13
- * dev/x86_64/src/polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.S using scripts/simpasm. Do not modify it directly.
47
+ * dev/x86_64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.S using scripts/simpasm. Do not modify it directly.
14
48
  */
15
49
 
16
50
  .text
@@ -7,10 +7,44 @@
7
7
  #if defined(MLK_ARITH_BACKEND_X86_64_DEFAULT) && \
8
8
  !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
9
9
  (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 3)
10
+ /*yaml
11
+ Name: polyvec_basemul_acc_montgomery_cached_k3_avx2_asm
12
+ Description: x86_64 AVX2 base multiplication with accumulation (k=3)
13
+ Signature: void mlk_polyvec_basemul_acc_montgomery_cached_k3_avx2_asm(int16_t *r, const int16_t *a, const int16_t *b, const int16_t *b_cache)
14
+ ABI:
15
+ Architecture: x86_64
16
+ CallingConvention: SysV
17
+ Features: [AVX2]
18
+ rdi:
19
+ type: buffer
20
+ size_bytes: 512
21
+ permissions: read/write
22
+ c_parameter: int16_t *r
23
+ description: Output polynomial (256 x int16_t)
24
+ rsi:
25
+ type: buffer
26
+ size_bytes: 1536
27
+ permissions: read-only
28
+ c_parameter: const int16_t *a
29
+ description: Input polyvec a (3 x 256 x int16_t)
30
+ rdx:
31
+ type: buffer
32
+ size_bytes: 1536
33
+ permissions: read-only
34
+ c_parameter: const int16_t *b
35
+ description: Input polyvec b (3 x 256 x int16_t)
36
+ rcx:
37
+ type: buffer
38
+ size_bytes: 768
39
+ permissions: read-only
40
+ c_parameter: const int16_t *b_cache
41
+ description: Mulcache for b (3 x 128 x int16_t)
42
+ */
43
+
10
44
 
11
45
  /*
12
46
  * WARNING: This file is auto-derived from the mlkem-native source file
13
- * dev/x86_64/src/polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.S using scripts/simpasm. Do not modify it directly.
47
+ * dev/x86_64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.S using scripts/simpasm. Do not modify it directly.
14
48
  */
15
49
 
16
50
  .text
@@ -7,10 +7,44 @@
7
7
  #if defined(MLK_ARITH_BACKEND_X86_64_DEFAULT) && \
8
8
  !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
9
9
  (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4)
10
+ /*yaml
11
+ Name: polyvec_basemul_acc_montgomery_cached_k4_avx2_asm
12
+ Description: x86_64 AVX2 base multiplication with accumulation (k=4)
13
+ Signature: void mlk_polyvec_basemul_acc_montgomery_cached_k4_avx2_asm(int16_t *r, const int16_t *a, const int16_t *b, const int16_t *b_cache)
14
+ ABI:
15
+ Architecture: x86_64
16
+ CallingConvention: SysV
17
+ Features: [AVX2]
18
+ rdi:
19
+ type: buffer
20
+ size_bytes: 512
21
+ permissions: read/write
22
+ c_parameter: int16_t *r
23
+ description: Output polynomial (256 x int16_t)
24
+ rsi:
25
+ type: buffer
26
+ size_bytes: 2048
27
+ permissions: read-only
28
+ c_parameter: const int16_t *a
29
+ description: Input polyvec a (4 x 256 x int16_t)
30
+ rdx:
31
+ type: buffer
32
+ size_bytes: 2048
33
+ permissions: read-only
34
+ c_parameter: const int16_t *b
35
+ description: Input polyvec b (4 x 256 x int16_t)
36
+ rcx:
37
+ type: buffer
38
+ size_bytes: 1024
39
+ permissions: read-only
40
+ c_parameter: const int16_t *b_cache
41
+ description: Mulcache for b (4 x 128 x int16_t)
42
+ */
43
+
10
44
 
11
45
  /*
12
46
  * WARNING: This file is auto-derived from the mlkem-native source file
13
- * dev/x86_64/src/polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.S using scripts/simpasm. Do not modify it directly.
47
+ * dev/x86_64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.S using scripts/simpasm. Do not modify it directly.
14
48
  */
15
49
 
16
50
  .text
@@ -27,10 +27,26 @@
27
27
 
28
28
  #if defined(MLK_ARITH_BACKEND_X86_64_DEFAULT) && \
29
29
  !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED)
30
+ /*yaml
31
+ Name: reduce_avx2_asm
32
+ Description: x86_64 AVX2 modular reduction
33
+ Signature: void mlk_reduce_avx2_asm(int16_t *r)
34
+ ABI:
35
+ Architecture: x86_64
36
+ CallingConvention: SysV
37
+ Features: [AVX2]
38
+ rdi:
39
+ type: buffer
40
+ size_bytes: 512
41
+ permissions: read/write
42
+ c_parameter: int16_t *r
43
+ description: Input/output polynomial (256 x int16_t)
44
+ */
45
+
30
46
 
31
47
  /*
32
48
  * WARNING: This file is auto-derived from the mlkem-native source file
33
- * dev/x86_64/src/reduce_avx2_asm.S using scripts/simpasm. Do not modify it directly.
49
+ * dev/x86_64/src/mlkem_reduce_avx2_asm.S using scripts/simpasm. Do not modify it directly.
34
50
  */
35
51
 
36
52
  .text