Skip to content

Commit 8c9bb54

Browse files
committed
Shorten MLKEM_NATIVE_ to MLK_, add MLK_ prefix to sys.h macros
This commit is a great renaming of macros from MLKEM_NATIVE_ to MLK_. In other places where there is risk of clash with other files -- e.g. sys.h defining ALIGN -- MLK_ is added as a prefix. The commit is produced by ``` FILES=$(git ls-files -s | grep -v "^120000" | cut -f2) printf '%s\n' $FILES | xargs -P 8 -I {} \ perl -pi -e 's/SYS_(UNIX_LIKE|LITTLE_ENDIAN|BIG_ENDIAN|X86_64|AARCH64)/MLK_SYS_$1/g' {} printf '%s\n' $FILES | xargs -P 8 -I {} \ perl -pi -e 's/^ALIGN([^A-Za-z_])/MLK_ALIGN\1/g' {} printf '%s\n' $FILES | xargs -P 8 -I {} \ perl -pi -e 's/([^A-Za-z_])INLINE([^A-Za-z_])/\1MLK_INLINE\2/g' {} printf '%s\n' $FILES | xargs -P 8 -I {} \ perl -pi -e 's/([^A-Za-z_])ALWAYS_INLINE([^A-Za-z_])/\1MLK_ALWAYS_INLINE\2/g' {} printf '%s\n' $FILES | xargs -P 8 -I {} \ perl -pi -e 's/([^A-Za-z_])RESTRICT([^A-Za-z_])/\1MLK_RESTRICT\2/g' {} printf '%s\n' $FILES | xargs -P 8 -I {} \ perl -pi -e 's/([^A-Za-z_])ALIGN([^A-Za-z_])/\1MLK_ALIGN\2/g' {} printf '%s\n' $FILES | xargs -P 8 -I {} \ perl -pi -e 's/([^A-Za-z_])FORCE_AARCH64([^A-Za-z_])/\1MLK_FORCE_AARCH64\2/g' {} printf '%s\n' $FILES | xargs -P 8 -I {} \ perl -pi -e 's/([^A-Za-z_])FORCE_X86_64([^A-Za-z_])/\1MLK_FORCE_X86_64\2/g' {} printf '%s\n' $FILES | xargs -P 8 -I {} \ perl -pi -e 's/([^A-Za-z_])RESTRICT /\1MLK_RESTRICT /g' {} printf '%s\n' $FILES | xargs -P 8 -I {} \ perl -pi -e 's/([^A-Za-z_])DEFAULT_ALIGN /\1MLK_DEFAULT_ALIGN /g' {} printf '%s\n' $FILES | xargs -P 8 -I {} \ perl -pi -e 's/MLKEM_ASM_NAMESPACE/MLK_ASM_NAMESPACE/g' {} printf '%s\n' $FILES | xargs -P 8 -I {} \ perl -pi -e 's/MLKEM_NAMESPACE/MLK_NAMESPACE/g' {} printf '%s\n' $FILES | xargs -P 8 -I {} \ perl -pi -e 's/MLKEM_DEFAULT_/MLK_DEFAULT_/g' {} printf '%s\n' $FILES | xargs -P 8 -I {} \ perl -pi -e 's/MLKEM_USE_/MLK_USE_/g' {} printf '%s\n' $FILES | xargs -P 8 -I {} \ perl -pi -e 's/PREFIX_UNDERSCORE/MLK_PREFIX_UNDERSCORE/g' {} printf '%s\n' $FILES | xargs -P 8 -I {} \ perl -pi -e 's/MLKEM_NATIVE_/MLK_/g' {} printf '%s\n' $FILES | xargs -P 8 -I {} \ perl -pi -e 's/UINT12_LIMIT/MLK_UINT12_LIMIT/g' {} printf '%s\n' $FILES | xargs -P 8 -I {} \ perl -pi -e 's/BUILD_INFO_/MLK_BUILD_INFO_/g' {} ``` followed by (in nix shell) ``` autogen format ``` Finally, restore the original default namespace extension as ``` PQCP_MLKEM_NATIVE_XXX ``` which was renamed to `PQCP_MLK_XXX` in the process. Signed-off-by: Hanno Becker <beckphan@amazon.co.uk>
1 parent decd67f commit 8c9bb54

330 files changed

Lines changed: 2866 additions & 2886 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ Macros:
2222
- __contract__(x)={ void a; void b; void c; void d; void e; void f; } void abcdefghijklmnopqrstuvw()
2323
- __loop__(x)={}
2424
# Make this artifically long to force line break
25-
- MLKEM_NATIVE_INTERNAL_API=void abcdefghijklmnopqrstuvwabcdefghijklmnopqrstuvwabcdefg();
25+
- MLK_INTERNAL_API=void abcdefghijklmnopqrstuvwabcdefghijklmnopqrstuvwabcdefg();

.github/workflows/bench.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- system: rpi4
3131
name: Arm Cortex-A72 (Raspberry Pi 4) benchmarks
3232
bench_pmu: PMU
33-
archflags: -mcpu=cortex-a72 -DSYS_AARCH64_SLOW_BARREL_SHIFTER
33+
archflags: -mcpu=cortex-a72 -DMLK_SYS_AARCH64_SLOW_BARREL_SHIFTER
3434
cflags: "-flto -DFORCE_AARCH64"
3535
bench_extra_args: ""
3636
- system: rpi5
@@ -43,7 +43,7 @@ jobs:
4343
name: Arm Cortex-A55 (Snapdragon 888) benchmarks
4444
bench_pmu: PERF
4545
archflags: "-mcpu=cortex-a55 -march=armv8.2-a"
46-
cflags: "-flto -static -DFORCE_AARCH64 -DMLKEM_NATIVE_FIPS202_BACKEND_FILE=\\\\\\\"fips202/native/aarch64/meta_cortex_a55.h\\\\\\\""
46+
cflags: "-flto -static -DFORCE_AARCH64 -DMLK_FIPS202_BACKEND_FILE=\\\\\\\"fips202/native/aarch64/meta_cortex_a55.h\\\\\\\""
4747
bench_extra_args: -w exec-on-a55
4848
- system: bpi
4949
name: SpacemiT K1 8 (Banana Pi F3) benchmarks

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,13 +499,13 @@ jobs:
499499
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
500500
- name: make quickcheck
501501
run: |
502-
OPT=0 CFLAGS="-DMLKEM_NATIVE_CHECK_APIS -Wno-redundant-decls" make quickcheck
502+
OPT=0 CFLAGS="-DMLK_CHECK_APIS -Wno-redundant-decls" make quickcheck
503503
make clean >/dev/null
504-
OPT=1 CFLAGS="-DMLKEM_NATIVE_CHECK_APIS -Wno-redundant-decls" make quickcheck
504+
OPT=1 CFLAGS="-DMLK_CHECK_APIS -Wno-redundant-decls" make quickcheck
505505
- uses: ./.github/actions/setup-apt
506506
- name: tests func
507507
run: |
508-
./scripts/tests func --cflags="-DMLKEM_NATIVE_CHECK_APIS -Wno-redundant-decls"
508+
./scripts/tests func --cflags="-DMLK_CHECK_APIS -Wno-redundant-decls"
509509
ec2_functests:
510510
strategy:
511511
fail-fast: false

dev/aarch64_clean/meta.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
#ifndef MLKEM_NATIVE_DEV_AARCH64_CLEAN_META_H
7-
#define MLKEM_NATIVE_DEV_AARCH64_CLEAN_META_H
6+
#ifndef MLK_DEV_AARCH64_CLEAN_META_H
7+
#define MLK_DEV_AARCH64_CLEAN_META_H
88
/* ML-KEM arithmetic native profile for clean assembly */
99

10-
#ifdef MLKEM_NATIVE_ARITH_PROFILE_H
10+
#ifdef MLK_ARITH_PROFILE_H
1111
#error Only one MLKEM_ARITH assembly profile can be defined -- did you include multiple profiles?
1212
#else
13-
#define MLKEM_NATIVE_ARITH_PROFILE_H
13+
#define MLK_ARITH_PROFILE_H
1414

1515
/* Identifier for this backend so that source and assembly files
1616
* in the build can be appropriately guarded. */
17-
#define MLKEM_NATIVE_ARITH_BACKEND_AARCH64_CLEAN
17+
#define MLK_ARITH_BACKEND_AARCH64_CLEAN
1818

19-
#define MLKEM_NATIVE_ARITH_BACKEND_NAME AARCH64_CLEAN
19+
#define MLK_ARITH_BACKEND_NAME AARCH64_CLEAN
2020

2121
/* Filename of the C backend implementation.
2222
* This is not inlined here because this header is included in assembly
2323
* files as well. */
24-
#define MLKEM_NATIVE_ARITH_BACKEND_IMPL "native/aarch64/src/clean_impl.h"
24+
#define MLK_ARITH_BACKEND_IMPL "native/aarch64/src/clean_impl.h"
2525

26-
#endif /* MLKEM_NATIVE_ARITH_PROFILE_H */
26+
#endif /* MLK_ARITH_PROFILE_H */
2727

28-
#endif /* MLKEM_NATIVE_DEV_AARCH64_CLEAN_META_H */
28+
#endif /* MLK_DEV_AARCH64_CLEAN_META_H */

dev/aarch64_clean/src/aarch64_zetas.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
#include "../../../common.h"
1212

13-
#if defined(MLKEM_NATIVE_ARITH_BACKEND_AARCH64_CLEAN) && \
14-
!defined(MLKEM_NATIVE_MULTILEVEL_BUILD_NO_SHARED)
13+
#if defined(MLK_ARITH_BACKEND_AARCH64_CLEAN) && \
14+
!defined(MLK_MULTILEVEL_BUILD_NO_SHARED)
1515

1616
#include <stdint.h>
1717
#include "arith_native_aarch64.h"
@@ -20,7 +20,7 @@
2020
* Table of zeta values used in the AArch64 forward NTT
2121
* See autogen for details.
2222
*/
23-
ALIGN const int16_t aarch64_ntt_zetas_layer01234[] = {
23+
MLK_ALIGN const int16_t aarch64_ntt_zetas_layer01234[] = {
2424
-1600, -15749, -749, -7373, -40, -394, -687, -6762, 630, 6201,
2525
-1432, -14095, 848, 8347, 0, 0, 1062, 10453, 296, 2914,
2626
-882, -8682, 0, 0, -1410, -13879, 1339, 13180, 1476, 14529,
@@ -31,7 +31,7 @@ ALIGN const int16_t aarch64_ntt_zetas_layer01234[] = {
3131
0, 0, -1583, -15582, -1355, -13338, 821, 8081, 0, 0,
3232
};
3333

34-
ALIGN const int16_t aarch64_ntt_zetas_layer56[] = {
34+
MLK_ALIGN const int16_t aarch64_ntt_zetas_layer56[] = {
3535
289, 289, 331, 331, -76, -76, -1573, -1573, 2845,
3636
2845, 3258, 3258, -748, -748, -15483, -15483, 17, 17,
3737
583, 583, 1637, 1637, -1041, -1041, 167, 167, 5739,
@@ -77,7 +77,7 @@ ALIGN const int16_t aarch64_ntt_zetas_layer56[] = {
7777
10129, 10129, -3878, -3878, -11566, -11566,
7878
};
7979

80-
ALIGN const int16_t aarch64_invntt_zetas_layer01234[] = {
80+
MLK_ALIGN const int16_t aarch64_invntt_zetas_layer01234[] = {
8181
1583, 15582, -821, -8081, 1355, 13338, 0, 0, -569, -5601,
8282
450, 4429, 936, 9213, 0, 0, 69, 679, 447, 4400,
8383
-535, -5266, 0, 0, 543, 5345, 1235, 12156, -1426, -14036,
@@ -88,7 +88,7 @@ ALIGN const int16_t aarch64_invntt_zetas_layer01234[] = {
8888
-848, -8347, 1432, 14095, -630, -6201, 687, 6762, 0, 0,
8989
};
9090

91-
ALIGN const int16_t aarch64_invntt_zetas_layer56[] = {
91+
MLK_ALIGN const int16_t aarch64_invntt_zetas_layer56[] = {
9292
-910, -910, -1227, -1227, 219, 219, 855, 855, -8957,
9393
-8957, -12078, -12078, 2156, 2156, 8416, 8416, 1175, 1175,
9494
394, 394, -1029, -1029, -1212, -1212, 11566, 11566, 3878,
@@ -134,7 +134,7 @@ ALIGN const int16_t aarch64_invntt_zetas_layer56[] = {
134134
-16113, -16113, -5739, -5739, -167, -167,
135135
};
136136

137-
ALIGN const int16_t aarch64_zetas_mulcache_native[] = {
137+
MLK_ALIGN const int16_t aarch64_zetas_mulcache_native[] = {
138138
17, -17, -568, 568, 583, -583, -680, 680, 1637, -1637, 723,
139139
-723, -1041, 1041, 1100, -1100, 1409, -1409, -667, 667, -48, 48,
140140
233, -233, 756, -756, -1173, 1173, -314, 314, -279, 279, -1626,
@@ -149,7 +149,7 @@ ALIGN const int16_t aarch64_zetas_mulcache_native[] = {
149149
1219, -394, 394, 885, -885, -1175, 1175,
150150
};
151151

152-
ALIGN const int16_t aarch64_zetas_mulcache_twisted_native[] = {
152+
MLK_ALIGN const int16_t aarch64_zetas_mulcache_twisted_native[] = {
153153
167, -167, -5591, 5591, 5739, -5739, -6693, 6693, 16113,
154154
-16113, 7117, -7117, -10247, 10247, 10828, -10828, 13869, -13869,
155155
-6565, 6565, -472, 472, 2293, -2293, 7441, -7441, -11546,
@@ -167,11 +167,11 @@ ALIGN const int16_t aarch64_zetas_mulcache_twisted_native[] = {
167167
-11566, 11566,
168168
};
169169

170-
#else /* defined(MLKEM_NATIVE_ARITH_BACKEND_AARCH64_CLEAN) \
171-
&& !defined(MLKEM_NATIVE_MULTILEVEL_BUILD_NO_SHARED) */
170+
#else /* defined(MLK_ARITH_BACKEND_AARCH64_CLEAN) \
171+
&& !defined(MLK_MULTILEVEL_BUILD_NO_SHARED) */
172172

173-
MLKEM_NATIVE_EMPTY_CU(aarch64_zetas)
173+
MLK_EMPTY_CU(aarch64_zetas)
174174

175175

176-
#endif /* defined(MLKEM_NATIVE_ARITH_BACKEND_AARCH64_CLEAN) \
177-
&& !defined(MLKEM_NATIVE_MULTILEVEL_BUILD_NO_SHARED) */
176+
#endif /* defined(MLK_ARITH_BACKEND_AARCH64_CLEAN) \
177+
&& !defined(MLK_MULTILEVEL_BUILD_NO_SHARED) */

dev/aarch64_clean/src/arith_native_aarch64.h

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,22 @@
22
* Copyright (c) 2024-2025 The mlkem-native project authors
33
* SPDX-License-Identifier: Apache-2.0
44
*/
5-
#ifndef MLKEM_NATIVE_DEV_AARCH64_CLEAN_SRC_ARITH_NATIVE_AARCH64_H
6-
#define MLKEM_NATIVE_DEV_AARCH64_CLEAN_SRC_ARITH_NATIVE_AARCH64_H
5+
#ifndef MLK_DEV_AARCH64_CLEAN_SRC_ARITH_NATIVE_AARCH64_H
6+
#define MLK_DEV_AARCH64_CLEAN_SRC_ARITH_NATIVE_AARCH64_H
77

88
#include <stdint.h>
99
#include "../../../common.h"
1010

11-
#define aarch64_ntt_zetas_layer01234 \
12-
MLKEM_NAMESPACE(aarch64_ntt_zetas_layer01234)
13-
#define aarch64_ntt_zetas_layer56 MLKEM_NAMESPACE(aarch64_ntt_zetas_layer56)
11+
#define aarch64_ntt_zetas_layer01234 MLK_NAMESPACE(aarch64_ntt_zetas_layer01234)
12+
#define aarch64_ntt_zetas_layer56 MLK_NAMESPACE(aarch64_ntt_zetas_layer56)
1413
#define aarch64_invntt_zetas_layer01234 \
15-
MLKEM_NAMESPACE(aarch64_invntt_zetas_layer01234)
16-
#define aarch64_invntt_zetas_layer56 \
17-
MLKEM_NAMESPACE(aarch64_invntt_zetas_layer56)
14+
MLK_NAMESPACE(aarch64_invntt_zetas_layer01234)
15+
#define aarch64_invntt_zetas_layer56 MLK_NAMESPACE(aarch64_invntt_zetas_layer56)
1816
#define aarch64_zetas_mulcache_native \
19-
MLKEM_NAMESPACE(aarch64_zetas_mulcache_native)
17+
MLK_NAMESPACE(aarch64_zetas_mulcache_native)
2018
#define aarch64_zetas_mulcache_twisted_native \
21-
MLKEM_NAMESPACE(aarch64_zetas_mulcache_twisted_native)
22-
#define rej_uniform_table MLKEM_NAMESPACE(rej_uniform_table)
19+
MLK_NAMESPACE(aarch64_zetas_mulcache_twisted_native)
20+
#define rej_uniform_table MLK_NAMESPACE(rej_uniform_table)
2321

2422
extern const int16_t aarch64_ntt_zetas_layer01234[];
2523
extern const int16_t aarch64_ntt_zetas_layer56[];
@@ -29,50 +27,50 @@ extern const int16_t aarch64_zetas_mulcache_native[];
2927
extern const int16_t aarch64_zetas_mulcache_twisted_native[];
3028
extern const uint8_t rej_uniform_table[];
3129

32-
#define ntt_asm_clean MLKEM_NAMESPACE(ntt_asm_clean)
30+
#define ntt_asm_clean MLK_NAMESPACE(ntt_asm_clean)
3331
void ntt_asm_clean(int16_t *, const int16_t *, const int16_t *);
3432

35-
#define intt_asm_clean MLKEM_NAMESPACE(intt_asm_clean)
33+
#define intt_asm_clean MLK_NAMESPACE(intt_asm_clean)
3634
void intt_asm_clean(int16_t *, const int16_t *, const int16_t *);
3735

38-
#define rej_uniform_asm_clean MLKEM_NAMESPACE(rej_uniform_asm_clean)
36+
#define rej_uniform_asm_clean MLK_NAMESPACE(rej_uniform_asm_clean)
3937
unsigned rej_uniform_asm_clean(int16_t *r, const uint8_t *buf, unsigned buflen,
4038
const uint8_t *table);
4139

42-
#define poly_reduce_asm_clean MLKEM_NAMESPACE(poly_reduce_asm_clean)
40+
#define poly_reduce_asm_clean MLK_NAMESPACE(poly_reduce_asm_clean)
4341
void poly_reduce_asm_clean(int16_t *);
4442

45-
#define poly_tomont_asm_clean MLKEM_NAMESPACE(poly_tomont_asm_clean)
43+
#define poly_tomont_asm_clean MLK_NAMESPACE(poly_tomont_asm_clean)
4644
void poly_tomont_asm_clean(int16_t *);
4745

4846
#define poly_mulcache_compute_asm_clean \
49-
MLKEM_NAMESPACE(poly_mulcache_compute_asm_clean)
47+
MLK_NAMESPACE(poly_mulcache_compute_asm_clean)
5048
void poly_mulcache_compute_asm_clean(int16_t *, const int16_t *,
5149
const int16_t *, const int16_t *);
5250

5351

54-
#define poly_tobytes_asm_clean MLKEM_NAMESPACE(poly_tobytes_asm_clean)
52+
#define poly_tobytes_asm_clean MLK_NAMESPACE(poly_tobytes_asm_clean)
5553
void poly_tobytes_asm_clean(uint8_t *r, const int16_t *a);
5654

5755
#define polyvec_basemul_acc_montgomery_cached_asm_k2_clean \
58-
MLKEM_NAMESPACE(polyvec_basemul_acc_montgomery_cached_asm_k2_clean)
56+
MLK_NAMESPACE(polyvec_basemul_acc_montgomery_cached_asm_k2_clean)
5957
void polyvec_basemul_acc_montgomery_cached_asm_k2_clean(int16_t *r,
6058
const int16_t *a,
6159
const int16_t *b,
6260
const int16_t *b_cache);
6361

6462
#define polyvec_basemul_acc_montgomery_cached_asm_k3_clean \
65-
MLKEM_NAMESPACE(polyvec_basemul_acc_montgomery_cached_asm_k3_clean)
63+
MLK_NAMESPACE(polyvec_basemul_acc_montgomery_cached_asm_k3_clean)
6664
void polyvec_basemul_acc_montgomery_cached_asm_k3_clean(int16_t *r,
6765
const int16_t *a,
6866
const int16_t *b,
6967
const int16_t *b_cache);
7068

7169
#define polyvec_basemul_acc_montgomery_cached_asm_k4_clean \
72-
MLKEM_NAMESPACE(polyvec_basemul_acc_montgomery_cached_asm_k4_clean)
70+
MLK_NAMESPACE(polyvec_basemul_acc_montgomery_cached_asm_k4_clean)
7371
void polyvec_basemul_acc_montgomery_cached_asm_k4_clean(int16_t *r,
7472
const int16_t *a,
7573
const int16_t *b,
7674
const int16_t *b_cache);
7775

78-
#endif /* MLKEM_NATIVE_DEV_AARCH64_CLEAN_SRC_ARITH_NATIVE_AARCH64_H */
76+
#endif /* MLK_DEV_AARCH64_CLEAN_SRC_ARITH_NATIVE_AARCH64_H */

dev/aarch64_clean/src/clean_impl.h

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,84 +3,84 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
#ifndef MLKEM_NATIVE_DEV_AARCH64_CLEAN_SRC_CLEAN_IMPL_H
7-
#define MLKEM_NATIVE_DEV_AARCH64_CLEAN_SRC_CLEAN_IMPL_H
6+
#ifndef MLK_DEV_AARCH64_CLEAN_SRC_CLEAN_IMPL_H
7+
#define MLK_DEV_AARCH64_CLEAN_SRC_CLEAN_IMPL_H
88
/* ML-KEM arithmetic native profile for clean assembly */
99

10-
#ifdef MLKEM_NATIVE_ARITH_PROFILE_IMPL_H
10+
#ifdef MLK_ARITH_PROFILE_IMPL_H
1111
#error Only one MLKEM_ARITH assembly profile can be defined -- did you include multiple profiles?
1212
#else
13-
#define MLKEM_NATIVE_ARITH_PROFILE_IMPL_H
13+
#define MLK_ARITH_PROFILE_IMPL_H
1414

1515
#include "arith_native_aarch64.h"
1616

1717
/* Set of primitives that this backend replaces */
18-
#define MLKEM_USE_NATIVE_NTT
19-
#define MLKEM_USE_NATIVE_INTT
20-
#define MLKEM_USE_NATIVE_POLY_REDUCE
21-
#define MLKEM_USE_NATIVE_POLY_TOMONT
22-
#define MLKEM_USE_NATIVE_POLY_MULCACHE_COMPUTE
23-
#define MLKEM_USE_NATIVE_POLYVEC_BASEMUL_ACC_MONTGOMERY_CACHED
24-
#define MLKEM_USE_NATIVE_POLY_TOBYTES
25-
#define MLKEM_USE_NATIVE_REJ_UNIFORM
26-
27-
static INLINE void ntt_native(int16_t data[MLKEM_N])
18+
#define MLK_USE_NATIVE_NTT
19+
#define MLK_USE_NATIVE_INTT
20+
#define MLK_USE_NATIVE_POLY_REDUCE
21+
#define MLK_USE_NATIVE_POLY_TOMONT
22+
#define MLK_USE_NATIVE_POLY_MULCACHE_COMPUTE
23+
#define MLK_USE_NATIVE_POLYVEC_BASEMUL_ACC_MONTGOMERY_CACHED
24+
#define MLK_USE_NATIVE_POLY_TOBYTES
25+
#define MLK_USE_NATIVE_REJ_UNIFORM
26+
27+
static MLK_INLINE void ntt_native(int16_t data[MLKEM_N])
2828
{
2929
ntt_asm_clean(data, aarch64_ntt_zetas_layer01234, aarch64_ntt_zetas_layer56);
3030
}
3131

32-
static INLINE void intt_native(int16_t data[MLKEM_N])
32+
static MLK_INLINE void intt_native(int16_t data[MLKEM_N])
3333
{
3434
intt_asm_clean(data, aarch64_invntt_zetas_layer01234,
3535
aarch64_invntt_zetas_layer56);
3636
}
3737

38-
static INLINE void poly_reduce_native(int16_t data[MLKEM_N])
38+
static MLK_INLINE void poly_reduce_native(int16_t data[MLKEM_N])
3939
{
4040
poly_reduce_asm_clean(data);
4141
}
4242

43-
static INLINE void poly_tomont_native(int16_t data[MLKEM_N])
43+
static MLK_INLINE void poly_tomont_native(int16_t data[MLKEM_N])
4444
{
4545
poly_tomont_asm_clean(data);
4646
}
4747

48-
static INLINE void poly_mulcache_compute_native(int16_t x[MLKEM_N / 2],
49-
const int16_t y[MLKEM_N])
48+
static MLK_INLINE void poly_mulcache_compute_native(int16_t x[MLKEM_N / 2],
49+
const int16_t y[MLKEM_N])
5050
{
5151
poly_mulcache_compute_asm_clean(x, y, aarch64_zetas_mulcache_native,
5252
aarch64_zetas_mulcache_twisted_native);
5353
}
5454

55-
static INLINE void polyvec_basemul_acc_montgomery_cached_k2_native(
55+
static MLK_INLINE void polyvec_basemul_acc_montgomery_cached_k2_native(
5656
int16_t r[MLKEM_N], const int16_t a[2 * MLKEM_N],
5757
const int16_t b[2 * MLKEM_N], const int16_t b_cache[2 * (MLKEM_N / 2)])
5858
{
5959
polyvec_basemul_acc_montgomery_cached_asm_k2_clean(r, a, b, b_cache);
6060
}
6161

62-
static INLINE void polyvec_basemul_acc_montgomery_cached_k3_native(
62+
static MLK_INLINE void polyvec_basemul_acc_montgomery_cached_k3_native(
6363
int16_t r[MLKEM_N], const int16_t a[3 * MLKEM_N],
6464
const int16_t b[3 * MLKEM_N], const int16_t b_cache[3 * (MLKEM_N / 2)])
6565
{
6666
polyvec_basemul_acc_montgomery_cached_asm_k3_clean(r, a, b, b_cache);
6767
}
6868

69-
static INLINE void polyvec_basemul_acc_montgomery_cached_k4_native(
69+
static MLK_INLINE void polyvec_basemul_acc_montgomery_cached_k4_native(
7070
int16_t r[MLKEM_N], const int16_t a[4 * MLKEM_N],
7171
const int16_t b[4 * MLKEM_N], const int16_t b_cache[4 * (MLKEM_N / 2)])
7272
{
7373
polyvec_basemul_acc_montgomery_cached_asm_k4_clean(r, a, b, b_cache);
7474
}
7575

76-
static INLINE void poly_tobytes_native(uint8_t r[MLKEM_POLYBYTES],
77-
const int16_t a[MLKEM_N])
76+
static MLK_INLINE void poly_tobytes_native(uint8_t r[MLKEM_POLYBYTES],
77+
const int16_t a[MLKEM_N])
7878
{
7979
poly_tobytes_asm_clean(r, a);
8080
}
8181

82-
static INLINE int rej_uniform_native(int16_t *r, unsigned len,
83-
const uint8_t *buf, unsigned buflen)
82+
static MLK_INLINE int rej_uniform_native(int16_t *r, unsigned len,
83+
const uint8_t *buf, unsigned buflen)
8484
{
8585
if (len != MLKEM_N || buflen % 24 != 0)
8686
{
@@ -89,6 +89,6 @@ static INLINE int rej_uniform_native(int16_t *r, unsigned len,
8989
return (int)rej_uniform_asm_clean(r, buf, buflen, rej_uniform_table);
9090
}
9191

92-
#endif /* MLKEM_NATIVE_ARITH_PROFILE_IMPL_H */
92+
#endif /* MLK_ARITH_PROFILE_IMPL_H */
9393

94-
#endif /* MLKEM_NATIVE_DEV_AARCH64_CLEAN_SRC_CLEAN_IMPL_H */
94+
#endif /* MLK_DEV_AARCH64_CLEAN_SRC_CLEAN_IMPL_H */

dev/aarch64_clean/src/consts.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
#ifndef MLKEM_NATIVE_DEV_AARCH64_CLEAN_SRC_CONSTS_H
7-
#define MLKEM_NATIVE_DEV_AARCH64_CLEAN_SRC_CONSTS_H
6+
#ifndef MLK_DEV_AARCH64_CLEAN_SRC_CONSTS_H
7+
#define MLK_DEV_AARCH64_CLEAN_SRC_CONSTS_H
88

99
#include <stdint.h>
1010
#include "../../../common.h"
1111

12-
#define zetas_mulcache_native MLKEM_NAMESPACE(zetas_mulcache_native)
12+
#define zetas_mulcache_native MLK_NAMESPACE(zetas_mulcache_native)
1313
extern const int16_t zetas_mulcache_native[256];
1414

1515
#define zetas_mulcache_twisted_native \
16-
MLKEM_NAMESPACE(zetas_mulcache_twisted_native)
16+
MLK_NAMESPACE(zetas_mulcache_twisted_native)
1717
extern const int16_t zetas_mulcache_twisted_native[256];
1818

19-
#endif /* MLKEM_NATIVE_DEV_AARCH64_CLEAN_SRC_CONSTS_H */
19+
#endif /* MLK_DEV_AARCH64_CLEAN_SRC_CONSTS_H */

0 commit comments

Comments
 (0)