Skip to content

Commit

Permalink
crypto_backend.h: Wrap APIs in extern C
Browse files Browse the repository at this point in the history
It's a good practice to mark public APIs as extern "C" so that
projects written in C++ can use our library.

[mbroz] It is not public API in cryptsetup, but we use this backend
in other projects, this aligns the code changes.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
  • Loading branch information
zippy2 authored and mbroz committed Oct 18, 2024
1 parent b7cf60f commit fb04611
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/crypto_backend/crypto_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#define char16_t uint16_t
#endif

# ifdef __cplusplus
extern "C" {
# endif

struct crypt_hash;
struct crypt_hmac;
struct crypt_cipher;
Expand Down Expand Up @@ -143,4 +147,8 @@ int crypt_backend_memeq(const void *m1, const void *m2, size_t n);
/* crypto backend running in FIPS mode */
bool crypt_fips_mode(void);

# ifdef __cplusplus
}
# endif

#endif /* _CRYPTO_BACKEND_H */

0 comments on commit fb04611

Please sign in to comment.