pq_crypto 0.3.2 → 0.5.0

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 (328) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +56 -0
  3. data/CHANGELOG.md +62 -0
  4. data/GET_STARTED.md +366 -40
  5. data/README.md +76 -233
  6. data/SECURITY.md +107 -82
  7. data/ext/pqcrypto/extconf.rb +169 -87
  8. data/ext/pqcrypto/mldsa_api.h +1 -48
  9. data/ext/pqcrypto/mlkem_api.h +1 -18
  10. data/ext/pqcrypto/pq_externalmu.c +89 -204
  11. data/ext/pqcrypto/pqcrypto_native_api.h +129 -0
  12. data/ext/pqcrypto/pqcrypto_ruby_secure.c +484 -84
  13. data/ext/pqcrypto/pqcrypto_secure.c +203 -78
  14. data/ext/pqcrypto/pqcrypto_secure.h +53 -14
  15. data/ext/pqcrypto/pqcrypto_version.h +7 -0
  16. data/ext/pqcrypto/randombytes.h +9 -0
  17. data/ext/pqcrypto/vendor/.vendored +10 -5
  18. data/ext/pqcrypto/vendor/mldsa-native/BUILDING.md +105 -0
  19. data/ext/pqcrypto/vendor/mldsa-native/LICENSE +286 -0
  20. data/ext/pqcrypto/vendor/mldsa-native/META.yml +24 -0
  21. data/ext/pqcrypto/vendor/mldsa-native/README.md +221 -0
  22. data/ext/pqcrypto/vendor/mldsa-native/SECURITY.md +8 -0
  23. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.c +721 -0
  24. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.h +975 -0
  25. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_asm.S +724 -0
  26. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_config.h +723 -0
  27. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/cbmc.h +166 -0
  28. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/common.h +321 -0
  29. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.c +21 -0
  30. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.h +385 -0
  31. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.c +73 -0
  32. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.h +130 -0
  33. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.c +277 -0
  34. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.h +244 -0
  35. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.c +182 -0
  36. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.h +117 -0
  37. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.c +438 -0
  38. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.h +105 -0
  39. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/auto.h +71 -0
  40. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/fips202_native_aarch64.h +62 -0
  41. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_asm.S +376 -0
  42. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_asm.S +204 -0
  43. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_asm.S +259 -0
  44. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_asm.S +1077 -0
  45. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S +987 -0
  46. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +41 -0
  47. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_scalar.h +26 -0
  48. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_v84a.h +35 -0
  49. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x2_v84a.h +37 -0
  50. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_scalar.h +27 -0
  51. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +36 -0
  52. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/api.h +69 -0
  53. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/README.md +10 -0
  54. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/mve.h +32 -0
  55. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/fips202_native_armv81m.h +20 -0
  56. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +638 -0
  57. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +136 -0
  58. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +52 -0
  59. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/auto.h +29 -0
  60. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.c +488 -0
  61. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.h +16 -0
  62. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/xkcp.h +31 -0
  63. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/meta.h +247 -0
  64. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/aarch64_zetas.c +231 -0
  65. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/arith_native_aarch64.h +150 -0
  66. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/intt.S +753 -0
  67. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l4.S +129 -0
  68. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l5.S +145 -0
  69. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l7.S +177 -0
  70. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/ntt.S +653 -0
  71. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/pointwise_montgomery.S +79 -0
  72. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_caddq_asm.S +53 -0
  73. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_chknorm_asm.S +55 -0
  74. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_32_asm.S +85 -0
  75. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_88_asm.S +85 -0
  76. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_32_asm.S +102 -0
  77. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_88_asm.S +110 -0
  78. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_17_asm.S +72 -0
  79. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_19_asm.S +69 -0
  80. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_table.c +40 -0
  81. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_asm.S +189 -0
  82. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta2_asm.S +135 -0
  83. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta4_asm.S +128 -0
  84. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta_table.c +543 -0
  85. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_table.c +62 -0
  86. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/api.h +649 -0
  87. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/meta.h +23 -0
  88. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/meta.h +315 -0
  89. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/arith_native_x86_64.h +124 -0
  90. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.c +157 -0
  91. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.h +27 -0
  92. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/intt.S +2311 -0
  93. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/ntt.S +2383 -0
  94. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/nttunpack.S +239 -0
  95. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise.S +131 -0
  96. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l4.S +139 -0
  97. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l5.S +155 -0
  98. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l7.S +187 -0
  99. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_caddq_avx2.c +61 -0
  100. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_chknorm_avx2.c +52 -0
  101. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_32_avx2.c +155 -0
  102. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_88_avx2.c +155 -0
  103. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_32_avx2.c +102 -0
  104. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_88_avx2.c +104 -0
  105. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_17_avx2.c +91 -0
  106. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_19_avx2.c +93 -0
  107. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_avx2.c +126 -0
  108. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta2_avx2.c +155 -0
  109. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta4_avx2.c +139 -0
  110. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_table.c +160 -0
  111. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.c +293 -0
  112. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.h +224 -0
  113. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/params.h +77 -0
  114. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.c +991 -0
  115. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.h +393 -0
  116. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.c +946 -0
  117. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.h +360 -0
  118. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.c +877 -0
  119. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.h +725 -0
  120. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/randombytes.h +26 -0
  121. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/reduce.h +139 -0
  122. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/rounding.h +249 -0
  123. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.c +1511 -0
  124. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.h +806 -0
  125. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/symmetric.h +68 -0
  126. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sys.h +268 -0
  127. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/zetas.inc +55 -0
  128. data/ext/pqcrypto/vendor/mlkem-native/BUILDING.md +104 -0
  129. data/ext/pqcrypto/vendor/mlkem-native/LICENSE +294 -0
  130. data/ext/pqcrypto/vendor/mlkem-native/META.yml +30 -0
  131. data/ext/pqcrypto/vendor/mlkem-native/README.md +223 -0
  132. data/ext/pqcrypto/vendor/mlkem-native/RELEASE.md +86 -0
  133. data/ext/pqcrypto/vendor/mlkem-native/SECURITY.md +8 -0
  134. data/ext/pqcrypto/vendor/mlkem-native/mlkem/README.md +23 -0
  135. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.c +660 -0
  136. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.h +538 -0
  137. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_asm.S +681 -0
  138. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_config.h +709 -0
  139. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/cbmc.h +174 -0
  140. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h +274 -0
  141. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.c +717 -0
  142. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.h +688 -0
  143. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.c +64 -0
  144. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.h +128 -0
  145. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.c +251 -0
  146. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.h +158 -0
  147. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.c +208 -0
  148. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.h +80 -0
  149. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.c +463 -0
  150. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.h +98 -0
  151. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/auto.h +70 -0
  152. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/fips202_native_aarch64.h +69 -0
  153. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_asm.S +375 -0
  154. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_asm.S +203 -0
  155. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_asm.S +258 -0
  156. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_asm.S +1076 -0
  157. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S +986 -0
  158. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +46 -0
  159. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_scalar.h +25 -0
  160. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_v84a.h +34 -0
  161. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x2_v84a.h +35 -0
  162. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_scalar.h +26 -0
  163. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +35 -0
  164. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/api.h +117 -0
  165. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/README.md +10 -0
  166. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/mve.h +79 -0
  167. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/fips202_native_armv81m.h +35 -0
  168. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +667 -0
  169. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +40 -0
  170. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +51 -0
  171. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_extract_bytes_x4_mve.S +290 -0
  172. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_xor_bytes_x4_mve.S +314 -0
  173. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/auto.h +28 -0
  174. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h +33 -0
  175. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/fips202_native_x86_64.h +41 -0
  176. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2.S +451 -0
  177. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccakf1600_constants.c +51 -0
  178. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.c +622 -0
  179. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.h +156 -0
  180. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.c +446 -0
  181. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.h +326 -0
  182. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/README.md +16 -0
  183. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h +122 -0
  184. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/aarch64_zetas.c +174 -0
  185. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/arith_native_aarch64.h +177 -0
  186. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/intt.S +628 -0
  187. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/ntt.S +562 -0
  188. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_mulcache_compute_asm.S +127 -0
  189. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_reduce_asm.S +150 -0
  190. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_tobytes_asm.S +117 -0
  191. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_tomont_asm.S +98 -0
  192. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/polyvec_basemul_acc_montgomery_cached_asm_k2.S +261 -0
  193. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/polyvec_basemul_acc_montgomery_cached_asm_k3.S +314 -0
  194. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/polyvec_basemul_acc_montgomery_cached_asm_k4.S +368 -0
  195. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/rej_uniform_asm.S +226 -0
  196. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/rej_uniform_table.c +542 -0
  197. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/api.h +637 -0
  198. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/meta.h +25 -0
  199. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/README.md +11 -0
  200. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/meta.h +128 -0
  201. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/arith_native_riscv64.h +45 -0
  202. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.c +81 -0
  203. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.h +145 -0
  204. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_izetas.inc +27 -0
  205. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_poly.c +805 -0
  206. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_zetas.inc +27 -0
  207. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_zetas_basemul.inc +39 -0
  208. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/README.md +4 -0
  209. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/meta.h +304 -0
  210. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/arith_native_x86_64.h +309 -0
  211. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.c +94 -0
  212. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.h +45 -0
  213. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.c +102 -0
  214. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.h +25 -0
  215. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/intt.S +719 -0
  216. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mulcache_compute.S +90 -0
  217. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/ntt.S +639 -0
  218. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/nttfrombytes.S +193 -0
  219. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/ntttobytes.S +181 -0
  220. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/nttunpack.S +174 -0
  221. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d10.S +382 -0
  222. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d11.S +448 -0
  223. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d4.S +163 -0
  224. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d5.S +220 -0
  225. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d10.S +228 -0
  226. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d11.S +277 -0
  227. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d4.S +180 -0
  228. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d5.S +192 -0
  229. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/polyvec_basemul_acc_montgomery_cached_asm_k2.S +502 -0
  230. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/polyvec_basemul_acc_montgomery_cached_asm_k3.S +750 -0
  231. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/polyvec_basemul_acc_montgomery_cached_asm_k4.S +998 -0
  232. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/reduce.S +218 -0
  233. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/rej_uniform_asm.S +103 -0
  234. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/rej_uniform_table.c +544 -0
  235. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/tomont.S +155 -0
  236. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/params.h +76 -0
  237. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.c +572 -0
  238. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.h +317 -0
  239. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.c +502 -0
  240. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.h +668 -0
  241. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/randombytes.h +60 -0
  242. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.c +362 -0
  243. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.h +118 -0
  244. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/symmetric.h +70 -0
  245. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sys.h +260 -0
  246. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.c +20 -0
  247. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.h +464 -0
  248. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/zetas.inc +30 -0
  249. data/lib/pq_crypto/algorithm_registry.rb +200 -0
  250. data/lib/pq_crypto/hybrid_kem.rb +1 -12
  251. data/lib/pq_crypto/kem.rb +104 -13
  252. data/lib/pq_crypto/pkcs8.rb +387 -0
  253. data/lib/pq_crypto/serialization.rb +1 -14
  254. data/lib/pq_crypto/signature.rb +123 -17
  255. data/lib/pq_crypto/spki.rb +131 -0
  256. data/lib/pq_crypto/version.rb +1 -1
  257. data/lib/pq_crypto.rb +79 -20
  258. data/script/vendor_libs.rb +88 -155
  259. metadata +241 -73
  260. data/ext/pqcrypto/vendor/pqclean/common/aes.c +0 -639
  261. data/ext/pqcrypto/vendor/pqclean/common/aes.h +0 -64
  262. data/ext/pqcrypto/vendor/pqclean/common/compat.h +0 -73
  263. data/ext/pqcrypto/vendor/pqclean/common/crypto_declassify.h +0 -7
  264. data/ext/pqcrypto/vendor/pqclean/common/fips202.c +0 -928
  265. data/ext/pqcrypto/vendor/pqclean/common/fips202.h +0 -166
  266. data/ext/pqcrypto/vendor/pqclean/common/keccak2x/feat.S +0 -168
  267. data/ext/pqcrypto/vendor/pqclean/common/keccak2x/fips202x2.c +0 -684
  268. data/ext/pqcrypto/vendor/pqclean/common/keccak2x/fips202x2.h +0 -60
  269. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/KeccakP-1600-times4-SIMD256.c +0 -1028
  270. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/KeccakP-1600-times4-SnP.h +0 -50
  271. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/KeccakP-1600-unrolling.macros +0 -198
  272. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/Makefile +0 -8
  273. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/Makefile.Microsoft_nmake +0 -8
  274. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/SIMD256-config.h +0 -3
  275. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/align.h +0 -34
  276. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/brg_endian.h +0 -142
  277. data/ext/pqcrypto/vendor/pqclean/common/nistseedexpander.c +0 -101
  278. data/ext/pqcrypto/vendor/pqclean/common/nistseedexpander.h +0 -39
  279. data/ext/pqcrypto/vendor/pqclean/common/randombytes.c +0 -355
  280. data/ext/pqcrypto/vendor/pqclean/common/randombytes.h +0 -27
  281. data/ext/pqcrypto/vendor/pqclean/common/sha2.c +0 -769
  282. data/ext/pqcrypto/vendor/pqclean/common/sha2.h +0 -173
  283. data/ext/pqcrypto/vendor/pqclean/common/sp800-185.c +0 -156
  284. data/ext/pqcrypto/vendor/pqclean/common/sp800-185.h +0 -27
  285. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/LICENSE +0 -5
  286. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/Makefile +0 -19
  287. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/Makefile.Microsoft_nmake +0 -23
  288. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/api.h +0 -18
  289. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/cbd.c +0 -83
  290. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/cbd.h +0 -11
  291. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/indcpa.c +0 -327
  292. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/indcpa.h +0 -22
  293. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/kem.c +0 -164
  294. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/kem.h +0 -23
  295. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/ntt.c +0 -146
  296. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/ntt.h +0 -14
  297. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/params.h +0 -36
  298. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/poly.c +0 -299
  299. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/poly.h +0 -37
  300. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/polyvec.c +0 -188
  301. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/polyvec.h +0 -26
  302. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/reduce.c +0 -41
  303. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/reduce.h +0 -13
  304. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/symmetric-shake.c +0 -71
  305. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/symmetric.h +0 -30
  306. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/verify.c +0 -67
  307. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/verify.h +0 -13
  308. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/LICENSE +0 -5
  309. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/Makefile +0 -19
  310. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/Makefile.Microsoft_nmake +0 -23
  311. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/api.h +0 -50
  312. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/ntt.c +0 -98
  313. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/ntt.h +0 -10
  314. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/packing.c +0 -261
  315. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/packing.h +0 -31
  316. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/params.h +0 -44
  317. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/poly.c +0 -799
  318. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/poly.h +0 -52
  319. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/polyvec.c +0 -415
  320. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/polyvec.h +0 -65
  321. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/reduce.c +0 -69
  322. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/reduce.h +0 -17
  323. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/rounding.c +0 -92
  324. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/rounding.h +0 -14
  325. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/sign.c +0 -407
  326. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/sign.h +0 -47
  327. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/symmetric-shake.c +0 -26
  328. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/symmetric.h +0 -34
@@ -1,50 +0,0 @@
1
- /*
2
- Implementation by the Keccak, Keyak and Ketje Teams, namely, Guido Bertoni,
3
- Joan Daemen, Michaël Peeters, Gilles Van Assche and Ronny Van Keer, hereby
4
- denoted as "the implementer".
5
-
6
- For more information, feedback or questions, please refer to our websites:
7
- http://keccak.noekeon.org/
8
- http://keyak.noekeon.org/
9
- http://ketje.noekeon.org/
10
-
11
- To the extent possible under law, the implementer has waived all copyright
12
- and related or neighboring rights to the source code in this file.
13
- http://creativecommons.org/publicdomain/zero/1.0/
14
- */
15
-
16
- #ifndef _KeccakP_1600_times4_SnP_h_
17
- #define _KeccakP_1600_times4_SnP_h_
18
-
19
- /** For the documentation, see PlSnP-documentation.h.
20
- */
21
-
22
- #include "SIMD256-config.h"
23
-
24
- #define KeccakP1600times4_implementation "256-bit SIMD implementation (" KeccakP1600times4_implementation_config ")"
25
- #define KeccakP1600times4_statesSizeInBytes 800
26
- #define KeccakP1600times4_statesAlignment 32
27
- #define KeccakF1600times4_FastLoop_supported
28
- #define KeccakP1600times4_12rounds_FastLoop_supported
29
-
30
- #include <stddef.h>
31
-
32
- #define KeccakP1600times4_StaticInitialize()
33
- void KeccakP1600times4_InitializeAll(void *states);
34
- #define KeccakP1600times4_AddByte(states, instanceIndex, byte, offset) \
35
- ((unsigned char*)(states))[(instanceIndex)*8 + ((offset)/8)*4*8 + (offset)%8] ^= (byte)
36
- void KeccakP1600times4_AddBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length);
37
- void KeccakP1600times4_AddLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset);
38
- void KeccakP1600times4_OverwriteBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length);
39
- void KeccakP1600times4_OverwriteLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset);
40
- void KeccakP1600times4_OverwriteWithZeroes(void *states, unsigned int instanceIndex, unsigned int byteCount);
41
- void KeccakP1600times4_PermuteAll_12rounds(void *states);
42
- void KeccakP1600times4_PermuteAll_24rounds(void *states);
43
- void KeccakP1600times4_ExtractBytes(const void *states, unsigned int instanceIndex, unsigned char *data, unsigned int offset, unsigned int length);
44
- void KeccakP1600times4_ExtractLanesAll(const void *states, unsigned char *data, unsigned int laneCount, unsigned int laneOffset);
45
- void KeccakP1600times4_ExtractAndAddBytes(const void *states, unsigned int instanceIndex, const unsigned char *input, unsigned char *output, unsigned int offset, unsigned int length);
46
- void KeccakP1600times4_ExtractAndAddLanesAll(const void *states, const unsigned char *input, unsigned char *output, unsigned int laneCount, unsigned int laneOffset);
47
- size_t KeccakF1600times4_FastLoop_Absorb(void *states, unsigned int laneCount, unsigned int laneOffsetParallel, unsigned int laneOffsetSerial, const unsigned char *data, size_t dataByteLen);
48
- size_t KeccakP1600times4_12rounds_FastLoop_Absorb(void *states, unsigned int laneCount, unsigned int laneOffsetParallel, unsigned int laneOffsetSerial, const unsigned char *data, size_t dataByteLen);
49
-
50
- #endif
@@ -1,198 +0,0 @@
1
- /*
2
- Implementation by the Keccak, Keyak and Ketje Teams, namely, Guido Bertoni,
3
- Joan Daemen, Michaël Peeters, Gilles Van Assche and Ronny Van Keer, hereby
4
- denoted as "the implementer".
5
-
6
- For more information, feedback or questions, please refer to our websites:
7
- http://keccak.noekeon.org/
8
- http://keyak.noekeon.org/
9
- http://ketje.noekeon.org/
10
-
11
- To the extent possible under law, the implementer has waived all copyright
12
- and related or neighboring rights to the source code in this file.
13
- http://creativecommons.org/publicdomain/zero/1.0/
14
- */
15
-
16
- #if (defined(FullUnrolling))
17
- #define rounds24 \
18
- prepareTheta \
19
- thetaRhoPiChiIotaPrepareTheta( 0, A, E) \
20
- thetaRhoPiChiIotaPrepareTheta( 1, E, A) \
21
- thetaRhoPiChiIotaPrepareTheta( 2, A, E) \
22
- thetaRhoPiChiIotaPrepareTheta( 3, E, A) \
23
- thetaRhoPiChiIotaPrepareTheta( 4, A, E) \
24
- thetaRhoPiChiIotaPrepareTheta( 5, E, A) \
25
- thetaRhoPiChiIotaPrepareTheta( 6, A, E) \
26
- thetaRhoPiChiIotaPrepareTheta( 7, E, A) \
27
- thetaRhoPiChiIotaPrepareTheta( 8, A, E) \
28
- thetaRhoPiChiIotaPrepareTheta( 9, E, A) \
29
- thetaRhoPiChiIotaPrepareTheta(10, A, E) \
30
- thetaRhoPiChiIotaPrepareTheta(11, E, A) \
31
- thetaRhoPiChiIotaPrepareTheta(12, A, E) \
32
- thetaRhoPiChiIotaPrepareTheta(13, E, A) \
33
- thetaRhoPiChiIotaPrepareTheta(14, A, E) \
34
- thetaRhoPiChiIotaPrepareTheta(15, E, A) \
35
- thetaRhoPiChiIotaPrepareTheta(16, A, E) \
36
- thetaRhoPiChiIotaPrepareTheta(17, E, A) \
37
- thetaRhoPiChiIotaPrepareTheta(18, A, E) \
38
- thetaRhoPiChiIotaPrepareTheta(19, E, A) \
39
- thetaRhoPiChiIotaPrepareTheta(20, A, E) \
40
- thetaRhoPiChiIotaPrepareTheta(21, E, A) \
41
- thetaRhoPiChiIotaPrepareTheta(22, A, E) \
42
- thetaRhoPiChiIota(23, E, A) \
43
-
44
- #define rounds12 \
45
- prepareTheta \
46
- thetaRhoPiChiIotaPrepareTheta(12, A, E) \
47
- thetaRhoPiChiIotaPrepareTheta(13, E, A) \
48
- thetaRhoPiChiIotaPrepareTheta(14, A, E) \
49
- thetaRhoPiChiIotaPrepareTheta(15, E, A) \
50
- thetaRhoPiChiIotaPrepareTheta(16, A, E) \
51
- thetaRhoPiChiIotaPrepareTheta(17, E, A) \
52
- thetaRhoPiChiIotaPrepareTheta(18, A, E) \
53
- thetaRhoPiChiIotaPrepareTheta(19, E, A) \
54
- thetaRhoPiChiIotaPrepareTheta(20, A, E) \
55
- thetaRhoPiChiIotaPrepareTheta(21, E, A) \
56
- thetaRhoPiChiIotaPrepareTheta(22, A, E) \
57
- thetaRhoPiChiIota(23, E, A) \
58
-
59
- #elif (Unrolling == 12)
60
- #define rounds24 \
61
- prepareTheta \
62
- for(i=0; i<24; i+=12) { \
63
- thetaRhoPiChiIotaPrepareTheta(i , A, E) \
64
- thetaRhoPiChiIotaPrepareTheta(i+ 1, E, A) \
65
- thetaRhoPiChiIotaPrepareTheta(i+ 2, A, E) \
66
- thetaRhoPiChiIotaPrepareTheta(i+ 3, E, A) \
67
- thetaRhoPiChiIotaPrepareTheta(i+ 4, A, E) \
68
- thetaRhoPiChiIotaPrepareTheta(i+ 5, E, A) \
69
- thetaRhoPiChiIotaPrepareTheta(i+ 6, A, E) \
70
- thetaRhoPiChiIotaPrepareTheta(i+ 7, E, A) \
71
- thetaRhoPiChiIotaPrepareTheta(i+ 8, A, E) \
72
- thetaRhoPiChiIotaPrepareTheta(i+ 9, E, A) \
73
- thetaRhoPiChiIotaPrepareTheta(i+10, A, E) \
74
- thetaRhoPiChiIotaPrepareTheta(i+11, E, A) \
75
- } \
76
-
77
- #define rounds12 \
78
- prepareTheta \
79
- thetaRhoPiChiIotaPrepareTheta(12, A, E) \
80
- thetaRhoPiChiIotaPrepareTheta(13, E, A) \
81
- thetaRhoPiChiIotaPrepareTheta(14, A, E) \
82
- thetaRhoPiChiIotaPrepareTheta(15, E, A) \
83
- thetaRhoPiChiIotaPrepareTheta(16, A, E) \
84
- thetaRhoPiChiIotaPrepareTheta(17, E, A) \
85
- thetaRhoPiChiIotaPrepareTheta(18, A, E) \
86
- thetaRhoPiChiIotaPrepareTheta(19, E, A) \
87
- thetaRhoPiChiIotaPrepareTheta(20, A, E) \
88
- thetaRhoPiChiIotaPrepareTheta(21, E, A) \
89
- thetaRhoPiChiIotaPrepareTheta(22, A, E) \
90
- thetaRhoPiChiIota(23, E, A) \
91
-
92
- #elif (Unrolling == 6)
93
- #define rounds24 \
94
- prepareTheta \
95
- for(i=0; i<24; i+=6) { \
96
- thetaRhoPiChiIotaPrepareTheta(i , A, E) \
97
- thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
98
- thetaRhoPiChiIotaPrepareTheta(i+2, A, E) \
99
- thetaRhoPiChiIotaPrepareTheta(i+3, E, A) \
100
- thetaRhoPiChiIotaPrepareTheta(i+4, A, E) \
101
- thetaRhoPiChiIotaPrepareTheta(i+5, E, A) \
102
- } \
103
-
104
- #define rounds12 \
105
- prepareTheta \
106
- for(i=12; i<24; i+=6) { \
107
- thetaRhoPiChiIotaPrepareTheta(i , A, E) \
108
- thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
109
- thetaRhoPiChiIotaPrepareTheta(i+2, A, E) \
110
- thetaRhoPiChiIotaPrepareTheta(i+3, E, A) \
111
- thetaRhoPiChiIotaPrepareTheta(i+4, A, E) \
112
- thetaRhoPiChiIotaPrepareTheta(i+5, E, A) \
113
- } \
114
-
115
- #elif (Unrolling == 4)
116
- #define rounds24 \
117
- prepareTheta \
118
- for(i=0; i<24; i+=4) { \
119
- thetaRhoPiChiIotaPrepareTheta(i , A, E) \
120
- thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
121
- thetaRhoPiChiIotaPrepareTheta(i+2, A, E) \
122
- thetaRhoPiChiIotaPrepareTheta(i+3, E, A) \
123
- } \
124
-
125
- #define rounds12 \
126
- prepareTheta \
127
- for(i=12; i<24; i+=4) { \
128
- thetaRhoPiChiIotaPrepareTheta(i , A, E) \
129
- thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
130
- thetaRhoPiChiIotaPrepareTheta(i+2, A, E) \
131
- thetaRhoPiChiIotaPrepareTheta(i+3, E, A) \
132
- } \
133
-
134
- #elif (Unrolling == 3)
135
- #define rounds24 \
136
- prepareTheta \
137
- for(i=0; i<24; i+=3) { \
138
- thetaRhoPiChiIotaPrepareTheta(i , A, E) \
139
- thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
140
- thetaRhoPiChiIotaPrepareTheta(i+2, A, E) \
141
- copyStateVariables(A, E) \
142
- } \
143
-
144
- #define rounds12 \
145
- prepareTheta \
146
- for(i=12; i<24; i+=3) { \
147
- thetaRhoPiChiIotaPrepareTheta(i , A, E) \
148
- thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
149
- thetaRhoPiChiIotaPrepareTheta(i+2, A, E) \
150
- copyStateVariables(A, E) \
151
- } \
152
-
153
- #elif (Unrolling == 2)
154
- #define rounds24 \
155
- prepareTheta \
156
- for(i=0; i<24; i+=2) { \
157
- thetaRhoPiChiIotaPrepareTheta(i , A, E) \
158
- thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
159
- } \
160
-
161
- #define rounds12 \
162
- prepareTheta \
163
- for(i=12; i<24; i+=2) { \
164
- thetaRhoPiChiIotaPrepareTheta(i , A, E) \
165
- thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
166
- } \
167
-
168
- #elif (Unrolling == 1)
169
- #define rounds24 \
170
- prepareTheta \
171
- for(i=0; i<24; i++) { \
172
- thetaRhoPiChiIotaPrepareTheta(i , A, E) \
173
- copyStateVariables(A, E) \
174
- } \
175
-
176
- #define rounds12 \
177
- prepareTheta \
178
- for(i=12; i<24; i++) { \
179
- thetaRhoPiChiIotaPrepareTheta(i , A, E) \
180
- copyStateVariables(A, E) \
181
- } \
182
-
183
- #else
184
- #error "Unrolling is not correctly specified!"
185
- #endif
186
-
187
- #define roundsN(__nrounds) \
188
- prepareTheta \
189
- i = 24 - (__nrounds); \
190
- if ((i&1) != 0) { \
191
- thetaRhoPiChiIotaPrepareTheta(i, A, E) \
192
- copyStateVariables(A, E) \
193
- ++i; \
194
- } \
195
- for( /* empty */; i<24; i+=2) { \
196
- thetaRhoPiChiIotaPrepareTheta(i , A, E) \
197
- thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
198
- }
@@ -1,8 +0,0 @@
1
- KeccakP-1600-times4-SIMD256.o: KeccakP-1600-times4-SIMD256.c \
2
- align.h brg_endian.h KeccakP-1600-times4-SnP.h \
3
- KeccakP-1600-unrolling.macros SIMD256-config.h
4
- $(CC) -O3 -mavx2 -c $< -o $@
5
-
6
- .PHONY: clean
7
- clean:
8
- $(RM) KeccakP-1600-times4-SIMD256.o
@@ -1,8 +0,0 @@
1
- KeccakP-1600-times4-SIMD256.obj: KeccakP-1600-times4-SIMD256.c \
2
- align.h brg_endian.h KeccakP-1600-times4-SnP.h \
3
- KeccakP-1600-unrolling.macros SIMD256-config.h
4
- $(CC) /nologo /c /O2 /W4 /WX /arch:AVX2 KeccakP-1600-times4-SIMD256.c
5
-
6
- .PHONY: clean
7
- clean:
8
- $(RM) KeccakP-1600-times4-SIMD256.obj
@@ -1,3 +0,0 @@
1
- #define KeccakP1600times4_implementation_config "AVX2, all rounds unrolled"
2
- #define KeccakP1600times4_fullUnrolling
3
- #define KeccakP1600times4_useAVX2
@@ -1,34 +0,0 @@
1
- /*
2
- Implementation by the Keccak, Keyak and Ketje Teams, namely, Guido Bertoni,
3
- Joan Daemen, Michaël Peeters, Gilles Van Assche and Ronny Van Keer, hereby
4
- denoted as "the implementer".
5
-
6
- For more information, feedback or questions, please refer to our websites:
7
- http://keccak.noekeon.org/
8
- http://keyak.noekeon.org/
9
- http://ketje.noekeon.org/
10
-
11
- To the extent possible under law, the implementer has waived all copyright
12
- and related or neighboring rights to the source code in this file.
13
- http://creativecommons.org/publicdomain/zero/1.0/
14
- */
15
-
16
- #ifndef _align_h_
17
- #define _align_h_
18
-
19
- /* on Mac OS-X and possibly others, ALIGN(x) is defined in param.h, and -Werror chokes on the redef. */
20
- #ifdef ALIGN
21
- #undef ALIGN
22
- #endif
23
-
24
- #if defined(__GNUC__)
25
- #define ALIGN(x) __attribute__ ((aligned(x)))
26
- #elif defined(_MSC_VER)
27
- #define ALIGN(x) __declspec(align(x))
28
- #elif defined(__ARMCC_VERSION)
29
- #define ALIGN(x) __align(x)
30
- #else
31
- #define ALIGN(x)
32
- #endif
33
-
34
- #endif
@@ -1,142 +0,0 @@
1
- /*
2
- ---------------------------------------------------------------------------
3
- Copyright (c) 1998-2008, Brian Gladman, Worcester, UK. All rights reserved.
4
-
5
- LICENSE TERMS
6
-
7
- The redistribution and use of this software (with or without changes)
8
- is allowed without the payment of fees or royalties provided that:
9
-
10
- 1. source code distributions include the above copyright notice, this
11
- list of conditions and the following disclaimer;
12
-
13
- 2. binary distributions include the above copyright notice, this list
14
- of conditions and the following disclaimer in their documentation;
15
-
16
- 3. the name of the copyright holder is not used to endorse products
17
- built using this software without specific written permission.
18
-
19
- DISCLAIMER
20
-
21
- This software is provided 'as is' with no explicit or implied warranties
22
- in respect of its properties, including, but not limited to, correctness
23
- and/or fitness for purpose.
24
- ---------------------------------------------------------------------------
25
- Issue Date: 20/12/2007
26
- Changes for ARM 9/9/2010
27
- */
28
-
29
- #ifndef _BRG_ENDIAN_H
30
- #define _BRG_ENDIAN_H
31
-
32
- #define IS_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */
33
- #define IS_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */
34
-
35
- #if 0
36
- /* Include files where endian defines and byteswap functions may reside */
37
- #if defined( __sun )
38
- # include <sys/isa_defs.h>
39
- #elif defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __NetBSD__ )
40
- # include <sys/endian.h>
41
- #elif defined( BSD ) && ( BSD >= 199103 ) || defined( __APPLE__ ) || \
42
- defined( __CYGWIN32__ ) || defined( __DJGPP__ ) || defined( __osf__ )
43
- # include <machine/endian.h>
44
- #elif defined( __linux__ ) || defined( __GNUC__ ) || defined( __GNU_LIBRARY__ )
45
- # if !defined( __MINGW32__ ) && !defined( _AIX )
46
- # include <endian.h>
47
- # if !defined( __BEOS__ )
48
- # include <byteswap.h>
49
- # endif
50
- # endif
51
- #endif
52
- #endif
53
-
54
- /* Now attempt to set the define for platform byte order using any */
55
- /* of the four forms SYMBOL, _SYMBOL, __SYMBOL & __SYMBOL__, which */
56
- /* seem to encompass most endian symbol definitions */
57
-
58
- #if defined( BIG_ENDIAN ) && defined( LITTLE_ENDIAN )
59
- # if defined( BYTE_ORDER ) && BYTE_ORDER == BIG_ENDIAN
60
- # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
61
- # elif defined( BYTE_ORDER ) && BYTE_ORDER == LITTLE_ENDIAN
62
- # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
63
- # endif
64
- #elif defined( BIG_ENDIAN )
65
- # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
66
- #elif defined( LITTLE_ENDIAN )
67
- # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
68
- #endif
69
-
70
- #if defined( _BIG_ENDIAN ) && defined( _LITTLE_ENDIAN )
71
- # if defined( _BYTE_ORDER ) && _BYTE_ORDER == _BIG_ENDIAN
72
- # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
73
- # elif defined( _BYTE_ORDER ) && _BYTE_ORDER == _LITTLE_ENDIAN
74
- # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
75
- # endif
76
- #elif defined( _BIG_ENDIAN )
77
- # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
78
- #elif defined( _LITTLE_ENDIAN )
79
- # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
80
- #endif
81
-
82
- #if defined( __BIG_ENDIAN ) && defined( __LITTLE_ENDIAN )
83
- # if defined( __BYTE_ORDER ) && __BYTE_ORDER == __BIG_ENDIAN
84
- # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
85
- # elif defined( __BYTE_ORDER ) && __BYTE_ORDER == __LITTLE_ENDIAN
86
- # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
87
- # endif
88
- #elif defined( __BIG_ENDIAN )
89
- # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
90
- #elif defined( __LITTLE_ENDIAN )
91
- # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
92
- #endif
93
-
94
- #if defined( __BIG_ENDIAN__ ) && defined( __LITTLE_ENDIAN__ )
95
- # if defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __BIG_ENDIAN__
96
- # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
97
- # elif defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __LITTLE_ENDIAN__
98
- # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
99
- # endif
100
- #elif defined( __BIG_ENDIAN__ )
101
- # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
102
- #elif defined( __LITTLE_ENDIAN__ )
103
- # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
104
- #endif
105
-
106
- /* if the platform byte order could not be determined, then try to */
107
- /* set this define using common machine defines */
108
- #if !defined(PLATFORM_BYTE_ORDER)
109
-
110
- #if defined( __alpha__ ) || defined( __alpha ) || defined( i386 ) || \
111
- defined( __i386__ ) || defined( _M_I86 ) || defined( _M_IX86 ) || \
112
- defined( __OS2__ ) || defined( sun386 ) || defined( __TURBOC__ ) || \
113
- defined( vax ) || defined( vms ) || defined( VMS ) || \
114
- defined( __VMS ) || defined( _M_X64 )
115
- # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
116
-
117
- #elif defined( AMIGA ) || defined( applec ) || defined( __AS400__ ) || \
118
- defined( _CRAY ) || defined( __hppa ) || defined( __hp9000 ) || \
119
- defined( ibm370 ) || defined( mc68000 ) || defined( m68k ) || \
120
- defined( __MRC__ ) || defined( __MVS__ ) || defined( __MWERKS__ ) || \
121
- defined( sparc ) || defined( __sparc) || defined( SYMANTEC_C ) || \
122
- defined( __VOS__ ) || defined( __TIGCC__ ) || defined( __TANDEM ) || \
123
- defined( THINK_C ) || defined( __VMCMS__ ) || defined( _AIX )
124
- # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
125
-
126
- #elif defined(__arm__)
127
- # ifdef __BIG_ENDIAN
128
- # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
129
- # else
130
- # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
131
- # endif
132
- #elif 1 /* **** EDIT HERE IF NECESSARY **** */
133
- # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
134
- #elif 0 /* **** EDIT HERE IF NECESSARY **** */
135
- # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
136
- #else
137
- # error Please edit lines 132 or 134 in brg_endian.h to set the platform byte order
138
- #endif
139
-
140
- #endif
141
-
142
- #endif
@@ -1,101 +0,0 @@
1
- //
2
- // rng.c
3
- //
4
- // Created by Bassham, Lawrence E (Fed) on 8/29/17.
5
- // Copyright © 2017 Bassham, Lawrence E (Fed). All rights reserved.
6
- // Modified for PQClean by Sebastian Verschoor
7
- //
8
-
9
- #include "nistseedexpander.h"
10
- #include "aes.h"
11
- #include <string.h>
12
-
13
- /*
14
- seedexpander_init()
15
- ctx - stores the current state of an instance of the seed expander
16
- seed - a 32 byte random value
17
- diversifier - an 8 byte diversifier
18
- maxlen - maximum number of bytes (less than 2**32) generated under this seed and diversifier
19
- */
20
- int
21
- seedexpander_init(AES_XOF_struct *ctx,
22
- const uint8_t *seed,
23
- const uint8_t *diversifier,
24
- size_t maxlen) {
25
- ctx->length_remaining = maxlen;
26
-
27
- memcpy(ctx->key, seed, 32);
28
- memcpy(ctx->ctr, diversifier, 8);
29
-
30
- ctx->ctr[11] = maxlen % 256;
31
- maxlen >>= 8;
32
- ctx->ctr[10] = maxlen % 256;
33
- maxlen >>= 8;
34
- ctx->ctr[9] = maxlen % 256;
35
- maxlen >>= 8;
36
- ctx->ctr[8] = maxlen % 256;
37
- memset(ctx->ctr + 12, 0x00, 4);
38
-
39
- ctx->buffer_pos = 16;
40
- memset(ctx->buffer, 0x00, 16);
41
-
42
- return RNG_SUCCESS;
43
- }
44
-
45
- static void AES256_ECB(uint8_t *key, uint8_t *ctr, uint8_t *buffer) {
46
- aes256ctx ctx;
47
- aes256_ecb_keyexp(&ctx, key);
48
- aes256_ecb(buffer, ctr, 1, &ctx);
49
- aes256_ctx_release(&ctx);
50
- }
51
-
52
- /*
53
- seedexpander()
54
- ctx - stores the current state of an instance of the seed expander
55
- x - returns the XOF data
56
- xlen - number of bytes to return
57
- */
58
- int
59
- seedexpander(AES_XOF_struct *ctx, uint8_t *x, size_t xlen) {
60
- size_t offset;
61
-
62
- if ( x == NULL ) {
63
- return RNG_BAD_OUTBUF;
64
- }
65
- if ( xlen >= ctx->length_remaining ) {
66
- return RNG_BAD_REQ_LEN;
67
- }
68
-
69
- ctx->length_remaining -= xlen;
70
-
71
- offset = 0;
72
- while ( xlen > 0 ) {
73
- if ( xlen <= (16 - ctx->buffer_pos) ) { // buffer has what we need
74
- memcpy(x + offset, ctx->buffer + ctx->buffer_pos, xlen);
75
- ctx->buffer_pos += xlen;
76
-
77
- return RNG_SUCCESS;
78
- }
79
-
80
- // take what's in the buffer
81
- memcpy(x + offset, ctx->buffer + ctx->buffer_pos, 16 - ctx->buffer_pos);
82
- xlen -= 16 - ctx->buffer_pos;
83
- offset += 16 - ctx->buffer_pos;
84
-
85
- AES256_ECB(ctx->key, ctx->ctr, ctx->buffer);
86
- ctx->buffer_pos = 0;
87
-
88
- //increment the counter
89
- for (size_t i = 15; i >= 12; i--) {
90
- if ( ctx->ctr[i] == 0xff ) {
91
- ctx->ctr[i] = 0x00;
92
- } else {
93
- ctx->ctr[i]++;
94
- break;
95
- }
96
- }
97
-
98
- }
99
-
100
- return RNG_SUCCESS;
101
- }
@@ -1,39 +0,0 @@
1
- #ifndef NISTSEEDEXPANDER_H
2
- #define NISTSEEDEXPANDER_H
3
-
4
- //
5
- // rng.h
6
- //
7
- // Created by Bassham, Lawrence E (Fed) on 8/29/17.
8
- // Copyright © 2017 Bassham, Lawrence E (Fed). All rights reserved.
9
- // Modified for PQClean by Sebastian Verschoor
10
- //
11
-
12
- #include <stddef.h>
13
- #include <stdint.h>
14
-
15
- #define NISTSEEDEXPANDER_SEED_LEN 32
16
-
17
- #define RNG_SUCCESS ( 0)
18
- #define RNG_BAD_MAXLEN (-1)
19
- #define RNG_BAD_OUTBUF (-2)
20
- #define RNG_BAD_REQ_LEN (-3)
21
-
22
- typedef struct {
23
- uint8_t buffer[16];
24
- size_t buffer_pos;
25
- size_t length_remaining;
26
- uint8_t key[NISTSEEDEXPANDER_SEED_LEN];
27
- uint8_t ctr[16];
28
- } AES_XOF_struct;
29
-
30
- int
31
- seedexpander_init(AES_XOF_struct *ctx,
32
- const uint8_t *seed,
33
- const uint8_t *diversifier,
34
- size_t maxlen);
35
-
36
- int
37
- seedexpander(AES_XOF_struct *ctx, uint8_t *x, size_t xlen);
38
-
39
- #endif /* NISTSEEDEXPANDER_H */