Fix formatting: remove trailing spaces, #endif with comments (> 10 lines)

This commit is contained in:
Paul Bakker 2014-05-01 13:03:14 +02:00
parent 525f87559f
commit 9af723cee7
75 changed files with 316 additions and 302 deletions

View File

@ -39,15 +39,15 @@
#include <string.h>
/**
/**
* \addtogroup asn1_module
* \{
* \{
*/
/**
* \name ASN1 Error codes
* These error codes are OR'ed to X509 error codes for
* higher error granularity.
* higher error granularity.
* ASN1 is a standard to specify data structures.
* \{
*/
@ -274,7 +274,7 @@ int asn1_get_sequence_of( unsigned char **p,
int asn1_get_mpi( unsigned char **p,
const unsigned char *end,
mpi *X );
#endif
#endif /* POLARSSL_BIGNUM_C */
/**
* \brief Retrieve an AlgorithmIdentifier ASN.1 sequence.

View File

@ -85,7 +85,7 @@ int asn1_write_raw_buffer( unsigned char **p, unsigned char *start,
* \return the length written or a negative error code
*/
int asn1_write_mpi( unsigned char **p, unsigned char *start, mpi *X );
#endif
#endif /* POLARSSL_BIGNUM_C */
/**
* \brief Write a NULL tag (ASN1_NULL) with zero data in ASN.1 format

View File

@ -51,7 +51,7 @@ typedef UINT32 uint32_t;
typedef UINT64 uint64_t;
#else
#include <inttypes.h>
#endif
#endif /* _MSC_VER && !EFIX64 && !EFI32 */
#define POLARSSL_ERR_MPI_FILE_IO_ERROR -0x0002 /**< An error occurred while reading from or writing to a file. */
#define POLARSSL_ERR_MPI_BAD_INPUT_DATA -0x0004 /**< Bad input parameters to function. */
@ -644,7 +644,7 @@ int mpi_mod_int( t_uint *r, const mpi *A, t_sint b );
/**
* \brief Sliding-window exponentiation: X = A^E mod N
*
* \param X Destination MPI
* \param X Destination MPI
* \param A Left-hand MPI
* \param E Exponent MPI
* \param N Modular MPI

View File

@ -329,7 +329,7 @@
);
#else
#else /* __MACH__ && __APPLE__ */
#define MULADDC_INIT \
asm( \
@ -369,7 +369,7 @@
: "r3", "r4", "r5", "r6", "r7", "r8", "r9" \
);
#endif
#endif /* __MACH__ && __APPLE__ */
#else /* PPC32 */
@ -413,7 +413,7 @@
: "r3", "r4", "r5", "r6", "r7", "r8", "r9" \
);
#else
#else /* __MACH__ && __APPLE__ */
#define MULADDC_INIT \
asm( \
@ -453,7 +453,7 @@
: "r3", "r4", "r5", "r6", "r7", "r8", "r9" \
);
#endif
#endif /* __MACH__ && __APPLE__ */
#endif /* PPC32 */
#endif /* PPC64 */

View File

@ -72,7 +72,7 @@ camellia_context;
* \param ctx CAMELLIA context to be initialized
* \param key encryption key
* \param keysize must be 128, 192 or 256
*
*
* \return 0 if successful, or POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH
*/
int camellia_setkey_enc( camellia_context *ctx, const unsigned char *key, unsigned int keysize );
@ -83,7 +83,7 @@ int camellia_setkey_enc( camellia_context *ctx, const unsigned char *key, unsign
* \param ctx CAMELLIA context to be initialized
* \param key decryption key
* \param keysize must be 128, 192 or 256
*
*
* \return 0 if successful, or POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH
*/
int camellia_setkey_dec( camellia_context *ctx, const unsigned char *key, unsigned int keysize );
@ -95,7 +95,7 @@ int camellia_setkey_dec( camellia_context *ctx, const unsigned char *key, unsign
* \param mode CAMELLIA_ENCRYPT or CAMELLIA_DECRYPT
* \param input 16-byte input block
* \param output 16-byte output block
*
*
* \return 0 if successful
*/
int camellia_crypt_ecb( camellia_context *ctx,
@ -115,7 +115,7 @@ int camellia_crypt_ecb( camellia_context *ctx,
* \param iv initialization vector (updated after use)
* \param input buffer holding the input data
* \param output buffer holding the output data
*
*
* \return 0 if successful, or POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH
*/
int camellia_crypt_cbc( camellia_context *ctx,

View File

@ -1,6 +1,6 @@
/**
* \file cipher.h
*
*
* \brief Generic cipher wrapper.
*
* \author Adriaan de Jong <dejong@fox-it.com>

View File

@ -1,6 +1,6 @@
/**
* \file cipher_wrap.h
*
*
* \brief Cipher wrappers.
*
* \author Adriaan de Jong <dejong@fox-it.com>

View File

@ -171,7 +171,7 @@ static inline int sha4_self_test( int verbose ) {
#warning "rsa_pkcs1_verify() prototype changed. Manual change required if used"
#warning "rsa_pkcs1_decrypt() prototype changed. Manual change required if used"
#endif
#endif
#endif /* POLARSSL_RSA_C */
#if defined(POLARSSL_DHM_C)
#if defined(SHOW_PROTOTYPE_CHANGE_WARNINGS)

View File

@ -108,7 +108,7 @@ ctr_drbg_context;
/**
* \brief CTR_DRBG initialization
*
*
* Note: Personalization data can be provided in addition to the more generic
* entropy source to make this instantiation as unique as possible.
*
@ -163,7 +163,7 @@ void ctr_drbg_set_reseed_interval( ctr_drbg_context *ctx,
/**
* \brief CTR_DRBG reseeding (extracts data from entropy source)
*
*
* \param ctx CTR_DRBG context
* \param additional Additional data to add to state (Can be NULL)
* \param len Length of additional data
@ -245,7 +245,7 @@ int ctr_drbg_write_seed_file( ctr_drbg_context *ctx, const char *path );
* POLARSSL_ERR_CTR_DRBG_INPUT_TOO_BIG
*/
int ctr_drbg_update_seed_file( ctr_drbg_context *ctx, const char *path );
#endif
#endif /* POLARSSL_FS_IO */
/**
* \brief Checkup routine

View File

@ -81,7 +81,7 @@
debug_print_crt( ssl, level, __FILE__, __LINE__, text, crt );
#endif
#else
#else /* POLARSSL_DEBUG_C */
#define SSL_DEBUG_MSG( level, args ) do { } while( 0 )
#define SSL_DEBUG_RET( level, text, ret ) do { } while( 0 )
@ -90,7 +90,7 @@
#define SSL_DEBUG_ECP( level, text, X ) do { } while( 0 )
#define SSL_DEBUG_CRT( level, text, crt ) do { } while( 0 )
#endif
#endif /* POLARSSL_DEBUG_C */
#ifdef __cplusplus
extern "C" {

View File

@ -285,4 +285,4 @@ int dhm_self_test( int verbose );
}
#endif
#endif
#endif /* dhm.h */

View File

@ -212,4 +212,4 @@ int ecdh_self_test( int verbose );
}
#endif
#endif
#endif /* ecdh.h */

View File

@ -90,7 +90,7 @@ int ecdsa_sign( ecp_group *grp, mpi *r, mpi *s,
int ecdsa_sign_det( ecp_group *grp, mpi *r, mpi *s,
const mpi *d, const unsigned char *buf, size_t blen,
md_type_t md_alg );
#endif
#endif /* POLARSSL_ECDSA_DETERMINISTIC */
/**
* \brief Verify ECDSA signature of a previously hashed message
@ -163,7 +163,7 @@ int ecdsa_write_signature_det( ecdsa_context *ctx,
const unsigned char *hash, size_t hlen,
unsigned char *sig, size_t *slen,
md_type_t md_alg );
#endif
#endif /* POLARSSL_ECDSA_DETERMINISTIC */
/**
* \brief Read and verify an ECDSA signature
@ -233,4 +233,4 @@ int ecdsa_self_test( int verbose );
}
#endif
#endif
#endif /* ecdsa.h */

View File

@ -648,4 +648,4 @@ int ecp_self_test( int verbose );
}
#endif
#endif
#endif /* ecp.h */

View File

@ -191,7 +191,7 @@ int entropy_func( void *data, unsigned char *output, size_t len );
/**
* \brief Add data to the accumulator manually
* (Thread-safe if POLARSSL_THREADING_C is enabled)
*
*
* \param ctx Entropy context
* \param data Data to add
* \param len Length of data
@ -227,7 +227,7 @@ int entropy_write_seed_file( entropy_context *ctx, const char *path );
* POLARSSL_ERR_ENTROPY_SOURCE_FAILED
*/
int entropy_update_seed_file( entropy_context *ctx, const char *path );
#endif
#endif /* POLARSSL_FS_IO */
#ifdef __cplusplus
}

View File

@ -265,7 +265,7 @@ int hmac_drbg_write_seed_file( hmac_drbg_context *ctx, const char *path );
* POLARSSL_ERR_HMAC_DRBG_INPUT_TOO_BIG
*/
int hmac_drbg_update_seed_file( hmac_drbg_context *ctx, const char *path );
#endif
#endif /* POLARSSL_FS_IO */
#if defined(POLARSSL_SELF_TEST)

View File

@ -1,6 +1,6 @@
/**
* \file md.h
*
*
* \brief Generic message digest wrapper
*
* \author Adriaan de Jong <dejong@fox-it.com>

View File

@ -1,6 +1,6 @@
/**
* \file md_wrap.h
*
*
* \brief Message digest wrappers.
*
* \author Adriaan de Jong <dejong@fox-it.com>

View File

@ -98,7 +98,7 @@ inline rsa_context* d2i_RSA_PUBKEY( void *ignore, unsigned char **bufptr,
memset( rsa, 0, sizeof( rsa_context ) );
if( ( len == 94 &&
if( ( len == 94 &&
mpi_read_binary( &rsa->N, &buffer[ 25], 64 ) == 0 &&
mpi_read_binary( &rsa->E, &buffer[ 91], 3 ) == 0 ) ||
( len == 162 &&

View File

@ -148,7 +148,7 @@ static inline int ssl_pkcs11_decrypt( void *ctx, int mode, size_t *olen,
output_max_len );
}
static inline int ssl_pkcs11_sign( void *ctx,
static inline int ssl_pkcs11_sign( void *ctx,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,
int mode, md_type_t md_alg, unsigned int hashlen,
const unsigned char *hash, unsigned char *sig )

View File

@ -86,10 +86,10 @@ extern void (*polarssl_free)( void *ptr );
*/
int platform_set_malloc_free( void * (*malloc_func)( size_t ),
void (*free_func)( void * ) );
#else
#else /* POLARSSL_PLATFORM_ENTROPY */
#define polarssl_malloc malloc
#define polarssl_free free
#endif
#endif /* POLARSSL_PLATFORM_ENTROPY */
/*
* The function pointers for printf
@ -105,9 +105,9 @@ extern int (*polarssl_printf)( const char *format, ... );
* \return 0
*/
int platform_set_printf( int (*printf_func)( const char *, ... ) );
#else
#else /* POLARSSL_PLATFORM_PRINTF_ALT */
#define polarssl_printf printf
#endif
#endif /* POLARSSL_PLATFORM_PRINTF_ALT */
/*
* The function pointers for fprintf

View File

@ -168,10 +168,10 @@
#else
#if defined(POLARSSL_SSL_PROTO_TLS1_2)
#define SSL_MIN_MINOR_VERSION SSL_MINOR_VERSION_3
#endif
#endif
#endif
#endif
#endif /* POLARSSL_SSL_PROTO_TLS1_2 */
#endif /* POLARSSL_SSL_PROTO_TLS1_1 */
#endif /* POLARSSL_SSL_PROTO_TLS1 */
#endif /* POLARSSL_SSL_PROTO_SSL3 */
/* Determine maximum supported version */
#define SSL_MAX_MAJOR_VERSION SSL_MAJOR_VERSION_3
@ -187,10 +187,10 @@
#else
#if defined(POLARSSL_SSL_PROTO_SSL3)
#define SSL_MAX_MINOR_VERSION SSL_MINOR_VERSION_0
#endif
#endif
#endif
#endif
#endif /* POLARSSL_SSL_PROTO_SSL3 */
#endif /* POLARSSL_SSL_PROTO_TLS1 */
#endif /* POLARSSL_SSL_PROTO_TLS1_1 */
#endif /* POLARSSL_SSL_PROTO_TLS1_2 */
/* RFC 6066 section 4, see also mfl_code_to_length in ssl_tls.c
* NONE must be zero so that memset()ing structure to zero works */
@ -395,7 +395,7 @@ extern "C" {
*/
typedef int (*rsa_decrypt_func)( void *ctx, int mode, size_t *olen,
const unsigned char *input, unsigned char *output,
size_t output_max_len );
size_t output_max_len );
typedef int (*rsa_sign_func)( void *ctx,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,
int mode, md_type_t md_alg, unsigned int hashlen,
@ -545,7 +545,7 @@ struct _ssl_handshake_params
#if defined(POLARSSL_SSL_SERVER_NAME_INDICATION)
ssl_key_cert *sni_key_cert; /*!< key/cert list from SNI */
#endif
#endif
#endif /* POLARSSL_X509_CRT_PARSE_C */
/*
* Checksum contexts
@ -814,7 +814,7 @@ extern int (*ssl_hw_record_reset)(ssl_context *ssl);
extern int (*ssl_hw_record_write)(ssl_context *ssl);
extern int (*ssl_hw_record_read)(ssl_context *ssl);
extern int (*ssl_hw_record_finish)(ssl_context *ssl);
#endif
#endif /* POLARSSL_SSL_HW_RECORD_ACCEL */
/**
* \brief Returns the list of ciphersuites supported by the SSL/TLS module.
@ -1195,7 +1195,7 @@ int ssl_set_dh_param( ssl_context *ssl, const char *dhm_P, const char *dhm_G );
* \return 0 if successful
*/
int ssl_set_dh_param_ctx( ssl_context *ssl, dhm_context *dhm_ctx );
#endif
#endif /* POLARSSL_DHM_C */
#if defined(POLARSSL_SSL_SET_CURVES)
/**
@ -1217,7 +1217,7 @@ int ssl_set_dh_param_ctx( ssl_context *ssl, dhm_context *dhm_ctx );
* terminated by POLARSSL_ECP_DP_NONE.
*/
void ssl_set_curves( ssl_context *ssl, const ecp_group_id *curves );
#endif
#endif /* POLARSSL_SSL_SET_CURVES */
#if defined(POLARSSL_SSL_SERVER_NAME_INDICATION)
/**
@ -1395,7 +1395,7 @@ void ssl_set_renegotiation( ssl_context *ssl, int renegotiation );
/**
* \brief Prevent or allow legacy renegotiation.
* (Default: SSL_LEGACY_NO_RENEGOTIATION)
*
*
* SSL_LEGACY_NO_RENEGOTIATION allows connections to
* be established even if the peer does not support
* secure renegotiation, but does not allow renegotiation

View File

@ -346,16 +346,16 @@ static const uint32_t RCON[10] =
0x0000001B, 0x00000036
};
#else
#else /* POLARSSL_AES_ROM_TABLES */
/*
* Forward S-box & tables
*/
static unsigned char FSb[256];
static uint32_t FT0[256];
static uint32_t FT1[256];
static uint32_t FT2[256];
static uint32_t FT3[256];
static uint32_t FT0[256];
static uint32_t FT1[256];
static uint32_t FT2[256];
static uint32_t FT3[256];
/*
* Reverse S-box & tables
@ -456,7 +456,7 @@ static void aes_gen_tables( void )
}
}
#endif
#endif /* POLARSSL_AES_ROM_TABLES */
/*
* AES key schedule (encryption)
@ -826,7 +826,7 @@ int aes_crypt_cbc( aes_context *ctx,
{
if( padlock_xcryptcbc( ctx, mode, length, iv, input, output ) == 0 )
return( 0 );
// If padlock data misaligned, we just fall back to
// unaccelerated mode
//
@ -1424,6 +1424,6 @@ int aes_self_test( int verbose )
return( 0 );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_AES_C */

View File

@ -178,6 +178,6 @@ int arc4_self_test( int verbose )
return( 0 );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_ARC4_C */

View File

@ -387,4 +387,4 @@ asn1_named_data *asn1_find_named_data( asn1_named_data *list,
return( list );
}
#endif
#endif /* POLARSSL_ASN1_PARSE_C */

View File

@ -363,4 +363,4 @@ asn1_named_data *asn1_store_named_data( asn1_named_data **head,
return( cur );
}
#endif
#endif /* POLARSSL_ASN1_WRITE_C */

View File

@ -267,6 +267,6 @@ int base64_self_test( int verbose )
return( 0 );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_BASE64_C */

View File

@ -313,7 +313,7 @@ int mpi_set_bit( mpi *X, size_t pos, unsigned char val )
if( val != 0 && val != 1 )
return POLARSSL_ERR_MPI_BAD_INPUT_DATA;
if( X->n * biL <= pos )
{
if( val == 0 )
@ -326,7 +326,7 @@ int mpi_set_bit( mpi *X, size_t pos, unsigned char val )
X->p[off] |= (t_uint) val << idx;
cleanup:
return( ret );
}
@ -860,7 +860,7 @@ int mpi_add_abs( mpi *X, const mpi *A, const mpi *B )
if( X != A )
MPI_CHK( mpi_copy( X, A ) );
/*
* X should always be positive as a result of unsigned additions.
*/
@ -1083,7 +1083,7 @@ void mpi_mul_hlp( size_t i, t_uint *s, t_uint *d, t_uint b )
MULADDC_CORE
MULADDC_STOP
}
#else
#else /* MULADDC_HUIT */
for( ; i >= 16; i -= 16 )
{
MULADDC_INIT
@ -1116,7 +1116,7 @@ void mpi_mul_hlp( size_t i, t_uint *s, t_uint *d, t_uint b )
MULADDC_CORE
MULADDC_STOP
}
#endif
#endif /* MULADDC_HUIT */
t++;
@ -2333,6 +2333,6 @@ cleanup:
return( ret );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_BIGNUM_C */

View File

@ -1,7 +1,7 @@
/*
* Blowfish implementation
*
* Copyright (C) 2012-2013, Brainspark B.V.
* Copyright (C) 2012-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -75,7 +75,7 @@ static const uint32_t P[BLOWFISH_ROUNDS + 2] = {
/* declarations of data at the end of this file */
static const uint32_t S[4][256];
static uint32_t F(blowfish_context *ctx, uint32_t x)
static uint32_t F(blowfish_context *ctx, uint32_t x)
{
unsigned short a, b, c, d;
uint32_t y;
@ -94,7 +94,7 @@ static uint32_t F(blowfish_context *ctx, uint32_t x)
return y;
}
static void blowfish_enc(blowfish_context *ctx, uint32_t *xl, uint32_t *xr)
static void blowfish_enc(blowfish_context *ctx, uint32_t *xl, uint32_t *xr)
{
uint32_t Xl, Xr, temp;
short i;
@ -102,7 +102,7 @@ static void blowfish_enc(blowfish_context *ctx, uint32_t *xl, uint32_t *xr)
Xl = *xl;
Xr = *xr;
for (i = 0; i < BLOWFISH_ROUNDS; ++i)
for (i = 0; i < BLOWFISH_ROUNDS; ++i)
{
Xl = Xl ^ ctx->P[i];
Xr = F(ctx, Xl) ^ Xr;
@ -123,7 +123,7 @@ static void blowfish_enc(blowfish_context *ctx, uint32_t *xl, uint32_t *xr)
*xr = Xr;
}
static void blowfish_dec(blowfish_context *ctx, uint32_t *xl, uint32_t *xr)
static void blowfish_dec(blowfish_context *ctx, uint32_t *xl, uint32_t *xr)
{
uint32_t Xl, Xr, temp;
short i;
@ -131,7 +131,7 @@ static void blowfish_dec(blowfish_context *ctx, uint32_t *xl, uint32_t *xr)
Xl = *xl;
Xr = *xr;
for (i = BLOWFISH_ROUNDS + 1; i > 1; --i)
for (i = BLOWFISH_ROUNDS + 1; i > 1; --i)
{
Xl = Xl ^ ctx->P[i];
Xr = F(ctx, Xl) ^ Xr;
@ -161,14 +161,14 @@ int blowfish_setkey( blowfish_context *ctx, const unsigned char *key, unsigned i
uint32_t data, datal, datar;
if( keysize < BLOWFISH_MIN_KEY || keysize > BLOWFISH_MAX_KEY ||
( keysize % 8 ) )
( keysize % 8 ) )
{
return POLARSSL_ERR_BLOWFISH_INVALID_KEY_LENGTH;
}
keysize >>= 3;
for( i = 0; i < 4; i++ )
for( i = 0; i < 4; i++ )
{
for( j = 0; j < 256; j++ )
ctx->S[i][j] = S[i][j];
@ -219,8 +219,8 @@ int blowfish_crypt_ecb( blowfish_context *ctx,
{
uint32_t X0, X1;
GET_UINT32_BE( X0, input, 0 );
GET_UINT32_BE( X1, input, 4 );
GET_UINT32_BE( X0, input, 0 );
GET_UINT32_BE( X1, input, 4 );
if( mode == BLOWFISH_DECRYPT )
{

View File

@ -107,7 +107,7 @@ static const unsigned char FSb[256] =
#define SBOX3(n) (unsigned char)((FSb[(n)] >> 1 ^ FSb[(n)] << 7) & 0xff)
#define SBOX4(n) FSb[((n) << 1 ^ (n) >> 7) &0xff]
#else
#else /* POLARSSL_CAMELLIA_SMALL_MEMORY */
static const unsigned char FSb[256] =
{
@ -194,7 +194,7 @@ static const unsigned char FSb4[256] =
#define SBOX3(n) FSb3[(n)]
#define SBOX4(n) FSb4[(n)]
#endif
#endif /* POLARSSL_CAMELLIA_SMALL_MEMORY */
static const unsigned char shifts[2][4][4] =
{
@ -268,13 +268,13 @@ static const signed char transposes[2][20] =
(XR) = ((((XL) & (KL)) << 1) | (((XL) & (KL)) >> 31)) ^ (XR); \
(XL) = ((XR) | (KR)) ^ (XL); \
}
#define FLInv(YL, YR, KL, KR) \
{ \
(YL) = ((YR) | (KR)) ^ (YL); \
(YR) = ((((YL) & (KL)) << 1) | (((YL) & (KL)) >> 31)) ^ (YR); \
}
#define SHIFT_AND_PLACE(INDEX, OFFSET) \
{ \
TK[0] = KC[(OFFSET) * 4 + 0]; \
@ -392,7 +392,7 @@ int camellia_setkey_enc( camellia_context *ctx, const unsigned char *key, unsign
/*
* Generating subkeys
*/
*/
/* Manipulating KL */
SHIFT_AND_PLACE(idx, 0);
@ -691,14 +691,14 @@ static const unsigned char camellia_test_ecb_key[3][CAMELLIA_TESTS_ECB][32] =
{
{ 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{
{ 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
@ -707,7 +707,7 @@ static const unsigned char camellia_test_ecb_key[3][CAMELLIA_TESTS_ECB][32] =
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
@ -718,7 +718,7 @@ static const unsigned char camellia_test_ecb_plain[CAMELLIA_TESTS_ECB][16] =
{
{ 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
{ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
{ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
};
@ -1048,6 +1048,6 @@ int camellia_self_test( int verbose )
return ( 0 );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_CAMELLIA_C */

View File

@ -1,7 +1,7 @@
/*
* X.509 test certificates
*
* Copyright (C) 2006-2010, Brainspark B.V.
* Copyright (C) 2006-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -305,6 +305,6 @@ const char *test_srv_crt = test_srv_crt_ec;
const char *test_srv_key = test_srv_key_ec;
const char *test_cli_crt = test_cli_crt_ec;
const char *test_cli_key = test_cli_key_ec;
#endif
#endif /* POLARSSL_RSA_C */
#endif /* POLARSSL_CERTS_C */

View File

@ -376,7 +376,7 @@ int cipher_update( cipher_context_t *ctx, const unsigned char *input, size_t ile
return 0;
}
#endif
#endif /* POLARSSL_CIPHER_MODE_CFB */
#if defined(POLARSSL_CIPHER_MODE_CTR)
if( ctx->cipher_info->mode == POLARSSL_MODE_CTR )
@ -392,7 +392,7 @@ int cipher_update( cipher_context_t *ctx, const unsigned char *input, size_t ile
return 0;
}
#endif
#endif /* POLARSSL_CIPHER_MODE_CTR */
#if defined(POLARSSL_CIPHER_MODE_STREAM)
if( ctx->cipher_info->mode == POLARSSL_MODE_STREAM )
@ -407,7 +407,7 @@ int cipher_update( cipher_context_t *ctx, const unsigned char *input, size_t ile
return 0;
}
#endif
#endif /* POLARSSL_CIPHER_MODE_STREAM */
return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE;
}
@ -728,7 +728,7 @@ int cipher_write_tag( cipher_context_t *ctx,
return 0;
}
int cipher_check_tag( cipher_context_t *ctx,
const unsigned char *tag, size_t tag_len )
{
@ -765,7 +765,7 @@ int cipher_check_tag( cipher_context_t *ctx,
return( 0 );
}
#endif
#endif /* POLARSSL_GCM_C */
return( 0 );
}
@ -783,6 +783,6 @@ int cipher_self_test( int verbose )
return( 0 );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_CIPHER_C */

View File

@ -1,6 +1,6 @@
/**
* \file cipher_wrap.c
*
*
* \brief Generic cipher wrapper for PolarSSL
*
* \author Adriaan de Jong <dejong@fox-it.com>
@ -82,7 +82,7 @@ static void gcm_ctx_free( void *ctx )
gcm_free( ctx );
polarssl_free( ctx );
}
#endif
#endif /* POLARSSL_GCM_C */
#if defined(POLARSSL_AES_C)
@ -124,7 +124,7 @@ static int aes_crypt_cfb128_wrap( void *ctx, operation_t operation, size_t lengt
((void) output);
return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE;
#endif
#endif /* POLARSSL_CIPHER_MODE_CFB */
}
static int aes_crypt_ctr_wrap( void *ctx, size_t length,
@ -144,7 +144,7 @@ static int aes_crypt_ctr_wrap( void *ctx, size_t length,
((void) output);
return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE;
#endif
#endif /* POLARSSL_CIPHER_MODE_CTR */
}
static int aes_setkey_dec_wrap( void *ctx, const unsigned char *key, unsigned int key_length )
@ -372,7 +372,7 @@ const cipher_info_t aes_256_gcm_info = {
};
#endif /* POLARSSL_GCM_C */
#endif
#endif /* POLARSSL_AES_C */
#if defined(POLARSSL_CAMELLIA_C)
@ -414,7 +414,7 @@ static int camellia_crypt_cfb128_wrap( void *ctx, operation_t operation, size_t
((void) output);
return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE;
#endif
#endif /* POLARSSL_CIPHER_MODE_CFB */
}
static int camellia_crypt_ctr_wrap( void *ctx, size_t length,
@ -434,7 +434,7 @@ static int camellia_crypt_ctr_wrap( void *ctx, size_t length,
((void) output);
return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE;
#endif
#endif /* POLARSSL_CIPHER_MODE_CTR */
}
static int camellia_setkey_dec_wrap( void *ctx, const unsigned char *key, unsigned int key_length )
@ -909,7 +909,7 @@ const cipher_info_t des_ede3_cbc_info = {
&des_ede3_info
};
#endif /* POLARSSL_CIPHER_MODE_CBC */
#endif
#endif /* POLARSSL_DES_C */
#if defined(POLARSSL_BLOWFISH_C)
@ -951,7 +951,7 @@ static int blowfish_crypt_cfb64_wrap( void *ctx, operation_t operation, size_t l
((void) output);
return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE;
#endif
#endif /* POLARSSL_CIPHER_MODE_CFB */
}
static int blowfish_crypt_ctr_wrap( void *ctx, size_t length,
@ -971,7 +971,7 @@ static int blowfish_crypt_ctr_wrap( void *ctx, size_t length,
((void) output);
return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE;
#endif
#endif /* POLARSSL_CIPHER_MODE_CTR */
}
static int blowfish_setkey_wrap( void *ctx, const unsigned char *key, unsigned int key_length )
@ -1254,4 +1254,4 @@ const cipher_definition_t cipher_definitions[] =
#define NUM_CIPHERS sizeof cipher_definitions / sizeof cipher_definitions[0]
int supported_ciphers[NUM_CIPHERS];
#endif
#endif /* POLARSSL_CIPHER_C */

View File

@ -286,7 +286,7 @@ int ctr_drbg_reseed( ctr_drbg_context *ctx,
return( 0 );
}
int ctr_drbg_random_with_add( void *p_rng,
unsigned char *output, size_t output_len,
const unsigned char *additional, size_t add_len )
@ -524,6 +524,6 @@ int ctr_drbg_self_test( int verbose )
return( 0 );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_CTR_DRBG_C */

View File

@ -348,4 +348,4 @@ void debug_print_crt( const ssl_context *ssl, int level,
}
#endif /* POLARSSL_X509_CRT_PARSE_C */
#endif
#endif /* POLARSSL_DEBUG_C */

View File

@ -1012,6 +1012,6 @@ int des_self_test( int verbose )
return( 0 );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_DES_C */

View File

@ -431,7 +431,7 @@ int dhm_parse_dhm( dhm_context *dhm, const unsigned char *dhmin, size_t dhminlen
p = ( ret == 0 ) ? pem.buf : (unsigned char *) dhmin;
#else
p = (unsigned char *) dhmin;
#endif
#endif /* POLARSSL_PEM_PARSE_C */
end = p + dhminlen;
/*
@ -578,9 +578,9 @@ int dhm_self_test( int verbose )
polarssl_printf( " DHM parameter load: skipped\n" );
return( 0 );
#endif
#endif /* POLARSSL_CERTS_C */
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_DHM_C */

View File

@ -1,7 +1,7 @@
/*
* Elliptic curve Diffie-Hellman
*
* Copyright (C) 2006-2013, Brainspark B.V.
* Copyright (C) 2006-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -275,6 +275,6 @@ int ecdh_self_test( int verbose )
return( 0 );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif /* defined(POLARSSL_ECDH_C) */
#endif /* POLARSSL_ECDH_C */

View File

@ -1,7 +1,7 @@
/*
* Elliptic curve DSA
*
* Copyright (C) 2006-2013, Brainspark B.V.
* Copyright (C) 2006-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -70,7 +70,7 @@ static const md_info_t *md_info_by_size( size_t min_size )
return( md_picked );
}
#endif
#endif /* POLARSSL_ECDSA_DETERMINISTIC */
/*
* Derive a suitable integer for group grp from a buffer of length len
@ -498,6 +498,6 @@ int ecdsa_self_test( int verbose )
return( 0 );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif /* defined(POLARSSL_ECDSA_C) */
#endif /* POLARSSL_ECDSA_C */

View File

@ -1776,7 +1776,7 @@ int ecp_check_privkey( const ecp_group *grp, const mpi *d )
else
return( 0 );
}
#endif
#endif /* POLARSSL_ECP_MONTGOMERY */
#if defined(POLARSSL_ECP_SHORT_WEIERSTRASS)
if( ecp_get_type( grp ) == POLARSSL_ECP_TYPE_SHORT_WEIERSTRASS )
{
@ -1787,7 +1787,7 @@ int ecp_check_privkey( const ecp_group *grp, const mpi *d )
else
return( 0 );
}
#endif
#endif /* POLARSSL_ECP_SHORT_WEIERSTRASS */
return( POLARSSL_ERR_ECP_BAD_INPUT_DATA );
}
@ -1823,7 +1823,7 @@ int ecp_gen_keypair( ecp_group *grp, mpi *d, ecp_point *Q,
MPI_CHK( mpi_set_bit( d, 2, 0 ) );
}
else
#endif
#endif /* POLARSSL_ECP_MONTGOMERY */
#if defined(POLARSSL_ECP_SHORT_WEIERSTRASS)
if( ecp_get_type( grp ) == POLARSSL_ECP_TYPE_SHORT_WEIERSTRASS )
{
@ -1860,7 +1860,7 @@ int ecp_gen_keypair( ecp_group *grp, mpi *d, ecp_point *Q,
mpi_cmp_mpi( d, &grp->N ) >= 0 );
}
else
#endif
#endif /* POLARSSL_ECP_SHORT_WEIERSTRASS */
return( POLARSSL_ERR_ECP_BAD_INPUT_DATA );
cleanup:
@ -2013,6 +2013,6 @@ cleanup:
return( ret );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_ECP_C */

View File

@ -1,7 +1,7 @@
/*
* Elliptic curves over GF(p): curve-specific data and functions
*
* Copyright (C) 2006-2013, Brainspark B.V.
* Copyright (C) 2006-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -1377,4 +1377,4 @@ static int ecp_mod_p256k1( mpi *N )
}
#endif /* POLARSSL_ECP_DP_SECP256K1_ENABLED */
#endif
#endif /* POLARSSL_ECP_C */

View File

@ -1,7 +1,7 @@
/*
* Entropy accumulator implementation
*
* Copyright (C) 2006-2013, Brainspark B.V.
* Copyright (C) 2006-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -372,4 +372,4 @@ int entropy_update_seed_file( entropy_context *ctx, const char *path )
}
#endif /* POLARSSL_FS_IO */
#endif
#endif /* POLARSSL_ENTROPY_C */

View File

@ -1,7 +1,7 @@
/*
* Platform-specific and custom entropy polling functions
*
* Copyright (C) 2006-2011, Brainspark B.V.
* Copyright (C) 2006-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -71,7 +71,7 @@ int platform_entropy_poll( void *data, unsigned char *output, size_t len,
return( 0 );
}
#else
#else /* _WIN32 && !EFIX64 && !EFI32 */
#include <stdio.h>
@ -87,7 +87,7 @@ int platform_entropy_poll( void *data,
file = fopen( "/dev/urandom", "rb" );
if( file == NULL )
return POLARSSL_ERR_ENTROPY_SOURCE_FAILED;
ret = fread( output, 1, len, file );
if( ret != len )
{
@ -100,8 +100,8 @@ int platform_entropy_poll( void *data,
return( 0 );
}
#endif
#endif
#endif /* _WIN32 && !EFIX64 && !EFI32 */
#endif /* !POLARSSL_NO_PLATFORM_ENTROPY */
#if defined(POLARSSL_TIMING_C)
int hardclock_poll( void *data,
@ -119,7 +119,7 @@ int hardclock_poll( void *data,
return( 0 );
}
#endif
#endif /* POLARSSL_TIMING_C */
#if defined(POLARSSL_HAVEGE_C)
int havege_poll( void *data,
@ -135,6 +135,6 @@ int havege_poll( void *data,
return( 0 );
}
#endif
#endif /* POLARSSL_HAVEGE_C */
#endif /* POLARSSL_ENTROPY_C */

View File

@ -211,7 +211,7 @@ static void gcm_mult( gcm_context *ctx, const unsigned char x[16],
aesni_gcm_mult( output, x, h );
return;
}
#endif
#endif /* POLARSSL_AESNI_C && POLARSSL_HAVE_X86_64 */
memset( z, 0x00, 16 );
@ -924,4 +924,4 @@ int gcm_self_test( int verbose )
#endif /* POLARSSL_SELF_TEST && POLARSSL_AES_C */
#endif
#endif /* POLARSSL_GCM_C */

View File

@ -1,7 +1,7 @@
/**
* \brief HAVEGE: HArdware Volatile Entropy Gathering and Expansion
*
* Copyright (C) 2006-2010, Brainspark B.V.
* Copyright (C) 2006-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -223,7 +223,7 @@ int havege_random( void *p_rng, unsigned char *buf, size_t len )
val ^= hs->pool[hs->offset[1]++];
memcpy( p, &val, use_len );
len -= use_len;
p += use_len;
}
@ -231,4 +231,4 @@ int havege_random( void *p_rng, unsigned char *buf, size_t len )
return( 0 );
}
#endif
#endif /* POLARSSL_HAVEGE_C */

View File

@ -1,11 +1,11 @@
/**
* \file md.c
*
*
* \brief Generic message digest wrapper for PolarSSL
*
* \author Adriaan de Jong <dejong@fox-it.com>
*
* Copyright (C) 2006-2010, Brainspark B.V.
* Copyright (C) 2006-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -256,7 +256,7 @@ int md_file( const md_info_t *md_info, const char *path, unsigned char *output )
((void) output);
return POLARSSL_ERR_MD_FEATURE_UNAVAILABLE;
#endif
#endif /* POLARSSL_FS_IO */
}
int md_hmac_starts( md_context_t *ctx, const unsigned char *key, size_t keylen )
@ -321,4 +321,4 @@ int md_process( md_context_t *ctx, const unsigned char *data )
return 0;
}
#endif
#endif /* POLARSSL_MD_C */

View File

@ -373,6 +373,6 @@ int md2_self_test( int verbose )
return( 0 );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_MD2_C */

View File

@ -407,7 +407,7 @@ void md4_hmac( const unsigned char *key, size_t keylen,
*/
static const char md4_test_str[7][81] =
{
{ "" },
{ "" },
{ "a" },
{ "abc" },
{ "message digest" },
@ -469,6 +469,6 @@ int md4_self_test( int verbose )
return( 0 );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_MD4_C */

View File

@ -161,7 +161,7 @@ void md5_process( md5_context *ctx, const unsigned char data[64] )
P( B, C, D, A, 12, 20, 0x8D2A4C8A );
#undef F
#define F(x,y,z) (x ^ y ^ z)
P( A, B, C, D, 5, 4, 0xFFFA3942 );
@ -423,7 +423,7 @@ void md5_hmac( const unsigned char *key, size_t keylen,
*/
static unsigned char md5_test_buf[7][81] =
{
{ "" },
{ "" },
{ "a" },
{ "abc" },
{ "message digest" },
@ -590,6 +590,6 @@ int md5_self_test( int verbose )
return( 0 );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_MD5_C */

View File

@ -158,7 +158,7 @@ const md_info_t md2_info = {
md2_process_wrap,
};
#endif
#endif /* POLARSSL_MD2_C */
#if defined(POLARSSL_MD4_C)
@ -242,7 +242,7 @@ const md_info_t md4_info = {
md4_process_wrap,
};
#endif
#endif /* POLARSSL_MD4_C */
#if defined(POLARSSL_MD5_C)
@ -326,7 +326,7 @@ const md_info_t md5_info = {
md5_process_wrap,
};
#endif
#endif /* POLARSSL_MD5_C */
#if defined(POLARSSL_RIPEMD160_C)
@ -410,7 +410,7 @@ const md_info_t ripemd160_info = {
ripemd160_process_wrap,
};
#endif
#endif /* POLARSSL_RIPEMD160_C */
#if defined(POLARSSL_SHA1_C)
@ -494,7 +494,7 @@ const md_info_t sha1_info = {
sha1_process_wrap,
};
#endif
#endif /* POLARSSL_SHA1_C */
/*
* Wrappers for generic message digests
@ -687,7 +687,7 @@ const md_info_t sha256_info = {
sha256_process_wrap,
};
#endif
#endif /* POLARSSL_SHA256_C */
#if defined(POLARSSL_SHA512_C)
@ -877,6 +877,6 @@ const md_info_t sha512_info = {
sha512_process_wrap,
};
#endif
#endif /* POLARSSL_SHA512_C */
#endif
#endif /* POLARSSL_MD_C */

View File

@ -539,7 +539,7 @@ static void buffer_alloc_free_mutexed( void *ptr )
buffer_alloc_free( ptr );
polarssl_mutex_unlock( &heap.mutex );
}
#endif
#endif /* POLARSSL_THREADING_C */
int memory_buffer_alloc_init( unsigned char *buf, size_t len )
{

View File

@ -1,7 +1,7 @@
/*
* TCP networking functions
*
* Copyright (C) 2006-2013, Brainspark B.V.
* Copyright (C) 2006-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -572,4 +572,4 @@ void net_close( int fd )
close( fd );
}
#endif
#endif /* POLARSSL_NET_C */

View File

@ -3,7 +3,7 @@
*
* \brief Object Identifier (OID) database
*
* Copyright (C) 2006-2013, Brainspark B.V.
* Copyright (C) 2006-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -624,7 +624,7 @@ static int compat_snprintf(char *str, size_t size, const char *format, ...)
}
#define snprintf compat_snprintf
#endif
#endif /* _MSC_VER && !snprintf && !EFIX64 && !EFI32 */
#define SAFE_SNPRINTF() \
{ \

View File

@ -1,7 +1,7 @@
/*
* VIA PadLock support functions
*
* Copyright (C) 2006-2010, Brainspark B.V.
* Copyright (C) 2006-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -161,6 +161,6 @@ int padlock_xcryptcbc( aes_context *ctx,
return( 0 );
}
#endif
#endif /* POLARSSL_HAVE_X86 */
#endif
#endif /* POLARSSL_PADLOCK_C */

View File

@ -334,7 +334,7 @@ static int ecdsa_sign_wrap( void *ctx, md_type_t md_alg,
return( ecdsa_write_signature( (ecdsa_context *) ctx,
hash, hash_len, sig, sig_len, f_rng, p_rng ) );
#endif
#endif /* POLARSSL_ECDSA_DETERMINISTIC */
}
static void *ecdsa_alloc_wrap( void )

View File

@ -329,7 +329,7 @@ uint32_t key_len[MAX_TESTS] =
{ 20, 20, 20, 20, 25, 16 };
unsigned char result_key[MAX_TESTS][32] =
unsigned char result_key[MAX_TESTS][32] =
{
{ 0x0c, 0x60, 0xc8, 0x0f, 0x96, 0x1f, 0x0e, 0x71,
0xf3, 0xa9, 0xb5, 0x24, 0xaf, 0x60, 0x12, 0x06,

View File

@ -1,7 +1,7 @@
/*
* Public Key layer for parsing key files and structures
*
* Copyright (C) 2006-2013, Brainspark B.V.
* Copyright (C) 2006-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -1236,7 +1236,7 @@ int pk_parse_public_key( pk_context *ctx,
pem_free( &pem );
return( ret );
}
#endif
#endif /* POLARSSL_PEM_PARSE_C */
p = (unsigned char *) key;
ret = pk_parse_subpubkey( &p, p + keylen, ctx );

View File

@ -221,7 +221,7 @@ int pk_write_key_der( pk_context *key, unsigned char *buf, size_t size )
ASN1_CHK_ADD( len, asn1_write_tag( &c, buf, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) );
}
else
#endif
#endif /* POLARSSL_RSA_C */
#if defined(POLARSSL_ECP_C)
if( pk_get_type( key ) == POLARSSL_PK_ECKEY )
{
@ -274,7 +274,7 @@ int pk_write_key_der( pk_context *key, unsigned char *buf, size_t size )
ASN1_CHK_ADD( len, asn1_write_tag( &c, buf, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) );
}
else
#endif
#endif /* POLARSSL_ECP_C */
return( POLARSSL_ERR_PK_FEATURE_UNAVAILABLE );
return( (int) len );

View File

@ -630,6 +630,6 @@ int ripemd160_self_test( int verbose )
return( 0 );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_RIPEMD160_C */

View File

@ -104,7 +104,7 @@ int rsa_gen_key( rsa_context *ctx,
do
{
MPI_CHK( mpi_gen_prime( &ctx->P, ( nbits + 1 ) >> 1, 0,
MPI_CHK( mpi_gen_prime( &ctx->P, ( nbits + 1 ) >> 1, 0,
f_rng, p_rng ) );
MPI_CHK( mpi_gen_prime( &ctx->Q, ( nbits + 1 ) >> 1, 0,
@ -153,7 +153,7 @@ cleanup:
return( 0 );
}
#endif
#endif /* POLARSSL_GENPRIME */
/*
* Check a public RSA key
@ -329,7 +329,7 @@ cleanup:
return( ret );
}
#endif
#endif /* !POLARSSL_RSA_NO_CRT */
/*
* Do an RSA private key operation
@ -361,7 +361,7 @@ int rsa_private( rsa_context *ctx,
Vi = &ctx->Vi;
Vf = &ctx->Vf;
#endif
#endif
#endif /* !POLARSSL_RSA_NO_CRT */
mpi_init( &T ); mpi_init( &T1 ); mpi_init( &T2 );
@ -419,7 +419,7 @@ int rsa_private( rsa_context *ctx,
MPI_CHK( mpi_mul_mpi( &T, &T, Vf ) );
MPI_CHK( mpi_mod_mpi( &T, &T, &ctx->N ) );
}
#endif
#endif /* POLARSSL_RSA_NO_CRT */
olen = ctx->len;
MPI_CHK( mpi_write_binary( &T, output, olen ) );
@ -483,7 +483,7 @@ static void mgf_mask( unsigned char *dst, size_t dlen, unsigned char *src,
dlen -= use_len;
}
}
#endif
#endif /* POLARSSL_PKCS1_V21 */
#if defined(POLARSSL_PKCS1_V21)
/*
@ -1490,7 +1490,7 @@ static int myrand( void *rng_state, unsigned char *output, size_t len )
return( 0 );
}
#endif
#endif /* POLARSSL_PKCS1_V15 */
/*
* Checkup routine
@ -1606,6 +1606,6 @@ cleanup:
return( ret );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_RSA_C */

View File

@ -454,7 +454,7 @@ void sha1_hmac( const unsigned char *key, size_t keylen,
/*
* FIPS-180-1 test vectors
*/
static unsigned char sha1_test_buf[3][57] =
static unsigned char sha1_test_buf[3][57] =
{
{ "abc" },
{ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" },
@ -629,6 +629,6 @@ int sha1_self_test( int verbose )
return( 0 );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_SHA1_C */

View File

@ -461,7 +461,7 @@ void sha256_hmac( const unsigned char *key, size_t keylen,
/*
* FIPS-180-2 test vectors
*/
static unsigned char sha256_test_buf[3][57] =
static unsigned char sha256_test_buf[3][57] =
{
{ "abc" },
{ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" },
@ -710,6 +710,6 @@ int sha256_self_test( int verbose )
return( 0 );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_SHA256_C */

View File

@ -65,7 +65,7 @@
| ( (uint64_t) (b)[(i) + 6] << 8 ) \
| ( (uint64_t) (b)[(i) + 7] ); \
}
#endif
#endif /* GET_UINT64_BE */
#ifndef PUT_UINT64_BE
#define PUT_UINT64_BE(n,b,i) \
@ -79,7 +79,7 @@
(b)[(i) + 6] = (unsigned char) ( (n) >> 8 ); \
(b)[(i) + 7] = (unsigned char) ( (n) ); \
}
#endif
#endif /* PUT_UINT64_BE */
/*
* Round constants
@ -461,7 +461,7 @@ void sha512_hmac( const unsigned char *key, size_t keylen,
/*
* FIPS-180-2 test vectors
*/
static unsigned char sha512_test_buf[3][113] =
static unsigned char sha512_test_buf[3][113] =
{
{ "abc" },
{ "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
@ -765,6 +765,6 @@ int sha512_self_test( int verbose )
return( 0 );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_SHA512_C */

View File

@ -3,7 +3,7 @@
*
* \brief SSL ciphersuites for PolarSSL
*
* Copyright (C) 2006-2013, Brainspark B.V.
* Copyright (C) 2006-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -1654,7 +1654,7 @@ pk_type_t ssl_get_ciphersuite_sig_pk_alg( const ssl_ciphersuite_t *info )
return( POLARSSL_PK_NONE );
}
}
#endif
#endif /* POLARSSL_PK_C */
#if defined(POLARSSL_ECDH_C) || defined(POLARSSL_ECDSA_C)
int ssl_ciphersuite_uses_ec( const ssl_ciphersuite_t *info )
@ -1672,7 +1672,7 @@ int ssl_ciphersuite_uses_ec( const ssl_ciphersuite_t *info )
return( 0 );
}
}
#endif
#endif /* POLARSSL_ECDH_C || POLARSSL_ECDSA_C */
#if defined(POLARSSL_KEY_EXCHANGE__SOME__PSK_ENABLED)
int ssl_ciphersuite_uses_psk( const ssl_ciphersuite_t *info )
@ -1689,6 +1689,6 @@ int ssl_ciphersuite_uses_psk( const ssl_ciphersuite_t *info )
return( 0 );
}
}
#endif
#endif /* POLARSSL_KEY_EXCHANGE__SOME__PSK_ENABLED */
#endif
#endif /* POLARSSL_SSL_TLS_C */

View File

@ -496,7 +496,7 @@ static int ssl_write_client_hello( ssl_context *ssl )
return( ret );
p += 4;
#endif
#endif /* POLARSSL_HAVE_TIME */
if( ( ret = ssl->f_rng( ssl->p_rng, p, 28 ) ) != 0 )
return( ret );
@ -607,7 +607,7 @@ static int ssl_write_client_hello( ssl_context *ssl )
*p++ = 1;
*p++ = SSL_COMPRESS_NULL;
#endif
#endif /* POLARSSL_ZLIB_SUPPORT */
// First write extensions, then the total length
//
@ -1268,8 +1268,11 @@ static int ssl_check_server_ecdh_params( const ssl_context *ssl )
return( 0 );
}
#endif
#endif /* POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED ||
POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED ||
POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED ||
POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED ||
POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED */
#if defined(POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
defined(POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
@ -1539,7 +1542,8 @@ static int ssl_parse_server_key_exchange( ssl_context *ssl )
}
((void) p);
((void) end);
#endif
#endif /* POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED ||
POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED */
if( ( ret = ssl_read_record( ssl ) ) != 0 )
{
@ -1661,7 +1665,7 @@ static int ssl_parse_server_key_exchange( ssl_context *ssl )
}
}
else
#endif
#endif /* POLARSSL_SSL_PROTO_TLS1_2 */
#if defined(POLARSSL_SSL_PROTO_SSL3) || defined(POLARSSL_SSL_PROTO_TLS1) || \
defined(POLARSSL_SSL_PROTO_TLS1_1)
if( ssl->minor_ver < SSL_MINOR_VERSION_3 )
@ -2608,4 +2612,4 @@ int ssl_handshake_client_step( ssl_context *ssl )
return( ret );
}
#endif
#endif /* POLARSSL_SSL_CLI_C */

View File

@ -491,7 +491,7 @@ static int ssl_parse_signature_algorithms_ext( ssl_context *ssl,
ssl->handshake->sig_alg = SSL_HASH_SHA384;
break;
}
#endif
#endif /* POLARSSL_SHA512_C */
#if defined(POLARSSL_SHA256_C)
if( p[0] == SSL_HASH_SHA256 )
{
@ -503,7 +503,7 @@ static int ssl_parse_signature_algorithms_ext( ssl_context *ssl,
ssl->handshake->sig_alg = SSL_HASH_SHA224;
break;
}
#endif
#endif /* POLARSSL_SHA256_C */
if( p[0] == SSL_HASH_SHA1 )
{
ssl->handshake->sig_alg = SSL_HASH_SHA1;
@ -552,7 +552,7 @@ static int ssl_parse_supported_elliptic_curves( ssl_context *ssl,
if( ( curves = polarssl_malloc( our_size * sizeof( *curves ) ) ) == NULL )
return( POLARSSL_ERR_SSL_MALLOC_FAILED );
/* explicit void pointer cast for buggy MS compiler */
/* explicit void pointer cast for buggy MS compiler */
memset( (void *) curves, 0, our_size * sizeof( *curves ) );
ssl->handshake->curves = curves;
@ -1798,7 +1798,7 @@ static int ssl_write_server_hello( ssl_context *ssl )
return( ret );
p += 4;
#endif
#endif /* POLARSSL_HAVE_TIME */
if( ( ret = ssl->f_rng( ssl->p_rng, p, 28 ) ) != 0 )
return( ret );
@ -1997,7 +1997,7 @@ static int ssl_write_certificate_request( ssl_context *ssl )
* 4 . 4 cert type count
* 5 .. m-1 cert types
* m .. m+1 sig alg length (TLS 1.2 only)
* m+1 .. n-1 SignatureAndHashAlgorithms (TLS 1.2 only)
* m+1 .. n-1 SignatureAndHashAlgorithms (TLS 1.2 only)
* n .. n+1 length of all DNs
* n+2 .. n+3 length of DN 1
* n+4 .. ... Distinguished Name #1
@ -3037,7 +3037,8 @@ static int ssl_parse_certificate_verify( ssl_context *ssl )
}
}
else
#endif
#endif /* POLARSSL_SSL_PROTO_SSL3 || POLARSSL_SSL_PROTO_TLS1 ||
POLARSSL_SSL_PROTO_TLS1_1 */
#if defined(POLARSSL_SSL_PROTO_TLS1_2)
if( ssl->minor_ver == SSL_MINOR_VERSION_3 )
{
@ -3282,4 +3283,4 @@ int ssl_handshake_server_step( ssl_context *ssl )
return( ret );
}
#endif
#endif /* POLARSSL_SSL_SRV_C */

View File

@ -122,18 +122,18 @@ static int ssl_session_copy( ssl_session *dst, const ssl_session *src )
#if defined(POLARSSL_SSL_HW_RECORD_ACCEL)
int (*ssl_hw_record_init)(ssl_context *ssl,
const unsigned char *key_enc, const unsigned char *key_dec,
size_t keylen,
const unsigned char *iv_enc, const unsigned char *iv_dec,
size_t ivlen,
const unsigned char *mac_enc, const unsigned char *mac_dec,
size_t maclen) = NULL;
const unsigned char *key_enc, const unsigned char *key_dec,
size_t keylen,
const unsigned char *iv_enc, const unsigned char *iv_dec,
size_t ivlen,
const unsigned char *mac_enc, const unsigned char *mac_dec,
size_t maclen) = NULL;
int (*ssl_hw_record_activate)(ssl_context *ssl, int direction) = NULL;
int (*ssl_hw_record_reset)(ssl_context *ssl) = NULL;
int (*ssl_hw_record_write)(ssl_context *ssl) = NULL;
int (*ssl_hw_record_read)(ssl_context *ssl) = NULL;
int (*ssl_hw_record_finish)(ssl_context *ssl) = NULL;
#endif
#endif /* POLARSSL_SSL_HW_RECORD_ACCEL */
/*
* Key material generation
@ -363,7 +363,7 @@ static void ssl_update_checksum_sha384(ssl_context *, const unsigned char *, siz
static void ssl_calc_verify_tls_sha384(ssl_context *,unsigned char *);
static void ssl_calc_finished_tls_sha384(ssl_context *,unsigned char *,int);
#endif
#endif
#endif /* POLARSSL_SSL_PROTO_TLS1_2 */
int ssl_derive_keys( ssl_context *ssl )
{
@ -441,7 +441,7 @@ int ssl_derive_keys( ssl_context *ssl )
}
else
#endif
#endif
#endif /* POLARSSL_SSL_PROTO_TLS1_2 */
{
SSL_DEBUG_MSG( 1, ( "should never happen" ) );
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
@ -615,7 +615,7 @@ int ssl_derive_keys( ssl_context *ssl )
memcpy( transform->mac_dec, mac_dec, transform->maclen );
}
else
#endif
#endif /* POLARSSL_SSL_PROTO_SSL3 */
#if defined(POLARSSL_SSL_PROTO_TLS1) || defined(POLARSSL_SSL_PROTO_TLS1_1) || \
defined(POLARSSL_SSL_PROTO_TLS1_2)
if( ssl->minor_ver >= SSL_MINOR_VERSION_1 )
@ -647,7 +647,7 @@ int ssl_derive_keys( ssl_context *ssl )
return POLARSSL_ERR_SSL_HW_ACCEL_FAILED;
}
}
#endif
#endif /* POLARSSL_SSL_HW_RECORD_ACCEL */
if( ( ret = cipher_init_ctx( &transform->cipher_ctx_enc,
cipher_info ) ) != 0 )
@ -777,7 +777,7 @@ void ssl_calc_verify_ssl( ssl_context *ssl, unsigned char hash[36] )
return;
}
#endif
#endif /* POLARSSL_SSL_PROTO_SSL3 */
#if defined(POLARSSL_SSL_PROTO_TLS1) || defined(POLARSSL_SSL_PROTO_TLS1_1)
void ssl_calc_verify_tls( ssl_context *ssl, unsigned char hash[36] )
@ -1621,7 +1621,7 @@ static int ssl_decrypt_buf( ssl_context *ssl )
}
}
else
#endif
#endif /* POLARSSL_SSL_PROTO_SSL3 */
#if defined(POLARSSL_SSL_PROTO_TLS1) || defined(POLARSSL_SSL_PROTO_TLS1_1) || \
defined(POLARSSL_SSL_PROTO_TLS1_2)
if( ssl->minor_ver > SSL_MINOR_VERSION_0 )
@ -1719,7 +1719,7 @@ static int ssl_decrypt_buf( ssl_context *ssl )
* Process MAC and always update for padlen afterwards to make
* total time independent of padlen
*
* extra_run compensates MAC check for padlen
* extra_run compensates MAC check for padlen
*
* Known timing attacks:
* - Lucky Thirteen (http://www.isg.rhul.ac.uk/tls/TLStiming.pdf)
@ -2021,7 +2021,7 @@ int ssl_write_record( ssl_context *ssl )
if( ret == 0 )
done = 1;
}
#endif
#endif /* POLARSSL_SSL_HW_RECORD_ACCEL */
if( !done )
{
ssl->out_hdr[0] = (unsigned char) ssl->out_msgtype;
@ -2218,7 +2218,7 @@ int ssl_read_record( ssl_context *ssl )
if( ret == 0 )
done = 1;
}
#endif
#endif /* POLARSSL_SSL_HW_RECORD_ACCEL */
if( !done && ssl->transform_in != NULL )
{
if( ( ret = ssl_decrypt_buf( ssl ) ) != 0 )
@ -2753,7 +2753,7 @@ int ssl_parse_certificate( ssl_context *ssl )
ret = POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE;
}
}
#endif
#endif /* POLARSSL_SSL_SET_CURVES */
if( ssl_check_cert_usage( ssl->session_negotiate->peer_cert,
ciphersuite_info,
@ -4358,7 +4358,7 @@ int ssl_read( ssl_context *ssl, unsigned char *buf, size_t len )
return( ret );
}
else
#endif
#endif /* POLARSSL_SSL_PROTO_SSL3 */
#if defined(POLARSSL_SSL_PROTO_TLS1) || defined(POLARSSL_SSL_PROTO_TLS1_1) || \
defined(POLARSSL_SSL_PROTO_TLS1_2)
if( ssl->minor_ver >= SSL_MINOR_VERSION_1 )
@ -4371,7 +4371,8 @@ int ssl_read( ssl_context *ssl, unsigned char *buf, size_t len )
}
}
else
#endif
#endif /* POLARSSL_SSL_PROTO_TLS1 || POLARSSL_SSL_PROTO_TLS1_1 ||
POLARSSL_SSL_PROTO_TLS1_2 */
{
SSL_DEBUG_MSG( 1, ( "should never happen" ) );
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
@ -4562,8 +4563,8 @@ void ssl_handshake_free( ssl_handshake_params *handshake )
#endif
#if defined(POLARSSL_ECDH_C) || defined(POLARSSL_ECDSA_C)
/* explicit void pointer cast for buggy MS compiler */
polarssl_free( (void *) handshake->curves );
/* explicit void pointer cast for buggy MS compiler */
polarssl_free( (void *) handshake->curves );
#endif
#if defined(POLARSSL_X509_CRT_PARSE_C) && \
@ -4583,7 +4584,7 @@ void ssl_handshake_free( ssl_handshake_params *handshake )
cur = next;
}
}
#endif
#endif /* POLARSSL_X509_CRT_PARSE_C && POLARSSL_SSL_SERVER_NAME_INDICATION */
memset( handshake, 0, sizeof( ssl_handshake_params ) );
}
@ -4736,7 +4737,7 @@ pk_type_t ssl_pk_alg_from_sig( unsigned char sig )
return( POLARSSL_PK_NONE );
}
}
#endif
#endif /* POLARSSL_PK_C */
/*
* Convert between SSL_HASH_XXX and POLARSSL_MD_XXX
@ -4785,7 +4786,7 @@ int ssl_curve_is_acceptable( const ssl_context *ssl, ecp_group_id grp_id )
return( 0 );
}
#endif
#endif /* POLARSSL_SSL_SET_CURVES */
#if defined(POLARSSL_X509_CRT_PARSE_C)
int ssl_check_cert_usage( const x509_crt *cert,

View File

@ -63,7 +63,7 @@ struct _hr_time
struct timeval start;
};
#endif
#endif /* _WIN32 && !EFIX64 && !EFI32 */
#if !defined(POLARSSL_HAVE_HARDCLOCK) && defined(POLARSSL_HAVE_ASM) && \
(defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
@ -77,7 +77,8 @@ unsigned long hardclock( void )
__asm mov [tsc], eax
return( tsc );
}
#endif
#endif /* !POLARSSL_HAVE_HARDCLOCK && POLARSSL_HAVE_ASM &&
( _MSC_VER && _M_IX86 ) || __WATCOMC__ */
#if !defined(POLARSSL_HAVE_HARDCLOCK) && defined(POLARSSL_HAVE_ASM) && \
defined(__GNUC__) && defined(__i386__)
@ -90,7 +91,8 @@ unsigned long hardclock( void )
asm volatile( "rdtsc" : "=a" (lo), "=d" (hi) );
return( lo );
}
#endif
#endif /* !POLARSSL_HAVE_HARDCLOCK && POLARSSL_HAVE_ASM &&
__GNUC__ && __i386__ */
#if !defined(POLARSSL_HAVE_HARDCLOCK) && defined(POLARSSL_HAVE_ASM) && \
defined(__GNUC__) && (defined(__amd64__) || defined(__x86_64__))
@ -103,7 +105,8 @@ unsigned long hardclock( void )
asm volatile( "rdtsc" : "=a" (lo), "=d" (hi) );
return( lo | (hi << 32) );
}
#endif
#endif /* !POLARSSL_HAVE_HARDCLOCK && POLARSSL_HAVE_ASM &&
__GNUC__ && ( __amd64__ || __x86_64__ ) */
#if !defined(POLARSSL_HAVE_HARDCLOCK) && defined(POLARSSL_HAVE_ASM) && \
defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
@ -124,7 +127,8 @@ unsigned long hardclock( void )
return( tbl );
}
#endif
#endif /* !POLARSSL_HAVE_HARDCLOCK && POLARSSL_HAVE_ASM &&
__GNUC__ && ( __powerpc__ || __ppc__ ) */
#if !defined(POLARSSL_HAVE_HARDCLOCK) && defined(POLARSSL_HAVE_ASM) && \
defined(__GNUC__) && defined(__sparc64__)
@ -140,8 +144,9 @@ unsigned long hardclock( void )
asm volatile( "rdpr %%tick, %0;" : "=&r" (tick) );
return( tick );
}
#endif
#endif
#endif /* __OpenBSD__ */
#endif /* !POLARSSL_HAVE_HARDCLOCK && POLARSSL_HAVE_ASM &&
__GNUC__ && __sparc64__ */
#if !defined(POLARSSL_HAVE_HARDCLOCK) && defined(POLARSSL_HAVE_ASM) && \
defined(__GNUC__) && defined(__sparc__) && !defined(__sparc64__)
@ -155,7 +160,8 @@ unsigned long hardclock( void )
asm volatile( "mov %%g1, %0" : "=r" (tick) );
return( tick );
}
#endif
#endif /* !POLARSSL_HAVE_HARDCLOCK && POLARSSL_HAVE_ASM &&
__GNUC__ && __sparc__ && !__sparc64__ */
#if !defined(POLARSSL_HAVE_HARDCLOCK) && defined(POLARSSL_HAVE_ASM) && \
defined(__GNUC__) && defined(__alpha__)
@ -168,7 +174,8 @@ unsigned long hardclock( void )
asm volatile( "rpcc %0" : "=r" (cc) );
return( cc & 0xFFFFFFFF );
}
#endif
#endif /* !POLARSSL_HAVE_HARDCLOCK && POLARSSL_HAVE_ASM &&
__GNUC__ && __alpha__ */
#if !defined(POLARSSL_HAVE_HARDCLOCK) && defined(POLARSSL_HAVE_ASM) && \
defined(__GNUC__) && defined(__ia64__)
@ -181,7 +188,8 @@ unsigned long hardclock( void )
asm volatile( "mov %0 = ar.itc" : "=r" (itc) );
return( itc );
}
#endif
#endif /* !POLARSSL_HAVE_HARDCLOCK && POLARSSL_HAVE_ASM &&
__GNUC__ && __ia64__ */
#if !defined(POLARSSL_HAVE_HARDCLOCK) && defined(_MSC_VER) && \
!defined(EFIX64) && !defined(EFI32)
@ -196,7 +204,7 @@ unsigned long hardclock( void )
return (unsigned long)( offset.QuadPart );
}
#endif
#endif /* !POLARSSL_HAVE_HARDCLOCK && _MSC_VER && !EFIX64 && !EFI32 */
#if !defined(POLARSSL_HAVE_HARDCLOCK)
@ -219,7 +227,7 @@ unsigned long hardclock( void )
return( ( tv_cur.tv_sec - tv_init.tv_sec ) * 1000000
+ ( tv_cur.tv_usec - tv_init.tv_usec ) );
}
#endif
#endif /* !POLARSSL_HAVE_HARDCLOCK */
volatile int alarmed = 0;
@ -461,7 +469,7 @@ hard_test:
if( verbose != 0 )
polarssl_printf( "passed\n" );
#endif
#endif /* POLARSSL_NET_C */
return( 0 );
}

View File

@ -525,7 +525,7 @@ const char *features[] = {
#if defined(POLARSSL_XTEA_C)
"POLARSSL_XTEA_C",
#endif /* POLARSSL_XTEA_C */
#endif
#endif /* POLARSSL_VERSION_FEATURES */
NULL
};

View File

@ -468,7 +468,7 @@ static int compat_snprintf(char *str, size_t size, const char *format, ...)
}
#define snprintf compat_snprintf
#endif
#endif /* _MSC_VER && !snprintf && !EFIX64 && !EFI32 */
#define POLARSSL_ERR_DEBUG_BUF_TOO_SMALL -2
@ -652,7 +652,7 @@ static void x509_get_current_time( x509_time *now )
now->hour = lt.tm_hour;
now->min = lt.tm_min;
now->sec = lt.tm_sec;
#endif
#endif /* _WIN32 && !EFIX64 && !EFI32 */
}
/*
@ -796,9 +796,9 @@ int x509_self_test( int verbose )
#else
((void) verbose);
return( POLARSSL_ERR_X509_FEATURE_UNAVAILABLE );
#endif
#endif /* POLARSSL_CERTS_C && POLARSSL_SHA1_C */
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif /* POLARSSL_X509_USE_C */

View File

@ -158,7 +158,7 @@ static int x509_get_crl_entry_ext( unsigned char **p,
return( POLARSSL_ERR_X509_INVALID_EXTENSIONS + ret );
}
end = *p + ext->len;
end = *p + ext->len;
if( end != *p + ext->len )
return( POLARSSL_ERR_X509_INVALID_EXTENSIONS +
@ -316,7 +316,7 @@ int x509_crl_parse( x509_crl *chain, const unsigned char *buf, size_t buflen )
return( ret );
}
else
#endif
#endif /* POLARSSL_PEM_PARSE_C */
{
/*
* nope, copy the raw DER data
@ -583,7 +583,7 @@ static int compat_snprintf(char *str, size_t size, const char *format, ...)
}
#define snprintf compat_snprintf
#endif
#endif /* _MSC_VER && !snprintf && !EFIX64 && !EFI32 */
#define POLARSSL_ERR_DEBUG_BUF_TOO_SMALL -2
@ -751,4 +751,4 @@ void x509_crl_free( x509_crl *crl )
while( crl_cur != NULL );
}
#endif
#endif /* POLARSSL_X509_CRL_PARSE_C */

View File

@ -912,7 +912,7 @@ int x509_crt_parse( x509_crt *chain, const unsigned char *buf, size_t buflen )
success = 1;
}
}
#endif
#endif /* POLARSSL_PEM_PARSE_C */
if( success )
return( total_failed );
@ -954,23 +954,23 @@ int x509_crt_parse_path( x509_crt *chain, const char *path )
int w_ret;
WCHAR szDir[MAX_PATH];
char filename[MAX_PATH];
char *p;
char *p;
int len = (int) strlen( path );
WIN32_FIND_DATAW file_data;
WIN32_FIND_DATAW file_data;
HANDLE hFind;
if( len > MAX_PATH - 3 )
return( POLARSSL_ERR_X509_BAD_INPUT_DATA );
memset( szDir, 0, sizeof(szDir) );
memset( filename, 0, MAX_PATH );
memcpy( filename, path, len );
filename[len++] = '\\';
p = filename + len;
memset( szDir, 0, sizeof(szDir) );
memset( filename, 0, MAX_PATH );
memcpy( filename, path, len );
filename[len++] = '\\';
p = filename + len;
filename[len++] = '*';
w_ret = MultiByteToWideChar( CP_ACP, 0, filename, len, szDir, MAX_PATH - 3 );
w_ret = MultiByteToWideChar( CP_ACP, 0, filename, len, szDir, MAX_PATH - 3 );
hFind = FindFirstFileW( szDir, &file_data );
if (hFind == INVALID_HANDLE_VALUE)
@ -979,15 +979,15 @@ int x509_crt_parse_path( x509_crt *chain, const char *path )
len = MAX_PATH - len;
do
{
memset( p, 0, len );
memset( p, 0, len );
if( file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
continue;
w_ret = WideCharToMultiByte( CP_ACP, 0, file_data.cFileName,
lstrlenW(file_data.cFileName),
p, len - 1,
NULL, NULL );
w_ret = WideCharToMultiByte( CP_ACP, 0, file_data.cFileName,
lstrlenW(file_data.cFileName),
p, len - 1,
NULL, NULL );
w_ret = x509_crt_parse_file( chain, filename );
if( w_ret < 0 )
@ -1086,7 +1086,7 @@ static int compat_snprintf(char *str, size_t size, const char *format, ...)
}
#define snprintf compat_snprintf
#endif
#endif /* _MSC_VER && !snprintf && !EFIX64 && !EFI32 */
#define POLARSSL_ERR_DEBUG_BUF_TOO_SMALL -2
@ -1405,7 +1405,7 @@ int x509_crt_check_extended_key_usage( const x509_crt *crt,
return( POLARSSL_ERR_X509_BAD_INPUT_DATA );
}
#endif
#endif /* POLARSSL_X509_CHECK_EXTENDED_KEY_USAGE */
#if defined(POLARSSL_X509_CRL_PARSE_C)
/*
@ -1971,4 +1971,4 @@ void x509_crt_free( x509_crt *crt )
while( cert_cur != NULL );
}
#endif
#endif /* POLARSSL_X509_CRT_PARSE_C */

View File

@ -129,7 +129,7 @@ int x509_csr_parse( x509_csr *csr, const unsigned char *buf, size_t buflen )
return( ret );
}
else
#endif
#endif /* POLARSSL_PEM_PARSE_C */
{
/*
* nope, copy the raw DER data
@ -332,7 +332,7 @@ static int compat_snprintf(char *str, size_t size, const char *format, ...)
}
#define snprintf compat_snprintf
#endif
#endif /* _MSC_VER && !snprintf && !EFIX64 && !EFI32 */
#define POLARSSL_ERR_DEBUG_BUF_TOO_SMALL -2

View File

@ -1,7 +1,7 @@
/*
* An 32-bit implementation of the XTEA algorithm
*
* Copyright (C) 2006-2013, Brainspark B.V.
* Copyright (C) 2006-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -255,6 +255,6 @@ int xtea_self_test( int verbose )
return( 0 );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_XTEA_C */

View File

@ -43,7 +43,7 @@
const char *features[] = {
#if defined(POLARSSL_VERSION_FEATURES)
FEATURE_DEFINES
#endif
#endif /* POLARSSL_VERSION_FEATURES */
NULL
};