Skip to content

Commit aaacec6

Browse files
David Chisnallhanno-becker
authored andcommitted
Allow the public header to work in C++ mode.
Without this, includes of the header must be wrapped in `extern "C"`, which then causes problems if the config header includes headers that expect to be included in C or C++ mode. Signed-off-by: David Chisnall <David.Chisnall@scisemi.com>
1 parent e06ba17 commit aaacec6

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ IncludeBlocks: Preserve
1717
# as "attributes" so they don't get increasingly indented line after line
1818
BreakBeforeBraces: Allman
1919
InsertBraces: true
20+
IndentExternBlock: NoIndent
2021
WhitespaceSensitiveMacros: ['__contract__', '__loop__', 'MLK_RV64V_ABS_BOUNDS16' ]
2122
Macros:
2223
# Make this artifically long to avoid function bodies after short contracts

mlkem/mlkem_native.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@
183183

184184
#include <stdint.h>
185185

186+
#ifdef __cplusplus
187+
extern "C"
188+
{
189+
#endif
190+
186191
/*************************************************
187192
* Name: crypto_kem_keypair_derand
188193
*
@@ -377,6 +382,10 @@ MLK_API_MUST_CHECK_RETURN_VALUE
377382
int MLK_API_NAMESPACE(check_sk)(
378383
const uint8_t sk[MLKEM_SECRETKEYBYTES(MLK_CONFIG_API_PARAMETER_SET)]);
379384

385+
#ifdef __cplusplus
386+
}
387+
#endif
388+
380389
/****************************** SUPERCOP API *********************************/
381390

382391
#if !defined(MLK_CONFIG_API_NO_SUPERCOP)

0 commit comments

Comments
 (0)