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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/ext/pqcrypto/pqcrypto_version.h +1 -1
- data/ext/pqcrypto/vendor/.vendored +4 -4
- data/ext/pqcrypto/vendor/mlkem-native/README.md +6 -3
- data/ext/pqcrypto/vendor/mlkem-native/RELEASE.md +22 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.c +77 -36
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.h +135 -146
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_asm.S +116 -72
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_config.h +351 -415
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/cbmc.h +43 -20
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h +16 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.c +57 -31
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.h +260 -349
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.h +17 -24
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.c +35 -37
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.h +43 -57
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.c +14 -15
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.h +5 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.c +42 -6
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/fips202_native_aarch64.h +31 -20
- 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
- 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
- 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
- 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
- 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
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +10 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_scalar.h +2 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_v84a.h +1 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x2_v84a.h +4 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_scalar.h +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +1 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/fips202_native_armv81m.h +2 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +55 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +26 -25
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_extract_bytes_x4_mve.S +58 -14
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_xor_bytes_x4_mve.S +57 -16
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/auto.h +2 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/fips202_native_x86_64.h +10 -7
- 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
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccakf1600_constants.c +12 -11
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.c +167 -136
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.h +75 -68
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.h +135 -157
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h +15 -13
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/aarch64_zetas.c +143 -135
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/arith_native_aarch64.h +52 -46
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{intt.S → intt_aarch64_asm.S} +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{ntt.S → ntt_aarch64_asm.S} +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_mulcache_compute_asm.S → poly_mulcache_compute_aarch64_asm.S} +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_reduce_asm.S → poly_reduce_aarch64_asm.S} +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_tobytes_asm.S → poly_tobytes_aarch64_asm.S} +10 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_tomont_asm.S → poly_tomont_aarch64_asm.S} +10 -12
- 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
- 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
- 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
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{rej_uniform_asm.S → rej_uniform_aarch64_asm.S} +12 -12
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/rej_uniform_table.c +514 -513
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/api.h +254 -253
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/meta.h +6 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/README.md +6 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/meta.h +77 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/arith_native_ppc64le.h +24 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/consts.c +299 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/consts.h +34 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/intt_ppc_asm.S +3222 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/ntt_ppc_asm.S +1651 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/poly_tomont_ppc_asm.S +294 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/reduce_ppc_asm.S +710 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/meta.h +5 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.c +18 -16
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.h +19 -24
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_poly.c +53 -65
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/meta.h +20 -20
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/arith_native_x86_64.h +106 -88
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.c +45 -35
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.h +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.c +1 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.h +1 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{intt.S → intt_avx2_asm.S} +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{ntt.S → ntt_avx2_asm.S} +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{nttfrombytes.S → nttfrombytes_avx2_asm.S} +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{ntttobytes.S → ntttobytes_avx2_asm.S} +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{nttunpack.S → nttunpack_avx2_asm.S} +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d10.S → poly_compress_d10_avx2_asm.S} +9 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d11.S → poly_compress_d11_avx2_asm.S} +9 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d4.S → poly_compress_d4_avx2_asm.S} +9 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d5.S → poly_compress_d5_avx2_asm.S} +9 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d10.S → poly_decompress_d10_avx2_asm.S} +9 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d11.S → poly_decompress_d11_avx2_asm.S} +9 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d4.S → poly_decompress_d4_avx2_asm.S} +9 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d5.S → poly_decompress_d5_avx2_asm.S} +9 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{mulcache_compute.S → poly_mulcache_compute_avx2_asm.S} +8 -8
- 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
- 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
- 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
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{reduce.S → reduce_avx2_asm.S} +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{rej_uniform_asm.S → rej_uniform_avx2_asm.S} +9 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/rej_uniform_table.c +514 -513
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{tomont.S → tomont_avx2_asm.S} +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.c +61 -57
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.h +89 -116
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.c +31 -32
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.h +226 -301
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/randombytes.h +21 -29
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.c +68 -63
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.h +37 -48
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sys.h +44 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.h +141 -159
- data/lib/pq_crypto/version.rb +1 -1
- data/script/vendor_libs.rb +3 -3
- metadata +47 -38
|
@@ -8,37 +8,30 @@
|
|
|
8
8
|
|
|
9
9
|
#if defined(MLKEM_DEBUG)
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
*
|
|
11
|
+
/**
|
|
12
|
+
* Check debug assertion.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
14
|
+
* Prints an error message to stderr and calls exit(1) on failure.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
* - line: line number
|
|
21
|
-
* - val: Value asserted to be non-zero
|
|
22
|
-
**************************************************/
|
|
16
|
+
* @param[in] file Filename.
|
|
17
|
+
* @param line Line number.
|
|
18
|
+
* @param val Value asserted to be non-zero.
|
|
19
|
+
*/
|
|
23
20
|
#define mlk_debug_check_assert MLK_NAMESPACE(mlkem_debug_assert)
|
|
24
21
|
void mlk_debug_check_assert(const char *file, int line, const int val);
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
*
|
|
23
|
+
/**
|
|
24
|
+
* Check whether values in an array of int16_t are within specified bounds.
|
|
28
25
|
*
|
|
29
|
-
*
|
|
30
|
-
* are within specified bounds.
|
|
26
|
+
* Prints an error message to stderr and calls exit(1) on failure.
|
|
31
27
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
|
|
39
|
-
* - lower_bound_exclusive: Exclusive lower bound
|
|
40
|
-
* - upper_bound_exclusive: Exclusive upper bound
|
|
41
|
-
**************************************************/
|
|
28
|
+
* @param[in] file Filename.
|
|
29
|
+
* @param line Line number.
|
|
30
|
+
* @param[in] ptr Base of array to be checked.
|
|
31
|
+
* @param len Number of int16_t in @p ptr.
|
|
32
|
+
* @param lower_bound_exclusive Exclusive lower bound.
|
|
33
|
+
* @param upper_bound_exclusive Exclusive upper bound.
|
|
34
|
+
*/
|
|
42
35
|
#define mlk_debug_check_bounds MLK_NAMESPACE(mlkem_debug_check_bounds)
|
|
43
36
|
void mlk_debug_check_bounds(const char *file, int line, const int16_t *ptr,
|
|
44
37
|
unsigned len, int lower_bound_exclusive,
|
|
@@ -39,26 +39,23 @@
|
|
|
39
39
|
#include "fips202.h"
|
|
40
40
|
#include "keccakf1600.h"
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
*
|
|
42
|
+
/**
|
|
43
|
+
* Absorb step of Keccak; non-incremental, starts by zeroeing the state.
|
|
44
44
|
*
|
|
45
|
-
*
|
|
46
|
-
* non-incremental, starts by zeroeing the state.
|
|
45
|
+
* @warning Must only be called once.
|
|
47
46
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
|
|
55
|
-
* - uint8_t p: domain-separation byte for different
|
|
56
|
-
* Keccak-derived functions
|
|
57
|
-
**************************************************/
|
|
47
|
+
* @param[out] s Pointer to (uninitialized) output Keccak state.
|
|
48
|
+
* @param r Rate in bytes (e.g., 168 for SHAKE128).
|
|
49
|
+
* @param[in] m Input to be absorbed into @p s.
|
|
50
|
+
* @param mlen Length of input in bytes.
|
|
51
|
+
* @param p Domain-separation byte for different Keccak-derived
|
|
52
|
+
* functions.
|
|
53
|
+
*/
|
|
58
54
|
static void mlk_keccak_absorb_once(uint64_t *s, unsigned r, const uint8_t *m,
|
|
59
55
|
size_t mlen, uint8_t p)
|
|
60
56
|
__contract__(
|
|
61
57
|
requires(mlen <= MLK_MAX_BUFFER_SIZE)
|
|
58
|
+
requires(r > 0)
|
|
62
59
|
requires(r <= sizeof(uint64_t) * MLK_KECCAK_LANES)
|
|
63
60
|
requires(memory_no_alias(s, sizeof(uint64_t) * MLK_KECCAK_LANES))
|
|
64
61
|
requires(memory_no_alias(m, mlen))
|
|
@@ -67,7 +64,8 @@ __contract__(
|
|
|
67
64
|
/* Initialize state */
|
|
68
65
|
size_t i;
|
|
69
66
|
for (i = 0; i < 25; ++i)
|
|
70
|
-
__loop__(invariant(i <= 25)
|
|
67
|
+
__loop__(invariant(i <= 25)
|
|
68
|
+
decreases(25 - i))
|
|
71
69
|
{
|
|
72
70
|
s[i] = 0;
|
|
73
71
|
}
|
|
@@ -76,7 +74,8 @@ __contract__(
|
|
|
76
74
|
__loop__(
|
|
77
75
|
assigns(mlen, m, memory_slice(s, sizeof(uint64_t) * MLK_KECCAK_LANES))
|
|
78
76
|
invariant(mlen <= loop_entry(mlen))
|
|
79
|
-
invariant(m == loop_entry(m) + (loop_entry(mlen) - mlen))
|
|
77
|
+
invariant(m == loop_entry(m) + (loop_entry(mlen) - mlen))
|
|
78
|
+
decreases(mlen))
|
|
80
79
|
{
|
|
81
80
|
mlk_keccakf1600_xor_bytes(s, m, 0, r);
|
|
82
81
|
mlk_keccakf1600_permute(s);
|
|
@@ -104,16 +103,14 @@ __contract__(
|
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
|
|
107
|
-
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* Description: block-level Keccak squeeze
|
|
106
|
+
/**
|
|
107
|
+
* Block-level Keccak squeeze.
|
|
111
108
|
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
|
|
109
|
+
* @param[out] h Output bytes.
|
|
110
|
+
* @param nblocks Number of blocks to be squeezed.
|
|
111
|
+
* @param[in,out] s Input/output state.
|
|
112
|
+
* @param r Rate in bytes (e.g., 168 for SHAKE128).
|
|
113
|
+
*/
|
|
117
114
|
static void mlk_keccak_squeezeblocks(uint8_t *h, size_t nblocks, uint64_t *s,
|
|
118
115
|
unsigned r)
|
|
119
116
|
__contract__(
|
|
@@ -130,7 +127,8 @@ __contract__(
|
|
|
130
127
|
memory_slice(s, sizeof(uint64_t) * MLK_KECCAK_LANES),
|
|
131
128
|
memory_slice(h, nblocks * r))
|
|
132
129
|
invariant(nblocks <= loop_entry(nblocks) &&
|
|
133
|
-
h == loop_entry(h) + r * (loop_entry(nblocks) - nblocks))
|
|
130
|
+
h == loop_entry(h) + r * (loop_entry(nblocks) - nblocks))
|
|
131
|
+
decreases(nblocks))
|
|
134
132
|
{
|
|
135
133
|
mlk_keccakf1600_permute(s);
|
|
136
134
|
mlk_keccakf1600_extract_bytes(s, h, 0, r);
|
|
@@ -139,22 +137,21 @@ __contract__(
|
|
|
139
137
|
}
|
|
140
138
|
}
|
|
141
139
|
|
|
142
|
-
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* Description: Keccak squeeze; can be called on byte-level
|
|
140
|
+
/**
|
|
141
|
+
* Keccak squeeze; can be called on byte-level.
|
|
146
142
|
*
|
|
147
|
-
*
|
|
143
|
+
* @warning Must only be called once.
|
|
148
144
|
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
|
|
145
|
+
* @param[out] h Output bytes.
|
|
146
|
+
* @param outlen Number of bytes to be squeezed.
|
|
147
|
+
* @param[in,out] s Keccak state.
|
|
148
|
+
* @param r Rate in bytes (e.g., 168 for SHAKE128).
|
|
149
|
+
*/
|
|
154
150
|
static void mlk_keccak_squeeze_once(uint8_t *h, size_t outlen, uint64_t *s,
|
|
155
151
|
unsigned r)
|
|
156
152
|
__contract__(
|
|
157
153
|
requires(outlen <= MLK_MAX_BUFFER_SIZE)
|
|
154
|
+
requires(r > 0)
|
|
158
155
|
requires(r <= sizeof(uint64_t) * MLK_KECCAK_LANES)
|
|
159
156
|
requires(memory_no_alias(s, sizeof(uint64_t) * MLK_KECCAK_LANES))
|
|
160
157
|
requires(memory_no_alias(h, outlen))
|
|
@@ -168,7 +165,8 @@ __contract__(
|
|
|
168
165
|
memory_slice(s, sizeof(uint64_t) * MLK_KECCAK_LANES),
|
|
169
166
|
memory_slice(h, outlen))
|
|
170
167
|
invariant(outlen <= loop_entry(outlen) &&
|
|
171
|
-
h == loop_entry(h) + (loop_entry(outlen) - outlen))
|
|
168
|
+
h == loop_entry(h) + (loop_entry(outlen) - outlen))
|
|
169
|
+
decreases(outlen))
|
|
172
170
|
{
|
|
173
171
|
mlk_keccakf1600_permute(s);
|
|
174
172
|
|
|
@@ -14,35 +14,30 @@
|
|
|
14
14
|
#define SHA3_384_RATE 104
|
|
15
15
|
#define SHA3_512_RATE 72
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/** Context for the non-incremental SHAKE128 API. */
|
|
18
18
|
typedef struct
|
|
19
19
|
{
|
|
20
|
-
uint64_t ctx[25];
|
|
20
|
+
uint64_t ctx[25]; /**< Keccak state. */
|
|
21
21
|
} MLK_ALIGN mlk_shake128ctx;
|
|
22
22
|
|
|
23
23
|
#define mlk_shake128_absorb_once MLK_NAMESPACE(shake128_absorb_once)
|
|
24
|
-
|
|
25
|
-
*
|
|
24
|
+
/**
|
|
25
|
+
* One-shot absorb step of the SHAKE128 XOF.
|
|
26
26
|
*
|
|
27
|
-
*
|
|
27
|
+
* For call-sites (in mlkem-native):
|
|
28
|
+
* - This function MUST ONLY be called straight after mlk_shake128_init().
|
|
29
|
+
* - This function MUST ONLY be called once.
|
|
28
30
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* Consequently, for providers of custom FIPS202 code to be used with
|
|
32
|
+
* mlkem-native:
|
|
33
|
+
* - You may assume that the input context is freshly initialized via
|
|
34
|
+
* mlk_shake128_init().
|
|
35
|
+
* - You may assume that this function is called exactly once.
|
|
33
36
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
* - You may assume that this function is
|
|
39
|
-
* called exactly once.
|
|
40
|
-
*
|
|
41
|
-
* Arguments: - mlk_shake128ctx *state: pointer to SHAKE128 context
|
|
42
|
-
* - const uint8_t *input: pointer to input to be absorbed into
|
|
43
|
-
* the state
|
|
44
|
-
* - size_t inlen: length of input in bytes
|
|
45
|
-
**************************************************/
|
|
37
|
+
* @param[in,out] state SHAKE128 context.
|
|
38
|
+
* @param[in] input Input to be absorbed into the state.
|
|
39
|
+
* @param inlen Length of input in bytes.
|
|
40
|
+
*/
|
|
46
41
|
void mlk_shake128_absorb_once(mlk_shake128ctx *state, const uint8_t *input,
|
|
47
42
|
size_t inlen)
|
|
48
43
|
__contract__(
|
|
@@ -53,18 +48,15 @@ __contract__(
|
|
|
53
48
|
);
|
|
54
49
|
|
|
55
50
|
#define mlk_shake128_squeezeblocks MLK_NAMESPACE(shake128_squeezeblocks)
|
|
56
|
-
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* SHAKE128_RATE bytes each. Modifies the state. Can be called
|
|
61
|
-
* multiple times to keep squeezing, i.e., is incremental.
|
|
51
|
+
/**
|
|
52
|
+
* Squeeze step of SHAKE128 XOF. Squeezes full blocks of SHAKE128_RATE bytes
|
|
53
|
+
* each. Modifies the state. Can be called multiple times to keep squeezing,
|
|
54
|
+
* i.e., is incremental.
|
|
62
55
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
|
|
67
|
-
**************************************************/
|
|
56
|
+
* @param[out] output Output blocks.
|
|
57
|
+
* @param nblocks Number of blocks to be squeezed (written to output).
|
|
58
|
+
* @param[in,out] state Keccak state.
|
|
59
|
+
*/
|
|
68
60
|
void mlk_shake128_squeezeblocks(uint8_t *output, size_t nblocks,
|
|
69
61
|
mlk_shake128ctx *state)
|
|
70
62
|
__contract__(
|
|
@@ -83,16 +75,14 @@ void mlk_shake128_release(mlk_shake128ctx *state);
|
|
|
83
75
|
/* One-stop SHAKE256 call. Aliasing between input and
|
|
84
76
|
* output is not permitted */
|
|
85
77
|
#define mlk_shake256 MLK_NAMESPACE(shake256)
|
|
86
|
-
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* Description: SHAKE256 XOF with non-incremental API
|
|
78
|
+
/**
|
|
79
|
+
* SHAKE256 XOF with non-incremental API.
|
|
90
80
|
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
|
|
81
|
+
* @param[out] output Output buffer.
|
|
82
|
+
* @param outlen Requested output length in bytes.
|
|
83
|
+
* @param[in] input Input buffer.
|
|
84
|
+
* @param inlen Length of input in bytes.
|
|
85
|
+
*/
|
|
96
86
|
void mlk_shake256(uint8_t *output, size_t outlen, const uint8_t *input,
|
|
97
87
|
size_t inlen)
|
|
98
88
|
__contract__(
|
|
@@ -107,15 +97,13 @@ __contract__(
|
|
|
107
97
|
* output is not permitted */
|
|
108
98
|
#define SHA3_256_HASHBYTES 32
|
|
109
99
|
#define mlk_sha3_256 MLK_NAMESPACE(sha3_256)
|
|
110
|
-
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* Description: SHA3-256 with non-incremental API
|
|
100
|
+
/**
|
|
101
|
+
* SHA3-256 with non-incremental API.
|
|
114
102
|
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
|
|
103
|
+
* @param[out] output Output buffer.
|
|
104
|
+
* @param[in] input Input buffer.
|
|
105
|
+
* @param inlen Length of input in bytes.
|
|
106
|
+
*/
|
|
119
107
|
void mlk_sha3_256(uint8_t *output, const uint8_t *input, size_t inlen)
|
|
120
108
|
__contract__(
|
|
121
109
|
requires(inlen <= MLK_MAX_BUFFER_SIZE)
|
|
@@ -128,15 +116,13 @@ __contract__(
|
|
|
128
116
|
* output is not permitted */
|
|
129
117
|
#define SHA3_512_HASHBYTES 64
|
|
130
118
|
#define mlk_sha3_512 MLK_NAMESPACE(sha3_512)
|
|
131
|
-
|
|
132
|
-
*
|
|
119
|
+
/**
|
|
120
|
+
* SHA3-512 with non-incremental API.
|
|
133
121
|
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
|
|
138
|
-
* - size_t inlen: length of input in bytes
|
|
139
|
-
**************************************************/
|
|
122
|
+
* @param[out] output Output buffer.
|
|
123
|
+
* @param[in] input Input buffer.
|
|
124
|
+
* @param inlen Length of input in bytes.
|
|
125
|
+
*/
|
|
140
126
|
void mlk_sha3_512(uint8_t *output, const uint8_t *input, size_t inlen)
|
|
141
127
|
__contract__(
|
|
142
128
|
requires(inlen <= MLK_MAX_BUFFER_SIZE)
|
|
@@ -29,6 +29,7 @@ static void mlk_keccak_absorb_once_x4(uint64_t *s, unsigned r,
|
|
|
29
29
|
__contract__(
|
|
30
30
|
requires(inlen <= MLK_MAX_BUFFER_SIZE)
|
|
31
31
|
requires(memory_no_alias(s, sizeof(uint64_t) * MLK_KECCAK_LANES * MLK_KECCAK_WAY))
|
|
32
|
+
requires(r > 0)
|
|
32
33
|
requires(r <= sizeof(uint64_t) * MLK_KECCAK_LANES)
|
|
33
34
|
requires(memory_no_alias(in0, inlen))
|
|
34
35
|
requires(memory_no_alias(in1, inlen))
|
|
@@ -43,7 +44,8 @@ __contract__(
|
|
|
43
44
|
invariant(in0 == loop_entry(in0) + (loop_entry(inlen) - inlen))
|
|
44
45
|
invariant(in1 == loop_entry(in1) + (loop_entry(inlen) - inlen))
|
|
45
46
|
invariant(in2 == loop_entry(in2) + (loop_entry(inlen) - inlen))
|
|
46
|
-
invariant(in3 == loop_entry(in3) + (loop_entry(inlen) - inlen))
|
|
47
|
+
invariant(in3 == loop_entry(in3) + (loop_entry(inlen) - inlen))
|
|
48
|
+
decreases(inlen))
|
|
47
49
|
{
|
|
48
50
|
mlk_keccakf1600x4_xor_bytes(s, in0, in1, in2, in3, 0, r);
|
|
49
51
|
mlk_keccakf1600x4_permute(s);
|
|
@@ -93,27 +95,24 @@ __contract__(
|
|
|
93
95
|
assigns(memory_slice(out2, nblocks * r))
|
|
94
96
|
assigns(memory_slice(out3, nblocks * r)))
|
|
95
97
|
{
|
|
98
|
+
size_t current_offset = 0;
|
|
96
99
|
while (nblocks > 0)
|
|
97
100
|
__loop__(
|
|
98
|
-
assigns(
|
|
101
|
+
assigns(nblocks, current_offset,
|
|
99
102
|
memory_slice(s, sizeof(uint64_t) * MLK_KECCAK_LANES * MLK_KECCAK_WAY),
|
|
100
103
|
memory_slice(out0, nblocks * r),
|
|
101
104
|
memory_slice(out1, nblocks * r),
|
|
102
105
|
memory_slice(out2, nblocks * r),
|
|
103
106
|
memory_slice(out3, nblocks * r))
|
|
104
|
-
invariant(nblocks <= loop_entry(nblocks)
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
out2 == loop_entry(out2) + r * (loop_entry(nblocks) - nblocks) &&
|
|
108
|
-
out3 == loop_entry(out3) + r * (loop_entry(nblocks) - nblocks)))
|
|
107
|
+
invariant(nblocks <= loop_entry(nblocks))
|
|
108
|
+
invariant(current_offset == (loop_entry(nblocks) - nblocks) * r)
|
|
109
|
+
decreases(nblocks))
|
|
109
110
|
{
|
|
110
111
|
mlk_keccakf1600x4_permute(s);
|
|
111
|
-
mlk_keccakf1600x4_extract_bytes(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
out2 += r;
|
|
116
|
-
out3 += r;
|
|
112
|
+
mlk_keccakf1600x4_extract_bytes(
|
|
113
|
+
s, &out0[current_offset], &out1[current_offset], &out2[current_offset],
|
|
114
|
+
&out3[current_offset], 0, r);
|
|
115
|
+
current_offset += r;
|
|
117
116
|
nblocks--;
|
|
118
117
|
}
|
|
119
118
|
}
|
|
@@ -163,8 +162,8 @@ static void mlk_shake256x4_squeezeblocks(uint8_t *out0, uint8_t *out1,
|
|
|
163
162
|
}
|
|
164
163
|
|
|
165
164
|
void mlk_shake256x4(uint8_t *out0, uint8_t *out1, uint8_t *out2, uint8_t *out3,
|
|
166
|
-
size_t outlen, uint8_t *in0, uint8_t *in1,
|
|
167
|
-
uint8_t *in3, size_t inlen)
|
|
165
|
+
size_t outlen, const uint8_t *in0, const uint8_t *in1,
|
|
166
|
+
const uint8_t *in2, const uint8_t *in3, size_t inlen)
|
|
168
167
|
{
|
|
169
168
|
mlk_shake256x4_ctx statex;
|
|
170
169
|
size_t nblocks = outlen / SHAKE256_RATE;
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
#include "fips202.h"
|
|
13
13
|
#include "keccakf1600.h"
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
/** Context for the non-incremental 4-way SHAKE128 API. */
|
|
16
16
|
typedef struct
|
|
17
17
|
{
|
|
18
|
-
uint64_t ctx[MLK_KECCAK_LANES *
|
|
18
|
+
uint64_t ctx[MLK_KECCAK_LANES *
|
|
19
|
+
MLK_KECCAK_WAY]; /**< 4-way Keccak state, stored sequentially. */
|
|
19
20
|
} MLK_ALIGN mlk_shake128x4ctx;
|
|
20
21
|
|
|
21
22
|
#define mlk_shake128x4_absorb_once MLK_NAMESPACE(shake128x4_absorb_once)
|
|
@@ -58,8 +59,8 @@ void mlk_shake128x4_release(mlk_shake128x4ctx *state);
|
|
|
58
59
|
|
|
59
60
|
#define mlk_shake256x4 MLK_NAMESPACE(shake256x4)
|
|
60
61
|
void mlk_shake256x4(uint8_t *out0, uint8_t *out1, uint8_t *out2, uint8_t *out3,
|
|
61
|
-
size_t outlen, uint8_t *in0, uint8_t *in1,
|
|
62
|
-
uint8_t *in3, size_t inlen)
|
|
62
|
+
size_t outlen, const uint8_t *in0, const uint8_t *in1,
|
|
63
|
+
const uint8_t *in2, const uint8_t *in3, size_t inlen)
|
|
63
64
|
__contract__(
|
|
64
65
|
requires(inlen <= MLK_MAX_BUFFER_SIZE)
|
|
65
66
|
requires(outlen <= MLK_MAX_BUFFER_SIZE)
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
#if !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED)
|
|
32
32
|
|
|
33
33
|
#define MLK_KECCAK_NROUNDS 24
|
|
34
|
-
#define MLK_KECCAK_ROL(a, offset) ((a << offset) ^ (a >> (64 - offset)))
|
|
34
|
+
#define MLK_KECCAK_ROL(a, offset) (((a) << (offset)) ^ ((a) >> (64 - (offset))))
|
|
35
35
|
|
|
36
36
|
void mlk_keccakf1600_extract_bytes(uint64_t *state, unsigned char *data,
|
|
37
37
|
unsigned offset, unsigned length)
|
|
@@ -40,14 +40,16 @@ void mlk_keccakf1600_extract_bytes(uint64_t *state, unsigned char *data,
|
|
|
40
40
|
#if defined(MLK_SYS_LITTLE_ENDIAN)
|
|
41
41
|
uint8_t *state_ptr = (uint8_t *)state + offset;
|
|
42
42
|
for (i = 0; i < length; i++)
|
|
43
|
-
__loop__(invariant(i <= length)
|
|
43
|
+
__loop__(invariant(i <= length)
|
|
44
|
+
decreases(length - i))
|
|
44
45
|
{
|
|
45
46
|
data[i] = state_ptr[i];
|
|
46
47
|
}
|
|
47
48
|
#else /* MLK_SYS_LITTLE_ENDIAN */
|
|
48
49
|
/* Portable version */
|
|
49
50
|
for (i = 0; i < length; i++)
|
|
50
|
-
__loop__(invariant(i <= length)
|
|
51
|
+
__loop__(invariant(i <= length)
|
|
52
|
+
decreases(length - i))
|
|
51
53
|
{
|
|
52
54
|
data[i] = (state[(offset + i) >> 3] >> (8 * ((offset + i) & 0x07))) & 0xFF;
|
|
53
55
|
}
|
|
@@ -61,14 +63,16 @@ void mlk_keccakf1600_xor_bytes(uint64_t *state, const unsigned char *data,
|
|
|
61
63
|
#if defined(MLK_SYS_LITTLE_ENDIAN)
|
|
62
64
|
uint8_t *state_ptr = (uint8_t *)state + offset;
|
|
63
65
|
for (i = 0; i < length; i++)
|
|
64
|
-
__loop__(invariant(i <= length)
|
|
66
|
+
__loop__(invariant(i <= length)
|
|
67
|
+
decreases(length - i))
|
|
65
68
|
{
|
|
66
69
|
state_ptr[i] ^= data[i];
|
|
67
70
|
}
|
|
68
71
|
#else /* MLK_SYS_LITTLE_ENDIAN */
|
|
69
72
|
/* Portable version */
|
|
70
73
|
for (i = 0; i < length; i++)
|
|
71
|
-
__loop__(invariant(i <= length)
|
|
74
|
+
__loop__(invariant(i <= length)
|
|
75
|
+
decreases(length - i))
|
|
72
76
|
{
|
|
73
77
|
state[(offset + i) >> 3] ^= (uint64_t)data[i]
|
|
74
78
|
<< (8 * ((offset + i) & 0x07));
|
|
@@ -82,6 +86,19 @@ static void mlk_keccakf1600x4_extract_bytes_c(uint64_t *state,
|
|
|
82
86
|
unsigned char *data2,
|
|
83
87
|
unsigned char *data3,
|
|
84
88
|
unsigned offset, unsigned length)
|
|
89
|
+
__contract__(
|
|
90
|
+
requires(0 <= offset && offset <= MLK_KECCAK_LANES * sizeof(uint64_t) &&
|
|
91
|
+
0 <= length && length <= MLK_KECCAK_LANES * sizeof(uint64_t) - offset)
|
|
92
|
+
requires(memory_no_alias(state, sizeof(uint64_t) * MLK_KECCAK_LANES * MLK_KECCAK_WAY))
|
|
93
|
+
requires(memory_no_alias(data0, length))
|
|
94
|
+
requires(memory_no_alias(data1, length))
|
|
95
|
+
requires(memory_no_alias(data2, length))
|
|
96
|
+
requires(memory_no_alias(data3, length))
|
|
97
|
+
assigns(memory_slice(data0, length))
|
|
98
|
+
assigns(memory_slice(data1, length))
|
|
99
|
+
assigns(memory_slice(data2, length))
|
|
100
|
+
assigns(memory_slice(data3, length))
|
|
101
|
+
)
|
|
85
102
|
{
|
|
86
103
|
mlk_keccakf1600_extract_bytes(state + MLK_KECCAK_LANES * 0, data0, offset,
|
|
87
104
|
length);
|
|
@@ -116,6 +133,20 @@ static void mlk_keccakf1600x4_xor_bytes_c(uint64_t *state,
|
|
|
116
133
|
const unsigned char *data2,
|
|
117
134
|
const unsigned char *data3,
|
|
118
135
|
unsigned offset, unsigned length)
|
|
136
|
+
__contract__(
|
|
137
|
+
requires(0 <= offset && offset <= MLK_KECCAK_LANES * sizeof(uint64_t) &&
|
|
138
|
+
0 <= length && length <= MLK_KECCAK_LANES * sizeof(uint64_t) - offset)
|
|
139
|
+
requires(memory_no_alias(state, sizeof(uint64_t) * MLK_KECCAK_LANES * MLK_KECCAK_WAY))
|
|
140
|
+
requires(memory_no_alias(data0, length))
|
|
141
|
+
/* Case 1: all input buffers are distinct; Case 2: All input buffers are the same */
|
|
142
|
+
requires((data0 == data1 &&
|
|
143
|
+
data0 == data2 &&
|
|
144
|
+
data0 == data3) ||
|
|
145
|
+
(memory_no_alias(data1, length) &&
|
|
146
|
+
memory_no_alias(data2, length) &&
|
|
147
|
+
memory_no_alias(data3, length)))
|
|
148
|
+
assigns(memory_slice(state, sizeof(uint64_t) * MLK_KECCAK_LANES * MLK_KECCAK_WAY))
|
|
149
|
+
)
|
|
119
150
|
{
|
|
120
151
|
mlk_keccakf1600_xor_bytes(state + MLK_KECCAK_LANES * 0, data0, offset,
|
|
121
152
|
length);
|
|
@@ -175,6 +206,10 @@ static const uint64_t mlk_KeccakF_RoundConstants[MLK_KECCAK_NROUNDS] = {
|
|
|
175
206
|
|
|
176
207
|
MLK_STATIC_TESTABLE
|
|
177
208
|
void mlk_keccakf1600_permute_c(uint64_t *state)
|
|
209
|
+
__contract__(
|
|
210
|
+
requires(memory_no_alias(state, sizeof(uint64_t) * MLK_KECCAK_LANES))
|
|
211
|
+
assigns(memory_slice(state, sizeof(uint64_t) * MLK_KECCAK_LANES))
|
|
212
|
+
)
|
|
178
213
|
{
|
|
179
214
|
unsigned round;
|
|
180
215
|
|
|
@@ -219,7 +254,8 @@ void mlk_keccakf1600_permute_c(uint64_t *state)
|
|
|
219
254
|
Asu = state[24];
|
|
220
255
|
|
|
221
256
|
for (round = 0; round < MLK_KECCAK_NROUNDS; round += 2)
|
|
222
|
-
__loop__(invariant(round <= MLK_KECCAK_NROUNDS && round % 2 == 0)
|
|
257
|
+
__loop__(invariant(round <= MLK_KECCAK_NROUNDS && round % 2 == 0)
|
|
258
|
+
decreases(MLK_KECCAK_NROUNDS - round))
|
|
223
259
|
{
|
|
224
260
|
/* prepareTheta */
|
|
225
261
|
BCa = Aba ^ Aga ^ Aka ^ Ama ^ Asa;
|
data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/fips202_native_aarch64.h
CHANGED
|
@@ -10,56 +10,67 @@
|
|
|
10
10
|
|
|
11
11
|
#define mlk_keccakf1600_round_constants \
|
|
12
12
|
MLK_NAMESPACE(keccakf1600_round_constants)
|
|
13
|
-
|
|
13
|
+
MLK_INTERNAL_DATA_DECLARATION const uint64_t
|
|
14
|
+
mlk_keccakf1600_round_constants[24];
|
|
14
15
|
|
|
15
|
-
#define
|
|
16
|
-
|
|
16
|
+
#define mlk_keccak_f1600_x1_scalar_aarch64_asm \
|
|
17
|
+
MLK_NAMESPACE(keccak_f1600_x1_scalar_aarch64_asm)
|
|
18
|
+
void mlk_keccak_f1600_x1_scalar_aarch64_asm(uint64_t state[25],
|
|
19
|
+
const uint64_t rc[24])
|
|
17
20
|
/* This must be kept in sync with the HOL-Light specification
|
|
18
|
-
* in proofs/hol_light/aarch64/proofs/
|
|
21
|
+
* in proofs/hol_light/aarch64/proofs/keccak_f1600_x1_scalar_aarch64_asm.ml */
|
|
19
22
|
__contract__(
|
|
20
23
|
requires(memory_no_alias(state, sizeof(uint64_t) * 25 * 1))
|
|
21
24
|
requires(rc == mlk_keccakf1600_round_constants)
|
|
22
25
|
assigns(memory_slice(state, sizeof(uint64_t) * 25 * 1))
|
|
23
26
|
);
|
|
24
27
|
|
|
25
|
-
#define
|
|
26
|
-
|
|
28
|
+
#define mlk_keccak_f1600_x1_v84a_aarch64_asm \
|
|
29
|
+
MLK_NAMESPACE(keccak_f1600_x1_v84a_aarch64_asm)
|
|
30
|
+
void mlk_keccak_f1600_x1_v84a_aarch64_asm(uint64_t state[25],
|
|
31
|
+
const uint64_t rc[24])
|
|
27
32
|
/* This must be kept in sync with the HOL-Light specification
|
|
28
|
-
* in proofs/hol_light/aarch64/proofs/
|
|
33
|
+
* in proofs/hol_light/aarch64/proofs/keccak_f1600_x1_v84a_aarch64_asm.ml */
|
|
29
34
|
__contract__(
|
|
30
35
|
requires(memory_no_alias(state, sizeof(uint64_t) * 25 * 1))
|
|
31
36
|
requires(rc == mlk_keccakf1600_round_constants)
|
|
32
37
|
assigns(memory_slice(state, sizeof(uint64_t) * 25 * 1))
|
|
33
38
|
);
|
|
34
39
|
|
|
35
|
-
#define
|
|
36
|
-
|
|
40
|
+
#define mlk_keccak_f1600_x2_v84a_aarch64_asm \
|
|
41
|
+
MLK_NAMESPACE(keccak_f1600_x2_v84a_aarch64_asm)
|
|
42
|
+
void mlk_keccak_f1600_x2_v84a_aarch64_asm(uint64_t state[50],
|
|
43
|
+
const uint64_t rc[24])
|
|
37
44
|
/* This must be kept in sync with the HOL-Light specification
|
|
38
|
-
* in proofs/hol_light/aarch64/proofs/
|
|
45
|
+
* in proofs/hol_light/aarch64/proofs/keccak_f1600_x2_v84a_aarch64_asm.ml */
|
|
39
46
|
__contract__(
|
|
40
47
|
requires(memory_no_alias(state, sizeof(uint64_t) * 25 * 2))
|
|
41
48
|
requires(rc == mlk_keccakf1600_round_constants)
|
|
42
49
|
assigns(memory_slice(state, sizeof(uint64_t) * 25 * 2))
|
|
43
50
|
);
|
|
44
51
|
|
|
45
|
-
#define
|
|
46
|
-
MLK_NAMESPACE(
|
|
47
|
-
void
|
|
48
|
-
|
|
52
|
+
#define mlk_keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm \
|
|
53
|
+
MLK_NAMESPACE(keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm)
|
|
54
|
+
void mlk_keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm(uint64_t state[100],
|
|
55
|
+
const uint64_t rc[24])
|
|
49
56
|
/* This must be kept in sync with the HOL-Light specification
|
|
50
|
-
* in
|
|
57
|
+
* in
|
|
58
|
+
* proofs/hol_light/aarch64/proofs/keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.ml
|
|
59
|
+
*/
|
|
51
60
|
__contract__(
|
|
52
61
|
requires(memory_no_alias(state, sizeof(uint64_t) * 25 * 4))
|
|
53
62
|
requires(rc == mlk_keccakf1600_round_constants)
|
|
54
63
|
assigns(memory_slice(state, sizeof(uint64_t) * 25 * 4))
|
|
55
64
|
);
|
|
56
65
|
|
|
57
|
-
#define
|
|
58
|
-
MLK_NAMESPACE(
|
|
59
|
-
void
|
|
60
|
-
|
|
66
|
+
#define mlk_keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm \
|
|
67
|
+
MLK_NAMESPACE(keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm)
|
|
68
|
+
void mlk_keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm(
|
|
69
|
+
uint64_t state[100], const uint64_t rc[24])
|
|
61
70
|
/* This must be kept in sync with the HOL-Light specification
|
|
62
|
-
* in
|
|
71
|
+
* in
|
|
72
|
+
* proofs/hol_light/aarch64/proofs/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.ml
|
|
73
|
+
*/
|
|
63
74
|
__contract__(
|
|
64
75
|
requires(memory_no_alias(state, sizeof(uint64_t) * 25 * 4))
|
|
65
76
|
requires(rc == mlk_keccakf1600_round_constants)
|