Commit 82cb285e authored by Niels Möller's avatar Niels Möller

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
parent f2b218bc
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#include "nettle-types.h" #include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */ /* Name mangling */
#define aes_set_encrypt_key nettle_aes_set_encrypt_key #define aes_set_encrypt_key nettle_aes_set_encrypt_key
#define aes_set_decrypt_key nettle_aes_set_decrypt_key #define aes_set_decrypt_key nettle_aes_set_decrypt_key
...@@ -65,4 +69,8 @@ aes_decrypt(struct aes_ctx *ctx, ...@@ -65,4 +69,8 @@ aes_decrypt(struct aes_ctx *ctx,
unsigned length, uint8_t *dst, unsigned length, uint8_t *dst,
const uint8_t *src); const uint8_t *src);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_AES_H_INCLUDED */ #endif /* NETTLE_AES_H_INCLUDED */
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#include "nettle-types.h" #include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */ /* Name mangling */
#define arcfour_set_key nettle_arcfour_set_key #define arcfour_set_key nettle_arcfour_set_key
#define arcfour_crypt nettle_arcfour_crypt #define arcfour_crypt nettle_arcfour_crypt
...@@ -59,5 +63,9 @@ void ...@@ -59,5 +63,9 @@ void
arcfour_stream(struct arcfour_ctx *ctx, arcfour_stream(struct arcfour_ctx *ctx,
unsigned length, uint8_t *dst); unsigned length, uint8_t *dst);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_ARCFOUR_H_INCLUDED */ #endif /* NETTLE_ARCFOUR_H_INCLUDED */
...@@ -29,6 +29,10 @@ ...@@ -29,6 +29,10 @@
#include "nettle-types.h" #include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */ /* Name mangling */
#define arctwo_set_key nettle_arctwo_set_key #define arctwo_set_key nettle_arctwo_set_key
#define arctwo_set_key_ekb nettle_arctwo_set_key_ekb #define arctwo_set_key_ekb nettle_arctwo_set_key_ekb
...@@ -73,4 +77,8 @@ void ...@@ -73,4 +77,8 @@ void
arctwo_decrypt (struct arctwo_ctx *ctx, arctwo_decrypt (struct arctwo_ctx *ctx,
unsigned length, uint8_t *dst, const uint8_t *src); unsigned length, uint8_t *dst, const uint8_t *src);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_ARCTWO_H_INCLUDED */ #endif /* NETTLE_ARCTWO_H_INCLUDED */
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#include "nettle-types.h" #include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */ /* Name mangling */
#define asn1_der_iterator_first nettle_asn1_der_iterator_first #define asn1_der_iterator_first nettle_asn1_der_iterator_first
#define asn1_der_iterator_next nettle_asn1_der_iterator_next #define asn1_der_iterator_next nettle_asn1_der_iterator_next
...@@ -133,4 +137,8 @@ int ...@@ -133,4 +137,8 @@ int
asn1_der_get_uint32(struct asn1_der_iterator *i, asn1_der_get_uint32(struct asn1_der_iterator *i,
uint32_t *x); uint32_t *x);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_ASN1_H_INCLUDED */ #endif /* NETTLE_ASN1_H_INCLUDED */
...@@ -29,6 +29,10 @@ ...@@ -29,6 +29,10 @@
#include "nettle-types.h" #include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */ /* Name mangling */
#define base16_encode_single nettle_base16_encode_single #define base16_encode_single nettle_base16_encode_single
#define base16_encode_update nettle_base16_encode_update #define base16_encode_update nettle_base16_encode_update
...@@ -95,4 +99,8 @@ base16_decode_update(struct base16_decode_ctx *ctx, ...@@ -95,4 +99,8 @@ base16_decode_update(struct base16_decode_ctx *ctx,
int int
base16_decode_final(struct base16_decode_ctx *ctx); base16_decode_final(struct base16_decode_ctx *ctx);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_BASE16_H_INCLUDED */ #endif /* NETTLE_BASE16_H_INCLUDED */
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#include "nettle-types.h" #include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */ /* Name mangling */
#define base64_encode_init nettle_base64_encode_init #define base64_encode_init nettle_base64_encode_init
#define base64_encode_single nettle_base64_encode_single #define base64_encode_single nettle_base64_encode_single
...@@ -142,4 +146,8 @@ base64_decode_update(struct base64_decode_ctx *ctx, ...@@ -142,4 +146,8 @@ base64_decode_update(struct base64_decode_ctx *ctx,
int int
base64_decode_final(struct base64_decode_ctx *ctx); base64_decode_final(struct base64_decode_ctx *ctx);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_BASE64_H_INCLUDED */ #endif /* NETTLE_BASE64_H_INCLUDED */
...@@ -31,6 +31,10 @@ ...@@ -31,6 +31,10 @@
#include <gmp.h> #include <gmp.h>
#include "nettle-types.h" #include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Size needed for signed encoding, including extra sign byte if /* Size needed for signed encoding, including extra sign byte if
* necessary. */ * necessary. */
unsigned unsigned
...@@ -94,4 +98,8 @@ int ...@@ -94,4 +98,8 @@ int
nettle_asn1_der_get_bignum(struct asn1_der_iterator *iterator, nettle_asn1_der_get_bignum(struct asn1_der_iterator *iterator,
mpz_t x, unsigned limit); mpz_t x, unsigned limit);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_BIGNUM_H_INCLUDED */ #endif /* NETTLE_BIGNUM_H_INCLUDED */
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#include "nettle-types.h" #include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */ /* Name mangling */
#define blowfish_set_key nettle_blowfish_set_key #define blowfish_set_key nettle_blowfish_set_key
#define blowfish_encrypt nettle_blowfish_encrypt #define blowfish_encrypt nettle_blowfish_encrypt
...@@ -68,4 +72,8 @@ blowfish_decrypt(struct blowfish_ctx *ctx, ...@@ -68,4 +72,8 @@ blowfish_decrypt(struct blowfish_ctx *ctx,
unsigned length, uint8_t *dst, unsigned length, uint8_t *dst,
const uint8_t *src); const uint8_t *src);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_BLOWFISH_H_INCLUDED */ #endif /* NETTLE_BLOWFISH_H_INCLUDED */
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#include "realloc.h" #include "realloc.h"
#ifdef __cplusplus
extern "C" {
#endif
struct nettle_buffer struct nettle_buffer
{ {
uint8_t *contents; uint8_t *contents;
...@@ -87,4 +91,8 @@ int ...@@ -87,4 +91,8 @@ int
nettle_buffer_copy(struct nettle_buffer *dst, nettle_buffer_copy(struct nettle_buffer *dst,
const struct nettle_buffer *src); const struct nettle_buffer *src);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_BUFFER_H_INCLUDED */ #endif /* NETTLE_BUFFER_H_INCLUDED */
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
#include "nettle-types.h" #include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */ /* Name mangling */
#define cast128_set_key nettle_cast128_set_key #define cast128_set_key nettle_cast128_set_key
#define cast128_encrypt nettle_cast128_encrypt #define cast128_encrypt nettle_cast128_encrypt
...@@ -66,4 +70,8 @@ cast128_decrypt(struct cast128_ctx *ctx, ...@@ -66,4 +70,8 @@ cast128_decrypt(struct cast128_ctx *ctx,
unsigned length, uint8_t *dst, unsigned length, uint8_t *dst,
const uint8_t *src); const uint8_t *src);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_CAST128_H_INCLUDED */ #endif /* NETTLE_CAST128_H_INCLUDED */
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#include "nettle-types.h" #include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */ /* Name mangling */
#define cbc_encrypt nettle_cbc_encrypt #define cbc_encrypt nettle_cbc_encrypt
#define cbc_decrypt nettle_cbc_decrypt #define cbc_decrypt nettle_cbc_decrypt
...@@ -64,4 +68,8 @@ memcpy((ctx)->iv, (data), sizeof((ctx)->iv)) ...@@ -64,4 +68,8 @@ memcpy((ctx)->iv, (data), sizeof((ctx)->iv))
sizeof((self)->iv), (self)->iv, \ sizeof((self)->iv), (self)->iv, \
(length), (dst), (src))) (length), (dst), (src)))
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_CBC_H_INCLUDED */ #endif /* NETTLE_CBC_H_INCLUDED */
...@@ -29,6 +29,10 @@ ...@@ -29,6 +29,10 @@
#include "nettle-types.h" #include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */ /* Name mangling */
#define ctr_crypt nettle_ctr_crypt #define ctr_crypt nettle_ctr_crypt
...@@ -51,4 +55,8 @@ memcpy((ctx)->ctr, (data), sizeof((ctx)->ctr)) ...@@ -51,4 +55,8 @@ memcpy((ctx)->ctr, (data), sizeof((ctx)->ctr))
sizeof((self)->ctr), (self)->ctr, \ sizeof((self)->ctr), (self)->ctr, \
(length), (dst), (src))) (length), (dst), (src)))
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_CTR_H_INCLUDED */ #endif /* NETTLE_CTR_H_INCLUDED */
...@@ -35,6 +35,10 @@ ...@@ -35,6 +35,10 @@
#include "des.h" #include "des.h"
#ifdef __cplusplus
extern "C" {
#endif
/* We use some name mangling, to avoid collisions with either other /* We use some name mangling, to avoid collisions with either other
* nettle functions or with libcrypto. */ * nettle functions or with libcrypto. */
...@@ -143,4 +147,8 @@ des_key_sched(const_des_cblock *key, des_key_schedule ctx); ...@@ -143,4 +147,8 @@ des_key_sched(const_des_cblock *key, des_key_schedule ctx);
int int
des_is_weak_key(const_des_cblock *key); des_is_weak_key(const_des_cblock *key);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_DES_COMPAT_H_INCLUDED */ #endif /* NETTLE_DES_COMPAT_H_INCLUDED */
...@@ -37,6 +37,10 @@ ...@@ -37,6 +37,10 @@
#include "nettle-types.h" #include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Namespace mangling */ /* Namespace mangling */
#define des_set_key nettle_des_set_key #define des_set_key nettle_des_set_key
#define des_encrypt nettle_des_encrypt #define des_encrypt nettle_des_encrypt
...@@ -102,4 +106,8 @@ des3_decrypt(const struct des3_ctx *ctx, ...@@ -102,4 +106,8 @@ des3_decrypt(const struct des3_ctx *ctx,
unsigned length, uint8_t *dst, unsigned length, uint8_t *dst,
const uint8_t *src); const uint8_t *src);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_DES_H_INCLUDED */ #endif /* NETTLE_DES_H_INCLUDED */
...@@ -35,6 +35,10 @@ ...@@ -35,6 +35,10 @@
/* For nettle_random_func */ /* For nettle_random_func */
#include "nettle-meta.h" #include "nettle-meta.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */ /* Name mangling */
#define dsa_public_key_init nettle_dsa_public_key_init #define dsa_public_key_init nettle_dsa_public_key_init
#define dsa_public_key_clear nettle_dsa_public_key_clear #define dsa_public_key_clear nettle_dsa_public_key_clear
...@@ -191,4 +195,8 @@ dsa_keypair_from_sexp(struct dsa_public_key *pub, ...@@ -191,4 +195,8 @@ dsa_keypair_from_sexp(struct dsa_public_key *pub,
unsigned length, const uint8_t *expr); unsigned length, const uint8_t *expr);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_DSA_H_INCLUDED */ #endif /* NETTLE_DSA_H_INCLUDED */
...@@ -31,6 +31,10 @@ ...@@ -31,6 +31,10 @@
#include "md5.h" #include "md5.h"
#include "sha.h" #include "sha.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Namespace mangling */ /* Namespace mangling */
#define hmac_set_key nettle_hmac_set_key #define hmac_set_key nettle_hmac_set_key
#define hmac_update nettle_hmac_update #define hmac_update nettle_hmac_update
...@@ -122,4 +126,8 @@ void ...@@ -122,4 +126,8 @@ void
hmac_sha256_digest(struct hmac_sha256_ctx *ctx, hmac_sha256_digest(struct hmac_sha256_ctx *ctx,
unsigned length, uint8_t *digest); unsigned length, uint8_t *digest);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_HMAC_H_INCLUDED */ #endif /* NETTLE_HMAC_H_INCLUDED */
...@@ -33,6 +33,10 @@ ...@@ -33,6 +33,10 @@
#include "nettle-types.h" #include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Namespace mangling */ /* Namespace mangling */
#define knuth_lfib_init nettle_knuth_lfib_init #define knuth_lfib_init nettle_knuth_lfib_init
#define knuth_lfib_get nettle_knuth_lfib_get #define knuth_lfib_get nettle_knuth_lfib_get
...@@ -64,4 +68,8 @@ void ...@@ -64,4 +68,8 @@ void
knuth_lfib_random(struct knuth_lfib_ctx *ctx, knuth_lfib_random(struct knuth_lfib_ctx *ctx,
unsigned n, uint8_t *dst); unsigned n, uint8_t *dst);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_KNUTH_LFIB_H_INCLUDED */ #endif /* NETTLE_KNUTH_LFIB_H_INCLUDED */
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#include "nettle-types.h" #include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */ /* Name mangling */
#define md2_init nettle_md2_init #define md2_init nettle_md2_init
#define md2_update nettle_md2_update #define md2_update nettle_md2_update
...@@ -58,4 +62,8 @@ md2_digest(struct md2_ctx *ctx, ...@@ -58,4 +62,8 @@ md2_digest(struct md2_ctx *ctx,
uint8_t *digest); uint8_t *digest);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_MD2_H_INCLUDED */ #endif /* NETTLE_MD2_H_INCLUDED */
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#include "nettle-types.h" #include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */ /* Name mangling */
#define md4_init nettle_md4_init #define md4_init nettle_md4_init
#define md4_update nettle_md4_update #define md4_update nettle_md4_update
...@@ -61,4 +65,8 @@ md4_digest(struct md4_ctx *ctx, ...@@ -61,4 +65,8 @@ md4_digest(struct md4_ctx *ctx,
uint8_t *digest); uint8_t *digest);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_MD4_H_INCLUDED */ #endif /* NETTLE_MD4_H_INCLUDED */
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#include "md5.h" #include "md5.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */ /* Name mangling */
#define MD5Init nettle_MD5Init #define MD5Init nettle_MD5Init
#define MD5Update nettle_MD5Update #define MD5Update nettle_MD5Update
...@@ -39,4 +43,8 @@ void MD5Init(MD5_CTX *ctx); ...@@ -39,4 +43,8 @@ void MD5Init(MD5_CTX *ctx);
void MD5Update(MD5_CTX *ctx, const unsigned char *data, unsigned int length); void MD5Update(MD5_CTX *ctx, const unsigned char *data, unsigned int length);
void MD5Final(unsigned char *out, MD5_CTX *ctx); void MD5Final(unsigned char *out, MD5_CTX *ctx);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_MD5_COMPAT_H_INCLUDED */ #endif /* NETTLE_MD5_COMPAT_H_INCLUDED */
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#include "nettle-types.h" #include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */ /* Name mangling */
#define md5_init nettle_md5_init #define md5_init nettle_md5_init
#define md5_update nettle_md5_update #define md5_update nettle_md5_update
...@@ -65,4 +69,8 @@ md5_digest(struct md5_ctx *ctx, ...@@ -65,4 +69,8 @@ md5_digest(struct md5_ctx *ctx,
void void
_nettle_md5_compress(uint32_t *state, const uint8_t *data); _nettle_md5_compress(uint32_t *state, const uint8_t *data);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_MD5_H_INCLUDED */ #endif /* NETTLE_MD5_H_INCLUDED */
...@@ -8,7 +8,15 @@ ...@@ -8,7 +8,15 @@
#include <stdlib.h> #include <stdlib.h>
#include "nettle-types.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 *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); 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 */ #endif /* NETTLE_MEMXOR_H_INCLUDED */
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#include "nettle-types.h" #include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Randomness. Used by key generation and dsa signature creation. */ /* Randomness. Used by key generation and dsa signature creation. */
typedef void (*nettle_random_func)(void *ctx, typedef void (*nettle_random_func)(void *ctx,
unsigned length, uint8_t *dst); unsigned length, uint8_t *dst);
...@@ -231,4 +235,8 @@ struct nettle_armor ...@@ -231,4 +235,8 @@ struct nettle_armor
extern const struct nettle_armor nettle_base64; extern const struct nettle_armor nettle_base64;
extern const struct nettle_armor nettle_base16; extern const struct nettle_armor nettle_base16;
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_META_H_INCLUDED */ #endif /* NETTLE_META_H_INCLUDED */
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
#include "nettle-stdint.h" #include "nettle-stdint.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Uses a void * for cipher contexts. /* Uses a void * for cipher contexts.
For block ciphers it would make sense with a const void * for the For block ciphers it would make sense with a const void * for the
...@@ -37,5 +41,8 @@ typedef void (*nettle_crypt_func)(void *ctx, ...@@ -37,5 +41,8 @@ typedef void (*nettle_crypt_func)(void *ctx,
/* FIXME: Move more of the typedefs to this file? */ /* FIXME: Move more of the typedefs to this file? */
#endif /* NETTLE_TYPES_H */ #ifdef __cplusplus
}
#endif
#endif /* NETTLE_TYPES_H */
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
mpz_t defined. We don't do that here, in order to kludge through mpz_t defined. We don't do that here, in order to kludge through
compilation without public key support and without gmp.h. */ compilation without public key support and without gmp.h. */
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */ /* Name mangling */
#define pgp_put_uint32 nettle_pgp_put_uint32 #define pgp_put_uint32 nettle_pgp_put_uint32
#define pgp_put_uint16 nettle_pgp_put_uint16 #define pgp_put_uint16 nettle_pgp_put_uint16
...@@ -232,4 +236,8 @@ enum pgp_subpacket_tag ...@@ -232,4 +236,8 @@ enum pgp_subpacket_tag
PGP_SUBPACKET_REASON_FOR_REVOCATION = 29, PGP_SUBPACKET_REASON_FOR_REVOCATION = 29,
};