diff options
author | Niels Möller <nisse@lysator.liu.se> | 2006-11-24 17:27:43 +0100 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2006-11-24 17:27:43 +0100 |
commit | 82cb285e0ff3c60f7a2b185803a493067d0d1713 (patch) | |
tree | 502eb8a180b0ce443ffcc423916b4f284109b893 | |
parent | f2b218bcaba3b7d50cfbad1b1029c954c54a0df6 (diff) | |
download | nettle-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.h | 8 | ||||
-rw-r--r-- | arcfour.h | 8 | ||||
-rw-r--r-- | arctwo.h | 8 | ||||
-rw-r--r-- | asn1.h | 8 | ||||
-rw-r--r-- | base16.h | 8 | ||||
-rw-r--r-- | base64.h | 8 | ||||
-rw-r--r-- | bignum.h | 8 | ||||
-rw-r--r-- | blowfish.h | 8 | ||||
-rw-r--r-- | buffer.h | 8 | ||||
-rw-r--r-- | cast128.h | 8 | ||||
-rw-r--r-- | cbc.h | 8 | ||||
-rw-r--r-- | ctr.h | 8 | ||||
-rw-r--r-- | des-compat.h | 8 | ||||
-rw-r--r-- | des.h | 8 | ||||
-rw-r--r-- | dsa.h | 8 | ||||
-rw-r--r-- | hmac.h | 8 | ||||
-rw-r--r-- | knuth-lfib.h | 8 | ||||
-rw-r--r-- | md2.h | 8 | ||||
-rw-r--r-- | md4.h | 8 | ||||
-rw-r--r-- | md5-compat.h | 8 | ||||
-rw-r--r-- | md5.h | 8 | ||||
-rw-r--r-- | memxor.h | 8 | ||||
-rw-r--r-- | nettle-meta.h | 8 | ||||
-rw-r--r-- | nettle-types.h | 9 | ||||
-rw-r--r-- | pgp.h | 8 | ||||
-rw-r--r-- | pkcs1.h | 8 | ||||
-rw-r--r-- | realloc.h | 8 | ||||
-rw-r--r-- | rsa-compat.h | 8 | ||||
-rw-r--r-- | rsa.h | 8 | ||||
-rw-r--r-- | serpent.h | 8 | ||||
-rw-r--r-- | sexp.h | 8 | ||||
-rw-r--r-- | sha.h | 7 | ||||
-rw-r--r-- | testsuite/testutils.h | 8 | ||||
-rw-r--r-- | twofish.h | 8 | ||||
-rw-r--r-- | yarrow.h | 8 |
35 files changed, 278 insertions, 2 deletions
@@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ - @@ -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 */ @@ -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 */ @@ -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 */ @@ -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) @@ -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 */ @@ -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 */ |