Moved __cplusplus extern statement to include struct definitions as well.

This commit is contained in:
Paul Bakker 2013-06-27 14:29:21 +02:00
parent c5a79cca53
commit 407a0da160
30 changed files with 144 additions and 113 deletions

View File

@ -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)
*

View File

@ -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
*

View File

@ -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 <polarssl_maintainer at polarssl.org>

View File

@ -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 <polarssl_maintainer at polarssl.org>
@ -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 */

View File

@ -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
*

View File

@ -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
*

View File

@ -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)
*

View File

@ -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.
*

View File

@ -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.
*

View File

@ -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 <polarssl_maintainer at polarssl.org>
@ -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
*

View File

@ -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
*

View File

@ -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)
*/

View File

@ -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 <polarssl_maintainer at polarssl.org>
@ -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)
*

View File

@ -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 <polarssl_maintainer at polarssl.org>
@ -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
*

View File

@ -5,7 +5,7 @@
*
* \author Adriaan de Jong <dejong@fox-it.com>
*
* 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 <polarssl_maintainer at polarssl.org>
@ -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.
*

View File

@ -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
*

View File

@ -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
*

View File

@ -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
*

View File

@ -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
*

View File

@ -5,7 +5,7 @@
*
* \author Adriaan de Jong <dejong@fox-it.com>
*
* 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 <polarssl_maintainer at polarssl.org>
@ -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 */

View File

@ -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 <polarssl_maintainer at polarssl.org>
@ -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
*

View File

@ -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
*

View File

@ -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
*

View File

@ -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
*

View File

@ -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

View File

@ -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 <polarssl_maintainer at polarssl.org>
@ -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;
/**

View File

@ -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 <polarssl_maintainer at polarssl.org>
@ -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 */

View File

@ -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 <polarssl_maintainer at polarssl.org>
@ -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
* \{

View File

@ -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 <polarssl_maintainer at polarssl.org>
@ -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 */

View File

@ -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
*