Skip to content

Commit 2db4371

Browse files
willieyzhanno-becker
authored andcommitted
Port: 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: willieyz <willie.zhao@chelpis.com>
1 parent 6704243 commit 2db4371

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.clang-format

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

mldsa/mldsa_native.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,12 @@
199199
#include <stddef.h>
200200
#include <stdint.h>
201201

202+
203+
#ifdef __cplusplus
204+
extern "C"
205+
{
206+
#endif
207+
202208
/*************************************************
203209
* Name: crypto_sign_keypair_internal
204210
*
@@ -845,6 +851,10 @@ int MLD_API_NAMESPACE(pk_from_sk)(
845851
#endif
846852
);
847853

854+
#ifdef __cplusplus
855+
}
856+
#endif
857+
848858
/****************************** SUPERCOP API *********************************/
849859

850860
#if !defined(MLD_CONFIG_API_NO_SUPERCOP)

0 commit comments

Comments
 (0)