From 407a0da1607a5b9224b68cee2816a043d82fe563 Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Thu, 27 Jun 2013 14:29:21 +0200
Subject: [PATCH] Moved __cplusplus extern statement to include struct
definitions as well.
---
include/polarssl/aes.h | 8 ++++----
include/polarssl/arc4.h | 8 ++++----
include/polarssl/asn1.h | 2 +-
include/polarssl/asn1write.h | 10 +++++++++-
include/polarssl/bignum.h | 8 ++++----
include/polarssl/blowfish.h | 8 ++++----
include/polarssl/camellia.h | 8 ++++----
include/polarssl/cipher.h | 8 ++++----
include/polarssl/des.h | 8 ++++----
include/polarssl/dhm.h | 10 +++++-----
include/polarssl/ecdh.h | 8 ++++----
include/polarssl/ecp.h | 9 ++++-----
include/polarssl/gcm.h | 10 +++++-----
include/polarssl/havege.h | 10 +++++-----
include/polarssl/md.h | 10 +++++-----
include/polarssl/md2.h | 8 ++++----
include/polarssl/md4.h | 8 ++++----
include/polarssl/md5.h | 8 ++++----
include/polarssl/pem.h | 8 ++++----
include/polarssl/pkcs11.h | 10 +++++++++-
include/polarssl/rsa.h | 10 +++++-----
include/polarssl/sha1.h | 8 ++++----
include/polarssl/sha2.h | 8 ++++----
include/polarssl/sha4.h | 8 ++++----
include/polarssl/ssl.h | 8 ++++----
include/polarssl/timing.h | 10 +++++-----
include/polarssl/version.h | 10 +++++++++-
include/polarssl/x509.h | 10 +++++-----
include/polarssl/x509write.h | 10 +++++++++-
include/polarssl/xtea.h | 8 ++++----
30 files changed, 144 insertions(+), 113 deletions(-)
diff --git a/include/polarssl/aes.h b/include/polarssl/aes.h
index 30fdf617a..dfb9a0af2 100644
--- a/include/polarssl/aes.h
+++ b/include/polarssl/aes.h
@@ -48,6 +48,10 @@ typedef UINT32 uint32_t;
// Regular implementation
//
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief AES context structure
*/
@@ -59,10 +63,6 @@ typedef struct
}
aes_context;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief AES key schedule (encryption)
*
diff --git a/include/polarssl/arc4.h b/include/polarssl/arc4.h
index 1672fa233..aa8feaaf7 100644
--- a/include/polarssl/arc4.h
+++ b/include/polarssl/arc4.h
@@ -35,6 +35,10 @@
// Regular implementation
//
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief ARC4 context structure
*/
@@ -46,10 +50,6 @@ typedef struct
}
arc4_context;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief ARC4 key schedule
*
diff --git a/include/polarssl/asn1.h b/include/polarssl/asn1.h
index 8c7579dab..61ea908ab 100644
--- a/include/polarssl/asn1.h
+++ b/include/polarssl/asn1.h
@@ -3,7 +3,7 @@
*
* \brief Generic ASN.1 parsing
*
- * Copyright (C) 2006-2011, Brainspark B.V.
+ * Copyright (C) 2006-2013, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker
diff --git a/include/polarssl/asn1write.h b/include/polarssl/asn1write.h
index f7efb20cd..459b28256 100644
--- a/include/polarssl/asn1write.h
+++ b/include/polarssl/asn1write.h
@@ -3,7 +3,7 @@
*
* \brief ASN.1 buffer writing functionality
*
- * Copyright (C) 2006-2012, Brainspark B.V.
+ * Copyright (C) 2006-2013, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker
@@ -31,6 +31,10 @@
#define ASN1_CHK_ADD(g, f) if( ( ret = f ) < 0 ) return( ret ); else g += ret
+#ifdef __cplusplus
+extern "C" {
+#endif
+
int asn1_write_len( unsigned char **p, unsigned char *start, size_t len );
int asn1_write_tag( unsigned char **p, unsigned char *start, unsigned char tag );
#if defined(POLARSSL_BIGNUM_C)
@@ -45,4 +49,8 @@ int asn1_write_printable_string( unsigned char **p, unsigned char *start,
int asn1_write_ia5_string( unsigned char **p, unsigned char *start,
char *text );
+#ifdef __cplusplus
+}
+#endif
+
#endif /* POLARSSL_ASN1_WRITE_H */
diff --git a/include/polarssl/bignum.h b/include/polarssl/bignum.h
index afa9e61d8..b1c43b75c 100644
--- a/include/polarssl/bignum.h
+++ b/include/polarssl/bignum.h
@@ -158,6 +158,10 @@ typedef uint32_t t_udbl;
#endif /* POLARSSL_HAVE_INT16 */
#endif /* POLARSSL_HAVE_INT8 */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief MPI structure
*/
@@ -169,10 +173,6 @@ typedef struct
}
mpi;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief Initialize one MPI
*
diff --git a/include/polarssl/blowfish.h b/include/polarssl/blowfish.h
index 9b269b71c..b1932e732 100644
--- a/include/polarssl/blowfish.h
+++ b/include/polarssl/blowfish.h
@@ -52,6 +52,10 @@ typedef UINT32 uint32_t;
// Regular implementation
//
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief Blowfish context structure
*/
@@ -62,10 +66,6 @@ typedef struct
}
blowfish_context;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief Blowfish key schedule
*
diff --git a/include/polarssl/camellia.h b/include/polarssl/camellia.h
index 050c6cdb8..e46e17523 100644
--- a/include/polarssl/camellia.h
+++ b/include/polarssl/camellia.h
@@ -48,6 +48,10 @@ typedef UINT32 uint32_t;
// Regular implementation
//
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief CAMELLIA context structure
*/
@@ -58,10 +62,6 @@ typedef struct
}
camellia_context;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief CAMELLIA key schedule (encryption)
*
diff --git a/include/polarssl/cipher.h b/include/polarssl/cipher.h
index 2ffdf668f..8aa8cb090 100644
--- a/include/polarssl/cipher.h
+++ b/include/polarssl/cipher.h
@@ -46,6 +46,10 @@
#define POLARSSL_ERR_CIPHER_INVALID_PADDING -0x6200 /**< Input data contains invalid padding and is rejected. */
#define POLARSSL_ERR_CIPHER_FULL_BLOCK_EXPECTED -0x6280 /**< Decryption of block requires a full block. */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef enum {
POLARSSL_CIPHER_ID_NONE = 0,
POLARSSL_CIPHER_ID_NULL,
@@ -207,10 +211,6 @@ typedef struct {
void *cipher_ctx;
} cipher_context_t;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief Returns the list of ciphers supported by the generic cipher module.
*
diff --git a/include/polarssl/des.h b/include/polarssl/des.h
index d78b568c8..0dedf6299 100644
--- a/include/polarssl/des.h
+++ b/include/polarssl/des.h
@@ -49,6 +49,10 @@ typedef UINT32 uint32_t;
// Regular implementation
//
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief DES context structure
*/
@@ -69,10 +73,6 @@ typedef struct
}
des3_context;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief Set key parity on the given key to odd.
*
diff --git a/include/polarssl/dhm.h b/include/polarssl/dhm.h
index 48d926856..da787c346 100644
--- a/include/polarssl/dhm.h
+++ b/include/polarssl/dhm.h
@@ -3,7 +3,7 @@
*
* \brief Diffie-Hellman-Merkle key exchange
*
- * Copyright (C) 2006-2010, Brainspark B.V.
+ * Copyright (C) 2006-2013, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker
@@ -130,6 +130,10 @@
"EDFE72FE9B6AA4BD7B5A0F1C71CFFF4C19C418E1F6EC0179"\
"81BC087F2A7065B384B890D3191F2BFA"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief DHM context structure
*/
@@ -146,10 +150,6 @@ typedef struct
}
dhm_context;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief Parse the ServerKeyExchange parameters
*
diff --git a/include/polarssl/ecdh.h b/include/polarssl/ecdh.h
index 7f6f4cb28..2184ab95f 100644
--- a/include/polarssl/ecdh.h
+++ b/include/polarssl/ecdh.h
@@ -29,6 +29,10 @@
#include "polarssl/ecp.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief ECDH context structure
*/
@@ -43,10 +47,6 @@ typedef struct
}
ecdh_context;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief Generate a public key
*
diff --git a/include/polarssl/ecp.h b/include/polarssl/ecp.h
index 8debda44a..1d6310a68 100644
--- a/include/polarssl/ecp.h
+++ b/include/polarssl/ecp.h
@@ -36,6 +36,10 @@
#define POLARSSL_ERR_ECP_BUFFER_TOO_SMALL -0x4F80 /**< The buffer is too small to write to. */
#define POLARSSL_ERR_ECP_GENERIC -0x4F00 /**< Generic ECP error */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief ECP point structure (jacobian coordinates)
*
@@ -134,11 +138,6 @@ ecp_group;
*/
#define POLARSSL_ECP_TLS_NAMED_CURVE 3 /**< ECCurveType's named_curve */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief Initialize a point (as zero)
*/
diff --git a/include/polarssl/gcm.h b/include/polarssl/gcm.h
index c703f3bf0..2bed34288 100644
--- a/include/polarssl/gcm.h
+++ b/include/polarssl/gcm.h
@@ -3,7 +3,7 @@
*
* \brief Galois/Counter mode for AES
*
- * Copyright (C) 2006-2012, Brainspark B.V.
+ * Copyright (C) 2006-2013, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker
@@ -42,6 +42,10 @@ typedef UINT64 uint64_t;
#define POLARSSL_ERR_GCM_AUTH_FAILED -0x0012 /**< Authenticated decryption failed. */
#define POLARSSL_ERR_GCM_BAD_INPUT -0x0014 /**< Bad input parameters to function. */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief GCM context structure
*/
@@ -58,10 +62,6 @@ typedef struct {
}
gcm_context;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief GCM initialization (encryption)
*
diff --git a/include/polarssl/havege.h b/include/polarssl/havege.h
index 53c4f38cf..5998903ec 100644
--- a/include/polarssl/havege.h
+++ b/include/polarssl/havege.h
@@ -3,7 +3,7 @@
*
* \brief HAVEGE: HArdware Volatile Entropy Gathering and Expansion
*
- * Copyright (C) 2006-2010, Brainspark B.V.
+ * Copyright (C) 2006-2013, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker
@@ -31,6 +31,10 @@
#define COLLECT_SIZE 1024
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief HAVEGE state structure
*/
@@ -42,10 +46,6 @@ typedef struct
}
havege_state;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief HAVEGE initialization
*
diff --git a/include/polarssl/md.h b/include/polarssl/md.h
index d9ab5e74b..f7b8bd327 100644
--- a/include/polarssl/md.h
+++ b/include/polarssl/md.h
@@ -5,7 +5,7 @@
*
* \author Adriaan de Jong
*
- * Copyright (C) 2006-2011, Brainspark B.V.
+ * Copyright (C) 2006-2013, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker
@@ -44,6 +44,10 @@
#define POLARSSL_ERR_MD_ALLOC_FAILED -0x5180 /**< Failed to allocate memory. */
#define POLARSSL_ERR_MD_FILE_IO_ERROR -0x5200 /**< Opening or reading of file failed. */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef enum {
POLARSSL_MD_NONE=0,
POLARSSL_MD_MD2,
@@ -131,10 +135,6 @@ typedef struct {
NULL, /* md_ctx */ \
}
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief Returns the list of digests supported by the generic digest module.
*
diff --git a/include/polarssl/md2.h b/include/polarssl/md2.h
index 1dc77c280..a8e23d0da 100644
--- a/include/polarssl/md2.h
+++ b/include/polarssl/md2.h
@@ -37,6 +37,10 @@
// Regular implementation
//
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief MD2 context structure
*/
@@ -52,10 +56,6 @@ typedef struct
}
md2_context;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief MD2 context setup
*
diff --git a/include/polarssl/md4.h b/include/polarssl/md4.h
index a08ea70e3..a5c9142e9 100644
--- a/include/polarssl/md4.h
+++ b/include/polarssl/md4.h
@@ -44,6 +44,10 @@ typedef UINT32 uint32_t;
// Regular implementation
//
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief MD4 context structure
*/
@@ -58,10 +62,6 @@ typedef struct
}
md4_context;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief MD4 context setup
*
diff --git a/include/polarssl/md5.h b/include/polarssl/md5.h
index c90789d6a..87474a79d 100644
--- a/include/polarssl/md5.h
+++ b/include/polarssl/md5.h
@@ -44,6 +44,10 @@ typedef UINT32 uint32_t;
// Regular implementation
//
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief MD5 context structure
*/
@@ -58,10 +62,6 @@ typedef struct
}
md5_context;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief MD5 context setup
*
diff --git a/include/polarssl/pem.h b/include/polarssl/pem.h
index 801c57b0c..969faa283 100644
--- a/include/polarssl/pem.h
+++ b/include/polarssl/pem.h
@@ -46,6 +46,10 @@
#define POLARSSL_ERR_PEM_BAD_INPUT_DATA -0x1480 /**< Bad input parameters to function. */
/* \} name */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief PEM context structure
*/
@@ -57,10 +61,6 @@ typedef struct
}
pem_context;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief PEM context setup
*
diff --git a/include/polarssl/pkcs11.h b/include/polarssl/pkcs11.h
index 003d3f52d..270eb6d8d 100644
--- a/include/polarssl/pkcs11.h
+++ b/include/polarssl/pkcs11.h
@@ -5,7 +5,7 @@
*
* \author Adriaan de Jong
*
- * Copyright (C) 2006-2011, Brainspark B.V.
+ * Copyright (C) 2006-2013, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker
@@ -45,6 +45,10 @@
#endif /* __ARMCC_VERSION */
#endif /*_MSC_VER */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* Context for PKCS #11 private keys.
*/
@@ -156,6 +160,10 @@ static inline size_t ssl_pkcs11_key_len( void *ctx )
return ( (pkcs11_context *) ctx )->len;
}
+#ifdef __cplusplus
+}
+#endif
+
#endif /* POLARSSL_PKCS11_C */
#endif /* POLARSSL_PKCS11_H */
diff --git a/include/polarssl/rsa.h b/include/polarssl/rsa.h
index 907811164..7daa05a41 100644
--- a/include/polarssl/rsa.h
+++ b/include/polarssl/rsa.h
@@ -3,7 +3,7 @@
*
* \brief The RSA public-key cryptosystem
*
- * Copyright (C) 2006-2010, Brainspark B.V.
+ * Copyright (C) 2006-2013, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker
@@ -59,6 +59,10 @@
#define RSA_SIGN 1
#define RSA_CRYPT 2
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief RSA context structure
*/
@@ -90,10 +94,6 @@ typedef struct
}
rsa_context;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief Initialize an RSA context
*
diff --git a/include/polarssl/sha1.h b/include/polarssl/sha1.h
index 81ea77d97..1c18f8aab 100644
--- a/include/polarssl/sha1.h
+++ b/include/polarssl/sha1.h
@@ -44,6 +44,10 @@ typedef UINT32 uint32_t;
// Regular implementation
//
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief SHA-1 context structure
*/
@@ -58,10 +62,6 @@ typedef struct
}
sha1_context;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief SHA-1 context setup
*
diff --git a/include/polarssl/sha2.h b/include/polarssl/sha2.h
index 795299ee6..9df46fb38 100644
--- a/include/polarssl/sha2.h
+++ b/include/polarssl/sha2.h
@@ -44,6 +44,10 @@ typedef UINT32 uint32_t;
// Regular implementation
//
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief SHA-256 context structure
*/
@@ -59,10 +63,6 @@ typedef struct
}
sha2_context;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief SHA-256 context setup
*
diff --git a/include/polarssl/sha4.h b/include/polarssl/sha4.h
index e2ff3cc44..450ef5998 100644
--- a/include/polarssl/sha4.h
+++ b/include/polarssl/sha4.h
@@ -45,6 +45,10 @@
// Regular implementation
//
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief SHA-512 context structure
*/
@@ -60,10 +64,6 @@ typedef struct
}
sha4_context;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief SHA-512 context setup
*
diff --git a/include/polarssl/ssl.h b/include/polarssl/ssl.h
index f95219c3c..1bc589369 100644
--- a/include/polarssl/ssl.h
+++ b/include/polarssl/ssl.h
@@ -254,6 +254,10 @@
#define POLARSSL_PREMASTER_SIZE POLARSSL_MPI_MAX_SIZE
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* Generic function pointers for allowing external RSA private key
* implementations.
@@ -547,10 +551,6 @@ struct _ssl_context
char peer_verify_data[36]; /*!< previous handshake verify data */
};
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#if defined(POLARSSL_SSL_HW_RECORD_ACCEL)
#define SSL_CHANNEL_OUTBOUND 0
diff --git a/include/polarssl/timing.h b/include/polarssl/timing.h
index 355c63c77..5ab000e10 100644
--- a/include/polarssl/timing.h
+++ b/include/polarssl/timing.h
@@ -3,7 +3,7 @@
*
* \brief Portable interface to the CPU cycle counter
*
- * Copyright (C) 2006-2010, Brainspark B.V.
+ * Copyright (C) 2006-2013, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker
@@ -27,6 +27,10 @@
#ifndef POLARSSL_TIMING_H
#define POLARSSL_TIMING_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief timer structure
*/
@@ -35,10 +39,6 @@ struct hr_time
unsigned char opaque[32];
};
-#ifdef __cplusplus
-extern "C" {
-#endif
-
extern volatile int alarmed;
/**
diff --git a/include/polarssl/version.h b/include/polarssl/version.h
index 4f73ee291..9bab3cadd 100644
--- a/include/polarssl/version.h
+++ b/include/polarssl/version.h
@@ -3,7 +3,7 @@
*
* \brief Run-time version information
*
- * Copyright (C) 2006-2012, Brainspark B.V.
+ * Copyright (C) 2006-2013, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker
@@ -52,6 +52,10 @@
#if defined(POLARSSL_VERSION_C)
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* Get the version number.
*
@@ -76,6 +80,10 @@ void version_get_string( char *string );
*/
void version_get_string_full( char *string );
+#ifdef __cplusplus
+}
+#endif
+
#endif /* POLARSSL_VERSION_C */
#endif /* version.h */
diff --git a/include/polarssl/x509.h b/include/polarssl/x509.h
index 8baee1579..86624ecb0 100644
--- a/include/polarssl/x509.h
+++ b/include/polarssl/x509.h
@@ -3,7 +3,7 @@
*
* \brief X.509 certificate and private key decoding
*
- * Copyright (C) 2006-2011, Brainspark B.V.
+ * Copyright (C) 2006-2013, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker
@@ -140,6 +140,10 @@
#define X509_FORMAT_DER 1
#define X509_FORMAT_PEM 2
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \addtogroup x509_module
* \{ */
@@ -320,10 +324,6 @@ typedef struct _x509_raw
x509_raw;
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \name Functions to read in DHM parameters, a certificate, CRL or private RSA key
* \{
diff --git a/include/polarssl/x509write.h b/include/polarssl/x509write.h
index 35b318f0c..0d94f0154 100644
--- a/include/polarssl/x509write.h
+++ b/include/polarssl/x509write.h
@@ -3,7 +3,7 @@
*
* \brief X509 buffer writing functionality
*
- * Copyright (C) 2006-2012, Brainspark B.V.
+ * Copyright (C) 2006-2013, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker
@@ -33,6 +33,10 @@
#include "rsa.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct _x509_req_name
{
char oid[128];
@@ -47,6 +51,10 @@ int x509_write_key_der( unsigned char *buf, size_t size, rsa_context *rsa );
int x509_write_cert_req( unsigned char *buf, size_t size, rsa_context *rsa,
x509_req_name *req_name, md_type_t md_alg );
+#ifdef __cplusplus
+}
+#endif
+
#endif /* POLARSSL_X509_WRITE_C */
#endif /* POLARSSL_X509_WRITE_H */
diff --git a/include/polarssl/xtea.h b/include/polarssl/xtea.h
index 207e188d7..4b435aeb2 100644
--- a/include/polarssl/xtea.h
+++ b/include/polarssl/xtea.h
@@ -47,6 +47,10 @@ typedef UINT32 uint32_t;
// Regular implementation
//
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief XTEA context structure
*/
@@ -56,10 +60,6 @@ typedef struct
}
xtea_context;
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* \brief XTEA key schedule
*