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.
Files changed (247) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/SECURITY.md +7 -0
  4. data/ext/pqcrypto/pqcrypto_version.h +1 -1
  5. data/ext/pqcrypto/vendor/.vendored +7 -7
  6. data/ext/pqcrypto/vendor/mldsa-native/README.md +23 -10
  7. data/ext/pqcrypto/vendor/mldsa-native/mldsa/README.md +23 -0
  8. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.c +114 -58
  9. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.h +498 -461
  10. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_asm.S +145 -85
  11. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_config.h +456 -422
  12. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/cbmc.h +47 -25
  13. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/common.h +26 -14
  14. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.h +56 -81
  15. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.h +17 -24
  16. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.c +33 -40
  17. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.h +67 -87
  18. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.c +19 -14
  19. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.h +13 -5
  20. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.c +84 -10
  21. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.h +10 -5
  22. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/auto.h +6 -0
  23. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/fips202_native_aarch64.h +22 -15
  24. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_aarch64_asm.S +376 -0
  25. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_aarch64_asm.S +204 -0
  26. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_aarch64_asm.S +259 -0
  27. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S +1077 -0
  28. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S +987 -0
  29. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +16 -10
  30. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_scalar.h +2 -1
  31. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_v84a.h +1 -1
  32. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x2_v84a.h +4 -2
  33. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_scalar.h +2 -2
  34. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +1 -1
  35. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/api.h +60 -0
  36. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/mve.h +48 -0
  37. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/fips202_native_armv81m.h +18 -1
  38. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +658 -582
  39. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +5 -100
  40. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +26 -25
  41. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/state_extract_bytes_x4_mve.S +334 -0
  42. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/state_xor_bytes_x4_mve.S +355 -0
  43. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/auto.h +8 -3
  44. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/{xkcp.h → keccak_f1600_x4_avx2.h} +11 -8
  45. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/fips202_native_x86_64.h +44 -0
  46. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2_asm.S +454 -0
  47. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccakf1600_constants.c +52 -0
  48. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/meta.h +37 -28
  49. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/aarch64_zetas.c +213 -196
  50. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/arith_native_aarch64.h +248 -64
  51. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/intt_aarch64_asm.S +753 -0
  52. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm.S +129 -0
  53. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm.S +145 -0
  54. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm.S +177 -0
  55. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/ntt_aarch64_asm.S +653 -0
  56. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/pointwise_montgomery_aarch64_asm.S +84 -0
  57. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_caddq_aarch64_asm.S +53 -0
  58. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_chknorm_aarch64_asm.S +55 -0
  59. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_32_aarch64_asm.S +86 -0
  60. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_88_aarch64_asm.S +86 -0
  61. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_32_aarch64_asm.S +103 -0
  62. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_88_aarch64_asm.S +111 -0
  63. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_17_aarch64_asm.S +75 -0
  64. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_19_aarch64_asm.S +72 -0
  65. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_table.c +23 -11
  66. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_aarch64_asm.S +189 -0
  67. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta2_aarch64_asm.S +137 -0
  68. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta4_aarch64_asm.S +130 -0
  69. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta_table.c +520 -516
  70. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_table.c +34 -33
  71. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/api.h +202 -242
  72. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/meta.h +25 -17
  73. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/arith_native_x86_64.h +112 -28
  74. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.c +1 -1
  75. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.h +1 -1
  76. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/intt_avx2_asm.S +2311 -0
  77. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/ntt_avx2_asm.S +2383 -0
  78. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/nttunpack_avx2_asm.S +238 -0
  79. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l4_avx2_asm.S +139 -0
  80. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l5_avx2_asm.S +155 -0
  81. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l7_avx2_asm.S +187 -0
  82. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_avx2_asm.S +130 -0
  83. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_caddq_avx2_asm.S +190 -0
  84. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_32_avx2.c +6 -4
  85. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_88_avx2.c +6 -4
  86. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_32_avx2.c +9 -8
  87. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_88_avx2.c +10 -9
  88. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_17_avx2.c +8 -5
  89. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_19_avx2.c +8 -5
  90. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta2_avx2.c +6 -4
  91. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta4_avx2.c +6 -4
  92. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_table.c +130 -129
  93. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.c +109 -180
  94. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.h +169 -150
  95. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.c +56 -40
  96. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.h +149 -164
  97. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.c +52 -57
  98. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.h +132 -167
  99. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.c +57 -424
  100. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.h +167 -474
  101. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.c +308 -0
  102. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.h +653 -0
  103. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/reduce.h +22 -29
  104. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/rounding.h +37 -43
  105. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.c +511 -367
  106. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.h +456 -417
  107. data/ext/pqcrypto/vendor/mlkem-native/README.md +6 -3
  108. data/ext/pqcrypto/vendor/mlkem-native/RELEASE.md +22 -0
  109. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.c +77 -36
  110. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.h +135 -146
  111. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_asm.S +116 -72
  112. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_config.h +351 -415
  113. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/cbmc.h +43 -20
  114. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h +16 -8
  115. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.c +57 -31
  116. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.h +260 -349
  117. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.h +17 -24
  118. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.c +35 -37
  119. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.h +43 -57
  120. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.c +14 -15
  121. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.h +5 -4
  122. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.c +42 -6
  123. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/fips202_native_aarch64.h +31 -20
  124. 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
  125. 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
  126. 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
  127. 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
  128. 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
  129. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +10 -9
  130. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_scalar.h +2 -1
  131. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_v84a.h +1 -1
  132. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x2_v84a.h +4 -2
  133. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_scalar.h +2 -2
  134. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +1 -1
  135. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/fips202_native_armv81m.h +2 -1
  136. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +55 -9
  137. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +26 -25
  138. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_extract_bytes_x4_mve.S +58 -14
  139. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_xor_bytes_x4_mve.S +57 -16
  140. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/auto.h +2 -1
  141. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h +2 -2
  142. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/fips202_native_x86_64.h +10 -7
  143. 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
  144. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccakf1600_constants.c +12 -11
  145. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.c +167 -136
  146. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.h +75 -68
  147. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.h +135 -157
  148. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h +15 -13
  149. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/aarch64_zetas.c +143 -135
  150. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/arith_native_aarch64.h +52 -46
  151. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{intt.S → intt_aarch64_asm.S} +10 -10
  152. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{ntt.S → ntt_aarch64_asm.S} +10 -10
  153. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_mulcache_compute_asm.S → poly_mulcache_compute_aarch64_asm.S} +10 -10
  154. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_reduce_asm.S → poly_reduce_aarch64_asm.S} +10 -10
  155. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_tobytes_asm.S → poly_tobytes_aarch64_asm.S} +10 -10
  156. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_tomont_asm.S → poly_tomont_aarch64_asm.S} +10 -12
  157. 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
  158. 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
  159. 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
  160. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{rej_uniform_asm.S → rej_uniform_aarch64_asm.S} +12 -12
  161. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/rej_uniform_table.c +514 -513
  162. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/api.h +254 -253
  163. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/meta.h +6 -1
  164. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/README.md +6 -0
  165. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/meta.h +77 -0
  166. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/arith_native_ppc64le.h +24 -0
  167. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/consts.c +299 -0
  168. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/consts.h +34 -0
  169. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/intt_ppc_asm.S +3222 -0
  170. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/ntt_ppc_asm.S +1651 -0
  171. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/poly_tomont_ppc_asm.S +294 -0
  172. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/reduce_ppc_asm.S +710 -0
  173. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/meta.h +5 -0
  174. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.c +18 -16
  175. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.h +19 -24
  176. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_poly.c +53 -65
  177. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/meta.h +20 -20
  178. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/arith_native_x86_64.h +106 -88
  179. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.c +45 -35
  180. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.h +8 -8
  181. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.c +1 -1
  182. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.h +1 -1
  183. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{intt.S → intt_avx2_asm.S} +8 -8
  184. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{ntt.S → ntt_avx2_asm.S} +8 -8
  185. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{nttfrombytes.S → nttfrombytes_avx2_asm.S} +8 -8
  186. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{ntttobytes.S → ntttobytes_avx2_asm.S} +8 -8
  187. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{nttunpack.S → nttunpack_avx2_asm.S} +8 -8
  188. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d10.S → poly_compress_d10_avx2_asm.S} +9 -9
  189. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d11.S → poly_compress_d11_avx2_asm.S} +9 -9
  190. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d4.S → poly_compress_d4_avx2_asm.S} +9 -9
  191. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d5.S → poly_compress_d5_avx2_asm.S} +9 -9
  192. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d10.S → poly_decompress_d10_avx2_asm.S} +9 -9
  193. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d11.S → poly_decompress_d11_avx2_asm.S} +9 -9
  194. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d4.S → poly_decompress_d4_avx2_asm.S} +9 -9
  195. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d5.S → poly_decompress_d5_avx2_asm.S} +9 -9
  196. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{mulcache_compute.S → poly_mulcache_compute_avx2_asm.S} +8 -8
  197. 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
  198. 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
  199. 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
  200. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{reduce.S → reduce_avx2_asm.S} +8 -8
  201. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{rej_uniform_asm.S → rej_uniform_avx2_asm.S} +9 -9
  202. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/rej_uniform_table.c +514 -513
  203. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{tomont.S → tomont_avx2_asm.S} +8 -8
  204. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.c +61 -57
  205. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.h +89 -116
  206. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.c +31 -32
  207. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.h +226 -301
  208. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/randombytes.h +21 -29
  209. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.c +68 -63
  210. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.h +37 -48
  211. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sys.h +44 -2
  212. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.h +141 -159
  213. data/lib/pq_crypto/version.rb +1 -1
  214. data/script/vendor_libs.rb +6 -6
  215. metadata +86 -71
  216. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_asm.S +0 -376
  217. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_asm.S +0 -204
  218. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_asm.S +0 -259
  219. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_asm.S +0 -1077
  220. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S +0 -987
  221. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.c +0 -488
  222. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.h +0 -16
  223. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/intt.S +0 -753
  224. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l4.S +0 -129
  225. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l5.S +0 -145
  226. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l7.S +0 -177
  227. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/ntt.S +0 -653
  228. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/pointwise_montgomery.S +0 -79
  229. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_caddq_asm.S +0 -53
  230. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_chknorm_asm.S +0 -55
  231. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_32_asm.S +0 -85
  232. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_88_asm.S +0 -85
  233. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_32_asm.S +0 -102
  234. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_88_asm.S +0 -110
  235. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_17_asm.S +0 -72
  236. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_19_asm.S +0 -69
  237. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_asm.S +0 -189
  238. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta2_asm.S +0 -135
  239. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta4_asm.S +0 -128
  240. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/intt.S +0 -2311
  241. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/ntt.S +0 -2383
  242. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/nttunpack.S +0 -239
  243. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise.S +0 -131
  244. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l4.S +0 -139
  245. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l5.S +0 -155
  246. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l7.S +0 -187
  247. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_caddq_avx2.c +0 -61
@@ -27,18 +27,6 @@
27
27
  #include "poly.h"
28
28
  #include "verify.h"
29
29
 
30
- /************************************************************
31
- * Name: mlk_scalar_compress_d1
32
- *
33
- * Description: Computes round(u * 2 / q)
34
- *
35
- * Arguments: - u: Unsigned canonical modulus modulo q
36
- * to be compressed.
37
- *
38
- * Specification: Compress_1 from @[FIPS203, Eq (4.7)].
39
- *
40
- ************************************************************/
41
-
42
30
  /*
43
31
  * The multiplication in this routine will exceed UINT32_MAX
44
32
  * and wrap around for large values of u. This is expected and required.
@@ -48,7 +36,17 @@
48
36
  #pragma CPROVER check disable "unsigned-overflow"
49
37
  #endif
50
38
 
51
- /* Reference: Part of poly_tomsg() in the reference implementation @[REF]. */
39
+ /**
40
+ * Compute round(u * 2 / MLKEM_Q).
41
+ *
42
+ * @spec{Compress_1 from @[FIPS203, Eq (4.7)].}
43
+ *
44
+ * @reference{Part of poly_tomsg() in the reference implementation @[REF].}
45
+ *
46
+ * @param u Unsigned canonical modulus modulo MLKEM_Q to be compressed.
47
+ *
48
+ * @return Compressed value.
49
+ */
52
50
  static MLK_INLINE uint8_t mlk_scalar_compress_d1(int16_t u)
53
51
  __contract__(
54
52
  requires(0 <= u && u <= MLKEM_Q - 1)
@@ -71,17 +69,6 @@ __contract__(
71
69
  #pragma CPROVER check pop
72
70
  #endif
73
71
 
74
- /************************************************************
75
- * Name: mlk_scalar_compress_d4
76
- *
77
- * Description: Computes round(u * 16 / q) % 16
78
- *
79
- * Arguments: - u: Unsigned canonical modulus modulo q
80
- * to be compressed.
81
- *
82
- * Specification: Compress_4 from @[FIPS203, Eq (4.7)].
83
- *
84
- ************************************************************/
85
72
  /*
86
73
  * The multiplication in this routine will exceed UINT32_MAX
87
74
  * and wrap around for large values of u. This is expected and required.
@@ -91,8 +78,18 @@ __contract__(
91
78
  #pragma CPROVER check disable "unsigned-overflow"
92
79
  #endif
93
80
 
94
- /* Reference: Embedded into `poly_compress()` in the
95
- * reference implementation @[REF]. */
81
+ /**
82
+ * Compute round(u * 16 / MLKEM_Q) % 16.
83
+ *
84
+ * @spec{Compress_4 from @[FIPS203, Eq (4.7)].}
85
+ *
86
+ * @reference{Embedded into `poly_compress()` in the reference
87
+ * implementation @[REF].}
88
+ *
89
+ * @param u Unsigned canonical modulus modulo MLKEM_Q to be compressed.
90
+ *
91
+ * @return Compressed value.
92
+ */
96
93
  static MLK_INLINE uint8_t mlk_scalar_compress_d4(int16_t u)
97
94
  __contract__(
98
95
  requires(0 <= u && u <= MLKEM_Q - 1)
@@ -115,20 +112,18 @@ __contract__(
115
112
  #pragma CPROVER check pop
116
113
  #endif
117
114
 
118
- /************************************************************
119
- * Name: mlk_scalar_decompress_d4
115
+ /**
116
+ * Compute round(u * MLKEM_Q / 16).
120
117
  *
121
- * Description: Computes round(u * q / 16)
118
+ * @spec{Decompress_4 from @[FIPS203, Eq (4.8)].}
122
119
  *
123
- * Arguments: - u: Unsigned canonical modulus modulo 16
124
- * to be decompressed.
120
+ * @reference{Embedded into `poly_decompress()` in the reference
121
+ * implementation @[REF].}
125
122
  *
126
- * Specification: Decompress_4 from @[FIPS203, Eq (4.8)].
123
+ * @param u Unsigned canonical modulus modulo 16 to be decompressed.
127
124
  *
128
- ************************************************************/
129
-
130
- /* Reference: Embedded into `poly_decompress()` in the
131
- * reference implementation @[REF]. */
125
+ * @return Decompressed value.
126
+ */
132
127
  static MLK_INLINE int16_t mlk_scalar_decompress_d4(uint8_t u)
133
128
  __contract__(
134
129
  requires(0 <= u && u < 16)
@@ -140,17 +135,6 @@ __contract__(
140
135
  return (int16_t)((((uint32_t)u * MLKEM_Q) + 8) >> 4);
141
136
  }
142
137
 
143
- /************************************************************
144
- * Name: mlk_scalar_compress_d5
145
- *
146
- * Description: Computes round(u * 32 / q) % 32
147
- *
148
- * Arguments: - u: Unsigned canonical modulus modulo q
149
- * to be compressed.
150
- *
151
- * Specification: Compress_5 from @[FIPS203, Eq (4.7)].
152
- *
153
- ************************************************************/
154
138
  /*
155
139
  * The multiplication in this routine will exceed UINT32_MAX
156
140
  * and wrap around for large values of u. This is expected and required.
@@ -160,8 +144,18 @@ __contract__(
160
144
  #pragma CPROVER check disable "unsigned-overflow"
161
145
  #endif
162
146
 
163
- /* Reference: Embedded into `poly_compress()` in the
164
- * reference implementation @[REF]. */
147
+ /**
148
+ * Compute round(u * 32 / MLKEM_Q) % 32.
149
+ *
150
+ * @spec{Compress_5 from @[FIPS203, Eq (4.7)].}
151
+ *
152
+ * @reference{Embedded into `poly_compress()` in the reference
153
+ * implementation @[REF].}
154
+ *
155
+ * @param u Unsigned canonical modulus modulo MLKEM_Q to be compressed.
156
+ *
157
+ * @return Compressed value.
158
+ */
165
159
  static MLK_INLINE uint8_t mlk_scalar_compress_d5(int16_t u)
166
160
  __contract__(
167
161
  requires(0 <= u && u <= MLKEM_Q - 1)
@@ -184,20 +178,18 @@ __contract__(
184
178
  #pragma CPROVER check pop
185
179
  #endif
186
180
 
187
- /************************************************************
188
- * Name: mlk_scalar_decompress_d5
181
+ /**
182
+ * Compute round(u * MLKEM_Q / 32).
189
183
  *
190
- * Description: Computes round(u * q / 32)
184
+ * @spec{Decompress_5 from @[FIPS203, Eq (4.8)].}
191
185
  *
192
- * Arguments: - u: Unsigned canonical modulus modulo 32
193
- * to be decompressed.
186
+ * @reference{Embedded into `poly_decompress()` in the reference
187
+ * implementation @[REF].}
194
188
  *
195
- * Specification: Decompress_5 from @[FIPS203, Eq (4.8)].
189
+ * @param u Unsigned canonical modulus modulo 32 to be decompressed.
196
190
  *
197
- ************************************************************/
198
-
199
- /* Reference: Embedded into `poly_decompress()` in the
200
- * reference implementation @[REF]. */
191
+ * @return Decompressed value.
192
+ */
201
193
  static MLK_INLINE int16_t mlk_scalar_decompress_d5(uint8_t u)
202
194
  __contract__(
203
195
  requires(0 <= u && u < 32)
@@ -209,17 +201,6 @@ __contract__(
209
201
  return (int16_t)((((uint32_t)u * MLKEM_Q) + 16) >> 5);
210
202
  }
211
203
 
212
- /************************************************************
213
- * Name: mlk_scalar_compress_d10
214
- *
215
- * Description: Computes round(u * 2**10 / q) % 2**10
216
- *
217
- * Arguments: - u: Unsigned canonical modulus modulo q
218
- * to be compressed.
219
- *
220
- * Specification: Compress_10 from @[FIPS203, Eq (4.7)].
221
- *
222
- ************************************************************/
223
204
  /*
224
205
  * The multiplication in this routine will exceed UINT32_MAX
225
206
  * and wrap around for large values of u. This is expected and required.
@@ -229,8 +210,18 @@ __contract__(
229
210
  #pragma CPROVER check disable "unsigned-overflow"
230
211
  #endif
231
212
 
232
- /* Reference: Embedded into `polyvec_compress()` in the
233
- * reference implementation @[REF]. */
213
+ /**
214
+ * Compute round(u * 2**10 / MLKEM_Q) % 2**10.
215
+ *
216
+ * @spec{Compress_10 from @[FIPS203, Eq (4.7)].}
217
+ *
218
+ * @reference{Embedded into `polyvec_compress()` in the reference
219
+ * implementation @[REF].}
220
+ *
221
+ * @param u Unsigned canonical modulus modulo MLKEM_Q to be compressed.
222
+ *
223
+ * @return Compressed value.
224
+ */
234
225
  static MLK_INLINE uint16_t mlk_scalar_compress_d10(int16_t u)
235
226
  __contract__(
236
227
  requires(0 <= u && u <= MLKEM_Q - 1)
@@ -253,20 +244,18 @@ __contract__(
253
244
  #pragma CPROVER check pop
254
245
  #endif
255
246
 
256
- /************************************************************
257
- * Name: mlk_scalar_decompress_d10
247
+ /**
248
+ * Compute round(u * MLKEM_Q / 1024).
258
249
  *
259
- * Description: Computes round(u * q / 1024)
250
+ * @spec{Decompress_10 from @[FIPS203, Eq (4.8)].}
260
251
  *
261
- * Arguments: - u: Unsigned canonical modulus modulo 1024
262
- * to be decompressed.
252
+ * @reference{Embedded into `polyvec_decompress()` in the reference
253
+ * implementation @[REF].}
263
254
  *
264
- * Specification: Decompress_10 from @[FIPS203, Eq (4.8)].
255
+ * @param u Unsigned canonical modulus modulo 1024 to be decompressed.
265
256
  *
266
- ************************************************************/
267
-
268
- /* Reference: Embedded into `polyvec_decompress()` in the
269
- * reference implementation @[REF]. */
257
+ * @return Decompressed value.
258
+ */
270
259
  static MLK_INLINE int16_t mlk_scalar_decompress_d10(uint16_t u)
271
260
  __contract__(
272
261
  requires(0 <= u && u < 1024)
@@ -278,17 +267,6 @@ __contract__(
278
267
  return (int16_t)((((uint32_t)u * MLKEM_Q) + 512) >> 10);
279
268
  }
280
269
 
281
- /************************************************************
282
- * Name: mlk_scalar_compress_d11
283
- *
284
- * Description: Computes round(u * 2**11 / q) % 2**11
285
- *
286
- * Arguments: - u: Unsigned canonical modulus modulo q
287
- * to be compressed.
288
- *
289
- * Specification: Compress_11 from @[FIPS203, Eq (4.7)].
290
- *
291
- ************************************************************/
292
270
  /*
293
271
  * The multiplication in this routine will exceed UINT32_MAX
294
272
  * and wrap around for large values of u. This is expected and required.
@@ -298,8 +276,18 @@ __contract__(
298
276
  #pragma CPROVER check disable "unsigned-overflow"
299
277
  #endif
300
278
 
301
- /* Reference: Embedded into `polyvec_compress()` in the
302
- * reference implementation @[REF]. */
279
+ /**
280
+ * Compute round(u * 2**11 / MLKEM_Q) % 2**11.
281
+ *
282
+ * @spec{Compress_11 from @[FIPS203, Eq (4.7)].}
283
+ *
284
+ * @reference{Embedded into `polyvec_compress()` in the reference
285
+ * implementation @[REF].}
286
+ *
287
+ * @param u Unsigned canonical modulus modulo MLKEM_Q to be compressed.
288
+ *
289
+ * @return Compressed value.
290
+ */
303
291
  static MLK_INLINE uint16_t mlk_scalar_compress_d11(int16_t u)
304
292
  __contract__(
305
293
  requires(0 <= u && u <= MLKEM_Q - 1)
@@ -322,20 +310,18 @@ __contract__(
322
310
  #pragma CPROVER check pop
323
311
  #endif
324
312
 
325
- /************************************************************
326
- * Name: mlk_scalar_decompress_d11
313
+ /**
314
+ * Compute round(u * MLKEM_Q / 2048).
327
315
  *
328
- * Description: Computes round(u * q / 2048)
316
+ * @spec{Decompress_11 from @[FIPS203, Eq (4.8)].}
329
317
  *
330
- * Arguments: - u: Unsigned canonical modulus modulo 2048
331
- * to be decompressed.
318
+ * @reference{Embedded into `polyvec_decompress()` in the reference
319
+ * implementation @[REF].}
332
320
  *
333
- * Specification: Decompress_11 from @[FIPS203, Eq (4.8)].
321
+ * @param u Unsigned canonical modulus modulo 2048 to be decompressed.
334
322
  *
335
- ************************************************************/
336
-
337
- /* Reference: Embedded into `polyvec_decompress()` in the
338
- * reference implementation @[REF]. */
323
+ * @return Decompressed value.
324
+ */
339
325
  static MLK_INLINE int16_t mlk_scalar_decompress_d11(uint16_t u)
340
326
  __contract__(
341
327
  requires(0 <= u && u < 2048)
@@ -349,111 +335,87 @@ __contract__(
349
335
 
350
336
  #if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || (MLKEM_K == 2 || MLKEM_K == 3)
351
337
  #define mlk_poly_compress_d4 MLK_NAMESPACE(poly_compress_d4)
352
- /*************************************************
353
- * Name: mlk_poly_compress_d4
354
- *
355
- * Description: Compression (4 bits) and subsequent serialization of a
356
- * polynomial
357
- *
358
- * Arguments: - uint8_t *r: pointer to output byte array
359
- * (of length MLKEM_POLYCOMPRESSEDBYTES_D4 bytes)
360
- * - const mlk_poly *a: pointer to input polynomial
361
- * Coefficients must be unsigned canonical,
362
- * i.e. in [0,1,..,MLKEM_Q-1].
363
- *
364
- * Specification: Implements `ByteEncode_4 (Compress_4 (a))`:
365
- * - ByteEncode_d: @[FIPS203, Algorithm 5],
366
- * - Compress_d: @[FIPS203, Eq (4.7)]
367
- * Extended to vectors as per
368
- * @[FIPS203, 2.4.8 Applying Algorithms to Arrays]
369
- * - `ByteEncode_{d_v} (Compress_{d_v} (v))` appears in
370
- * @[FIPS203, Algorithm 14 (K-PKE.Encrypt), L23],
371
- * where `d_v=4` for ML-KEM-{512,768} @[FIPS203, Table 2].
372
- *
373
- **************************************************/
338
+ /**
339
+ * Compression (4 bits) and subsequent serialization of a polynomial.
340
+ *
341
+ * @spec{Implements `ByteEncode_4 (Compress_4 (a))`: ByteEncode_d
342
+ * @[FIPS203, Algorithm 5], Compress_d @[FIPS203, Eq (4.7)], extended to
343
+ * vectors as per @[FIPS203, 2.4.8 Applying Algorithms to Arrays].
344
+ * `ByteEncode_{d_v} (Compress_{d_v} (v))` appears in @[FIPS203, Algorithm
345
+ * 14 (K-PKE.Encrypt), L23], where `d_v=4` for ML-KEM-{512,768} @[FIPS203,
346
+ * Table 2].}
347
+ *
348
+ * @param[out] r Output byte array (of length MLKEM_POLYCOMPRESSEDBYTES_D4
349
+ * bytes).
350
+ * @param[in] a Input polynomial. Coefficients must be unsigned canonical,
351
+ * i.e. in [0,1,..,MLKEM_Q-1].
352
+ */
374
353
  MLK_INTERNAL_API
375
354
  void mlk_poly_compress_d4(uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D4],
376
355
  const mlk_poly *a);
377
356
 
378
357
  #define mlk_poly_compress_d10 MLK_NAMESPACE(poly_compress_d10)
379
- /*************************************************
380
- * Name: mlk_poly_compress_d10
381
- *
382
- * Description: Compression (10 bits) and subsequent serialization of a
383
- * polynomial
384
- *
385
- * Arguments: - uint8_t *r: pointer to output byte array
386
- * (of length MLKEM_POLYCOMPRESSEDBYTES_D10 bytes)
387
- * - const mlk_poly *a: pointer to input polynomial
388
- * Coefficients must be unsigned canonical,
389
- * i.e. in [0,1,..,MLKEM_Q-1].
390
- *
391
- * Specification: Implements `ByteEncode_10 (Compress_10 (a))`:
392
- * - ByteEncode_d: @[FIPS203, Algorithm 5],
393
- * - Compress_d: @[FIPS203, Eq (4.7)]
394
- * Extended to vectors as per
395
- * @[FIPS203, 2.4.8 Applying Algorithms to Arrays]
396
- * - `ByteEncode_{d_u} (Compress_{d_u} (u))` appears in
397
- * @[FIPS203, Algorithm 14 (K-PKE.Encrypt), L22],
398
- * where `d_u=10` for ML-KEM-{512,768} @[FIPS203, Table 2].
399
- *
400
- **************************************************/
358
+ /**
359
+ * Compression (10 bits) and subsequent serialization of a polynomial.
360
+ *
361
+ * @spec{Implements `ByteEncode_10 (Compress_10 (a))`: ByteEncode_d
362
+ * @[FIPS203, Algorithm 5], Compress_d @[FIPS203, Eq (4.7)], extended to
363
+ * vectors as per @[FIPS203, 2.4.8 Applying Algorithms to Arrays].
364
+ * `ByteEncode_{d_u} (Compress_{d_u} (u))` appears in @[FIPS203, Algorithm
365
+ * 14 (K-PKE.Encrypt), L22], where `d_u=10` for ML-KEM-{512,768} @[FIPS203,
366
+ * Table 2].}
367
+ *
368
+ * @param[out] r Output byte array (of length MLKEM_POLYCOMPRESSEDBYTES_D10
369
+ * bytes).
370
+ * @param[in] a Input polynomial. Coefficients must be unsigned canonical,
371
+ * i.e. in [0,1,..,MLKEM_Q-1].
372
+ */
401
373
  MLK_INTERNAL_API
402
374
  void mlk_poly_compress_d10(uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D10],
403
375
  const mlk_poly *a);
404
376
 
405
377
  #define mlk_poly_decompress_d4 MLK_NAMESPACE(poly_decompress_d4)
406
- /*************************************************
407
- * Name: mlk_poly_decompress_d4
408
- *
409
- * Description: De-serialization and subsequent decompression (dv bits) of a
410
- * polynomial; approximate inverse of poly_compress
411
- *
412
- * Arguments: - mlk_poly *r: pointer to output polynomial
413
- * - const uint8_t *a: pointer to input byte array
414
- * (of length MLKEM_POLYCOMPRESSEDBYTES_D4 bytes)
415
- *
416
- * Upon return, the coefficients of the output polynomial are unsigned-canonical
417
- * (non-negative and smaller than MLKEM_Q).
418
- *
419
- * Specification: Implements `Decompress_4 (ByteDecode_4 (a))`:
420
- * - ByteDecode_d: @[FIPS203, Algorithm 6],
421
- * - Decompress_d: @[FIPS203, Eq (4.8)]
422
- * Extended to vectors as per
423
- * @[FIPS203, 2.4.8 Applying Algorithms to Arrays]
424
- * - `Decompress_{d_v} (ByteDecode_{d_v} (v))` appears in
425
- * @[FIPS203, Algorithm 15 (K-PKE.Decrypt), L4],
426
- * where `d_v=4` for ML-KEM-{512,768} @[FIPS203, Table 2].
427
- *
428
- **************************************************/
378
+ /**
379
+ * De-serialization and subsequent decompression (4 bits) of a polynomial;
380
+ * approximate inverse of mlk_poly_compress_d4.
381
+ *
382
+ * Upon return, the coefficients of the output polynomial are
383
+ * unsigned-canonical (non-negative and smaller than MLKEM_Q).
384
+ *
385
+ * @spec{Implements `Decompress_4 (ByteDecode_4 (a))`: ByteDecode_d
386
+ * @[FIPS203, Algorithm 6], Decompress_d @[FIPS203, Eq (4.8)], extended to
387
+ * vectors as per @[FIPS203, 2.4.8 Applying Algorithms to Arrays].
388
+ * `Decompress_{d_v} (ByteDecode_{d_v} (v))` appears in @[FIPS203, Algorithm
389
+ * 15 (K-PKE.Decrypt), L4], where `d_v=4` for ML-KEM-{512,768} @[FIPS203,
390
+ * Table 2].}
391
+ *
392
+ * @param[out] r Output polynomial.
393
+ * @param[in] a Input byte array (of length MLKEM_POLYCOMPRESSEDBYTES_D4
394
+ * bytes).
395
+ */
429
396
  MLK_INTERNAL_API
430
397
  void mlk_poly_decompress_d4(mlk_poly *r,
431
398
  const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D4]);
432
399
 
433
400
  #define mlk_poly_decompress_d10 MLK_NAMESPACE(poly_decompress_d10)
434
- /*************************************************
435
- * Name: mlk_poly_decompress_d10
436
- *
437
- * Description: De-serialization and subsequent decompression (10 bits) of a
438
- * polynomial; approximate inverse of mlk_poly_compress_d10
439
- *
440
- * Arguments: - mlk_poly *r: pointer to output polynomial
441
- * - const uint8_t *a: pointer to input byte array
442
- * (of length MLKEM_POLYCOMPRESSEDBYTES_D10 bytes)
443
- *
444
- * Upon return, the coefficients of the output polynomial are unsigned-canonical
445
- * (non-negative and smaller than MLKEM_Q).
446
- *
447
- * Specification: Implements `Decompress_10 (ByteDecode_10 (a))`:
448
- * - ByteDecode_d: @[FIPS203, Algorithm 6],
449
- * - Decompress_d: @[FIPS203, Eq (4.8)]
450
- * Extended to vectors as per
451
- * @[FIPS203, 2.4.8 Applying Algorithms to Arrays]
452
- * - `Decompress_{d_u} (ByteDecode_{d_u} (u))` appears in
453
- * @[FIPS203, Algorithm 15 (K-PKE.Decrypt), L3],
454
- * where `d_u=10` for ML-KEM-{512,768} @[FIPS203, Table 2].
455
- *
456
- **************************************************/
401
+ /**
402
+ * De-serialization and subsequent decompression (10 bits) of a polynomial;
403
+ * approximate inverse of mlk_poly_compress_d10.
404
+ *
405
+ * Upon return, the coefficients of the output polynomial are
406
+ * unsigned-canonical (non-negative and smaller than MLKEM_Q).
407
+ *
408
+ * @spec{Implements `Decompress_10 (ByteDecode_10 (a))`: ByteDecode_d
409
+ * @[FIPS203, Algorithm 6], Decompress_d @[FIPS203, Eq (4.8)], extended to
410
+ * vectors as per @[FIPS203, 2.4.8 Applying Algorithms to Arrays].
411
+ * `Decompress_{d_u} (ByteDecode_{d_u} (u))` appears in @[FIPS203, Algorithm
412
+ * 15 (K-PKE.Decrypt), L3], where `d_u=10` for ML-KEM-{512,768} @[FIPS203,
413
+ * Table 2].}
414
+ *
415
+ * @param[out] r Output polynomial.
416
+ * @param[in] a Input byte array (of length MLKEM_POLYCOMPRESSEDBYTES_D10
417
+ * bytes).
418
+ */
457
419
  MLK_INTERNAL_API
458
420
  void mlk_poly_decompress_d10(mlk_poly *r,
459
421
  const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D10]);
@@ -461,136 +423,104 @@ void mlk_poly_decompress_d10(mlk_poly *r,
461
423
 
462
424
  #if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4
463
425
  #define mlk_poly_compress_d5 MLK_NAMESPACE(poly_compress_d5)
464
- /*************************************************
465
- * Name: mlk_poly_compress_d5
466
- *
467
- * Description: Compression (5 bits) and subsequent serialization of a
468
- * polynomial
469
- *
470
- * Arguments: - uint8_t *r: pointer to output byte array
471
- * (of length MLKEM_POLYCOMPRESSEDBYTES_D5 bytes)
472
- * - const mlk_poly *a: pointer to input polynomial
473
- * Coefficients must be unsigned canonical,
474
- * i.e. in [0,1,..,MLKEM_Q-1].
475
- *
476
- * Specification: Implements `ByteEncode_5 (Compress_5 (a))`:
477
- * - ByteEncode_d: @[FIPS203, Algorithm 5],
478
- * - Compress_d: @[FIPS203, Eq (4.7)]
479
- * Extended to vectors as per
480
- * @[FIPS203, 2.4.8 Applying Algorithms to Arrays]
481
- * - `ByteEncode_{d_v} (Compress_{d_v} (v))` appears in
482
- * @[FIPS203, Algorithm 14 (K-PKE.Encrypt), L23],
483
- * where `d_v=5` for ML-KEM-1024 @[FIPS203, Table 2].
484
- *
485
- **************************************************/
426
+ /**
427
+ * Compression (5 bits) and subsequent serialization of a polynomial.
428
+ *
429
+ * @spec{Implements `ByteEncode_5 (Compress_5 (a))`: ByteEncode_d
430
+ * @[FIPS203, Algorithm 5], Compress_d @[FIPS203, Eq (4.7)], extended to
431
+ * vectors as per @[FIPS203, 2.4.8 Applying Algorithms to Arrays].
432
+ * `ByteEncode_{d_v} (Compress_{d_v} (v))` appears in @[FIPS203, Algorithm
433
+ * 14 (K-PKE.Encrypt), L23], where `d_v=5` for ML-KEM-1024 @[FIPS203,
434
+ * Table 2].}
435
+ *
436
+ * @param[out] r Output byte array (of length MLKEM_POLYCOMPRESSEDBYTES_D5
437
+ * bytes).
438
+ * @param[in] a Input polynomial. Coefficients must be unsigned canonical,
439
+ * i.e. in [0,1,..,MLKEM_Q-1].
440
+ */
486
441
  MLK_INTERNAL_API
487
442
  void mlk_poly_compress_d5(uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D5],
488
443
  const mlk_poly *a);
489
444
 
490
445
  #define mlk_poly_compress_d11 MLK_NAMESPACE(poly_compress_d11)
491
- /*************************************************
492
- * Name: mlk_poly_compress_d11
493
- *
494
- * Description: Compression (11 bits) and subsequent serialization of a
495
- * polynomial
496
- *
497
- * Arguments: - uint8_t *r: pointer to output byte array
498
- * (of length MLKEM_POLYCOMPRESSEDBYTES_D11 bytes)
499
- * - const mlk_poly *a: pointer to input polynomial
500
- * Coefficients must be unsigned canonical,
501
- * i.e. in [0,1,..,MLKEM_Q-1].
502
- *
503
- * Specification: `ByteEncode_11 (Compress_11 (a))`:
504
- * - ByteEncode_d: @[FIPS203, Algorithm 5],
505
- * - Compress_d: @[FIPS203, Eq (4.7)]
506
- * Extended to vectors as per
507
- * @[FIPS203, 2.4.8 Applying Algorithms to Arrays]
508
- * - `ByteEncode_{d_u} (Compress_{d_u} (u))` appears in
509
- * @[FIPS203, Algorithm 14 (K-PKE.Encrypt), L22],
510
- * where `d_u=11` for ML-KEM-1024 @[FIPS203, Table 2].
511
- *
512
- **************************************************/
446
+ /**
447
+ * Compression (11 bits) and subsequent serialization of a polynomial.
448
+ *
449
+ * @spec{`ByteEncode_11 (Compress_11 (a))`: ByteEncode_d @[FIPS203,
450
+ * Algorithm 5], Compress_d @[FIPS203, Eq (4.7)], extended to vectors as
451
+ * per @[FIPS203, 2.4.8 Applying Algorithms to Arrays].
452
+ * `ByteEncode_{d_u} (Compress_{d_u} (u))` appears in @[FIPS203, Algorithm
453
+ * 14 (K-PKE.Encrypt), L22], where `d_u=11` for ML-KEM-1024 @[FIPS203,
454
+ * Table 2].}
455
+ *
456
+ * @param[out] r Output byte array (of length MLKEM_POLYCOMPRESSEDBYTES_D11
457
+ * bytes).
458
+ * @param[in] a Input polynomial. Coefficients must be unsigned canonical,
459
+ * i.e. in [0,1,..,MLKEM_Q-1].
460
+ */
513
461
  MLK_INTERNAL_API
514
462
  void mlk_poly_compress_d11(uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D11],
515
463
  const mlk_poly *a);
516
464
 
517
465
  #define mlk_poly_decompress_d5 MLK_NAMESPACE(poly_decompress_d5)
518
- /*************************************************
519
- * Name: mlk_poly_decompress_d5
520
- *
521
- * Description: De-serialization and subsequent decompression (dv bits) of a
522
- * polynomial; approximate inverse of poly_compress
523
- *
524
- * Arguments: - mlk_poly *r: pointer to output polynomial
525
- * - const uint8_t *a: pointer to input byte array
526
- * (of length MLKEM_POLYCOMPRESSEDBYTES_D5 bytes)
527
- *
528
- * Upon return, the coefficients of the output polynomial are unsigned-canonical
529
- * (non-negative and smaller than MLKEM_Q).
530
- *
531
- * Specification: Implements `Decompress_5 (ByteDecode_5 (a))`:
532
- * - ByteDecode_d: @[FIPS203, Algorithm 6],
533
- * - Decompress_d: @[FIPS203, Eq (4.8)]
534
- * Extended to vectors as per
535
- * @[FIPS203, 2.4.8 Applying Algorithms to Arrays]
536
- * - `Decompress_{d_v} (ByteDecode_{d_v} (v))` appears in
537
- * @[FIPS203, Algorithm 15 (K-PKE.Decrypt), L4],
538
- * where `d_v=5` for ML-KEM-1024 @[FIPS203, Table 2].
539
- *
540
- **************************************************/
466
+ /**
467
+ * De-serialization and subsequent decompression (5 bits) of a polynomial;
468
+ * approximate inverse of mlk_poly_compress_d5.
469
+ *
470
+ * Upon return, the coefficients of the output polynomial are
471
+ * unsigned-canonical (non-negative and smaller than MLKEM_Q).
472
+ *
473
+ * @spec{Implements `Decompress_5 (ByteDecode_5 (a))`: ByteDecode_d
474
+ * @[FIPS203, Algorithm 6], Decompress_d @[FIPS203, Eq (4.8)], extended to
475
+ * vectors as per @[FIPS203, 2.4.8 Applying Algorithms to Arrays].
476
+ * `Decompress_{d_v} (ByteDecode_{d_v} (v))` appears in @[FIPS203, Algorithm
477
+ * 15 (K-PKE.Decrypt), L4], where `d_v=5` for ML-KEM-1024 @[FIPS203,
478
+ * Table 2].}
479
+ *
480
+ * @param[out] r Output polynomial.
481
+ * @param[in] a Input byte array (of length MLKEM_POLYCOMPRESSEDBYTES_D5
482
+ * bytes).
483
+ */
541
484
  MLK_INTERNAL_API
542
485
  void mlk_poly_decompress_d5(mlk_poly *r,
543
486
  const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D5]);
544
487
 
545
488
  #define mlk_poly_decompress_d11 MLK_NAMESPACE(poly_decompress_d11)
546
- /*************************************************
547
- * Name: mlk_poly_decompress_d11
548
- *
549
- * Description: De-serialization and subsequent decompression (11 bits) of a
550
- * polynomial; approximate inverse of mlk_poly_compress_d11
551
- *
552
- * Arguments: - mlk_poly *r: pointer to output polynomial
553
- * - const uint8_t *a: pointer to input byte array
554
- * (of length MLKEM_POLYCOMPRESSEDBYTES_D11 bytes)
555
- *
556
- * Upon return, the coefficients of the output polynomial are unsigned-canonical
557
- * (non-negative and smaller than MLKEM_Q).
558
- *
559
- * Specification: Implements `Decompress_11 (ByteDecode_11 (a))`:
560
- * - ByteDecode_d: @[FIPS203, Algorithm 6],
561
- * - Decompress_d: @[FIPS203, Eq (4.8)]
562
- * Extended to vectors as per
563
- * @[FIPS203, 2.4.8 Applying Algorithms to Arrays]
564
- * - `Decompress_{d_u} (ByteDecode_{d_u} (u))` appears in
565
- * @[FIPS203, Algorithm 15 (K-PKE.Decrypt), L3],
566
- * where `d_u=11` for ML-KEM-1024 @[FIPS203, Table 2].
567
- *
568
- **************************************************/
489
+ /**
490
+ * De-serialization and subsequent decompression (11 bits) of a polynomial;
491
+ * approximate inverse of mlk_poly_compress_d11.
492
+ *
493
+ * Upon return, the coefficients of the output polynomial are
494
+ * unsigned-canonical (non-negative and smaller than MLKEM_Q).
495
+ *
496
+ * @spec{Implements `Decompress_11 (ByteDecode_11 (a))`: ByteDecode_d
497
+ * @[FIPS203, Algorithm 6], Decompress_d @[FIPS203, Eq (4.8)], extended to
498
+ * vectors as per @[FIPS203, 2.4.8 Applying Algorithms to Arrays].
499
+ * `Decompress_{d_u} (ByteDecode_{d_u} (u))` appears in @[FIPS203, Algorithm
500
+ * 15 (K-PKE.Decrypt), L3], where `d_u=11` for ML-KEM-1024 @[FIPS203,
501
+ * Table 2].}
502
+ *
503
+ * @param[out] r Output polynomial.
504
+ * @param[in] a Input byte array (of length MLKEM_POLYCOMPRESSEDBYTES_D11
505
+ * bytes).
506
+ */
569
507
  MLK_INTERNAL_API
570
508
  void mlk_poly_decompress_d11(mlk_poly *r,
571
509
  const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D11]);
572
510
  #endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 4 */
573
511
 
574
512
  #define mlk_poly_tobytes MLK_NAMESPACE(poly_tobytes)
575
- /*************************************************
576
- * Name: mlk_poly_tobytes
577
- *
578
- * Description: Serialization of a polynomial.
579
- * Signed coefficients are converted to
580
- * unsigned form before serialization.
513
+ /**
514
+ * Serialization of a polynomial. Signed coefficients are converted to
515
+ * unsigned form before serialization.
581
516
  *
582
- * Arguments: INPUT:
583
- * - a: const pointer to input polynomial,
584
- * with each coefficient in the range [0,1,..,Q-1]
585
- * OUTPUT
586
- * - r: pointer to output byte array
587
- * (of MLKEM_POLYBYTES bytes)
517
+ * @spec{Implements ByteEncode_12 @[FIPS203, Algorithm 5]. Extended to
518
+ * vectors as per @[FIPS203, 2.4.8 Applying Algorithms to Arrays].}
588
519
  *
589
- * Specification: Implements ByteEncode_12 @[FIPS203, Algorithm 5].
590
- * Extended to vectors as per
591
- * @[FIPS203, 2.4.8 Applying Algorithms to Arrays]
592
- *
593
- **************************************************/
520
+ * @param[out] r Output byte array (of MLKEM_POLYBYTES bytes).
521
+ * @param[in] a Input polynomial, with each coefficient in the range
522
+ * [0,1,..,MLKEM_Q-1].
523
+ */
594
524
  MLK_INTERNAL_API
595
525
  void mlk_poly_tobytes(uint8_t r[MLKEM_POLYBYTES], const mlk_poly *a)
596
526
  __contract__(
@@ -602,24 +532,16 @@ __contract__(
602
532
 
603
533
 
604
534
  #define mlk_poly_frombytes MLK_NAMESPACE(poly_frombytes)
605
- /*************************************************
606
- * Name: mlk_poly_frombytes
607
- *
608
- * Description: De-serialization of a polynomial.
535
+ /**
536
+ * De-serialization of a polynomial.
609
537
  *
610
- * Arguments: INPUT
611
- * - a: pointer to input byte array
612
- * (of MLKEM_POLYBYTES bytes)
613
- * OUTPUT
614
- * - r: pointer to output polynomial, with
615
- * each coefficient unsigned and in the range
616
- * 0 .. 4095
538
+ * @spec{Implements ByteDecode_12 @[FIPS203, Algorithm 6]. Extended to
539
+ * vectors as per @[FIPS203, 2.4.8 Applying Algorithms to Arrays].}
617
540
  *
618
- * Specification: Implements ByteDecode_12 @[FIPS203, Algorithm 6].
619
- * Extended to vectors as per
620
- * @[FIPS203, 2.4.8 Applying Algorithms to Arrays]
621
- *
622
- **************************************************/
541
+ * @param[out] r Output polynomial, with each coefficient unsigned and in
542
+ * the range 0..4095.
543
+ * @param[in] a Input byte array (of MLKEM_POLYBYTES bytes).
544
+ */
623
545
  MLK_INTERNAL_API
624
546
  void mlk_poly_frombytes(mlk_poly *r, const uint8_t a[MLKEM_POLYBYTES])
625
547
  __contract__(
@@ -631,23 +553,18 @@ __contract__(
631
553
 
632
554
 
633
555
  #define mlk_poly_frommsg MLK_NAMESPACE(poly_frommsg)
634
- /*************************************************
635
- * Name: mlk_poly_frommsg
636
- *
637
- * Description: Convert 32-byte message to polynomial
556
+ /**
557
+ * Convert a 32-byte message to a polynomial.
638
558
  *
639
- * Arguments: - mlk_poly *r: pointer to output polynomial
640
- * - const uint8_t *msg: pointer to input message
559
+ * @spec{Implements `Decompress_1 (ByteDecode_1 (a))`: ByteDecode_d
560
+ * @[FIPS203, Algorithm 6], Decompress_d @[FIPS203, Eq (4.8)], extended to
561
+ * vectors as per @[FIPS203, 2.4.8 Applying Algorithms to Arrays].
562
+ * `Decompress_1 (ByteDecode_1 (w))` appears in @[FIPS203, Algorithm 15
563
+ * (K-PKE.Encrypt), L20].}
641
564
  *
642
- * Specification: Implements `Decompress_1 (ByteDecode_1 (a))`:
643
- * - ByteDecode_d: @[FIPS203, Algorithm 6],
644
- * - Decompress_d: @[FIPS203, Eq (4.8)]
645
- * Extended to vectors as per
646
- * @[FIPS203, 2.4.8 Applying Algorithms to Arrays]
647
- * - `Decompress_1 (ByteDecode_1 (w))` appears in
648
- * @[FIPS203, Algorithm 15 (K-PKE.Encrypt), L20].
649
- *
650
- **************************************************/
565
+ * @param[out] r Output polynomial.
566
+ * @param[in] msg Input message.
567
+ */
651
568
  MLK_INTERNAL_API
652
569
  void mlk_poly_frommsg(mlk_poly *r, const uint8_t msg[MLKEM_INDCPA_MSGBYTES])
653
570
  __contract__(
@@ -658,24 +575,18 @@ __contract__(
658
575
  );
659
576
 
660
577
  #define mlk_poly_tomsg MLK_NAMESPACE(poly_tomsg)
661
- /*************************************************
662
- * Name: mlk_poly_tomsg
663
- *
664
- * Description: Convert polynomial to 32-byte message
578
+ /**
579
+ * Convert a polynomial to a 32-byte message.
665
580
  *
666
- * Arguments: - uint8_t *msg: pointer to output message
667
- * - const mlk_poly *r: pointer to input polynomial
668
- * Coefficients must be unsigned canonical
581
+ * @spec{Implements `ByteEncode_1 (Compress_1 (a))`: ByteEncode_d
582
+ * @[FIPS203, Algorithm 5], Compress_d @[FIPS203, Eq (4.7)], extended to
583
+ * vectors as per @[FIPS203, 2.4.8 Applying Algorithms to Arrays].
584
+ * `ByteEncode_1 (Compress_1 (w))` appears in @[FIPS203, Algorithm 14
585
+ * (K-PKE.Decrypt), L7].}
669
586
  *
670
- * Specification: Implements `ByteEncode_1 (Compress_1 (a))`:
671
- * - ByteEncode_d: @[FIPS203, Algorithm 5],
672
- * - Compress_d: @[FIPS203, Eq (4.7)]
673
- * Extended to vectors as per
674
- * @[FIPS203, 2.4.8 Applying Algorithms to Arrays]
675
- * - `ByteEncode_1 (Compress_1 (w))` appears in
676
- * @[FIPS203, Algorithm 14 (K-PKE.Decrypt), L7].
677
- *
678
- **************************************************/
587
+ * @param[out] msg Output message.
588
+ * @param[in] r Input polynomial. Coefficients must be unsigned canonical.
589
+ */
679
590
  MLK_INTERNAL_API
680
591
  void mlk_poly_tomsg(uint8_t msg[MLKEM_INDCPA_MSGBYTES], const mlk_poly *r)
681
592
  __contract__(