pq_crypto 0.6.1 → 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 (141) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/SECURITY.md +7 -0
  4. data/ext/pqcrypto/pqcrypto_version.h +1 -1
  5. data/ext/pqcrypto/vendor/.vendored +4 -4
  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/lib/pq_crypto/version.rb +1 -1
  108. data/script/vendor_libs.rb +3 -3
  109. metadata +41 -35
  110. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_asm.S +0 -376
  111. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_asm.S +0 -204
  112. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_asm.S +0 -259
  113. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_asm.S +0 -1077
  114. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S +0 -987
  115. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.c +0 -488
  116. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.h +0 -16
  117. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/intt.S +0 -753
  118. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l4.S +0 -129
  119. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l5.S +0 -145
  120. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l7.S +0 -177
  121. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/ntt.S +0 -653
  122. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/pointwise_montgomery.S +0 -79
  123. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_caddq_asm.S +0 -53
  124. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_chknorm_asm.S +0 -55
  125. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_32_asm.S +0 -85
  126. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_88_asm.S +0 -85
  127. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_32_asm.S +0 -102
  128. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_88_asm.S +0 -110
  129. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_17_asm.S +0 -72
  130. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_19_asm.S +0 -69
  131. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_asm.S +0 -189
  132. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta2_asm.S +0 -135
  133. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta4_asm.S +0 -128
  134. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/intt.S +0 -2311
  135. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/ntt.S +0 -2383
  136. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/nttunpack.S +0 -239
  137. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise.S +0 -131
  138. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l4.S +0 -139
  139. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l5.S +0 -155
  140. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l7.S +0 -187
  141. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_caddq_avx2.c +0 -61
@@ -18,21 +18,32 @@
18
18
  #define mld_aarch64_intt_zetas_layer123456 \
19
19
  MLD_NAMESPACE(aarch64_intt_zetas_layer123456)
20
20
 
21
- extern const int32_t mld_aarch64_ntt_zetas_layer123456[];
22
- extern const int32_t mld_aarch64_ntt_zetas_layer78[];
21
+ MLD_INTERNAL_DATA_DECLARATION const int32_t
22
+ mld_aarch64_ntt_zetas_layer123456[144];
23
+ MLD_INTERNAL_DATA_DECLARATION const int32_t mld_aarch64_ntt_zetas_layer78[384];
23
24
 
24
- extern const int32_t mld_aarch64_intt_zetas_layer78[];
25
- extern const int32_t mld_aarch64_intt_zetas_layer123456[];
25
+ MLD_INTERNAL_DATA_DECLARATION const int32_t mld_aarch64_intt_zetas_layer78[384];
26
+ MLD_INTERNAL_DATA_DECLARATION const int32_t
27
+ mld_aarch64_intt_zetas_layer123456[160];
26
28
 
27
29
  #define mld_rej_uniform_table MLD_NAMESPACE(rej_uniform_table)
28
- extern const uint8_t mld_rej_uniform_table[];
30
+ MLD_INTERNAL_DATA_DECLARATION const uint8_t mld_rej_uniform_table[256];
31
+ #if !defined(MLD_CONFIG_NO_KEYPAIR_API)
29
32
  #define mld_rej_uniform_eta_table MLD_NAMESPACE(rej_uniform_eta_table)
30
- extern const uint8_t mld_rej_uniform_eta_table[];
33
+ MLD_INTERNAL_DATA_DECLARATION const uint8_t mld_rej_uniform_eta_table[4096];
34
+ #endif
31
35
 
36
+ #if !defined(MLD_CONFIG_NO_SIGN_API) || !defined(MLD_CONFIG_NO_VERIFY_API)
37
+ #if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLD_CONFIG_PARAMETER_SET == 44
32
38
  #define mld_polyz_unpack_17_indices MLD_NAMESPACE(polyz_unpack_17_indices)
33
- extern const uint8_t mld_polyz_unpack_17_indices[];
39
+ MLD_INTERNAL_DATA_DECLARATION const uint8_t mld_polyz_unpack_17_indices[64];
40
+ #endif
41
+ #if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || \
42
+ (MLD_CONFIG_PARAMETER_SET == 65 || MLD_CONFIG_PARAMETER_SET == 87)
34
43
  #define mld_polyz_unpack_19_indices MLD_NAMESPACE(polyz_unpack_19_indices)
35
- extern const uint8_t mld_polyz_unpack_19_indices[];
44
+ MLD_INTERNAL_DATA_DECLARATION const uint8_t mld_polyz_unpack_19_indices[64];
45
+ #endif
46
+ #endif /* !MLD_CONFIG_NO_SIGN_API || !MLD_CONFIG_NO_VERIFY_API */
36
47
 
37
48
 
38
49
  /*
@@ -49,11 +60,11 @@ extern const uint8_t mld_polyz_unpack_19_indices[];
49
60
  */
50
61
  #define MLD_AARCH64_REJ_UNIFORM_ETA4_BUFLEN (2 * 136)
51
62
 
52
- #define mld_ntt_asm MLD_NAMESPACE(ntt_asm)
53
- void mld_ntt_asm(int32_t *r, const int32_t *zetas_l123456,
54
- const int32_t *zetas_l78)
63
+ #define mld_ntt_aarch64_asm MLD_NAMESPACE(ntt_aarch64_asm)
64
+ void mld_ntt_aarch64_asm(int32_t *r, const int32_t *zetas_l123456,
65
+ const int32_t *zetas_l78)
55
66
  /* This must be kept in sync with the HOL-Light specification
56
- * in proofs/hol_light/aarch64/proofs/mldsa_ntt.ml */
67
+ * in proofs/hol_light/aarch64/proofs/ntt_aarch64_asm.ml */
57
68
  __contract__(
58
69
  requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
59
70
  requires(array_abs_bound(r, 0, MLDSA_N, 8380417))
@@ -65,34 +76,94 @@ __contract__(
65
76
  /* check-magic: on */
66
77
  );
67
78
 
68
- #define mld_intt_asm MLD_NAMESPACE(intt_asm)
69
- void mld_intt_asm(int32_t *, const int32_t *, const int32_t *);
79
+ #define mld_intt_aarch64_asm MLD_NAMESPACE(intt_aarch64_asm)
80
+ void mld_intt_aarch64_asm(int32_t *r, const int32_t *zetas_l78,
81
+ const int32_t *zetas_l123456)
82
+ /* This must be kept in sync with the HOL-Light specification
83
+ * in proofs/hol_light/aarch64/proofs/intt_aarch64_asm.ml */
84
+ __contract__(
85
+ requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
86
+ requires(array_abs_bound(r, 0, MLDSA_N, 8380417))
87
+ requires(zetas_l78 == mld_aarch64_intt_zetas_layer78)
88
+ requires(zetas_l123456 == mld_aarch64_intt_zetas_layer123456)
89
+ assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
90
+ /* check-magic: off */
91
+ ensures(array_abs_bound(r, 0, MLDSA_N, 8380417))
92
+ /* check-magic: on */
93
+ );
70
94
 
71
- #define mld_rej_uniform_asm MLD_NAMESPACE(rej_uniform_asm)
95
+ #define mld_rej_uniform_aarch64_asm MLD_NAMESPACE(rej_uniform_aarch64_asm)
72
96
  MLD_MUST_CHECK_RETURN_VALUE
73
- uint64_t mld_rej_uniform_asm(int32_t *r, const uint8_t *buf, unsigned buflen,
74
- const uint8_t *table);
97
+ uint64_t mld_rej_uniform_aarch64_asm(int32_t *r, const uint8_t *buf,
98
+ unsigned buflen, const uint8_t *table)
99
+ /* This must be kept in sync with the HOL-Light specification
100
+ * in proofs/hol_light/aarch64/proofs/rej_uniform_aarch64_asm.ml. */
101
+ __contract__(
102
+ requires(buflen % 24 == 0)
103
+ requires(memory_no_alias(buf, buflen))
104
+ requires(table == mld_rej_uniform_table)
105
+ requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
106
+ assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
107
+ ensures(return_value <= MLDSA_N)
108
+ ensures(array_bound(r, 0, (unsigned) return_value, 0, MLDSA_Q))
109
+ );
75
110
 
76
- #define mld_rej_uniform_eta2_asm MLD_NAMESPACE(rej_uniform_eta2_asm)
111
+ #if !defined(MLD_CONFIG_NO_KEYPAIR_API)
112
+ #define mld_rej_uniform_eta2_aarch64_asm \
113
+ MLD_NAMESPACE(rej_uniform_eta2_aarch64_asm)
77
114
  MLD_MUST_CHECK_RETURN_VALUE
78
- uint64_t mld_rej_uniform_eta2_asm(int32_t *r, const uint8_t *buf,
79
- unsigned buflen, const uint8_t *table);
115
+ uint64_t mld_rej_uniform_eta2_aarch64_asm(int32_t *r, const uint8_t *buf,
116
+ unsigned buflen,
117
+ const uint8_t *table);
80
118
 
81
- #define mld_rej_uniform_eta4_asm MLD_NAMESPACE(rej_uniform_eta4_asm)
119
+ #define mld_rej_uniform_eta4_aarch64_asm \
120
+ MLD_NAMESPACE(rej_uniform_eta4_aarch64_asm)
82
121
  MLD_MUST_CHECK_RETURN_VALUE
83
- uint64_t mld_rej_uniform_eta4_asm(int32_t *r, const uint8_t *buf,
84
- unsigned buflen, const uint8_t *table);
122
+ uint64_t mld_rej_uniform_eta4_aarch64_asm(int32_t *r, const uint8_t *buf,
123
+ unsigned buflen,
124
+ const uint8_t *table);
125
+ #endif /* !MLD_CONFIG_NO_KEYPAIR_API */
85
126
 
86
- #define mld_poly_decompose_32_asm MLD_NAMESPACE(poly_decompose_32_asm)
87
- void mld_poly_decompose_32_asm(int32_t *a1, int32_t *a0);
127
+ #if !defined(MLD_CONFIG_NO_SIGN_API)
128
+ #define mld_poly_decompose_32_aarch64_asm \
129
+ MLD_NAMESPACE(poly_decompose_32_aarch64_asm)
130
+ void mld_poly_decompose_32_aarch64_asm(int32_t *a1, int32_t *a0)
131
+ /* This must be kept in sync with the HOL-Light specification
132
+ * in proofs/hol_light/aarch64/proofs/poly_decompose_32_aarch64_asm.ml */
133
+ __contract__(
134
+ requires(memory_no_alias(a1, sizeof(int32_t) * MLDSA_N))
135
+ requires(memory_no_alias(a0, sizeof(int32_t) * MLDSA_N))
136
+ requires(array_bound(a0, 0, MLDSA_N, 0, MLDSA_Q))
137
+ assigns(memory_slice(a1, sizeof(int32_t) * MLDSA_N))
138
+ assigns(memory_slice(a0, sizeof(int32_t) * MLDSA_N))
139
+ /* check-magic: 16 == (MLDSA_Q - 1) / (2 * ((MLDSA_Q - 1) / 32)) */
140
+ ensures(array_bound(a1, 0, MLDSA_N, 0, 16))
141
+ /* check-magic: 261889 == (MLDSA_Q - 1) / 32 + 1 */
142
+ ensures(array_abs_bound(a0, 0, MLDSA_N, 261889))
143
+ );
88
144
 
89
- #define mld_poly_decompose_88_asm MLD_NAMESPACE(poly_decompose_88_asm)
90
- void mld_poly_decompose_88_asm(int32_t *a1, int32_t *a0);
145
+ #define mld_poly_decompose_88_aarch64_asm \
146
+ MLD_NAMESPACE(poly_decompose_88_aarch64_asm)
147
+ void mld_poly_decompose_88_aarch64_asm(int32_t *a1, int32_t *a0)
148
+ /* This must be kept in sync with the HOL-Light specification
149
+ * in proofs/hol_light/aarch64/proofs/poly_decompose_88_aarch64_asm.ml */
150
+ __contract__(
151
+ requires(memory_no_alias(a1, sizeof(int32_t) * MLDSA_N))
152
+ requires(memory_no_alias(a0, sizeof(int32_t) * MLDSA_N))
153
+ requires(array_bound(a0, 0, MLDSA_N, 0, MLDSA_Q))
154
+ assigns(memory_slice(a1, sizeof(int32_t) * MLDSA_N))
155
+ assigns(memory_slice(a0, sizeof(int32_t) * MLDSA_N))
156
+ /* check-magic: 44 == (MLDSA_Q - 1) / (2 * ((MLDSA_Q - 1) / 88)) */
157
+ ensures(array_bound(a1, 0, MLDSA_N, 0, 44))
158
+ /* check-magic: 95233 == (MLDSA_Q - 1) / 88 + 1 */
159
+ ensures(array_abs_bound(a0, 0, MLDSA_N, 95233))
160
+ );
161
+ #endif /* !MLD_CONFIG_NO_SIGN_API */
91
162
 
92
- #define mld_poly_caddq_asm MLD_NAMESPACE(poly_caddq_asm)
93
- void mld_poly_caddq_asm(int32_t *a)
163
+ #define mld_poly_caddq_aarch64_asm MLD_NAMESPACE(poly_caddq_aarch64_asm)
164
+ void mld_poly_caddq_aarch64_asm(int32_t *a)
94
165
  /* This must be kept in sync with the HOL-Light specification
95
- * in proofs/hol_light/aarch64/proofs/mldsa_poly_caddq.ml */
166
+ * in proofs/hol_light/aarch64/proofs/poly_caddq_aarch64_asm.ml */
96
167
  __contract__(
97
168
  requires(memory_no_alias(a, sizeof(int32_t) * MLDSA_N))
98
169
  requires(array_abs_bound(a, 0, MLDSA_N, MLDSA_Q))
@@ -100,17 +171,41 @@ __contract__(
100
171
  ensures(array_bound(a, 0, MLDSA_N, 0, MLDSA_Q))
101
172
  );
102
173
 
103
- #define mld_poly_use_hint_32_asm MLD_NAMESPACE(poly_use_hint_32_asm)
104
- void mld_poly_use_hint_32_asm(int32_t *b, const int32_t *a, const int32_t *h);
174
+ #if !defined(MLD_CONFIG_NO_VERIFY_API)
175
+ #define mld_poly_use_hint_32_aarch64_asm \
176
+ MLD_NAMESPACE(poly_use_hint_32_aarch64_asm)
177
+ void mld_poly_use_hint_32_aarch64_asm(int32_t *a, const int32_t *h)
178
+ /* This must be kept in sync with the HOL-Light specification
179
+ * in proofs/hol_light/aarch64/proofs/poly_use_hint_32_aarch64_asm.ml */
180
+ __contract__(
181
+ requires(memory_no_alias(a, sizeof(int32_t) * MLDSA_N))
182
+ requires(memory_no_alias(h, sizeof(int32_t) * MLDSA_N))
183
+ requires(array_bound(a, 0, MLDSA_N, 0, MLDSA_Q))
184
+ requires(array_bound(h, 0, MLDSA_N, 0, 2))
185
+ assigns(memory_slice(a, sizeof(int32_t) * MLDSA_N))
186
+ ensures(array_bound(a, 0, MLDSA_N, 0, 16))
187
+ );
105
188
 
106
- #define mld_poly_use_hint_88_asm MLD_NAMESPACE(poly_use_hint_88_asm)
107
- void mld_poly_use_hint_88_asm(int32_t *b, const int32_t *a, const int32_t *h);
189
+ #define mld_poly_use_hint_88_aarch64_asm \
190
+ MLD_NAMESPACE(poly_use_hint_88_aarch64_asm)
191
+ void mld_poly_use_hint_88_aarch64_asm(int32_t *a, const int32_t *h)
192
+ /* This must be kept in sync with the HOL-Light specification
193
+ * in proofs/hol_light/aarch64/proofs/poly_use_hint_88_aarch64_asm.ml */
194
+ __contract__(
195
+ requires(memory_no_alias(a, sizeof(int32_t) * MLDSA_N))
196
+ requires(memory_no_alias(h, sizeof(int32_t) * MLDSA_N))
197
+ requires(array_bound(a, 0, MLDSA_N, 0, MLDSA_Q))
198
+ requires(array_bound(h, 0, MLDSA_N, 0, 2))
199
+ assigns(memory_slice(a, sizeof(int32_t) * MLDSA_N))
200
+ ensures(array_bound(a, 0, MLDSA_N, 0, 44))
201
+ );
202
+ #endif /* !MLD_CONFIG_NO_VERIFY_API */
108
203
 
109
- #define mld_poly_chknorm_asm MLD_NAMESPACE(poly_chknorm_asm)
204
+ #define mld_poly_chknorm_aarch64_asm MLD_NAMESPACE(poly_chknorm_aarch64_asm)
110
205
  MLD_MUST_CHECK_RETURN_VALUE
111
- int mld_poly_chknorm_asm(const int32_t *a, int32_t B)
206
+ int mld_poly_chknorm_aarch64_asm(const int32_t *a, int32_t B)
112
207
  /* This must be kept in sync with the HOL-Light specification
113
- * in proofs/hol_light/aarch64/proofs/mldsa_poly_chknorm.ml */
208
+ * in proofs/hol_light/aarch64/proofs/poly_chknorm_aarch64_asm.ml */
114
209
  __contract__(
115
210
  requires(memory_no_alias(a, sizeof(int32_t) * MLDSA_N))
116
211
  /* HOL Light precondition: abs(ival(x i)) < 2^31, i.e., a[i] != INT32_MIN */
@@ -119,32 +214,121 @@ __contract__(
119
214
  ensures((return_value == 0) == array_abs_bound(a, 0, MLDSA_N, B))
120
215
  );
121
216
 
122
- #define mld_polyz_unpack_17_asm MLD_NAMESPACE(polyz_unpack_17_asm)
123
- void mld_polyz_unpack_17_asm(int32_t *r, const uint8_t *buf,
124
- const uint8_t *indices);
125
-
126
- #define mld_polyz_unpack_19_asm MLD_NAMESPACE(polyz_unpack_19_asm)
127
- void mld_polyz_unpack_19_asm(int32_t *r, const uint8_t *buf,
128
- const uint8_t *indices);
129
-
130
- #define mld_poly_pointwise_montgomery_asm \
131
- MLD_NAMESPACE(poly_pointwise_montgomery_asm)
132
- void mld_poly_pointwise_montgomery_asm(int32_t *, const int32_t *,
133
- const int32_t *);
134
-
135
- #define mld_polyvecl_pointwise_acc_montgomery_l4_asm \
136
- MLD_NAMESPACE(polyvecl_pointwise_acc_montgomery_l4_asm)
137
- void mld_polyvecl_pointwise_acc_montgomery_l4_asm(int32_t *, const int32_t *,
138
- const int32_t *);
139
-
140
- #define mld_polyvecl_pointwise_acc_montgomery_l5_asm \
141
- MLD_NAMESPACE(polyvecl_pointwise_acc_montgomery_l5_asm)
142
- void mld_polyvecl_pointwise_acc_montgomery_l5_asm(int32_t *, const int32_t *,
143
- const int32_t *);
144
-
145
- #define mld_polyvecl_pointwise_acc_montgomery_l7_asm \
146
- MLD_NAMESPACE(polyvecl_pointwise_acc_montgomery_l7_asm)
147
- void mld_polyvecl_pointwise_acc_montgomery_l7_asm(int32_t *, const int32_t *,
148
- const int32_t *);
217
+ #if !defined(MLD_CONFIG_NO_SIGN_API) || !defined(MLD_CONFIG_NO_VERIFY_API)
218
+ #if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLD_CONFIG_PARAMETER_SET == 44
219
+ #define mld_polyz_unpack_17_aarch64_asm \
220
+ MLD_NAMESPACE(polyz_unpack_17_aarch64_asm)
221
+ void mld_polyz_unpack_17_aarch64_asm(int32_t *r, const uint8_t *buf,
222
+ const uint8_t *indices)
223
+ /* This must be kept in sync with the HOL-Light specification
224
+ * in proofs/hol_light/aarch64/proofs/polyz_unpack_17_aarch64_asm.ml */
225
+ __contract__(
226
+ requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
227
+ requires(memory_no_alias(buf, 576))
228
+ requires(indices == mld_polyz_unpack_17_indices)
229
+ assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
230
+ ensures(array_bound(r, 0, MLDSA_N, -((1 << 17) - 1), (1 << 17) + 1))
231
+ );
232
+ #endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 44 \
233
+ */
234
+
235
+ #if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || \
236
+ (MLD_CONFIG_PARAMETER_SET == 65 || MLD_CONFIG_PARAMETER_SET == 87)
237
+ #define mld_polyz_unpack_19_aarch64_asm \
238
+ MLD_NAMESPACE(polyz_unpack_19_aarch64_asm)
239
+ void mld_polyz_unpack_19_aarch64_asm(int32_t *r, const uint8_t *buf,
240
+ const uint8_t *indices)
241
+ /* This must be kept in sync with the HOL-Light specification
242
+ * in proofs/hol_light/aarch64/proofs/polyz_unpack_19_aarch64_asm.ml */
243
+ __contract__(
244
+ requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
245
+ requires(memory_no_alias(buf, 640))
246
+ requires(indices == mld_polyz_unpack_19_indices)
247
+ assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
248
+ ensures(array_bound(r, 0, MLDSA_N, -((1 << 19) - 1), (1 << 19) + 1))
249
+ );
250
+ #endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 65 \
251
+ || MLD_CONFIG_PARAMETER_SET == 87 */
252
+ #endif /* !MLD_CONFIG_NO_SIGN_API || !MLD_CONFIG_NO_VERIFY_API */
253
+
254
+ #if !defined(MLD_CONFIG_NO_SIGN_API) || !defined(MLD_CONFIG_NO_VERIFY_API) || \
255
+ defined(MLD_CONFIG_REDUCE_RAM) || defined(MLD_UNIT_TEST)
256
+ #define mld_poly_pointwise_montgomery_aarch64_asm \
257
+ MLD_NAMESPACE(poly_pointwise_montgomery_aarch64_asm)
258
+ void mld_poly_pointwise_montgomery_aarch64_asm(int32_t *a, const int32_t *b)
259
+ /* This must be kept in sync with the HOL-Light specification
260
+ * in proofs/hol_light/aarch64/proofs/pointwise_montgomery_aarch64_asm.ml */
261
+ __contract__(
262
+ requires(memory_no_alias(a, sizeof(int32_t) * MLDSA_N))
263
+ requires(memory_no_alias(b, sizeof(int32_t) * MLDSA_N))
264
+ /* check-magic: off */
265
+ requires(array_abs_bound(a, 0, MLDSA_N, 75423753))
266
+ requires(array_abs_bound(b, 0, MLDSA_N, 75423753))
267
+ assigns(memory_slice(a, sizeof(int32_t) * MLDSA_N))
268
+ ensures(array_abs_bound(a, 0, MLDSA_N, 8380417))
269
+ /* check-magic: on */
270
+ );
271
+ #endif /* !MLD_CONFIG_NO_SIGN_API || !MLD_CONFIG_NO_VERIFY_API || \
272
+ MLD_CONFIG_REDUCE_RAM || MLD_UNIT_TEST */
273
+
274
+ #define mld_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm \
275
+ MLD_NAMESPACE(polyvecl_pointwise_acc_montgomery_l4_aarch64_asm)
276
+ void mld_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm(
277
+ int32_t *r, const int32_t a[4][MLDSA_N], const int32_t b[4][MLDSA_N])
278
+ /* This must be kept in sync with the HOL-Light specification
279
+ * in
280
+ * proofs/hol_light/aarch64/proofs/mld_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm.ml
281
+ */
282
+ __contract__(
283
+ requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
284
+ requires(memory_no_alias(a, sizeof(int32_t) * 4 * MLDSA_N))
285
+ requires(memory_no_alias(b, sizeof(int32_t) * 4 * MLDSA_N))
286
+ /* check-magic: off */
287
+ requires(forall(l0, 0, 4, array_abs_bound(a[l0], 0, MLDSA_N, 8380417)))
288
+ requires(forall(l1, 0, 4, array_abs_bound(b[l1], 0, MLDSA_N, 75423753)))
289
+ assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
290
+ ensures(array_abs_bound(r, 0, MLDSA_N, 8380417))
291
+ /* check-magic: on */
292
+ );
293
+
294
+ #define mld_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm \
295
+ MLD_NAMESPACE(polyvecl_pointwise_acc_montgomery_l5_aarch64_asm)
296
+ void mld_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm(
297
+ int32_t *r, const int32_t a[5][MLDSA_N], const int32_t b[5][MLDSA_N])
298
+ /* This must be kept in sync with the HOL-Light specification
299
+ * in
300
+ * proofs/hol_light/aarch64/proofs/mld_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm.ml
301
+ */
302
+ __contract__(
303
+ requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
304
+ requires(memory_no_alias(a, sizeof(int32_t) * 5 * MLDSA_N))
305
+ requires(memory_no_alias(b, sizeof(int32_t) * 5 * MLDSA_N))
306
+ /* check-magic: off */
307
+ requires(forall(l0, 0, 5, array_abs_bound(a[l0], 0, MLDSA_N, 8380417)))
308
+ requires(forall(l1, 0, 5, array_abs_bound(b[l1], 0, MLDSA_N, 75423753)))
309
+ assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
310
+ ensures(array_abs_bound(r, 0, MLDSA_N, 8380417))
311
+ /* check-magic: on */
312
+ );
313
+
314
+ #define mld_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm \
315
+ MLD_NAMESPACE(polyvecl_pointwise_acc_montgomery_l7_aarch64_asm)
316
+ void mld_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm(
317
+ int32_t *r, const int32_t a[7][MLDSA_N], const int32_t b[7][MLDSA_N])
318
+ /* This must be kept in sync with the HOL-Light specification
319
+ * in
320
+ * proofs/hol_light/aarch64/proofs/mld_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm.ml
321
+ */
322
+ __contract__(
323
+ requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
324
+ requires(memory_no_alias(a, sizeof(int32_t) * 7 * MLDSA_N))
325
+ requires(memory_no_alias(b, sizeof(int32_t) * 7 * MLDSA_N))
326
+ /* check-magic: off */
327
+ requires(forall(l0, 0, 7, array_abs_bound(a[l0], 0, MLDSA_N, 8380417)))
328
+ requires(forall(l1, 0, 7, array_abs_bound(b[l1], 0, MLDSA_N, 75423753)))
329
+ assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
330
+ ensures(array_abs_bound(r, 0, MLDSA_N, 8380417))
331
+ /* check-magic: on */
332
+ );
149
333
 
150
334
  #endif /* !MLD_NATIVE_AARCH64_SRC_ARITH_NATIVE_AARCH64_H */