-
Notifications
You must be signed in to change notification settings - Fork 12
/
common.h
42 lines (36 loc) · 1.26 KB
/
common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* Copyright (c) 2024 The mlkem-native project authors
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef MLKEM_NATIVE_COMMON_H
#define MLKEM_NATIVE_COMMON_H
#if defined(MLKEM_NATIVE_CONFIG_FILE)
#include MLKEM_NATIVE_CONFIG_FILE
#endif /* MLKEM_NATIVE_CONFIG_FILE */
#include "params.h"
#include "sys.h"
/* Include backend metadata */
#if defined(MLKEM_USE_NATIVE)
#if defined(MLKEM_NATIVE_ARITH_BACKEND)
#include MLKEM_NATIVE_ARITH_BACKEND
#endif
#if defined(MLKEM_NATIVE_FIPS202_BACKEND)
#include MLKEM_NATIVE_FIPS202_BACKEND
#endif
#endif
/* This must come after the inclusion of the backend metadata
* since the backend choice may be part of the namespace. */
#include "namespace.h"
/* On Apple platforms, we need to emit leading underscore
* in front of assembly symbols. We thus introducee a separate
* namespace wrapper for ASM symbols. */
#if !defined(__APPLE__)
#define MLKEM_ASM_NAMESPACE(sym) MLKEM_NAMESPACE(sym)
#define FIPS202_ASM_NAMESPACE(sym) FIPS202_NAMESPACE(sym)
#else
#define _PREFIX_UNDERSCORE(sym) _##sym
#define PREFIX_UNDERSCORE(sym) _PREFIX_UNDERSCORE(sym)
#define MLKEM_ASM_NAMESPACE(sym) PREFIX_UNDERSCORE(MLKEM_NAMESPACE(sym))
#define FIPS202_ASM_NAMESPACE(sym) PREFIX_UNDERSCORE(FIPS202_NAMESPACE(sym))
#endif
#endif /* MLKEM_NATIVE_COMMON_H */