pq_crypto 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/ext/pqcrypto/pqcrypto_version.h +1 -1
  4. data/ext/pqcrypto/vendor/.vendored +4 -4
  5. data/ext/pqcrypto/vendor/mlkem-native/README.md +6 -3
  6. data/ext/pqcrypto/vendor/mlkem-native/RELEASE.md +22 -0
  7. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.c +77 -36
  8. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.h +135 -146
  9. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_asm.S +116 -72
  10. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_config.h +351 -415
  11. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/cbmc.h +43 -20
  12. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h +16 -8
  13. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.c +57 -31
  14. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.h +260 -349
  15. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.h +17 -24
  16. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.c +35 -37
  17. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.h +43 -57
  18. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.c +14 -15
  19. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.h +5 -4
  20. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.c +42 -6
  21. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/fips202_native_aarch64.h +31 -20
  22. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/{keccak_f1600_x1_scalar_asm.S → keccak_f1600_x1_scalar_aarch64_asm.S} +10 -10
  23. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/{keccak_f1600_x1_v84a_asm.S → keccak_f1600_x1_v84a_aarch64_asm.S} +10 -10
  24. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/{keccak_f1600_x2_v84a_asm.S → keccak_f1600_x2_v84a_aarch64_asm.S} +10 -10
  25. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/{keccak_f1600_x4_v8a_scalar_hybrid_asm.S → keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S} +10 -10
  26. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/{keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S → keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S} +10 -10
  27. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +10 -9
  28. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_scalar.h +2 -1
  29. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_v84a.h +1 -1
  30. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x2_v84a.h +4 -2
  31. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_scalar.h +2 -2
  32. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +1 -1
  33. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/fips202_native_armv81m.h +2 -1
  34. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +55 -9
  35. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +26 -25
  36. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_extract_bytes_x4_mve.S +58 -14
  37. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_xor_bytes_x4_mve.S +57 -16
  38. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/auto.h +2 -1
  39. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h +2 -2
  40. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/fips202_native_x86_64.h +10 -7
  41. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/{keccak_f1600_x4_avx2.S → keccak_f1600_x4_avx2_asm.S} +13 -11
  42. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccakf1600_constants.c +12 -11
  43. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.c +167 -136
  44. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.h +75 -68
  45. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.h +135 -157
  46. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h +15 -13
  47. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/aarch64_zetas.c +143 -135
  48. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/arith_native_aarch64.h +52 -46
  49. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{intt.S → intt_aarch64_asm.S} +10 -10
  50. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{ntt.S → ntt_aarch64_asm.S} +10 -10
  51. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_mulcache_compute_asm.S → poly_mulcache_compute_aarch64_asm.S} +10 -10
  52. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_reduce_asm.S → poly_reduce_aarch64_asm.S} +10 -10
  53. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_tobytes_asm.S → poly_tobytes_aarch64_asm.S} +10 -10
  54. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_tomont_asm.S → poly_tomont_aarch64_asm.S} +10 -12
  55. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{polyvec_basemul_acc_montgomery_cached_asm_k2.S → polyvec_basemul_acc_montgomery_cached_k2_aarch64_asm.S} +10 -10
  56. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{polyvec_basemul_acc_montgomery_cached_asm_k3.S → polyvec_basemul_acc_montgomery_cached_k3_aarch64_asm.S} +10 -10
  57. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{polyvec_basemul_acc_montgomery_cached_asm_k4.S → polyvec_basemul_acc_montgomery_cached_k4_aarch64_asm.S} +10 -10
  58. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{rej_uniform_asm.S → rej_uniform_aarch64_asm.S} +12 -12
  59. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/rej_uniform_table.c +514 -513
  60. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/api.h +254 -253
  61. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/meta.h +6 -1
  62. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/README.md +6 -0
  63. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/meta.h +77 -0
  64. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/arith_native_ppc64le.h +24 -0
  65. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/consts.c +299 -0
  66. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/consts.h +34 -0
  67. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/intt_ppc_asm.S +3222 -0
  68. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/ntt_ppc_asm.S +1651 -0
  69. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/poly_tomont_ppc_asm.S +294 -0
  70. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/reduce_ppc_asm.S +710 -0
  71. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/meta.h +5 -0
  72. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.c +18 -16
  73. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.h +19 -24
  74. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_poly.c +53 -65
  75. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/meta.h +20 -20
  76. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/arith_native_x86_64.h +106 -88
  77. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.c +45 -35
  78. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.h +8 -8
  79. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.c +1 -1
  80. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.h +1 -1
  81. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{intt.S → intt_avx2_asm.S} +8 -8
  82. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{ntt.S → ntt_avx2_asm.S} +8 -8
  83. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{nttfrombytes.S → nttfrombytes_avx2_asm.S} +8 -8
  84. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{ntttobytes.S → ntttobytes_avx2_asm.S} +8 -8
  85. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{nttunpack.S → nttunpack_avx2_asm.S} +8 -8
  86. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d10.S → poly_compress_d10_avx2_asm.S} +9 -9
  87. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d11.S → poly_compress_d11_avx2_asm.S} +9 -9
  88. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d4.S → poly_compress_d4_avx2_asm.S} +9 -9
  89. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d5.S → poly_compress_d5_avx2_asm.S} +9 -9
  90. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d10.S → poly_decompress_d10_avx2_asm.S} +9 -9
  91. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d11.S → poly_decompress_d11_avx2_asm.S} +9 -9
  92. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d4.S → poly_decompress_d4_avx2_asm.S} +9 -9
  93. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d5.S → poly_decompress_d5_avx2_asm.S} +9 -9
  94. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{mulcache_compute.S → poly_mulcache_compute_avx2_asm.S} +8 -8
  95. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{polyvec_basemul_acc_montgomery_cached_asm_k2.S → polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.S} +8 -8
  96. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{polyvec_basemul_acc_montgomery_cached_asm_k3.S → polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.S} +8 -8
  97. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{polyvec_basemul_acc_montgomery_cached_asm_k4.S → polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.S} +8 -8
  98. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{reduce.S → reduce_avx2_asm.S} +8 -8
  99. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{rej_uniform_asm.S → rej_uniform_avx2_asm.S} +9 -9
  100. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/rej_uniform_table.c +514 -513
  101. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{tomont.S → tomont_avx2_asm.S} +8 -8
  102. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.c +61 -57
  103. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.h +89 -116
  104. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.c +31 -32
  105. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.h +226 -301
  106. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/randombytes.h +21 -29
  107. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.c +68 -63
  108. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.h +37 -48
  109. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sys.h +44 -2
  110. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.h +141 -159
  111. data/lib/pq_crypto/version.rb +1 -1
  112. data/script/vendor_libs.rb +3 -3
  113. metadata +47 -38
@@ -14,7 +14,8 @@
14
14
  #include "aarch64/meta.h"
15
15
  #endif
16
16
 
17
- #ifdef MLK_SYS_X86_64_AVX2
17
+ /* The x86_64 backend requires toolchain support for the SysV ABI */
18
+ #if defined(MLK_SYS_X86_64_AVX2) && defined(MLK_SYSV_ABI_SUPPORTED)
18
19
  #include "x86_64/meta.h"
19
20
  #endif
20
21
 
@@ -22,4 +23,8 @@
22
23
  #include "riscv64/meta.h"
23
24
  #endif
24
25
 
26
+ #ifdef MLK_SYS_PPC64LE
27
+ #include "ppc64le/meta.h"
28
+ #endif
29
+
25
30
  #endif /* !MLK_NATIVE_META_H */
@@ -0,0 +1,6 @@
1
+ [//]: # (SPDX-License-Identifier: CC-BY-4.0)
2
+
3
+ # ppc64le backend (little endian)
4
+
5
+ This directory contains a native backend for little endian POWER 9 (ppc64le) and above systems.
6
+ Or, Power systems supporting ISA 2.07 and above.
@@ -0,0 +1,77 @@
1
+ /*
2
+ * Copyright (c) The mlkem-native project authors
3
+ * SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
4
+ */
5
+
6
+ #ifndef MLK_NATIVE_PPC64LE_META_H
7
+ #define MLK_NATIVE_PPC64LE_META_H
8
+
9
+ /* Identifier for this backend so that source and assembly files
10
+ * in the build can be appropriately guarded. */
11
+ #define MLK_ARITH_BACKEND_PPC64LE_DEFAULT
12
+
13
+ #define MLK_ARITH_BACKEND_NAME PPC64LE_DEFAULT
14
+
15
+ /* Set of primitives that this backend replaces */
16
+ #define MLK_USE_NATIVE_NTT
17
+ #define MLK_USE_NATIVE_INTT
18
+ #define MLK_USE_NATIVE_POLY_REDUCE
19
+ #define MLK_USE_NATIVE_POLY_TOMONT
20
+
21
+ #if !defined(__ASSEMBLER__)
22
+ #include <string.h>
23
+ #include "../../common.h"
24
+ #include "../../params.h"
25
+ #include "../api.h"
26
+ #include "src/arith_native_ppc64le.h"
27
+
28
+ MLK_MUST_CHECK_RETURN_VALUE
29
+ static MLK_INLINE int mlk_ntt_native(int16_t data[MLKEM_N])
30
+ {
31
+ #if defined(__POWER8_VECTOR__)
32
+ mlk_ntt_ppc_asm(data, mlk_ppc_qdata);
33
+ return MLK_NATIVE_FUNC_SUCCESS;
34
+ #else
35
+ (void)data;
36
+ return MLK_NATIVE_FUNC_FALLBACK;
37
+ #endif
38
+ }
39
+
40
+ MLK_MUST_CHECK_RETURN_VALUE
41
+ static MLK_INLINE int mlk_intt_native(int16_t data[MLKEM_N])
42
+ {
43
+ #if defined(__POWER8_VECTOR__)
44
+ mlk_intt_ppc_asm(data, mlk_ppc_qdata);
45
+ return MLK_NATIVE_FUNC_SUCCESS;
46
+ #else
47
+ (void)data;
48
+ return MLK_NATIVE_FUNC_FALLBACK;
49
+ #endif
50
+ }
51
+
52
+ MLK_MUST_CHECK_RETURN_VALUE
53
+ static MLK_INLINE int mlk_poly_reduce_native(int16_t data[MLKEM_N])
54
+ {
55
+ #if defined(__POWER8_VECTOR__)
56
+ mlk_reduce_ppc_asm(data, mlk_ppc_qdata);
57
+ return MLK_NATIVE_FUNC_SUCCESS;
58
+ #else
59
+ (void)data;
60
+ return MLK_NATIVE_FUNC_FALLBACK;
61
+ #endif
62
+ }
63
+
64
+ MLK_MUST_CHECK_RETURN_VALUE
65
+ static MLK_INLINE int mlk_poly_tomont_native(int16_t data[MLKEM_N])
66
+ {
67
+ #if defined(__POWER8_VECTOR__)
68
+ mlk_poly_tomont_ppc_asm(data, mlk_ppc_qdata);
69
+ return MLK_NATIVE_FUNC_SUCCESS;
70
+ #else
71
+ (void)data;
72
+ return MLK_NATIVE_FUNC_FALLBACK;
73
+ #endif
74
+ }
75
+ #endif /* !__ASSEMBLER__ */
76
+
77
+ #endif /* !MLK_NATIVE_PPC64LE_META_H */
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Copyright (c) The mlkem-native project authors
3
+ * SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
4
+ */
5
+ #ifndef MLK_NATIVE_PPC64LE_SRC_ARITH_NATIVE_PPC64LE_H
6
+ #define MLK_NATIVE_PPC64LE_SRC_ARITH_NATIVE_PPC64LE_H
7
+
8
+ #include <stdint.h>
9
+ #include "../../../common.h"
10
+ #include "consts.h"
11
+
12
+ #define mlk_ntt_ppc_asm MLK_NAMESPACE(ntt_ppc_asm)
13
+ void mlk_ntt_ppc_asm(int16_t *, const int16_t *);
14
+
15
+ #define mlk_intt_ppc_asm MLK_NAMESPACE(intt_ppc_asm)
16
+ void mlk_intt_ppc_asm(int16_t *, const int16_t *);
17
+
18
+ #define mlk_reduce_ppc_asm MLK_NAMESPACE(reduce_ppc_asm)
19
+ void mlk_reduce_ppc_asm(int16_t *r, const int16_t *);
20
+
21
+ #define mlk_poly_tomont_ppc_asm MLK_NAMESPACE(poly_tomont_ppc_asm)
22
+ void mlk_poly_tomont_ppc_asm(int16_t *, const int16_t *);
23
+
24
+ #endif /* !MLK_NATIVE_PPC64LE_SRC_ARITH_NATIVE_PPC64LE_H */
@@ -0,0 +1,299 @@
1
+ /*
2
+ * Copyright (c) The mlkem-native project authors
3
+ * SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
4
+ */
5
+
6
+ /*
7
+ * WARNING: This file is auto-generated from scripts/autogen
8
+ * in the mlkem-native repository.
9
+ * Do not modify it directly.
10
+ */
11
+
12
+ #include "../../../common.h"
13
+
14
+ #if defined(MLK_ARITH_BACKEND_PPC64LE_DEFAULT) && \
15
+ !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && defined(__POWER8_VECTOR__)
16
+
17
+ #include "consts.h"
18
+
19
+ /*
20
+ * Constant table for the PPC64LE NTT/invNTT.
21
+ * For the layout, see the offset macros in consts.h.
22
+ */
23
+ /* clang-format off */
24
+ MLK_ALIGN MLK_INTERNAL_DATA_DEFINITION const int16_t mlk_ppc_qdata[2072] = {
25
+ /* -Q */
26
+ -3329, -3329, -3329, -3329, -3329, -3329, -3329, -3329,
27
+ /* Q */
28
+ 3329, 3329, 3329, 3329, 3329, 3329, 3329, 3329,
29
+ /* round(2^26 / MLKEM_Q), Barrett reduction constant */
30
+ 20159, 20159, 20159, 20159, 20159, 20159, 20159, 20159,
31
+ /* N^-1 in Montgomery form */
32
+ 512, 512, 512, 512, 512, 512, 512, 512,
33
+ /* Barrett twist of N^-1 */
34
+ 5040, 5040, 5040, 5040, 5040, 5040, 5040, 5040,
35
+ /* 2^16 mod MLKEM_Q (R), Barrett tomont factor */
36
+ -1044, -1044, -1044, -1044, -1044, -1044, -1044, -1044,
37
+ /* Barrett twist of R for poly_tomont */
38
+ -10276, -10276, -10276, -10276, -10276, -10276, -10276, -10276,
39
+ /* Twiddle factors for the forward NTT */
40
+ -1600, -1600, -1600, -1600, -1600, -1600, -1600, -1600,
41
+ -749, -749, -749, -749, -749, -749, -749, -749,
42
+ -40, -40, -40, -40, -40, -40, -40, -40,
43
+ -687, -687, -687, -687, -687, -687, -687, -687,
44
+ 630, 630, 630, 630, 630, 630, 630, 630,
45
+ -1432, -1432, -1432, -1432, -1432, -1432, -1432, -1432,
46
+ 848, 848, 848, 848, 848, 848, 848, 848,
47
+ 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062,
48
+ -1410, -1410, -1410, -1410, -1410, -1410, -1410, -1410,
49
+ 193, 193, 193, 193, 193, 193, 193, 193,
50
+ 797, 797, 797, 797, 797, 797, 797, 797,
51
+ -543, -543, -543, -543, -543, -543, -543, -543,
52
+ -69, -69, -69, -69, -69, -69, -69, -69,
53
+ 569, 569, 569, 569, 569, 569, 569, 569,
54
+ -1583, -1583, -1583, -1583, -1583, -1583, -1583, -1583,
55
+ 296, 296, 296, 296, 296, 296, 296, 296,
56
+ -882, -882, -882, -882, -882, -882, -882, -882,
57
+ 1339, 1339, 1339, 1339, 1339, 1339, 1339, 1339,
58
+ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476,
59
+ -283, -283, -283, -283, -283, -283, -283, -283,
60
+ 56, 56, 56, 56, 56, 56, 56, 56,
61
+ -1089, -1089, -1089, -1089, -1089, -1089, -1089, -1089,
62
+ 1333, 1333, 1333, 1333, 1333, 1333, 1333, 1333,
63
+ 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426,
64
+ -1235, -1235, -1235, -1235, -1235, -1235, -1235, -1235,
65
+ 535, 535, 535, 535, 535, 535, 535, 535,
66
+ -447, -447, -447, -447, -447, -447, -447, -447,
67
+ -936, -936, -936, -936, -936, -936, -936, -936,
68
+ -450, -450, -450, -450, -450, -450, -450, -450,
69
+ -1355, -1355, -1355, -1355, -1355, -1355, -1355, -1355,
70
+ 821, 821, 821, 821, 821, 821, 821, 821,
71
+ 331, 331, 331, 331, 289, 289, 289, 289,
72
+ -1573, -1573, -1573, -1573, -76, -76, -76, -76,
73
+ -1025, -1025, -1025, -1025, 1197, 1197, 1197, 1197,
74
+ -1274, -1274, -1274, -1274, -1052, -1052, -1052, -1052,
75
+ -1352, -1352, -1352, -1352, 650, 650, 650, 650,
76
+ 632, 632, 632, 632, -816, -816, -816, -816,
77
+ 33, 33, 33, 33, -464, -464, -464, -464,
78
+ -1414, -1414, -1414, -1414, 1320, 1320, 1320, 1320,
79
+ 1435, 1435, 1435, 1435, -1010, -1010, -1010, -1010,
80
+ 452, 452, 452, 452, 807, 807, 807, 807,
81
+ -461, -461, -461, -461, 1438, 1438, 1438, 1438,
82
+ -927, -927, -927, -927, 1534, 1534, 1534, 1534,
83
+ -712, -712, -712, -712, -682, -682, -682, -682,
84
+ 648, 648, 648, 648, 1481, 1481, 1481, 1481,
85
+ -219, -219, -219, -219, -855, -855, -855, -855,
86
+ 910, 910, 910, 910, 1227, 1227, 1227, 1227,
87
+ 583, 583, 17, 17, -680, -680, -568, -568,
88
+ -1041, -1041, 1637, 1637, 1100, 1100, 723, 723,
89
+ -48, -48, 1409, 1409, 233, 233, -667, -667,
90
+ -314, -314, 756, 756, -279, -279, -1173, -1173,
91
+ -540, -540, -1626, -1626, -1540, -1540, 1651, 1651,
92
+ 1461, 1461, -1482, -1482, -642, -642, 952, 952,
93
+ -892, -892, 939, 939, -941, -941, -1021, -1021,
94
+ 268, 268, 733, 733, 641, 641, -992, -992,
95
+ -1292, -1292, 1584, 1584, -109, -109, -1031, -1031,
96
+ -1239, -1239, 375, 375, 1645, 1645, -780, -780,
97
+ -556, -556, 1063, 1063, 757, 757, 319, 319,
98
+ -863, -863, -1230, -1230, -735, -735, 561, 561,
99
+ 403, 403, -525, -525, 1026, 1026, 1092, 1092,
100
+ -554, -554, 1143, 1143, 886, 886, -1179, -1179,
101
+ -1455, -1455, -1607, -1607, 1029, 1029, 1212, 1212,
102
+ 885, 885, -1219, -1219, -1175, -1175, -394, -394,
103
+ /* Twiddle factors for the inverse NTT */
104
+ -394, -394, -1175, -1175, -1219, -1219, 885, 885,
105
+ 1212, 1212, 1029, 1029, -1607, -1607, -1455, -1455,
106
+ -1179, -1179, 886, 886, 1143, 1143, -554, -554,
107
+ 1092, 1092, 1026, 1026, -525, -525, 403, 403,
108
+ 561, 561, -735, -735, -1230, -1230, -863, -863,
109
+ 319, 319, 757, 757, 1063, 1063, -556, -556,
110
+ -780, -780, 1645, 1645, 375, 375, -1239, -1239,
111
+ -1031, -1031, -109, -109, 1584, 1584, -1292, -1292,
112
+ -992, -992, 641, 641, 733, 733, 268, 268,
113
+ -1021, -1021, -941, -941, 939, 939, -892, -892,
114
+ 952, 952, -642, -642, -1482, -1482, 1461, 1461,
115
+ 1651, 1651, -1540, -1540, -1626, -1626, -540, -540,
116
+ -1173, -1173, -279, -279, 756, 756, -314, -314,
117
+ -667, -667, 233, 233, 1409, 1409, -48, -48,
118
+ 723, 723, 1100, 1100, 1637, 1637, -1041, -1041,
119
+ -568, -568, -680, -680, 17, 17, 583, 583,
120
+ 1227, 1227, 1227, 1227, 910, 910, 910, 910,
121
+ -855, -855, -855, -855, -219, -219, -219, -219,
122
+ 1481, 1481, 1481, 1481, 648, 648, 648, 648,
123
+ -682, -682, -682, -682, -712, -712, -712, -712,
124
+ 1534, 1534, 1534, 1534, -927, -927, -927, -927,
125
+ 1438, 1438, 1438, 1438, -461, -461, -461, -461,
126
+ 807, 807, 807, 807, 452, 452, 452, 452,
127
+ -1010, -1010, -1010, -1010, 1435, 1435, 1435, 1435,
128
+ 1320, 1320, 1320, 1320, -1414, -1414, -1414, -1414,
129
+ -464, -464, -464, -464, 33, 33, 33, 33,
130
+ -816, -816, -816, -816, 632, 632, 632, 632,
131
+ 650, 650, 650, 650, -1352, -1352, -1352, -1352,
132
+ -1052, -1052, -1052, -1052, -1274, -1274, -1274, -1274,
133
+ 1197, 1197, 1197, 1197, -1025, -1025, -1025, -1025,
134
+ -76, -76, -76, -76, -1573, -1573, -1573, -1573,
135
+ 289, 289, 289, 289, 331, 331, 331, 331,
136
+ 821, 821, 821, 821, 821, 821, 821, 821,
137
+ -1355, -1355, -1355, -1355, -1355, -1355, -1355, -1355,
138
+ -450, -450, -450, -450, -450, -450, -450, -450,
139
+ -936, -936, -936, -936, -936, -936, -936, -936,
140
+ -447, -447, -447, -447, -447, -447, -447, -447,
141
+ 535, 535, 535, 535, 535, 535, 535, 535,
142
+ -1235, -1235, -1235, -1235, -1235, -1235, -1235, -1235,
143
+ 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426,
144
+ 1333, 1333, 1333, 1333, 1333, 1333, 1333, 1333,
145
+ -1089, -1089, -1089, -1089, -1089, -1089, -1089, -1089,
146
+ 56, 56, 56, 56, 56, 56, 56, 56,
147
+ -283, -283, -283, -283, -283, -283, -283, -283,
148
+ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476,
149
+ 1339, 1339, 1339, 1339, 1339, 1339, 1339, 1339,
150
+ -882, -882, -882, -882, -882, -882, -882, -882,
151
+ 296, 296, 296, 296, 296, 296, 296, 296,
152
+ -1583, -1583, -1583, -1583, -1583, -1583, -1583, -1583,
153
+ 569, 569, 569, 569, 569, 569, 569, 569,
154
+ -69, -69, -69, -69, -69, -69, -69, -69,
155
+ -543, -543, -543, -543, -543, -543, -543, -543,
156
+ 797, 797, 797, 797, 797, 797, 797, 797,
157
+ 193, 193, 193, 193, 193, 193, 193, 193,
158
+ -1410, -1410, -1410, -1410, -1410, -1410, -1410, -1410,
159
+ 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062,
160
+ 848, 848, 848, 848, 848, 848, 848, 848,
161
+ -1432, -1432, -1432, -1432, -1432, -1432, -1432, -1432,
162
+ 630, 630, 630, 630, 630, 630, 630, 630,
163
+ -687, -687, -687, -687, -687, -687, -687, -687,
164
+ -40, -40, -40, -40, -40, -40, -40, -40,
165
+ -749, -749, -749, -749, -749, -749, -749, -749,
166
+ -1600, -1600, -1600, -1600, -1600, -1600, -1600, -1600,
167
+ /* Twisted twiddle factors for the forward NTT */
168
+ -15749, -15749, -15749, -15749, -15749, -15749, -15749, -15749,
169
+ -7373, -7373, -7373, -7373, -7373, -7373, -7373, -7373,
170
+ -394, -394, -394, -394, -394, -394, -394, -394,
171
+ -6762, -6762, -6762, -6762, -6762, -6762, -6762, -6762,
172
+ 6201, 6201, 6201, 6201, 6201, 6201, 6201, 6201,
173
+ -14095, -14095, -14095, -14095, -14095, -14095, -14095, -14095,
174
+ 8347, 8347, 8347, 8347, 8347, 8347, 8347, 8347,
175
+ 10453, 10453, 10453, 10453, 10453, 10453, 10453, 10453,
176
+ -13879, -13879, -13879, -13879, -13879, -13879, -13879, -13879,
177
+ 1900, 1900, 1900, 1900, 1900, 1900, 1900, 1900,
178
+ 7845, 7845, 7845, 7845, 7845, 7845, 7845, 7845,
179
+ -5345, -5345, -5345, -5345, -5345, -5345, -5345, -5345,
180
+ -679, -679, -679, -679, -679, -679, -679, -679,
181
+ 5601, 5601, 5601, 5601, 5601, 5601, 5601, 5601,
182
+ -15582, -15582, -15582, -15582, -15582, -15582, -15582, -15582,
183
+ 2914, 2914, 2914, 2914, 2914, 2914, 2914, 2914,
184
+ -8682, -8682, -8682, -8682, -8682, -8682, -8682, -8682,
185
+ 13180, 13180, 13180, 13180, 13180, 13180, 13180, 13180,
186
+ 14529, 14529, 14529, 14529, 14529, 14529, 14529, 14529,
187
+ -2786, -2786, -2786, -2786, -2786, -2786, -2786, -2786,
188
+ 551, 551, 551, 551, 551, 551, 551, 551,
189
+ -10719, -10719, -10719, -10719, -10719, -10719, -10719, -10719,
190
+ 13121, 13121, 13121, 13121, 13121, 13121, 13121, 13121,
191
+ 14036, 14036, 14036, 14036, 14036, 14036, 14036, 14036,
192
+ -12156, -12156, -12156, -12156, -12156, -12156, -12156, -12156,
193
+ 5266, 5266, 5266, 5266, 5266, 5266, 5266, 5266,
194
+ -4400, -4400, -4400, -4400, -4400, -4400, -4400, -4400,
195
+ -9213, -9213, -9213, -9213, -9213, -9213, -9213, -9213,
196
+ -4429, -4429, -4429, -4429, -4429, -4429, -4429, -4429,
197
+ -13338, -13338, -13338, -13338, -13338, -13338, -13338, -13338,
198
+ 8081, 8081, 8081, 8081, 8081, 8081, 8081, 8081,
199
+ 3258, 3258, 3258, 3258, 2845, 2845, 2845, 2845,
200
+ -15483, -15483, -15483, -15483, -748, -748, -748, -748,
201
+ -10089, -10089, -10089, -10089, 11782, 11782, 11782, 11782,
202
+ -12540, -12540, -12540, -12540, -10355, -10355, -10355, -10355,
203
+ -13308, -13308, -13308, -13308, 6398, 6398, 6398, 6398,
204
+ 6221, 6221, 6221, 6221, -8032, -8032, -8032, -8032,
205
+ 325, 325, 325, 325, -4567, -4567, -4567, -4567,
206
+ -13918, -13918, -13918, -13918, 12993, 12993, 12993, 12993,
207
+ 14125, 14125, 14125, 14125, -9942, -9942, -9942, -9942,
208
+ 4449, 4449, 4449, 4449, 7943, 7943, 7943, 7943,
209
+ -4538, -4538, -4538, -4538, 14155, 14155, 14155, 14155,
210
+ -9125, -9125, -9125, -9125, 15099, 15099, 15099, 15099,
211
+ -7008, -7008, -7008, -7008, -6713, -6713, -6713, -6713,
212
+ 6378, 6378, 6378, 6378, 14578, 14578, 14578, 14578,
213
+ -2156, -2156, -2156, -2156, -8416, -8416, -8416, -8416,
214
+ 8957, 8957, 8957, 8957, 12078, 12078, 12078, 12078,
215
+ 5739, 5739, 167, 167, -6693, -6693, -5591, -5591,
216
+ -10247, -10247, 16113, 16113, 10828, 10828, 7117, 7117,
217
+ -472, -472, 13869, 13869, 2293, 2293, -6565, -6565,
218
+ -3091, -3091, 7441, 7441, -2746, -2746, -11546, -11546,
219
+ -5315, -5315, -16005, -16005, -15159, -15159, 16251, 16251,
220
+ 14381, 14381, -14588, -14588, -6319, -6319, 9371, 9371,
221
+ -8780, -8780, 9243, 9243, -9262, -9262, -10050, -10050,
222
+ 2638, 2638, 7215, 7215, 6309, 6309, -9764, -9764,
223
+ -12717, -12717, 15592, 15592, -1073, -1073, -10148, -10148,
224
+ -12196, -12196, 3691, 3691, 16192, 16192, -7678, -7678,
225
+ -5473, -5473, 10463, 10463, 7451, 7451, 3140, 3140,
226
+ -8495, -8495, -12107, -12107, -7235, -7235, 5522, 5522,
227
+ 3967, 3967, -5168, -5168, 10099, 10099, 10749, 10749,
228
+ -5453, -5453, 11251, 11251, 8721, 8721, -11605, -11605,
229
+ -14322, -14322, -15818, -15818, 10129, 10129, 11930, 11930,
230
+ 8711, 8711, -11999, -11999, -11566, -11566, -3878, -3878,
231
+ /* Twisted twiddle factors for the inverse NTT */
232
+ -3878, -3878, -11566, -11566, -11999, -11999, 8711, 8711,
233
+ 11930, 11930, 10129, 10129, -15818, -15818, -14322, -14322,
234
+ -11605, -11605, 8721, 8721, 11251, 11251, -5453, -5453,
235
+ 10749, 10749, 10099, 10099, -5168, -5168, 3967, 3967,
236
+ 5522, 5522, -7235, -7235, -12107, -12107, -8495, -8495,
237
+ 3140, 3140, 7451, 7451, 10463, 10463, -5473, -5473,
238
+ -7678, -7678, 16192, 16192, 3691, 3691, -12196, -12196,
239
+ -10148, -10148, -1073, -1073, 15592, 15592, -12717, -12717,
240
+ -9764, -9764, 6309, 6309, 7215, 7215, 2638, 2638,
241
+ -10050, -10050, -9262, -9262, 9243, 9243, -8780, -8780,
242
+ 9371, 9371, -6319, -6319, -14588, -14588, 14381, 14381,
243
+ 16251, 16251, -15159, -15159, -16005, -16005, -5315, -5315,
244
+ -11546, -11546, -2746, -2746, 7441, 7441, -3091, -3091,
245
+ -6565, -6565, 2293, 2293, 13869, 13869, -472, -472,
246
+ 7117, 7117, 10828, 10828, 16113, 16113, -10247, -10247,
247
+ -5591, -5591, -6693, -6693, 167, 167, 5739, 5739,
248
+ 12078, 12078, 12078, 12078, 8957, 8957, 8957, 8957,
249
+ -8416, -8416, -8416, -8416, -2156, -2156, -2156, -2156,
250
+ 14578, 14578, 14578, 14578, 6378, 6378, 6378, 6378,
251
+ -6713, -6713, -6713, -6713, -7008, -7008, -7008, -7008,
252
+ 15099, 15099, 15099, 15099, -9125, -9125, -9125, -9125,
253
+ 14155, 14155, 14155, 14155, -4538, -4538, -4538, -4538,
254
+ 7943, 7943, 7943, 7943, 4449, 4449, 4449, 4449,
255
+ -9942, -9942, -9942, -9942, 14125, 14125, 14125, 14125,
256
+ 12993, 12993, 12993, 12993, -13918, -13918, -13918, -13918,
257
+ -4567, -4567, -4567, -4567, 325, 325, 325, 325,
258
+ -8032, -8032, -8032, -8032, 6221, 6221, 6221, 6221,
259
+ 6398, 6398, 6398, 6398, -13308, -13308, -13308, -13308,
260
+ -10355, -10355, -10355, -10355, -12540, -12540, -12540, -12540,
261
+ 11782, 11782, 11782, 11782, -10089, -10089, -10089, -10089,
262
+ -748, -748, -748, -748, -15483, -15483, -15483, -15483,
263
+ 2845, 2845, 2845, 2845, 3258, 3258, 3258, 3258,
264
+ 8081, 8081, 8081, 8081, 8081, 8081, 8081, 8081,
265
+ -13338, -13338, -13338, -13338, -13338, -13338, -13338, -13338,
266
+ -4429, -4429, -4429, -4429, -4429, -4429, -4429, -4429,
267
+ -9213, -9213, -9213, -9213, -9213, -9213, -9213, -9213,
268
+ -4400, -4400, -4400, -4400, -4400, -4400, -4400, -4400,
269
+ 5266, 5266, 5266, 5266, 5266, 5266, 5266, 5266,
270
+ -12156, -12156, -12156, -12156, -12156, -12156, -12156, -12156,
271
+ 14036, 14036, 14036, 14036, 14036, 14036, 14036, 14036,
272
+ 13121, 13121, 13121, 13121, 13121, 13121, 13121, 13121,
273
+ -10719, -10719, -10719, -10719, -10719, -10719, -10719, -10719,
274
+ 551, 551, 551, 551, 551, 551, 551, 551,
275
+ -2786, -2786, -2786, -2786, -2786, -2786, -2786, -2786,
276
+ 14529, 14529, 14529, 14529, 14529, 14529, 14529, 14529,
277
+ 13180, 13180, 13180, 13180, 13180, 13180, 13180, 13180,
278
+ -8682, -8682, -8682, -8682, -8682, -8682, -8682, -8682,
279
+ 2914, 2914, 2914, 2914, 2914, 2914, 2914, 2914,
280
+ -15582, -15582, -15582, -15582, -15582, -15582, -15582, -15582,
281
+ 5601, 5601, 5601, 5601, 5601, 5601, 5601, 5601,
282
+ -679, -679, -679, -679, -679, -679, -679, -679,
283
+ -5345, -5345, -5345, -5345, -5345, -5345, -5345, -5345,
284
+ 7845, 7845, 7845, 7845, 7845, 7845, 7845, 7845,
285
+ 1900, 1900, 1900, 1900, 1900, 1900, 1900, 1900,
286
+ -13879, -13879, -13879, -13879, -13879, -13879, -13879, -13879,
287
+ 10453, 10453, 10453, 10453, 10453, 10453, 10453, 10453,
288
+ 8347, 8347, 8347, 8347, 8347, 8347, 8347, 8347,
289
+ -14095, -14095, -14095, -14095, -14095, -14095, -14095, -14095,
290
+ 6201, 6201, 6201, 6201, 6201, 6201, 6201, 6201,
291
+ -6762, -6762, -6762, -6762, -6762, -6762, -6762, -6762,
292
+ -394, -394, -394, -394, -394, -394, -394, -394,
293
+ -7373, -7373, -7373, -7373, -7373, -7373, -7373, -7373,
294
+ -15749, -15749, -15749, -15749, -15749, -15749, -15749, -15749,
295
+ };
296
+ /* clang-format on */
297
+
298
+ #endif /* MLK_ARITH_BACKEND_PPC64LE_DEFAULT && \
299
+ !MLK_CONFIG_MULTILEVEL_NO_SHARED && __POWER8_VECTOR__ */
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Copyright (c) The mlkem-native project authors
3
+ * SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
4
+ */
5
+
6
+ /*
7
+ * WARNING: This file is auto-generated from scripts/autogen
8
+ * in the mlkem-native repository.
9
+ * Do not modify it directly.
10
+ */
11
+
12
+ #ifndef MLK_NATIVE_PPC64LE_SRC_CONSTS_H
13
+ #define MLK_NATIVE_PPC64LE_SRC_CONSTS_H
14
+ #include "../../../common.h"
15
+
16
+ /* Byte offsets into the constant table */
17
+ #define MLK_PPC_NQ_OFFSET 0
18
+ #define MLK_PPC_Q_OFFSET 16
19
+ #define MLK_PPC_C20159_OFFSET 32
20
+ #define MLK_PPC_N_INV_OFFSET 48
21
+ #define MLK_PPC_N_INV_TW_OFFSET 64
22
+ #define MLK_PPC_TOMONT_OFFSET 80
23
+ #define MLK_PPC_TOMONT_TW_OFFSET 96
24
+ #define MLK_PPC_ZETA_NTT_OFFSET 112
25
+ #define MLK_PPC_ZETA_INTT_OFFSET 1120
26
+ #define MLK_PPC_ZETA_NTT_TW_OFFSET 2128
27
+ #define MLK_PPC_ZETA_INTT_TW_OFFSET 3136
28
+
29
+ #ifndef __ASSEMBLER__
30
+ #define mlk_ppc_qdata MLK_NAMESPACE(ppc_qdata)
31
+ MLK_INTERNAL_DATA_DECLARATION const int16_t mlk_ppc_qdata[2072];
32
+ #endif
33
+
34
+ #endif /* !MLK_NATIVE_PPC64LE_SRC_CONSTS_H */