commit c271eb3: [Rework] Add C++ guards to all headers

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Jul 8 14:28:07 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-07-08 15:22:05 +0100
URL: https://github.com/rspamd/rspamd/commit/c271eb36656a4ff88a9c8c1d59934949260275a3 (HEAD -> master)

[Rework] Add C++ guards to all headers

---
 src/client/rspamdclient.h                |   11 +-
 src/libcryptobox/base64/base64.h         |   10 +-
 src/libcryptobox/catena/catena.h         |   24 +-
 src/libcryptobox/chacha20/chacha.h       |   27 +-
 src/libcryptobox/cryptobox.h             |  110 +-
 src/libcryptobox/curve25519/curve25519.h |   12 +-
 src/libcryptobox/curve25519/fe.h         |  159 +-
 src/libcryptobox/ed25519/ed25519.h       |   24 +-
 src/libcryptobox/keypair.h               |   90 +-
 src/libcryptobox/keypair_private.h       |   11 +-
 src/libcryptobox/keypairs_cache.h        |   14 +-
 src/libmime/archives.h                   |   10 +-
 src/libmime/content_type.h               |   27 +-
 src/libmime/email_addr.h                 |   18 +-
 src/libmime/filter.h                     |   40 +-
 src/libmime/filter_private.h             |    8 +
 src/libmime/images.h                     |   14 +-
 src/libmime/lang_detection.h             |   22 +-
 src/libmime/message.h                    |   29 +-
 src/libmime/mime_encoding.c              |    1 +
 src/libmime/mime_encoding.h              |   23 +-
 src/libmime/mime_expressions.h           |   16 +-
 src/libmime/mime_headers.h               |   22 +-
 src/libmime/mime_parser.h                |   12 +-
 src/libmime/smtp_parsers.h               |   27 +-
 src/libserver/async_session.h            |   41 +-
 src/libserver/cfg_file.h                 |  189 +-
 src/libserver/cfg_file_private.h         |    8 +
 src/libserver/cfg_rcl.h                  |    9 +
 src/libserver/composites.h               |    8 +
 src/libserver/dkim.h                     |   90 +-
 src/libserver/dns.h                      |   28 +-
 src/libserver/dynamic_cfg.h              |   29 +-
 src/libserver/fuzzy_backend.h            |   45 +-
 src/libserver/fuzzy_backend_redis.h      |   52 +-
 src/libserver/fuzzy_backend_sqlite.h     |   25 +-
 src/libserver/fuzzy_wire.h               |    8 +
 src/libserver/html.h                     |   28 +-
 src/libserver/html_colors.h              | 1360 +++++-----
 src/libserver/html_entities.h            | 4258 +++++++++++++++---------------
 src/libserver/html_tags.h                |   10 +-
 src/libserver/milter.h                   |   43 +-
 src/libserver/milter_internal.h          |   63 +-
 src/libserver/monitored.h                |   33 +-
 src/libserver/protocol.h                 |   38 +-
 src/libserver/protocol_internal.h        |    8 +
 src/libserver/re_cache.h                 |   50 +-
 src/libserver/redis_pool.h               |   19 +-
 src/libserver/roll_history.h             |   18 +-
 src/libserver/rspamd_control.h           |   47 +-
 src/libserver/rspamd_symcache.h          |   83 +-
 src/libserver/spf.h                      |   23 +-
 src/libserver/task.h                     |  200 +-
 src/libserver/url.h                      |   26 +-
 src/libserver/worker_util.h              |   48 +-
 src/libstat/backends/backends.h          |  136 +-
 src/libstat/classifiers/classifiers.h    |   75 +-
 src/libstat/learn_cache/learn_cache.h    |   67 +-
 src/libstat/stat_api.h                   |   26 +-
 src/libstat/stat_internal.h              |   37 +-
 src/libstat/tokenizers/tokenizers.h      |   43 +-
 src/libutil/addr.h                       |   70 +-
 src/libutil/expression.h                 |   30 +-
 src/libutil/fstring.h                    |   65 +-
 src/libutil/hash.h                       |   28 +-
 src/libutil/heap.h                       |   20 +-
 src/libutil/http_connection.h            |   30 +-
 src/libutil/http_context.h               |   20 +-
 src/libutil/http_message.h               |   35 +-
 src/libutil/http_private.h               |   17 +-
 src/libutil/http_router.h                |   14 +-
 src/libutil/http_util.h                  |    8 +
 src/libutil/libev_helper.h               |   13 +-
 src/libutil/logger.h                     |   90 +-
 src/libutil/map.h                        |   36 +-
 src/libutil/map_helpers.h                |   58 +-
 src/libutil/map_private.h                |   15 +-
 src/libutil/mem_pool.h                   |   85 +-
 src/libutil/multipattern.h               |   39 +-
 src/libutil/printf.h                     |   28 +-
 src/libutil/radix.h                      |   29 +-
 src/libutil/ref.h                        |    2 +
 src/libutil/regexp.h                     |   48 +-
 src/libutil/rrd.c                        |    1 +
 src/libutil/rrd.h                        |   90 +-
 src/libutil/shingles.h                   |   38 +-
 src/libutil/sqlite_utils.h               |   23 +-
 src/libutil/ssl_util.h                   |   29 +-
 src/libutil/str_util.h                   |  126 +-
 src/libutil/upstream.h                   |   56 +-
 src/libutil/util.h                       |   98 +-
 src/lua/lua_common.h                     |  164 +-
 src/lua/lua_map.h                        |    8 +
 src/lua/lua_thread_pool.h                |   44 +-
 src/rspamadm/rspamadm.h                  |   21 +-
 src/rspamd.h                             |   74 +-
 src/worker_private.h                     |   15 +-
 test/tests.h                             |   10 +-
 98 files changed, 5364 insertions(+), 4245 deletions(-)

diff --git a/src/client/rspamdclient.h b/src/client/rspamdclient.h
index 9fced29af..dc274b7a8 100644
--- a/src/client/rspamdclient.h
+++ b/src/client/rspamdclient.h
@@ -20,6 +20,10 @@
 #include "ucl.h"
 #include "contrib/libev/ev.h"
 
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
 struct rspamd_client_connection;
 struct rspamd_http_message;
 
@@ -48,6 +52,7 @@ typedef void (*rspamd_client_callback) (
 		GError *err);
 
 struct rspamd_http_context;
+
 /**
  * Start rspamd worker or controller command
  * @param ev_base event base
@@ -56,7 +61,7 @@ struct rspamd_http_context;
  * @param timeout timeout in seconds
  * @return
  */
-struct rspamd_client_connection * rspamd_client_init (
+struct rspamd_client_connection *rspamd_client_init (
 		struct rspamd_http_context *http_ctx,
 		struct ev_loop *ev_base,
 		const gchar *name,
@@ -92,4 +97,8 @@ gboolean rspamd_client_command (
  */
 void rspamd_client_destroy (struct rspamd_client_connection *conn);
 
+#ifdef  __cplusplus
+}
+#endif
+
 #endif /* RSPAMDCLIENT_H_ */
diff --git a/src/libcryptobox/base64/base64.h b/src/libcryptobox/base64/base64.h
index e7c639d58..e2be379b5 100644
--- a/src/libcryptobox/base64/base64.h
+++ b/src/libcryptobox/base64/base64.h
@@ -18,6 +18,14 @@
 
 #include "config.h"
 
-const char* base64_load (void);
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+const char *base64_load (void);
+
+#ifdef  __cplusplus
+}
+#endif
 
 #endif /* SRC_LIBCRYPTOBOX_BASE64_BASE64_H_ */
diff --git a/src/libcryptobox/catena/catena.h b/src/libcryptobox/catena/catena.h
index 56da560ea..bf81cc0f9 100644
--- a/src/libcryptobox/catena/catena.h
+++ b/src/libcryptobox/catena/catena.h
@@ -24,12 +24,16 @@
 
 #define CATENA_HLEN 64
 
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
 int
-catena (const uint8_t *pwd,   const uint32_t pwdlen,
-	   const uint8_t *salt,  const uint8_t  saltlen,
-	   const uint8_t *data,  const uint32_t datalen,
-	   const uint8_t lambda, const uint8_t  min_garlic,
-	   const uint8_t garlic, const uint8_t hashlen,  uint8_t *hash);
+catena (const uint8_t *pwd, const uint32_t pwdlen,
+		const uint8_t *salt, const uint8_t saltlen,
+		const uint8_t *data, const uint32_t datalen,
+		const uint8_t lambda, const uint8_t min_garlic,
+		const uint8_t garlic, const uint8_t hashlen, uint8_t *hash);
 
 /**
  * Simple interface for catena PBKDF
@@ -43,13 +47,17 @@ catena (const uint8_t *pwd,   const uint32_t pwdlen,
  * @return 0 if hash is generated, -1 in case of error
  */
 int simple_catena (const uint8_t *pwd, const uint32_t pwdlen,
-		   const uint8_t *salt, const uint8_t  saltlen,
-		   const uint8_t *data, const uint32_t datalen,
-		   uint8_t hash[CATENA_HLEN]);
+				   const uint8_t *salt, const uint8_t saltlen,
+				   const uint8_t *data, const uint32_t datalen,
+				   uint8_t hash[CATENA_HLEN]);
 
 /**
  * Run a quick test on catena implementation
  */
 int catena_test (void);
 
+#ifdef  __cplusplus
+}
+#endif
+
 #endif /* SRC_LIBCRYPTOBOX_CATENA_CATENA_H_ */
diff --git a/src/libcryptobox/chacha20/chacha.h b/src/libcryptobox/chacha20/chacha.h
index 7f93a4517..02d6dba00 100644
--- a/src/libcryptobox/chacha20/chacha.h
+++ b/src/libcryptobox/chacha20/chacha.h
@@ -29,6 +29,10 @@
 
 #define CHACHA_BLOCKBYTES 64
 
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
 typedef struct chacha_state_internal_t {
 	unsigned char s[48];
 	size_t rounds;
@@ -53,26 +57,31 @@ typedef struct chacha_iv24_t {
 } chacha_iv24;
 
 void hchacha (const unsigned char key[32], const unsigned char iv[16],
-		unsigned char out[32], size_t rounds);
+			  unsigned char out[32], size_t rounds);
 
 void chacha_init (chacha_state *S, const chacha_key *key, const chacha_iv *iv,
-		size_t rounds);
+				  size_t rounds);
 
 void xchacha_init (chacha_state *S, const chacha_key *key,
-		const chacha_iv24 *iv, size_t rounds);
+				   const chacha_iv24 *iv, size_t rounds);
 
 size_t chacha_update (chacha_state *S, const unsigned char *in,
-		unsigned char *out, size_t inlen);
+					  unsigned char *out, size_t inlen);
 
 size_t chacha_final (chacha_state *S, unsigned char *out);
 
 void chacha (const chacha_key *key, const chacha_iv *iv,
-		const unsigned char *in, unsigned char *out, size_t inlen,
-		size_t rounds);
+			 const unsigned char *in, unsigned char *out, size_t inlen,
+			 size_t rounds);
+
 void xchacha (const chacha_key *key, const chacha_iv24 *iv,
-		const unsigned char *in, unsigned char *out, size_t inlen,
-		size_t rounds);
+			  const unsigned char *in, unsigned char *out, size_t inlen,
+			  size_t rounds);
+
+const char *chacha_load (void);
 
-const char* chacha_load (void);
+#ifdef  __cplusplus
+}
+#endif
 
 #endif /* CHACHA_H_ */
diff --git a/src/libcryptobox/cryptobox.h b/src/libcryptobox/cryptobox.h
index df713d79b..d9e4f51cd 100644
--- a/src/libcryptobox/cryptobox.h
+++ b/src/libcryptobox/cryptobox.h
@@ -18,14 +18,18 @@
 
 #include "config.h"
 
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
 struct rspamd_cryptobox_segment {
 	guchar *data;
 	gsize len;
 };
 
 #if defined(__GNUC__) && \
-	((defined(__clang__) && (__clang_major__ >= 4 || (__clang_major__ >= 3 && __clang_minor__ >= 8))) || \
-	((__GNUC__ == 4) &&  (__GNUC_MINOR__ >= 8) || (__GNUC__ > 4)))
+    ((defined(__clang__) && (__clang_major__ >= 4 || (__clang_major__ >= 3 && __clang_minor__ >= 8))) || \
+    ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8) || (__GNUC__ > 4)))
 #define RSPAMD_HAS_TARGET_ATTR 1
 #endif
 
@@ -81,7 +85,7 @@ struct rspamd_cryptobox_library_ctx {
 /**
  * Init cryptobox library
  */
-struct rspamd_cryptobox_library_ctx* rspamd_cryptobox_init (void);
+struct rspamd_cryptobox_library_ctx *rspamd_cryptobox_init (void);
 
 /**
  * Generate new keypair
@@ -89,7 +93,7 @@ struct rspamd_cryptobox_library_ctx* rspamd_cryptobox_init (void);
  * @param sk secret key buffer
  */
 void rspamd_cryptobox_keypair (rspamd_pk_t pk, rspamd_sk_t sk,
-		enum rspamd_cryptobox_mode mode);
+							   enum rspamd_cryptobox_mode mode);
 
 /**
  * Generate new keypair for signing
@@ -97,7 +101,7 @@ void rspamd_cryptobox_keypair (rspamd_pk_t pk, rspamd_sk_t sk,
  * @param sk secret key buffer
  */
 void rspamd_cryptobox_keypair_sig (rspamd_sig_pk_t pk, rspamd_sig_sk_t sk,
-		enum rspamd_cryptobox_mode mode);
+								   enum rspamd_cryptobox_mode mode);
 
 /**
  * Encrypt data inplace adding signature to sig afterwards
@@ -107,9 +111,9 @@ void rspamd_cryptobox_keypair_sig (rspamd_sig_pk_t pk, rspamd_sig_sk_t sk,
  * @param sig output signature
  */
 void rspamd_cryptobox_encrypt_inplace (guchar *data, gsize len,
-		const rspamd_nonce_t nonce,
-		const rspamd_pk_t pk, const rspamd_sk_t sk, rspamd_mac_t sig,
-		enum rspamd_cryptobox_mode mode);
+									   const rspamd_nonce_t nonce,
+									   const rspamd_pk_t pk, const rspamd_sk_t sk, rspamd_mac_t sig,
+									   enum rspamd_cryptobox_mode mode);
 
 /**
  * Encrypt segments of data inplace adding signature to sig afterwards
@@ -120,10 +124,10 @@ void rspamd_cryptobox_encrypt_inplace (guchar *data, gsize len,
  * @param sig output signature
  */
 void rspamd_cryptobox_encryptv_inplace (struct rspamd_cryptobox_segment *segments,
-		gsize cnt,
-		const rspamd_nonce_t nonce,
-		const rspamd_pk_t pk, const rspamd_sk_t sk, rspamd_mac_t sig,
-		enum rspamd_cryptobox_mode mode);
+										gsize cnt,
+										const rspamd_nonce_t nonce,
+										const rspamd_pk_t pk, const rspamd_sk_t sk, rspamd_mac_t sig,
+										enum rspamd_cryptobox_mode mode);
 
 
 /**
@@ -136,9 +140,9 @@ void rspamd_cryptobox_encryptv_inplace (struct rspamd_cryptobox_segment *segment
  * @return TRUE if input has been verified successfully
  */
 gboolean rspamd_cryptobox_decrypt_inplace (guchar *data, gsize len,
-		const rspamd_nonce_t nonce,
-		const rspamd_pk_t pk, const rspamd_sk_t sk, const rspamd_mac_t sig,
-		enum rspamd_cryptobox_mode mode);
+										   const rspamd_nonce_t nonce,
+										   const rspamd_pk_t pk, const rspamd_sk_t sk, const rspamd_mac_t sig,
+										   enum rspamd_cryptobox_mode mode);
 
 /**
  * Encrypt segments of data inplace adding signature to sig afterwards
@@ -149,9 +153,9 @@ gboolean rspamd_cryptobox_decrypt_inplace (guchar *data, gsize len,
  * @param sig output signature
  */
 void rspamd_cryptobox_encrypt_nm_inplace (guchar *data, gsize len,
-		const rspamd_nonce_t nonce,
-		const rspamd_nm_t nm, rspamd_mac_t sig,
-		enum rspamd_cryptobox_mode mode);
+										  const rspamd_nonce_t nonce,
+										  const rspamd_nm_t nm, rspamd_mac_t sig,
+										  enum rspamd_cryptobox_mode mode);
 
 /**
  * Encrypt segments of data inplace adding signature to sig afterwards
@@ -162,10 +166,10 @@ void rspamd_cryptobox_encrypt_nm_inplace (guchar *data, gsize len,
  * @param sig output signature
  */
 void rspamd_cryptobox_encryptv_nm_inplace (struct rspamd_cryptobox_segment *segments,
-		gsize cnt,
-		const rspamd_nonce_t nonce,
-		const rspamd_nm_t nm, rspamd_mac_t sig,
-		enum rspamd_cryptobox_mode mode);
+										   gsize cnt,
+										   const rspamd_nonce_t nonce,
+										   const rspamd_nm_t nm, rspamd_mac_t sig,
+										   enum rspamd_cryptobox_mode mode);
 
 
 /**
@@ -178,9 +182,9 @@ void rspamd_cryptobox_encryptv_nm_inplace (struct rspamd_cryptobox_segment *segm
  * @return TRUE if input has been verified successfully
  */
 gboolean rspamd_cryptobox_decrypt_nm_inplace (guchar *data, gsize len,
-		 const rspamd_nonce_t nonce,
-		 const rspamd_nm_t nm, const rspamd_mac_t sig,
-		 enum rspamd_cryptobox_mode mode);
+											  const rspamd_nonce_t nonce,
+											  const rspamd_nm_t nm, const rspamd_mac_t sig,
+											  enum rspamd_cryptobox_mode mode);
 
 /**
  * Generate shared secret from local sk and remote pk
@@ -189,7 +193,7 @@ gboolean rspamd_cryptobox_decrypt_nm_inplace (guchar *data, gsize len,
  * @param sk local privkey
  */
 void rspamd_cryptobox_nm (rspamd_nm_t nm, const rspamd_pk_t pk,
-		const rspamd_sk_t sk, enum rspamd_cryptobox_mode mode);
+						  const rspamd_sk_t sk, enum rspamd_cryptobox_mode mode);
 
 /**
  * Create digital signature for the specified message and place result in `sig`
@@ -200,9 +204,9 @@ void rspamd_cryptobox_nm (rspamd_nm_t nm, const rspamd_pk_t pk,
  * @param sk secret key
  */
 void rspamd_cryptobox_sign (guchar *sig, gsize *siglen_p,
-		const guchar *m, gsize mlen,
-		const rspamd_sk_t sk,
-		enum rspamd_cryptobox_mode mode);
+							const guchar *m, gsize mlen,
+							const rspamd_sk_t sk,
+							enum rspamd_cryptobox_mode mode);
 
 /**
  * Verifies digital signature for the specified message using the specified
@@ -214,18 +218,18 @@ void rspamd_cryptobox_sign (guchar *sig, gsize *siglen_p,
  * @return true if signature is valid, false otherwise
  */
 bool rspamd_cryptobox_verify (const guchar *sig,
-		gsize siglen,
-		const guchar *m,
-		gsize mlen,
-		const rspamd_pk_t pk,
-		enum rspamd_cryptobox_mode mode);
+							  gsize siglen,
+							  const guchar *m,
+							  gsize mlen,
+							  const rspamd_pk_t pk,
+							  enum rspamd_cryptobox_mode mode);
 
 /**
  * Securely clear the buffer specified
  * @param buf buffer to zero
  * @param buflen length of buffer
  */
-void rspamd_explicit_memzero (void * const buf, gsize buflen);
+void rspamd_explicit_memzero (void *const buf, gsize buflen);
 
 /**
  * Constant time memcmp
@@ -245,8 +249,8 @@ rspamd_cryptobox_memcmp (const void *const b1_, const void *const b2_, gsize len
  * @param k key (must be 16 bytes)
  */
 void rspamd_cryptobox_siphash (unsigned char *out, const unsigned char *in,
-		unsigned long long inlen,
-		const rspamd_sipkey_t k);
+							   unsigned long long inlen,
+							   const rspamd_sipkey_t k);
 
 enum rspamd_cryptobox_pbkdf_type {
 	RSPAMD_CRYPTOBOX_PBKDF2 = 0,
@@ -266,10 +270,10 @@ enum rspamd_cryptobox_pbkdf_type {
  * @return TRUE in case of success and FALSE if failed
  */
 gboolean rspamd_cryptobox_pbkdf (const char *pass, gsize pass_len,
-		const guint8 *salt, gsize salt_len,
-		guint8 *key, gsize key_len,
-		unsigned int complexity,
-		enum rspamd_cryptobox_pbkdf_type type);
+								 const guint8 *salt, gsize salt_len,
+								 guint8 *key, gsize key_len,
+								 unsigned int complexity,
+								 enum rspamd_cryptobox_pbkdf_type type);
 
 
 /**
@@ -313,7 +317,7 @@ guint rspamd_cryptobox_mac_bytes (enum rspamd_cryptobox_mode mode);
 guint rspamd_cryptobox_signature_bytes (enum rspamd_cryptobox_mode mode);
 
 /* Hash IUF interface */
-typedef struct rspamd_cryptobox_hash_state_s  {
+typedef struct rspamd_cryptobox_hash_state_s {
 	unsigned char opaque[256];
 } rspamd_cryptobox_hash_state_t;
 
@@ -338,10 +342,10 @@ void rspamd_cryptobox_hash_final (void *st, guchar *out);
  * One in all function
  */
 void rspamd_cryptobox_hash (guchar *out,
-		const guchar *data,
-		gsize len,
-		const guchar *key,
-		gsize keylen);
+							const guchar *data,
+							gsize len,
+							const guchar *key,
+							gsize keylen);
 
 enum rspamd_cryptobox_fast_hash_type {
 	RSPAMD_CRYPTOBOX_XXHASH64 = 0,
@@ -353,7 +357,7 @@ enum rspamd_cryptobox_fast_hash_type {
 };
 
 /* Non crypto hash IUF interface */
-typedef struct rspamd_cryptobox_fast_hash_state_s  {
+typedef struct rspamd_cryptobox_fast_hash_state_s {
 	guint64 opaque[11];
 	enum rspamd_cryptobox_fast_hash_type type;
 } rspamd_cryptobox_fast_hash_state_t;
@@ -364,7 +368,7 @@ typedef struct rspamd_cryptobox_fast_hash_state_s  {
  * non-keyed hash is generated
  */
 void rspamd_cryptobox_fast_hash_init (rspamd_cryptobox_fast_hash_state_t *st,
-		guint64 seed);
+									  guint64 seed);
 
 /**
  * Init cryptobox hash state using key if needed, `st` must point to the buffer
@@ -379,7 +383,7 @@ void rspamd_cryptobox_fast_hash_init_specific (rspamd_cryptobox_fast_hash_state_
  * Update hash with data portion
  */
 void rspamd_cryptobox_fast_hash_update (rspamd_cryptobox_fast_hash_state_t *st,
-		const void *data, gsize len);
+										const void *data, gsize len);
 
 /**
  * Output hash to the buffer of rspamd_cryptobox_HASHBYTES length
@@ -390,7 +394,7 @@ guint64 rspamd_cryptobox_fast_hash_final (rspamd_cryptobox_fast_hash_state_t *st
  * One in all function
  */
 guint64 rspamd_cryptobox_fast_hash (const void *data,
-		gsize len, guint64 seed);
+									gsize len, guint64 seed);
 
 /**
  * Platform independent version
@@ -409,7 +413,7 @@ guint64 rspamd_cryptobox_fast_hash_specific (
  * @return
  */
 gboolean rspamd_cryptobox_base64_decode (const gchar *in, gsize inlen,
-		guchar *out, gsize *outlen);
+										 guchar *out, gsize *outlen);
 
 /**
  * Returns TRUE if data looks like a valid base64 string
@@ -419,4 +423,8 @@ gboolean rspamd_cryptobox_base64_decode (const gchar *in, gsize inlen,
  */
 gboolean rspamd_cryptobox_base64_is_valid (const gchar *in, gsize inlen);
 
+#ifdef  __cplusplus
+}
+#endif
+
 #endif /* CRYPTOBOX_H_ */
diff --git a/src/libcryptobox/curve25519/curve25519.h b/src/libcryptobox/curve25519/curve25519.h
index 8b404f5c6..c75c355f8 100644
--- a/src/libcryptobox/curve25519/curve25519.h
+++ b/src/libcryptobox/curve25519/curve25519.h
@@ -3,11 +3,21 @@
 
 #include "config.h"
 
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
 static const guchar curve25519_basepoint[32] = {9};
 
 int curve25519 (guchar *mypublic, const guchar *secret, const guchar *basepoint);
+
 /* Call for optimized implementation of scalarmult if needed */
 int curve25519_base (guchar *mypublic, const guchar *secret);
-const char* curve25519_load (void);
+
+const char *curve25519_load (void);
+
+#ifdef  __cplusplus
+}
+#endif
 
 #endif
diff --git a/src/libcryptobox/curve25519/fe.h b/src/libcryptobox/curve25519/fe.h
index a64206026..44e8b44a6 100644
--- a/src/libcryptobox/curve25519/fe.h
+++ b/src/libcryptobox/curve25519/fe.h
@@ -18,25 +18,44 @@
 #ifndef SRC_LIBCRYPTOBOX_CURVE25519_FE_H_
 #define SRC_LIBCRYPTOBOX_CURVE25519_FE_H_
 
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
 typedef int32_t fe[10];
 
-void fe_frombytes(fe,const unsigned char *);
-void fe_tobytes(unsigned char *,const fe);
-
-void fe_copy(fe,const fe);
-int fe_isnonzero(const fe);
-int fe_isnegative(const fe);
-void fe_0(fe);
-void fe_1(fe);
-void fe_cmov(fe,const fe,unsigned int);
-void fe_add(fe,const fe,const fe);
-void fe_sub(fe,const fe,const fe);
-void fe_neg(fe,const fe);
-void fe_mul(fe,const fe,const fe);
-void fe_sq(fe,const fe);
-void fe_sq2(fe,const fe);
-void fe_invert(fe,const fe);
-void fe_pow22523(fe,const fe);
+void fe_frombytes (fe, const unsigned char *);
+
+void fe_tobytes (unsigned char *, const fe);
+
+void fe_copy (fe, const fe);
+
+int fe_isnonzero (const fe);
+
+int fe_isnegative (const fe);
+
+void fe_0 (fe);
+
+void fe_1 (fe);
+
+void fe_cmov (fe, const fe, unsigned int);
+
+void fe_add (fe, const fe, const fe);
+
+void fe_sub (fe, const fe, const fe);
+
+void fe_neg (fe, const fe);
+
+void fe_mul (fe, const fe, const fe);
+
+void fe_sq (fe, const fe);
+
+void fe_sq2 (fe, const fe);
+
+void fe_invert (fe, const fe);
+
+void fe_pow22523 (fe, const fe);
 
 /*
 ge means group element.
@@ -51,68 +70,90 @@ Representations:
 */
 
 typedef struct {
-  fe X;
-  fe Y;
-  fe Z;
+	fe X;
+	fe Y;
+	fe Z;
 } ge_p2;
 
 typedef struct {
-  fe X;
-  fe Y;
-  fe Z;
-  fe T;
+	fe X;
+	fe Y;
+	fe Z;
+	fe T;
 } ge_p3;
 
 typedef struct {
-  fe X;
-  fe Y;
-  fe Z;
-  fe T;
+	fe X;
+	fe Y;
+	fe Z;
+	fe T;
 } ge_p1p1;
 
 typedef struct {
-  fe yplusx;
-  fe yminusx;
-  fe xy2d;
+	fe yplusx;
+	fe yminusx;
+	fe xy2d;
 } ge_precomp;
 
 typedef struct {
-  fe YplusX;
-  fe YminusX;
-  fe Z;
-  fe T2d;
+	fe YplusX;
+	fe YminusX;
+	fe Z;
*** OUTPUT TRUNCATED, 14689 LINES SKIPPED ***


More information about the Commits mailing list