pq_crypto 0.6.0 → 0.6.2

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 (154) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/SECURITY.md +7 -0
  4. data/ext/pqcrypto/extconf.rb +2 -0
  5. data/ext/pqcrypto/pqcrypto_ruby_secure.c +139 -0
  6. data/ext/pqcrypto/pqcrypto_secure.c +532 -0
  7. data/ext/pqcrypto/pqcrypto_secure.h +20 -0
  8. data/ext/pqcrypto/pqcrypto_version.h +1 -1
  9. data/ext/pqcrypto/vendor/.vendored +4 -4
  10. data/ext/pqcrypto/vendor/mldsa-native/README.md +23 -10
  11. data/ext/pqcrypto/vendor/mldsa-native/mldsa/README.md +23 -0
  12. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.c +114 -58
  13. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.h +498 -461
  14. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_asm.S +145 -85
  15. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_config.h +456 -422
  16. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/cbmc.h +47 -25
  17. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/common.h +26 -14
  18. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.h +56 -81
  19. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.h +17 -24
  20. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.c +33 -40
  21. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.h +67 -87
  22. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.c +19 -14
  23. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.h +13 -5
  24. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.c +84 -10
  25. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.h +10 -5
  26. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/auto.h +6 -0
  27. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/fips202_native_aarch64.h +22 -15
  28. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_aarch64_asm.S +376 -0
  29. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_aarch64_asm.S +204 -0
  30. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_aarch64_asm.S +259 -0
  31. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S +1077 -0
  32. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S +987 -0
  33. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +16 -10
  34. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_scalar.h +2 -1
  35. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_v84a.h +1 -1
  36. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x2_v84a.h +4 -2
  37. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_scalar.h +2 -2
  38. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +1 -1
  39. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/api.h +60 -0
  40. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/mve.h +48 -0
  41. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/fips202_native_armv81m.h +18 -1
  42. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +658 -582
  43. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +5 -100
  44. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +26 -25
  45. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/state_extract_bytes_x4_mve.S +334 -0
  46. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/state_xor_bytes_x4_mve.S +355 -0
  47. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/auto.h +8 -3
  48. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/{xkcp.h → keccak_f1600_x4_avx2.h} +11 -8
  49. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/fips202_native_x86_64.h +44 -0
  50. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2_asm.S +454 -0
  51. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccakf1600_constants.c +52 -0
  52. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/meta.h +37 -28
  53. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/aarch64_zetas.c +213 -196
  54. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/arith_native_aarch64.h +248 -64
  55. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/intt_aarch64_asm.S +753 -0
  56. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm.S +129 -0
  57. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm.S +145 -0
  58. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm.S +177 -0
  59. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/ntt_aarch64_asm.S +653 -0
  60. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/pointwise_montgomery_aarch64_asm.S +84 -0
  61. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_caddq_aarch64_asm.S +53 -0
  62. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_chknorm_aarch64_asm.S +55 -0
  63. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_32_aarch64_asm.S +86 -0
  64. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_88_aarch64_asm.S +86 -0
  65. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_32_aarch64_asm.S +103 -0
  66. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_88_aarch64_asm.S +111 -0
  67. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_17_aarch64_asm.S +75 -0
  68. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_19_aarch64_asm.S +72 -0
  69. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_table.c +23 -11
  70. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_aarch64_asm.S +189 -0
  71. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta2_aarch64_asm.S +137 -0
  72. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta4_aarch64_asm.S +130 -0
  73. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta_table.c +520 -516
  74. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_table.c +34 -33
  75. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/api.h +202 -242
  76. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/meta.h +25 -17
  77. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/arith_native_x86_64.h +112 -28
  78. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.c +1 -1
  79. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.h +1 -1
  80. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/intt_avx2_asm.S +2311 -0
  81. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/ntt_avx2_asm.S +2383 -0
  82. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/nttunpack_avx2_asm.S +238 -0
  83. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l4_avx2_asm.S +139 -0
  84. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l5_avx2_asm.S +155 -0
  85. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l7_avx2_asm.S +187 -0
  86. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_avx2_asm.S +130 -0
  87. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_caddq_avx2_asm.S +190 -0
  88. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_32_avx2.c +6 -4
  89. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_88_avx2.c +6 -4
  90. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_32_avx2.c +9 -8
  91. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_88_avx2.c +10 -9
  92. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_17_avx2.c +8 -5
  93. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_19_avx2.c +8 -5
  94. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta2_avx2.c +6 -4
  95. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta4_avx2.c +6 -4
  96. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_table.c +130 -129
  97. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.c +109 -180
  98. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.h +169 -150
  99. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.c +56 -40
  100. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.h +149 -164
  101. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.c +52 -57
  102. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.h +132 -167
  103. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.c +57 -424
  104. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.h +167 -474
  105. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.c +308 -0
  106. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.h +653 -0
  107. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/reduce.h +22 -29
  108. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/rounding.h +37 -43
  109. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.c +511 -367
  110. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.h +456 -417
  111. data/lib/pq_crypto/hybrid_kem.rb +1 -1
  112. data/lib/pq_crypto/internal.rb +23 -0
  113. data/lib/pq_crypto/kem.rb +27 -34
  114. data/lib/pq_crypto/pkcs8/der.rb +68 -0
  115. data/lib/pq_crypto/pkcs8/private_key_choice.rb +186 -0
  116. data/lib/pq_crypto/pkcs8.rb +51 -468
  117. data/lib/pq_crypto/serialization.rb +19 -29
  118. data/lib/pq_crypto/signature.rb +28 -35
  119. data/lib/pq_crypto/version.rb +1 -1
  120. data/lib/pq_crypto.rb +10 -0
  121. data/script/vendor_libs.rb +3 -3
  122. metadata +44 -35
  123. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_asm.S +0 -376
  124. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_asm.S +0 -204
  125. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_asm.S +0 -259
  126. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_asm.S +0 -1077
  127. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S +0 -987
  128. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.c +0 -488
  129. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.h +0 -16
  130. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/intt.S +0 -753
  131. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l4.S +0 -129
  132. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l5.S +0 -145
  133. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l7.S +0 -177
  134. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/ntt.S +0 -653
  135. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/pointwise_montgomery.S +0 -79
  136. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_caddq_asm.S +0 -53
  137. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_chknorm_asm.S +0 -55
  138. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_32_asm.S +0 -85
  139. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_88_asm.S +0 -85
  140. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_32_asm.S +0 -102
  141. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_88_asm.S +0 -110
  142. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_17_asm.S +0 -72
  143. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_19_asm.S +0 -69
  144. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_asm.S +0 -189
  145. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta2_asm.S +0 -135
  146. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta4_asm.S +0 -128
  147. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/intt.S +0 -2311
  148. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/ntt.S +0 -2383
  149. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/nttunpack.S +0 -239
  150. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise.S +0 -131
  151. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l4.S +0 -139
  152. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l5.S +0 -155
  153. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l7.S +0 -187
  154. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_caddq_avx2.c +0 -61
@@ -38,16 +38,16 @@
38
38
  MLD_MUST_CHECK_RETURN_VALUE
39
39
  static MLD_INLINE int mld_ntt_native(int32_t data[MLDSA_N])
40
40
  {
41
- mld_ntt_asm(data, mld_aarch64_ntt_zetas_layer123456,
42
- mld_aarch64_ntt_zetas_layer78);
41
+ mld_ntt_aarch64_asm(data, mld_aarch64_ntt_zetas_layer123456,
42
+ mld_aarch64_ntt_zetas_layer78);
43
43
  return MLD_NATIVE_FUNC_SUCCESS;
44
44
  }
45
45
 
46
46
  MLD_MUST_CHECK_RETURN_VALUE
47
47
  static MLD_INLINE int mld_intt_native(int32_t data[MLDSA_N])
48
48
  {
49
- mld_intt_asm(data, mld_aarch64_intt_zetas_layer78,
50
- mld_aarch64_intt_zetas_layer123456);
49
+ mld_intt_aarch64_asm(data, mld_aarch64_intt_zetas_layer78,
50
+ mld_aarch64_intt_zetas_layer123456);
51
51
  return MLD_NATIVE_FUNC_SUCCESS;
52
52
  }
53
53
 
@@ -63,9 +63,11 @@ static MLD_INLINE int mld_rej_uniform_native(int32_t *r, unsigned len,
63
63
  }
64
64
 
65
65
  /* Safety: outlen is at most MLDSA_N, hence, this cast is safe. */
66
- return (int)mld_rej_uniform_asm(r, buf, buflen, mld_rej_uniform_table);
66
+ return (int)mld_rej_uniform_aarch64_asm(r, buf, buflen,
67
+ mld_rej_uniform_table);
67
68
  }
68
69
 
70
+ #if !defined(MLD_CONFIG_NO_KEYPAIR_API)
69
71
  #if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLDSA_ETA == 2
70
72
  MLD_MUST_CHECK_RETURN_VALUE
71
73
  static MLD_INLINE int mld_rej_uniform_eta2_native(int32_t *r, unsigned len,
@@ -86,7 +88,8 @@ static MLD_INLINE int mld_rej_uniform_eta2_native(int32_t *r, unsigned len,
86
88
  * We declassify prior the input data and mark the outputs as secret.
87
89
  */
88
90
  MLD_CT_TESTING_DECLASSIFY(buf, buflen);
89
- outlen = mld_rej_uniform_eta2_asm(r, buf, buflen, mld_rej_uniform_eta_table);
91
+ outlen = mld_rej_uniform_eta2_aarch64_asm(r, buf, buflen,
92
+ mld_rej_uniform_eta_table);
90
93
  MLD_CT_TESTING_SECRET(r, sizeof(int32_t) * outlen);
91
94
  /* Safety: outlen is at most MLDSA_N and, hence, this cast is safe. */
92
95
  return (int)outlen;
@@ -113,19 +116,22 @@ static MLD_INLINE int mld_rej_uniform_eta4_native(int32_t *r, unsigned len,
113
116
  * We declassify prior the input data and mark the outputs as secret.
114
117
  */
115
118
  MLD_CT_TESTING_DECLASSIFY(buf, buflen);
116
- outlen = mld_rej_uniform_eta4_asm(r, buf, buflen, mld_rej_uniform_eta_table);
119
+ outlen = mld_rej_uniform_eta4_aarch64_asm(r, buf, buflen,
120
+ mld_rej_uniform_eta_table);
117
121
  MLD_CT_TESTING_SECRET(r, sizeof(int32_t) * outlen);
118
122
  /* Safety: outlen is at most MLDSA_N and, hence, this cast is safe. */
119
123
  return (int)outlen;
120
124
  }
121
125
  #endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLDSA_ETA == 4 */
126
+ #endif /* !MLD_CONFIG_NO_KEYPAIR_API */
122
127
 
128
+ #if !defined(MLD_CONFIG_NO_SIGN_API)
123
129
  #if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || \
124
130
  (MLD_CONFIG_PARAMETER_SET == 65 || MLD_CONFIG_PARAMETER_SET == 87)
125
131
  MLD_MUST_CHECK_RETURN_VALUE
126
132
  static MLD_INLINE int mld_poly_decompose_32_native(int32_t *a1, int32_t *a0)
127
133
  {
128
- mld_poly_decompose_32_asm(a1, a0);
134
+ mld_poly_decompose_32_aarch64_asm(a1, a0);
129
135
  return MLD_NATIVE_FUNC_SUCCESS;
130
136
  }
131
137
  #endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 65 \
@@ -135,26 +141,27 @@ static MLD_INLINE int mld_poly_decompose_32_native(int32_t *a1, int32_t *a0)
135
141
  MLD_MUST_CHECK_RETURN_VALUE
136
142
  static MLD_INLINE int mld_poly_decompose_88_native(int32_t *a1, int32_t *a0)
137
143
  {
138
- mld_poly_decompose_88_asm(a1, a0);
144
+ mld_poly_decompose_88_aarch64_asm(a1, a0);
139
145
  return MLD_NATIVE_FUNC_SUCCESS;
140
146
  }
141
147
  #endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 44 \
142
148
  */
149
+ #endif /* !MLD_CONFIG_NO_SIGN_API */
143
150
 
144
151
  MLD_MUST_CHECK_RETURN_VALUE
145
152
  static MLD_INLINE int mld_poly_caddq_native(int32_t a[MLDSA_N])
146
153
  {
147
- mld_poly_caddq_asm(a);
154
+ mld_poly_caddq_aarch64_asm(a);
148
155
  return MLD_NATIVE_FUNC_SUCCESS;
149
156
  }
150
157
 
158
+ #if !defined(MLD_CONFIG_NO_VERIFY_API)
151
159
  #if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || \
152
160
  (MLD_CONFIG_PARAMETER_SET == 65 || MLD_CONFIG_PARAMETER_SET == 87)
153
161
  MLD_MUST_CHECK_RETURN_VALUE
154
- static MLD_INLINE int mld_poly_use_hint_32_native(int32_t *b, const int32_t *a,
155
- const int32_t *h)
162
+ static MLD_INLINE int mld_poly_use_hint_32_native(int32_t *a, const int32_t *h)
156
163
  {
157
- mld_poly_use_hint_32_asm(b, a, h);
164
+ mld_poly_use_hint_32_aarch64_asm(a, h);
158
165
  return MLD_NATIVE_FUNC_SUCCESS;
159
166
  }
160
167
  #endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 65 \
@@ -162,26 +169,27 @@ static MLD_INLINE int mld_poly_use_hint_32_native(int32_t *b, const int32_t *a,
162
169
 
163
170
  #if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLD_CONFIG_PARAMETER_SET == 44
164
171
  MLD_MUST_CHECK_RETURN_VALUE
165
- static MLD_INLINE int mld_poly_use_hint_88_native(int32_t *b, const int32_t *a,
166
- const int32_t *h)
172
+ static MLD_INLINE int mld_poly_use_hint_88_native(int32_t *a, const int32_t *h)
167
173
  {
168
- mld_poly_use_hint_88_asm(b, a, h);
174
+ mld_poly_use_hint_88_aarch64_asm(a, h);
169
175
  return MLD_NATIVE_FUNC_SUCCESS;
170
176
  }
171
177
  #endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 44 \
172
178
  */
179
+ #endif /* !MLD_CONFIG_NO_VERIFY_API */
173
180
 
174
181
  MLD_MUST_CHECK_RETURN_VALUE
175
182
  static MLD_INLINE int mld_poly_chknorm_native(const int32_t *a, int32_t B)
176
183
  {
177
- return mld_poly_chknorm_asm(a, B);
184
+ return mld_poly_chknorm_aarch64_asm(a, B);
178
185
  }
179
186
 
187
+ #if !defined(MLD_CONFIG_NO_SIGN_API) || !defined(MLD_CONFIG_NO_VERIFY_API)
180
188
  #if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLD_CONFIG_PARAMETER_SET == 44
181
189
  MLD_MUST_CHECK_RETURN_VALUE
182
190
  static MLD_INLINE int mld_polyz_unpack_17_native(int32_t *r, const uint8_t *buf)
183
191
  {
184
- mld_polyz_unpack_17_asm(r, buf, mld_polyz_unpack_17_indices);
192
+ mld_polyz_unpack_17_aarch64_asm(r, buf, mld_polyz_unpack_17_indices);
185
193
  return MLD_NATIVE_FUNC_SUCCESS;
186
194
  }
187
195
  #endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 44 \
@@ -192,20 +200,24 @@ static MLD_INLINE int mld_polyz_unpack_17_native(int32_t *r, const uint8_t *buf)
192
200
  MLD_MUST_CHECK_RETURN_VALUE
193
201
  static MLD_INLINE int mld_polyz_unpack_19_native(int32_t *r, const uint8_t *buf)
194
202
  {
195
- mld_polyz_unpack_19_asm(r, buf, mld_polyz_unpack_19_indices);
203
+ mld_polyz_unpack_19_aarch64_asm(r, buf, mld_polyz_unpack_19_indices);
196
204
  return MLD_NATIVE_FUNC_SUCCESS;
197
205
  }
198
206
  #endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 65 \
199
207
  || MLD_CONFIG_PARAMETER_SET == 87 */
208
+ #endif /* !MLD_CONFIG_NO_SIGN_API || !MLD_CONFIG_NO_VERIFY_API */
200
209
 
210
+ #if !defined(MLD_CONFIG_NO_SIGN_API) || !defined(MLD_CONFIG_NO_VERIFY_API) || \
211
+ defined(MLD_CONFIG_REDUCE_RAM) || defined(MLD_UNIT_TEST)
201
212
  MLD_MUST_CHECK_RETURN_VALUE
202
213
  static MLD_INLINE int mld_poly_pointwise_montgomery_native(
203
- int32_t out[MLDSA_N], const int32_t in0[MLDSA_N],
204
- const int32_t in1[MLDSA_N])
214
+ int32_t a[MLDSA_N], const int32_t b[MLDSA_N])
205
215
  {
206
- mld_poly_pointwise_montgomery_asm(out, in0, in1);
216
+ mld_poly_pointwise_montgomery_aarch64_asm(a, b);
207
217
  return MLD_NATIVE_FUNC_SUCCESS;
208
218
  }
219
+ #endif /* !MLD_CONFIG_NO_SIGN_API || !MLD_CONFIG_NO_VERIFY_API || \
220
+ MLD_CONFIG_REDUCE_RAM || MLD_UNIT_TEST */
209
221
 
210
222
  #if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLDSA_L == 4
211
223
  MLD_MUST_CHECK_RETURN_VALUE
@@ -213,8 +225,7 @@ static MLD_INLINE int mld_polyvecl_pointwise_acc_montgomery_l4_native(
213
225
  int32_t w[MLDSA_N], const int32_t u[4][MLDSA_N],
214
226
  const int32_t v[4][MLDSA_N])
215
227
  {
216
- mld_polyvecl_pointwise_acc_montgomery_l4_asm(w, (const int32_t *)u,
217
- (const int32_t *)v);
228
+ mld_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm(w, u, v);
218
229
  return MLD_NATIVE_FUNC_SUCCESS;
219
230
  }
220
231
  #endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLDSA_L == 4 */
@@ -225,8 +236,7 @@ static MLD_INLINE int mld_polyvecl_pointwise_acc_montgomery_l5_native(
225
236
  int32_t w[MLDSA_N], const int32_t u[5][MLDSA_N],
226
237
  const int32_t v[5][MLDSA_N])
227
238
  {
228
- mld_polyvecl_pointwise_acc_montgomery_l5_asm(w, (const int32_t *)u,
229
- (const int32_t *)v);
239
+ mld_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm(w, u, v);
230
240
  return MLD_NATIVE_FUNC_SUCCESS;
231
241
  }
232
242
  #endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLDSA_L == 5 */
@@ -237,8 +247,7 @@ static MLD_INLINE int mld_polyvecl_pointwise_acc_montgomery_l7_native(
237
247
  int32_t w[MLDSA_N], const int32_t u[7][MLDSA_N],
238
248
  const int32_t v[7][MLDSA_N])
239
249
  {
240
- mld_polyvecl_pointwise_acc_montgomery_l7_asm(w, (const int32_t *)u,
241
- (const int32_t *)v);
250
+ mld_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm(w, u, v);
242
251
  return MLD_NATIVE_FUNC_SUCCESS;
243
252
  }
244
253
  #endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLDSA_L == 7 */