summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2006-11-24 17:27:43 +0100
committerNiels Möller <nisse@lysator.liu.se>2006-11-24 17:27:43 +0100
commit82cb285e0ff3c60f7a2b185803a493067d0d1713 (patch)
tree502eb8a180b0ce443ffcc423916b4f284109b893
parentf2b218bcaba3b7d50cfbad1b1029c954c54a0df6 (diff)
downloadnettle-82cb285e0ff3c60f7a2b185803a493067d0d1713.tar.gz
Added C++ guards.
Rev: src/nettle/aes.h:1.8 Rev: src/nettle/arcfour.h:1.6 Rev: src/nettle/arctwo.h:1.3 Rev: src/nettle/asn1.h:1.3 Rev: src/nettle/base16.h:1.4 Rev: src/nettle/base64.h:1.15 Rev: src/nettle/bignum.h:1.11 Rev: src/nettle/blowfish.h:1.10 Rev: src/nettle/buffer.h:1.6 Rev: src/nettle/cast128.h:1.6 Rev: src/nettle/cbc.h:1.9 Rev: src/nettle/ctr.h:1.3 Rev: src/nettle/des-compat.h:1.13 Rev: src/nettle/des.h:1.11 Rev: src/nettle/dsa.h:1.10 Rev: src/nettle/hmac.h:1.6 Rev: src/nettle/knuth-lfib.h:1.4 Rev: src/nettle/md2.h:1.4 Rev: src/nettle/md4.h:1.4 Rev: src/nettle/md5-compat.h:1.3 Rev: src/nettle/md5.h:1.9 Rev: src/nettle/memxor.h:1.5 Rev: src/nettle/nettle-meta.h:1.15 Rev: src/nettle/nettle-types.h:1.2 Rev: src/nettle/pgp.h:1.8 Rev: src/nettle/pkcs1.h:1.4 Rev: src/nettle/realloc.h:1.3 Rev: src/nettle/rsa-compat.h:1.4 Rev: src/nettle/rsa.h:1.26 Rev: src/nettle/serpent.h:1.8 Rev: src/nettle/sexp.h:1.18 Rev: src/nettle/sha.h:1.7 Rev: src/nettle/testsuite/testutils.h:1.24 Rev: src/nettle/twofish.h:1.7 Rev: src/nettle/yarrow.h:1.12
-rw-r--r--aes.h8
-rw-r--r--arcfour.h8
-rw-r--r--arctwo.h8
-rw-r--r--asn1.h8
-rw-r--r--base16.h8
-rw-r--r--base64.h8
-rw-r--r--bignum.h8
-rw-r--r--blowfish.h8
-rw-r--r--buffer.h8
-rw-r--r--cast128.h8
-rw-r--r--cbc.h8
-rw-r--r--ctr.h8
-rw-r--r--des-compat.h8
-rw-r--r--des.h8
-rw-r--r--dsa.h8
-rw-r--r--hmac.h8
-rw-r--r--knuth-lfib.h8
-rw-r--r--md2.h8
-rw-r--r--md4.h8
-rw-r--r--md5-compat.h8
-rw-r--r--md5.h8
-rw-r--r--memxor.h8
-rw-r--r--nettle-meta.h8
-rw-r--r--nettle-types.h9
-rw-r--r--pgp.h8
-rw-r--r--pkcs1.h8
-rw-r--r--realloc.h8
-rw-r--r--rsa-compat.h8
-rw-r--r--rsa.h8
-rw-r--r--serpent.h8
-rw-r--r--sexp.h8
-rw-r--r--sha.h7
-rw-r--r--testsuite/testutils.h8
-rw-r--r--twofish.h8
-rw-r--r--yarrow.h8
35 files changed, 278 insertions, 2 deletions
diff --git a/aes.h b/aes.h
index 97d8deef..10c567f3 100644
--- a/aes.h
+++ b/aes.h
@@ -28,6 +28,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define aes_set_encrypt_key nettle_aes_set_encrypt_key
#define aes_set_decrypt_key nettle_aes_set_decrypt_key
@@ -65,4 +69,8 @@ aes_decrypt(struct aes_ctx *ctx,
unsigned length, uint8_t *dst,
const uint8_t *src);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_AES_H_INCLUDED */
diff --git a/arcfour.h b/arcfour.h
index 66891f8a..f8e66892 100644
--- a/arcfour.h
+++ b/arcfour.h
@@ -28,6 +28,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define arcfour_set_key nettle_arcfour_set_key
#define arcfour_crypt nettle_arcfour_crypt
@@ -59,5 +63,9 @@ void
arcfour_stream(struct arcfour_ctx *ctx,
unsigned length, uint8_t *dst);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_ARCFOUR_H_INCLUDED */
diff --git a/arctwo.h b/arctwo.h
index 852564ac..fa1360de 100644
--- a/arctwo.h
+++ b/arctwo.h
@@ -29,6 +29,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define arctwo_set_key nettle_arctwo_set_key
#define arctwo_set_key_ekb nettle_arctwo_set_key_ekb
@@ -73,4 +77,8 @@ void
arctwo_decrypt (struct arctwo_ctx *ctx,
unsigned length, uint8_t *dst, const uint8_t *src);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_ARCTWO_H_INCLUDED */
diff --git a/asn1.h b/asn1.h
index dde627dc..a7bca6ec 100644
--- a/asn1.h
+++ b/asn1.h
@@ -28,6 +28,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define asn1_der_iterator_first nettle_asn1_der_iterator_first
#define asn1_der_iterator_next nettle_asn1_der_iterator_next
@@ -133,4 +137,8 @@ int
asn1_der_get_uint32(struct asn1_der_iterator *i,
uint32_t *x);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_ASN1_H_INCLUDED */
diff --git a/base16.h b/base16.h
index 2631fae4..967da4d1 100644
--- a/base16.h
+++ b/base16.h
@@ -29,6 +29,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define base16_encode_single nettle_base16_encode_single
#define base16_encode_update nettle_base16_encode_update
@@ -95,4 +99,8 @@ base16_decode_update(struct base16_decode_ctx *ctx,
int
base16_decode_final(struct base16_decode_ctx *ctx);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_BASE16_H_INCLUDED */
diff --git a/base64.h b/base64.h
index 7da84c15..279dff99 100644
--- a/base64.h
+++ b/base64.h
@@ -28,6 +28,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define base64_encode_init nettle_base64_encode_init
#define base64_encode_single nettle_base64_encode_single
@@ -142,4 +146,8 @@ base64_decode_update(struct base64_decode_ctx *ctx,
int
base64_decode_final(struct base64_decode_ctx *ctx);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_BASE64_H_INCLUDED */
diff --git a/bignum.h b/bignum.h
index a14f7d67..38b30905 100644
--- a/bignum.h
+++ b/bignum.h
@@ -31,6 +31,10 @@
#include <gmp.h>
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Size needed for signed encoding, including extra sign byte if
* necessary. */
unsigned
@@ -94,4 +98,8 @@ int
nettle_asn1_der_get_bignum(struct asn1_der_iterator *iterator,
mpz_t x, unsigned limit);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_BIGNUM_H_INCLUDED */
diff --git a/blowfish.h b/blowfish.h
index 3d343c6d..9e6175d6 100644
--- a/blowfish.h
+++ b/blowfish.h
@@ -28,6 +28,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define blowfish_set_key nettle_blowfish_set_key
#define blowfish_encrypt nettle_blowfish_encrypt
@@ -68,4 +72,8 @@ blowfish_decrypt(struct blowfish_ctx *ctx,
unsigned length, uint8_t *dst,
const uint8_t *src);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_BLOWFISH_H_INCLUDED */
diff --git a/buffer.h b/buffer.h
index 050b06ce..466ad92a 100644
--- a/buffer.h
+++ b/buffer.h
@@ -28,6 +28,10 @@
#include "realloc.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct nettle_buffer
{
uint8_t *contents;
@@ -87,4 +91,8 @@ int
nettle_buffer_copy(struct nettle_buffer *dst,
const struct nettle_buffer *src);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_BUFFER_H_INCLUDED */
diff --git a/cast128.h b/cast128.h
index b9437655..421a18e1 100644
--- a/cast128.h
+++ b/cast128.h
@@ -34,6 +34,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define cast128_set_key nettle_cast128_set_key
#define cast128_encrypt nettle_cast128_encrypt
@@ -66,4 +70,8 @@ cast128_decrypt(struct cast128_ctx *ctx,
unsigned length, uint8_t *dst,
const uint8_t *src);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_CAST128_H_INCLUDED */
diff --git a/cbc.h b/cbc.h
index 50335f84..13bf8dd8 100644
--- a/cbc.h
+++ b/cbc.h
@@ -28,6 +28,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define cbc_encrypt nettle_cbc_encrypt
#define cbc_decrypt nettle_cbc_decrypt
@@ -64,4 +68,8 @@ memcpy((ctx)->iv, (data), sizeof((ctx)->iv))
sizeof((self)->iv), (self)->iv, \
(length), (dst), (src)))
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_CBC_H_INCLUDED */
diff --git a/ctr.h b/ctr.h
index 95c16615..80abb6e8 100644
--- a/ctr.h
+++ b/ctr.h
@@ -29,6 +29,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define ctr_crypt nettle_ctr_crypt
@@ -51,4 +55,8 @@ memcpy((ctx)->ctr, (data), sizeof((ctx)->ctr))
sizeof((self)->ctr), (self)->ctr, \
(length), (dst), (src)))
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_CTR_H_INCLUDED */
diff --git a/des-compat.h b/des-compat.h
index 5545e548..d005a7ed 100644
--- a/des-compat.h
+++ b/des-compat.h
@@ -35,6 +35,10 @@
#include "des.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* We use some name mangling, to avoid collisions with either other
* nettle functions or with libcrypto. */
@@ -143,4 +147,8 @@ des_key_sched(const_des_cblock *key, des_key_schedule ctx);
int
des_is_weak_key(const_des_cblock *key);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_DES_COMPAT_H_INCLUDED */
diff --git a/des.h b/des.h
index 57e20250..b9de4caa 100644
--- a/des.h
+++ b/des.h
@@ -37,6 +37,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Namespace mangling */
#define des_set_key nettle_des_set_key
#define des_encrypt nettle_des_encrypt
@@ -102,4 +106,8 @@ des3_decrypt(const struct des3_ctx *ctx,
unsigned length, uint8_t *dst,
const uint8_t *src);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_DES_H_INCLUDED */
diff --git a/dsa.h b/dsa.h
index 1f06136f..6190c77f 100644
--- a/dsa.h
+++ b/dsa.h
@@ -35,6 +35,10 @@
/* For nettle_random_func */
#include "nettle-meta.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define dsa_public_key_init nettle_dsa_public_key_init
#define dsa_public_key_clear nettle_dsa_public_key_clear
@@ -191,4 +195,8 @@ dsa_keypair_from_sexp(struct dsa_public_key *pub,
unsigned length, const uint8_t *expr);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_DSA_H_INCLUDED */
diff --git a/hmac.h b/hmac.h
index a89fb2ee..09b8ba99 100644
--- a/hmac.h
+++ b/hmac.h
@@ -31,6 +31,10 @@
#include "md5.h"
#include "sha.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Namespace mangling */
#define hmac_set_key nettle_hmac_set_key
#define hmac_update nettle_hmac_update
@@ -122,4 +126,8 @@ void
hmac_sha256_digest(struct hmac_sha256_ctx *ctx,
unsigned length, uint8_t *digest);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_HMAC_H_INCLUDED */
diff --git a/knuth-lfib.h b/knuth-lfib.h
index 073c9df5..b52393e4 100644
--- a/knuth-lfib.h
+++ b/knuth-lfib.h
@@ -33,6 +33,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Namespace mangling */
#define knuth_lfib_init nettle_knuth_lfib_init
#define knuth_lfib_get nettle_knuth_lfib_get
@@ -64,4 +68,8 @@ void
knuth_lfib_random(struct knuth_lfib_ctx *ctx,
unsigned n, uint8_t *dst);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_KNUTH_LFIB_H_INCLUDED */
diff --git a/md2.h b/md2.h
index 2fbfbbcc..ac1cf33b 100644
--- a/md2.h
+++ b/md2.h
@@ -28,6 +28,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define md2_init nettle_md2_init
#define md2_update nettle_md2_update
@@ -58,4 +62,8 @@ md2_digest(struct md2_ctx *ctx,
uint8_t *digest);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_MD2_H_INCLUDED */
diff --git a/md4.h b/md4.h
index 7ccf8c33..e9a32b9e 100644
--- a/md4.h
+++ b/md4.h
@@ -28,6 +28,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define md4_init nettle_md4_init
#define md4_update nettle_md4_update
@@ -61,4 +65,8 @@ md4_digest(struct md4_ctx *ctx,
uint8_t *digest);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_MD4_H_INCLUDED */
diff --git a/md5-compat.h b/md5-compat.h
index 32925d09..8f5f3318 100644
--- a/md5-compat.h
+++ b/md5-compat.h
@@ -28,6 +28,10 @@
#include "md5.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define MD5Init nettle_MD5Init
#define MD5Update nettle_MD5Update
@@ -39,4 +43,8 @@ void MD5Init(MD5_CTX *ctx);
void MD5Update(MD5_CTX *ctx, const unsigned char *data, unsigned int length);
void MD5Final(unsigned char *out, MD5_CTX *ctx);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_MD5_COMPAT_H_INCLUDED */
diff --git a/md5.h b/md5.h
index c06c2288..c936cb26 100644
--- a/md5.h
+++ b/md5.h
@@ -28,6 +28,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define md5_init nettle_md5_init
#define md5_update nettle_md5_update
@@ -65,4 +69,8 @@ md5_digest(struct md5_ctx *ctx,
void
_nettle_md5_compress(uint32_t *state, const uint8_t *data);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_MD5_H_INCLUDED */
diff --git a/memxor.h b/memxor.h
index 5b43a99f..c9e563d4 100644
--- a/memxor.h
+++ b/memxor.h
@@ -8,7 +8,15 @@
#include <stdlib.h>
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
uint8_t *memxor(uint8_t *dst, const uint8_t *src, size_t n);
uint8_t *memxor3(uint8_t *dst, const uint8_t *a, const uint8_t *b, size_t n);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_MEMXOR_H_INCLUDED */
diff --git a/nettle-meta.h b/nettle-meta.h
index bcf5bd2a..05afb36f 100644
--- a/nettle-meta.h
+++ b/nettle-meta.h
@@ -28,6 +28,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Randomness. Used by key generation and dsa signature creation. */
typedef void (*nettle_random_func)(void *ctx,
unsigned length, uint8_t *dst);
@@ -231,4 +235,8 @@ struct nettle_armor
extern const struct nettle_armor nettle_base64;
extern const struct nettle_armor nettle_base16;
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_META_H_INCLUDED */
diff --git a/nettle-types.h b/nettle-types.h
index a9d854ff..7b982517 100644
--- a/nettle-types.h
+++ b/nettle-types.h
@@ -25,6 +25,10 @@
#include "nettle-stdint.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Uses a void * for cipher contexts.
For block ciphers it would make sense with a const void * for the
@@ -37,5 +41,8 @@ typedef void (*nettle_crypt_func)(void *ctx,
/* FIXME: Move more of the typedefs to this file? */
-#endif /* NETTLE_TYPES_H */
+#ifdef __cplusplus
+}
+#endif
+#endif /* NETTLE_TYPES_H */
diff --git a/pgp.h b/pgp.h
index 4b901a6d..fb3fdf5b 100644
--- a/pgp.h
+++ b/pgp.h
@@ -34,6 +34,10 @@
mpz_t defined. We don't do that here, in order to kludge through
compilation without public key support and without gmp.h. */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define pgp_put_uint32 nettle_pgp_put_uint32
#define pgp_put_uint16 nettle_pgp_put_uint16
@@ -232,4 +236,8 @@ enum pgp_subpacket_tag
PGP_SUBPACKET_REASON_FOR_REVOCATION = 29,
};
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_PGP_H_INCLUDED */
diff --git a/pkcs1.h b/pkcs1.h
index 29f06284..163c5dd3 100644
--- a/pkcs1.h
+++ b/pkcs1.h
@@ -29,6 +29,10 @@
#include <gmp.h>
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define pkcs1_signature_prefix nettle_pkcs1_signature_prefix
#define pkcs1_rsa_md5_encode nettle_pkcs1_rsa_md5_encode
@@ -57,4 +61,8 @@ pkcs1_rsa_sha1_encode(mpz_t m, unsigned length, struct sha1_ctx *hash);
void
pkcs1_rsa_sha1_encode_digest(mpz_t m, unsigned length, const uint8_t *digest);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_PKCS1_H_INCLUDED */
diff --git a/realloc.h b/realloc.h
index fcd4ca85..c8c6aa4c 100644
--- a/realloc.h
+++ b/realloc.h
@@ -27,9 +27,17 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef void *nettle_realloc_func(void *ctx, void *p, unsigned length);
nettle_realloc_func nettle_realloc;
nettle_realloc_func nettle_xrealloc;
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_REALLOC_H_INCLUDED */
diff --git a/rsa-compat.h b/rsa-compat.h
index 7b40f3cf..9622503d 100644
--- a/rsa-compat.h
+++ b/rsa-compat.h
@@ -28,6 +28,10 @@
#include "rsa.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define R_SignInit nettle_R_SignInit
#define R_SignUpdate nettle_R_SignUpdate
@@ -120,6 +124,8 @@ R_VerifyFinal(R_SIGNATURE_CTX *ctx,
unsigned length,
R_RSA_PUBLIC_KEY *key);
+#ifdef __cplusplus
+}
+#endif
#endif /* NETTLE_RSA_COMPAT_H_INCLUDED */
-
diff --git a/rsa.h b/rsa.h
index 4598d83e..a4ea4de7 100644
--- a/rsa.h
+++ b/rsa.h
@@ -35,6 +35,10 @@
/* For nettle_random_func */
#include "nettle-meta.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define rsa_public_key_init nettle_rsa_public_key_init
#define rsa_public_key_clear nettle_rsa_public_key_clear
@@ -324,4 +328,8 @@ _rsa_verify(const struct rsa_public_key *key,
unsigned
_rsa_check_size(mpz_t n);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_RSA_H_INCLUDED */
diff --git a/serpent.h b/serpent.h
index 4fb1d7d0..2238f45b 100644
--- a/serpent.h
+++ b/serpent.h
@@ -33,6 +33,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define serpent_set_key nettle_serpent_set_key
#define serpent_encrypt nettle_serpent_encrypt
@@ -70,4 +74,8 @@ serpent_decrypt(struct serpent_ctx *ctx,
unsigned length, uint8_t *dst,
const uint8_t *src);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_SERPENT_H_INCLUDED */
diff --git a/sexp.h b/sexp.h
index e8547592..d8b39bf5 100644
--- a/sexp.h
+++ b/sexp.h
@@ -29,6 +29,10 @@
#include <stdarg.h>
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define sexp_iterator_first nettle_sexp_iterator_first
#define sexp_transport_iterator_first nettle_sexp_transport_iterator_first
@@ -204,4 +208,8 @@ sexp_token_chars[0x80];
#define TOKEN_CHAR(c) ((c) < 0x80 && sexp_token_chars[(c)])
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_SEXP_H_INCLUDED */
diff --git a/sha.h b/sha.h
index 30a531f4..22725d14 100644
--- a/sha.h
+++ b/sha.h
@@ -28,6 +28,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define sha1_init nettle_sha1_init
#define sha1_update nettle_sha1_update
@@ -99,5 +103,8 @@ sha256_digest(struct sha256_ctx *ctx,
unsigned length,
uint8_t *digest);
+#ifdef __cplusplus
+}
+#endif
#endif /* NETTLE_SHA_H_INCLUDED */
diff --git a/testsuite/testutils.h b/testsuite/testutils.h
index 7cc4b1fb..c69f7e3e 100644
--- a/testsuite/testutils.h
+++ b/testsuite/testutils.h
@@ -22,6 +22,10 @@
#include "nettle-meta.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void *
xalloc(size_t size);
@@ -127,6 +131,10 @@ test_dsa_key(struct dsa_public_key *pub,
#endif /* WITH_PUBLIC_KEY */
+#ifdef __cplusplus
+}
+#endif
+
#define H2(d, s) decode_hex((d), (s))
#define H(x) decode_hex_dup(x)
#define HL(x) decode_hex_length(x), decode_hex_dup(x)
diff --git a/twofish.h b/twofish.h
index 9a1e9bab..a21d0ec5 100644
--- a/twofish.h
+++ b/twofish.h
@@ -34,6 +34,10 @@
#include "nettle-types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define twofish_set_key nettle_twofish_set_key
#define twofish_encrypt nettle_twofish_encrypt
@@ -67,4 +71,8 @@ twofish_decrypt(struct twofish_ctx *ctx,
unsigned length, uint8_t *dst,
const uint8_t *src);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_TWOFISH_H_INCLUDED */
diff --git a/yarrow.h b/yarrow.h
index 36f8741e..52690bcf 100644
--- a/yarrow.h
+++ b/yarrow.h
@@ -29,6 +29,10 @@
#include "aes.h"
#include "sha.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Name mangling */
#define yarrow256_init nettle_yarrow256_init
#define yarrow256_seed nettle_yarrow256_seed
@@ -120,4 +124,8 @@ unsigned
yarrow_key_event_estimate(struct yarrow_key_event_ctx *ctx,
unsigned key, unsigned time);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* NETTLE_YARROW_COMPAT_H_INCLUDED */