Fix formatting: fix some 'easy' > 80 length lines
diff --git a/include/polarssl/aes.h b/include/polarssl/aes.h index 9b8a5fa..58b348e 100644 --- a/include/polarssl/aes.h +++ b/include/polarssl/aes.h
@@ -3,7 +3,7 @@ * * \brief AES block cipher * - * 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> @@ -82,7 +82,8 @@ * * \return 0 if successful, or POLARSSL_ERR_AES_INVALID_KEY_LENGTH */ -int aes_setkey_enc( aes_context *ctx, const unsigned char *key, unsigned int keysize ); +int aes_setkey_enc( aes_context *ctx, const unsigned char *key, + unsigned int keysize ); /** * \brief AES key schedule (decryption) @@ -93,7 +94,8 @@ * * \return 0 if successful, or POLARSSL_ERR_AES_INVALID_KEY_LENGTH */ -int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int keysize ); +int aes_setkey_dec( aes_context *ctx, const unsigned char *key, + unsigned int keysize ); /** * \brief AES-ECB block encryption/decryption
diff --git a/include/polarssl/arc4.h b/include/polarssl/arc4.h index baa4f6c..c6c676b 100644 --- a/include/polarssl/arc4.h +++ b/include/polarssl/arc4.h
@@ -3,7 +3,7 @@ * * \brief The ARCFOUR stream cipher * - * 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> @@ -61,7 +61,8 @@ * \param key the secret key * \param keylen length of the key, in bytes */ -void arc4_setup( arc4_context *ctx, const unsigned char *key, unsigned int keylen ); +void arc4_setup( arc4_context *ctx, const unsigned char *key, + unsigned int keylen ); /** * \brief ARC4 cipher function
diff --git a/include/polarssl/asn1write.h b/include/polarssl/asn1write.h index 9c36030..7a7fbf7 100644 --- a/include/polarssl/asn1write.h +++ b/include/polarssl/asn1write.h
@@ -3,7 +3,7 @@ * * \brief ASN.1 buffer writing functionality * - * 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> @@ -29,7 +29,8 @@ #include "asn1.h" -#define ASN1_CHK_ADD(g, f) do { if( ( ret = f ) < 0 ) return( ret ); else g += ret; } while( 0 ) +#define ASN1_CHK_ADD(g, f) do { if( ( ret = f ) < 0 ) return( ret ); else \ + g += ret; } while( 0 ) #ifdef __cplusplus extern "C" { @@ -57,7 +58,8 @@ * * \return the length written or a negative error code */ -int asn1_write_tag( unsigned char **p, unsigned char *start, unsigned char tag ); +int asn1_write_tag( unsigned char **p, unsigned char *start, + unsigned char tag ); /** * \brief Write raw buffer data
diff --git a/include/polarssl/bignum.h b/include/polarssl/bignum.h index 2c3f4b4..da18599 100644 --- a/include/polarssl/bignum.h +++ b/include/polarssl/bignum.h
@@ -3,7 +3,7 @@ * * \brief Multi-precision integer library * - * 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> @@ -652,8 +652,8 @@ * * \return 0 if successful, * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed, - * POLARSSL_ERR_MPI_BAD_INPUT_DATA if N is negative or even or if - * E is negative + * POLARSSL_ERR_MPI_BAD_INPUT_DATA if N is negative or even or + * if E is negative * * \note _RR is used to avoid re-computing R*R mod N across * multiple calls, which speeds up things a bit. It can @@ -721,7 +721,8 @@ * \brief Prime number generation * * \param X Destination MPI - * \param nbits Required size of X in bits ( 3 <= nbits <= POLARSSL_MPI_MAX_BITS ) + * \param nbits Required size of X in bits + * ( 3 <= nbits <= POLARSSL_MPI_MAX_BITS ) * \param dh_flag If 1, then (X-1)/2 will be prime too * \param f_rng RNG function * \param p_rng RNG parameter
diff --git a/include/polarssl/blowfish.h b/include/polarssl/blowfish.h index 8c470ed..c9c8672 100644 --- a/include/polarssl/blowfish.h +++ b/include/polarssl/blowfish.h
@@ -3,7 +3,7 @@ * * \brief Blowfish block cipher * - * 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> @@ -46,7 +46,7 @@ #define BLOWFISH_DECRYPT 0 #define BLOWFISH_MAX_KEY 448 #define BLOWFISH_MIN_KEY 32 -#define BLOWFISH_ROUNDS 16 /* when increasing this value, make sure to extend the initialisation vectors */ +#define BLOWFISH_ROUNDS 16 /**< Rounds to use. When increasing this value, make sure to extend the initialisation vectors */ #define BLOWFISH_BLOCKSIZE 8 /* Blowfish uses 64 bit blocks */ #define POLARSSL_ERR_BLOWFISH_INVALID_KEY_LENGTH -0x0016 /**< Invalid key length. */ @@ -79,7 +79,8 @@ * * \return 0 if successful, or POLARSSL_ERR_BLOWFISH_INVALID_KEY_LENGTH */ -int blowfish_setkey( blowfish_context *ctx, const unsigned char *key, unsigned int keysize ); +int blowfish_setkey( blowfish_context *ctx, const unsigned char *key, + unsigned int keysize ); /** * \brief Blowfish-ECB block encryption/decryption @@ -109,7 +110,8 @@ * \param input buffer holding the input data * \param output buffer holding the output data * - * \return 0 if successful, or POLARSSL_ERR_BLOWFISH_INVALID_INPUT_LENGTH + * \return 0 if successful, or + * POLARSSL_ERR_BLOWFISH_INVALID_INPUT_LENGTH */ int blowfish_crypt_cbc( blowfish_context *ctx, int mode,
diff --git a/include/polarssl/camellia.h b/include/polarssl/camellia.h index 9dbdb85..34c1990 100644 --- a/include/polarssl/camellia.h +++ b/include/polarssl/camellia.h
@@ -3,7 +3,7 @@ * * \brief Camellia block cipher * - * 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> @@ -75,7 +75,8 @@ * * \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 ); +int camellia_setkey_enc( camellia_context *ctx, const unsigned char *key, + unsigned int keysize ); /** * \brief CAMELLIA key schedule (decryption) @@ -86,7 +87,8 @@ * * \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 ); +int camellia_setkey_dec( camellia_context *ctx, const unsigned char *key, + unsigned int keysize ); /** * \brief CAMELLIA-ECB block encryption/decryption @@ -116,7 +118,8 @@ * \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 + * \return 0 if successful, or + * POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH */ int camellia_crypt_cbc( camellia_context *ctx, int mode, @@ -142,7 +145,8 @@ * \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 + * \return 0 if successful, or + * POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH */ int camellia_crypt_cfb128( camellia_context *ctx, int mode,
diff --git a/include/polarssl/cipher.h b/include/polarssl/cipher.h index e034fac..d26b206 100644 --- a/include/polarssl/cipher.h +++ b/include/polarssl/cipher.h
@@ -5,7 +5,7 @@ * * \author Adriaan de Jong <dejong@fox-it.com> * - * 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> @@ -173,29 +173,34 @@ /** Encrypt using ECB */ int (*ecb_func)( void *ctx, operation_t mode, - const unsigned char *input, unsigned char *output ); + const unsigned char *input, unsigned char *output ); /** Encrypt using CBC */ - int (*cbc_func)( void *ctx, operation_t mode, size_t length, unsigned char *iv, - const unsigned char *input, unsigned char *output ); + int (*cbc_func)( void *ctx, operation_t mode, size_t length, + unsigned char *iv, const unsigned char *input, + unsigned char *output ); /** Encrypt using CFB (Full length) */ int (*cfb_func)( void *ctx, operation_t mode, size_t length, size_t *iv_off, - unsigned char *iv, const unsigned char *input, unsigned char *output ); + unsigned char *iv, const unsigned char *input, + unsigned char *output ); /** Encrypt using CTR */ - int (*ctr_func)( void *ctx, size_t length, size_t *nc_off, unsigned char *nonce_counter, - unsigned char *stream_block, const unsigned char *input, unsigned char *output ); + int (*ctr_func)( void *ctx, size_t length, size_t *nc_off, + unsigned char *nonce_counter, unsigned char *stream_block, + const unsigned char *input, unsigned char *output ); /** Encrypt using STREAM */ int (*stream_func)( void *ctx, size_t length, const unsigned char *input, unsigned char *output ); /** Set key for encryption purposes */ - int (*setkey_enc_func)( void *ctx, const unsigned char *key, unsigned int key_length); + int (*setkey_enc_func)( void *ctx, const unsigned char *key, + unsigned int key_length ); /** Set key for decryption purposes */ - int (*setkey_dec_func)( void *ctx, const unsigned char *key, unsigned int key_length); + int (*setkey_dec_func)( void *ctx, const unsigned char *key, + unsigned int key_length); /** Allocate a new context */ void * (*ctx_alloc_func)( void ); @@ -323,9 +328,9 @@ * \param ctx context to initialise. May not be NULL. * \param cipher_info cipher to use. * - * \return \c 0 on success, - * \c POLARSSL_ERR_CIPHER_BAD_INPUT_DATA on parameter failure, - * \c POLARSSL_ERR_CIPHER_ALLOC_FAILED if allocation of the + * \return 0 on success, + * POLARSSL_ERR_CIPHER_BAD_INPUT_DATA on parameter failure, + * POLARSSL_ERR_CIPHER_ALLOC_FAILED if allocation of the * cipher-specific context failed. */ int cipher_init_ctx( cipher_context_t *ctx, const cipher_info_t *cipher_info ); @@ -474,8 +479,8 @@ * parameter verification fails or a cipher specific * error code. */ -int cipher_setkey( cipher_context_t *ctx, const unsigned char *key, int key_length, - const operation_t operation ); +int cipher_setkey( cipher_context_t *ctx, const unsigned char *key, + int key_length, const operation_t operation ); #if defined(POLARSSL_CIPHER_MODE_WITH_PADDING) /** @@ -568,8 +573,8 @@ * function, except the last one before cipher_finish(), * must have ilen a multiple of the block size. */ -int cipher_update( cipher_context_t *ctx, const unsigned char *input, size_t ilen, - unsigned char *output, size_t *olen ); +int cipher_update( cipher_context_t *ctx, const unsigned char *input, + size_t ilen, unsigned char *output, size_t *olen ); /** * \brief Generic cipher finalisation function. If data still
diff --git a/include/polarssl/ctr_drbg.h b/include/polarssl/ctr_drbg.h index a71b0ff..4b5a444 100644 --- a/include/polarssl/ctr_drbg.h +++ b/include/polarssl/ctr_drbg.h
@@ -3,7 +3,7 @@ * * \brief CTR_DRBG based on AES-256 (NIST SP 800-90) * - * 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> @@ -91,8 +91,9 @@ unsigned char counter[16]; /*!< counter (V) */ int reseed_counter; /*!< reseed counter */ int prediction_resistance; /*!< enable prediction resistance (Automatic - reseed before every random generation) */ - size_t entropy_len; /*!< amount of entropy grabbed on each (re)seed */ + reseed before every random generation) */ + size_t entropy_len; /*!< amount of entropy grabbed on each + (re)seed */ int reseed_interval; /*!< reseed interval */ aes_context aes_ctx; /*!< AES context */ @@ -255,7 +256,9 @@ int ctr_drbg_self_test( int verbose ); /* Internal functions (do not call directly) */ -int ctr_drbg_init_entropy_len( ctr_drbg_context *, int (*)(void *, unsigned char *, size_t), void *, const unsigned char *, size_t, size_t ); +int ctr_drbg_init_entropy_len( ctr_drbg_context *, + int (*)(void *, unsigned char *, size_t), void *, + const unsigned char *, size_t, size_t ); #ifdef __cplusplus }
diff --git a/include/polarssl/des.h b/include/polarssl/des.h index 7499b53..7872975 100644 --- a/include/polarssl/des.h +++ b/include/polarssl/des.h
@@ -3,7 +3,7 @@ * * \brief DES block cipher * - * 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> @@ -136,7 +136,8 @@ * * \return 0 */ -int des3_set2key_enc( des3_context *ctx, const unsigned char key[DES_KEY_SIZE * 2] ); +int des3_set2key_enc( des3_context *ctx, + const unsigned char key[DES_KEY_SIZE * 2] ); /** * \brief Triple-DES key schedule (112-bit, decryption) @@ -146,7 +147,8 @@ * * \return 0 */ -int des3_set2key_dec( des3_context *ctx, const unsigned char key[DES_KEY_SIZE * 2] ); +int des3_set2key_dec( des3_context *ctx, + const unsigned char key[DES_KEY_SIZE * 2] ); /** * \brief Triple-DES key schedule (168-bit, encryption) @@ -156,7 +158,8 @@ * * \return 0 */ -int des3_set3key_enc( des3_context *ctx, const unsigned char key[DES_KEY_SIZE * 3] ); +int des3_set3key_enc( des3_context *ctx, + const unsigned char key[DES_KEY_SIZE * 3] ); /** * \brief Triple-DES key schedule (168-bit, decryption) @@ -166,7 +169,8 @@ * * \return 0 */ -int des3_set3key_dec( des3_context *ctx, const unsigned char key[DES_KEY_SIZE * 3] ); +int des3_set3key_dec( des3_context *ctx, + const unsigned char key[DES_KEY_SIZE * 3] ); /** * \brief DES-ECB block encryption/decryption
diff --git a/include/polarssl/entropy.h b/include/polarssl/entropy.h index 784be16..55b262f 100644 --- a/include/polarssl/entropy.h +++ b/include/polarssl/entropy.h
@@ -3,7 +3,7 @@ * * \brief 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> @@ -177,7 +177,8 @@ int entropy_gather( entropy_context *ctx ); /** - * \brief Retrieve entropy from the accumulator (Max ENTROPY_BLOCK_SIZE) + * \brief Retrieve entropy from the accumulator + * (Maximum length: ENTROPY_BLOCK_SIZE) * (Thread-safe if POLARSSL_THREADING_C is enabled) * * \param data Entropy context
diff --git a/include/polarssl/md.h b/include/polarssl/md.h index 796c0df..8de233a 100644 --- a/include/polarssl/md.h +++ b/include/polarssl/md.h
@@ -5,7 +5,7 @@ * * \author Adriaan de Jong <dejong@fox-it.com> * - * 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> @@ -92,16 +92,18 @@ /** Generic digest function */ void (*digest_func)( const unsigned char *input, size_t ilen, - unsigned char *output ); + unsigned char *output ); /** Generic file digest function */ int (*file_func)( const char *path, unsigned char *output ); /** HMAC Initialisation function */ - void (*hmac_starts_func)( void *ctx, const unsigned char *key, size_t keylen ); + void (*hmac_starts_func)( void *ctx, const unsigned char *key, + size_t keylen ); /** HMAC update function */ - void (*hmac_update_func)( void *ctx, const unsigned char *input, size_t ilen ); + void (*hmac_update_func)( void *ctx, const unsigned char *input, + size_t ilen ); /** HMAC finalisation function */ void (*hmac_finish_func)( void *ctx, unsigned char *output); @@ -111,8 +113,8 @@ /** Generic HMAC function */ void (*hmac_func)( const unsigned char *key, size_t keylen, - const unsigned char *input, size_t ilen, - unsigned char *output ); + const unsigned char *input, size_t ilen, + unsigned char *output ); /** Allocate a new context */ void * (*ctx_alloc_func)( void ); @@ -171,8 +173,8 @@ const md_info_t *md_info_from_type( md_type_t md_type ); /** - * \brief Initialises and fills the message digest context structure with - * the appropriate values. + * \brief Initialises and fills the message digest context structure + * with the appropriate values. * * \param ctx context to initialise. May not be NULL. The * digest-specific context (ctx->md_ctx) must be NULL. It will @@ -299,7 +301,8 @@ * failed, POLARSSL_ERR_MD_FILE_READ_FAILED if fread failed, * POLARSSL_ERR_MD_BAD_INPUT_DATA if md_info was NULL. */ -int md_file( const md_info_t *md_info, const char *path, unsigned char *output ); +int md_file( const md_info_t *md_info, const char *path, + unsigned char *output ); /** * \brief Generic HMAC context setup @@ -311,7 +314,8 @@ * \returns 0 on success, POLARSSL_ERR_MD_BAD_INPUT_DATA if parameter * verification fails. */ -int md_hmac_starts( md_context_t *ctx, const unsigned char *key, size_t keylen ); +int md_hmac_starts( md_context_t *ctx, const unsigned char *key, + size_t keylen ); /** * \brief Generic HMAC process buffer @@ -323,7 +327,8 @@ * \returns 0 on success, POLARSSL_ERR_MD_BAD_INPUT_DATA if parameter * verification fails. */ -int md_hmac_update( md_context_t *ctx, const unsigned char *input, size_t ilen ); +int md_hmac_update( md_context_t *ctx, const unsigned char *input, + size_t ilen ); /** * \brief Generic HMAC final digest
diff --git a/include/polarssl/md2.h b/include/polarssl/md2.h index 3792a4d..96da06c 100644 --- a/include/polarssl/md2.h +++ b/include/polarssl/md2.h
@@ -3,7 +3,7 @@ * * \brief MD2 message digest algorithm (hash function) * - * 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> @@ -122,7 +122,8 @@ * \param key HMAC secret key * \param keylen length of the HMAC key */ -void md2_hmac_starts( md2_context *ctx, const unsigned char *key, size_t keylen ); +void md2_hmac_starts( md2_context *ctx, const unsigned char *key, + size_t keylen ); /** * \brief MD2 HMAC process buffer @@ -131,7 +132,8 @@ * \param input buffer holding the data * \param ilen length of the input data */ -void md2_hmac_update( md2_context *ctx, const unsigned char *input, size_t ilen ); +void md2_hmac_update( md2_context *ctx, const unsigned char *input, + size_t ilen ); /** * \brief MD2 HMAC final digest
diff --git a/include/polarssl/md4.h b/include/polarssl/md4.h index b0434dd..6302c3c 100644 --- a/include/polarssl/md4.h +++ b/include/polarssl/md4.h
@@ -3,7 +3,7 @@ * * \brief MD4 message digest algorithm (hash function) * - * 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> @@ -128,7 +128,8 @@ * \param key HMAC secret key * \param keylen length of the HMAC key */ -void md4_hmac_starts( md4_context *ctx, const unsigned char *key, size_t keylen ); +void md4_hmac_starts( md4_context *ctx, const unsigned char *key, + size_t keylen ); /** * \brief MD4 HMAC process buffer @@ -137,7 +138,8 @@ * \param input buffer holding the data * \param ilen length of the input data */ -void md4_hmac_update( md4_context *ctx, const unsigned char *input, size_t ilen ); +void md4_hmac_update( md4_context *ctx, const unsigned char *input, + size_t ilen ); /** * \brief MD4 HMAC final digest
diff --git a/include/polarssl/oid.h b/include/polarssl/oid.h index b1d33b6..32b0340 100644 --- a/include/polarssl/oid.h +++ b/include/polarssl/oid.h
@@ -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> @@ -63,7 +63,7 @@ */ #define OID_COUNTRY_US "\x86\x48" /* {us(840)} */ #define OID_ORG_RSA_DATA_SECURITY "\x86\xf7\x0d" /* {rsadsi(113549)} */ -#define OID_RSA_COMPANY OID_ISO_MEMBER_BODIES OID_COUNTRY_US \ +#define OID_RSA_COMPANY OID_ISO_MEMBER_BODIES OID_COUNTRY_US \ OID_ORG_RSA_DATA_SECURITY /* {iso(1) member-body(2) us(840) rsadsi(113549)} */ #define OID_ORG_ANSI_X9_62 "\xce\x3d" /* ansi-X9-62(10045) */ #define OID_ANSI_X9_62 OID_ISO_MEMBER_BODIES OID_COUNTRY_US \
diff --git a/include/polarssl/padlock.h b/include/polarssl/padlock.h index 545120f..3c5f725 100644 --- a/include/polarssl/padlock.h +++ b/include/polarssl/padlock.h
@@ -1,9 +1,10 @@ /** * \file padlock.h * - * \brief VIA PadLock ACE for HW encryption/decryption supported by some processors + * \brief VIA PadLock ACE for HW encryption/decryption supported by some + * processors * - * 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>
diff --git a/include/polarssl/pkcs11.h b/include/polarssl/pkcs11.h index 74859c0..84f862d 100644 --- a/include/polarssl/pkcs11.h +++ b/include/polarssl/pkcs11.h
@@ -5,7 +5,7 @@ * * \author Adriaan de Jong <dejong@fox-it.com> * - * 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> @@ -93,7 +93,8 @@ void pkcs11_priv_key_free( pkcs11_context *priv_key ); /** - * \brief Do an RSA private key decrypt, then remove the message padding + * \brief Do an RSA private key decrypt, then remove the message + * padding * * \param ctx PKCS #11 context * \param mode must be RSA_PRIVATE, for compatibility with rsa.c's signature @@ -119,8 +120,8 @@ * * \param ctx PKCS #11 context * \param mode must be RSA_PRIVATE, for compatibility with rsa.c's signature - * \param hash_id SIG_RSA_RAW, SIG_RSA_MD{2,4,5} or SIG_RSA_SHA{1,224,256,384,512} - * \param hashlen message digest length (for SIG_RSA_RAW only) + * \param md_alg a POLARSSL_MD_* (use POLARSSL_MD_NONE for signing raw data) + * \param hashlen message digest length (for POLARSSL_MD_NONE only) * \param hash buffer holding the message digest * \param sig buffer that will hold the ciphertext *
diff --git a/include/polarssl/rsa.h b/include/polarssl/rsa.h index ce84c1c..1c697fb 100644 --- a/include/polarssl/rsa.h +++ b/include/polarssl/rsa.h
@@ -3,7 +3,7 @@ * * \brief The RSA public-key cryptosystem * - * 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> @@ -503,8 +503,8 @@ * * \note In case of PKCS#1 v2.1 encoding keep in mind that * the hash_id in the RSA context is the one used for the - * verification. hash_id in the function call is the type of hash - * that is verified. According to RFC 3447 it is advised to + * verification. hash_id in the function call is the type of + * hash that is verified. According to RFC 3447 it is advised to * keep both hashes the same. */ int rsa_pkcs1_verify( rsa_context *ctx, @@ -563,8 +563,8 @@ * * \note In case of PKCS#1 v2.1 encoding keep in mind that * the hash_id in the RSA context is the one used for the - * verification. hash_id in the function call is the type of hash - * that is verified. According to RFC 3447 it is advised to + * verification. hash_id in the function call is the type of + * hash that is verified. According to RFC 3447 it is advised to * keep both hashes the same. */ int rsa_rsassa_pss_verify( rsa_context *ctx,
diff --git a/include/polarssl/sha1.h b/include/polarssl/sha1.h index f5e91a4..57a731b 100644 --- a/include/polarssl/sha1.h +++ b/include/polarssl/sha1.h
@@ -3,7 +3,7 @@ * * \brief SHA-1 cryptographic hash function * - * 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> @@ -131,7 +131,8 @@ * \param key HMAC secret key * \param keylen length of the HMAC key */ -void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key, size_t keylen ); +void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key, + size_t keylen ); /** * \brief SHA-1 HMAC process buffer @@ -140,7 +141,8 @@ * \param input buffer holding the data * \param ilen length of the input data */ -void sha1_hmac_update( sha1_context *ctx, const unsigned char *input, size_t ilen ); +void sha1_hmac_update( sha1_context *ctx, const unsigned char *input, + size_t ilen ); /** * \brief SHA-1 HMAC final digest
diff --git a/include/polarssl/sha256.h b/include/polarssl/sha256.h index f3c00fa..80a0224 100644 --- a/include/polarssl/sha256.h +++ b/include/polarssl/sha256.h
@@ -3,7 +3,7 @@ * * \brief SHA-224 and SHA-256 cryptographic hash function * - * 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> @@ -82,7 +82,8 @@ * \param input buffer holding the data * \param ilen length of the input data */ -void sha256_update( sha256_context *ctx, const unsigned char *input, size_t ilen ); +void sha256_update( sha256_context *ctx, const unsigned char *input, + size_t ilen ); /** * \brief SHA-256 final digest @@ -147,7 +148,8 @@ * \param input buffer holding the data * \param ilen length of the input data */ -void sha256_hmac_update( sha256_context *ctx, const unsigned char *input, size_t ilen ); +void sha256_hmac_update( sha256_context *ctx, const unsigned char *input, + size_t ilen ); /** * \brief SHA-256 HMAC final digest
diff --git a/include/polarssl/sha512.h b/include/polarssl/sha512.h index b8908af..c60564f 100644 --- a/include/polarssl/sha512.h +++ b/include/polarssl/sha512.h
@@ -3,7 +3,7 @@ * * \brief SHA-384 and SHA-512 cryptographic hash function * - * 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> @@ -83,7 +83,8 @@ * \param input buffer holding the data * \param ilen length of the input data */ -void sha512_update( sha512_context *ctx, const unsigned char *input, size_t ilen ); +void sha512_update( sha512_context *ctx, const unsigned char *input, + size_t ilen ); /** * \brief SHA-512 final digest @@ -145,7 +146,8 @@ * \param input buffer holding the data * \param ilen length of the input data */ -void sha512_hmac_update( sha512_context *ctx, const unsigned char *input, size_t ilen ); +void sha512_hmac_update( sha512_context *ctx, const unsigned char *input, + size_t ilen ); /** * \brief SHA-512 HMAC final digest
diff --git a/include/polarssl/ssl.h b/include/polarssl/ssl.h index 9cbd512..21ed42e 100644 --- a/include/polarssl/ssl.h +++ b/include/polarssl/ssl.h
@@ -3,7 +3,7 @@ * * \brief SSL/TLS 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> @@ -825,8 +825,8 @@ const int *ssl_list_ciphersuites( void ); /** - * \brief Return the name of the ciphersuite associated with the given - * ID + * \brief Return the name of the ciphersuite associated with the + * given ID * * \param ciphersuite_id SSL ciphersuite ID * @@ -835,8 +835,8 @@ const char *ssl_get_ciphersuite_name( const int ciphersuite_id ); /** - * \brief Return the ID of the ciphersuite associated with the given - * name + * \brief Return the ID of the ciphersuite associated with the + * given name * * \param ciphersuite_name SSL ciphersuite name * @@ -1642,7 +1642,8 @@ int ssl_parse_finished( ssl_context *ssl ); int ssl_write_finished( ssl_context *ssl ); -void ssl_optimize_checksum( ssl_context *ssl, const ssl_ciphersuite_t *ciphersuite_info ); +void ssl_optimize_checksum( ssl_context *ssl, + const ssl_ciphersuite_t *ciphersuite_info ); #if defined(POLARSSL_KEY_EXCHANGE__SOME__PSK_ENABLED) int ssl_psk_derive_premaster( ssl_context *ssl, key_exchange_type_t key_ex );
diff --git a/include/polarssl/x509.h b/include/polarssl/x509.h index e13f38f..7592348 100644 --- a/include/polarssl/x509.h +++ b/include/polarssl/x509.h
@@ -3,7 +3,7 @@ * * \brief X.509 generic defines 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> @@ -288,7 +288,9 @@ int x509_load_file( const char *path, unsigned char **buf, size_t *n ); int x509_key_size_helper( char *buf, size_t size, const char *name ); int x509_string_to_names( asn1_named_data **head, const char *name ); -int x509_set_extension( asn1_named_data **head, const char *oid, size_t oid_len, int critical, const unsigned char *val, size_t val_len ); +int x509_set_extension( asn1_named_data **head, const char *oid, size_t oid_len, + int critical, const unsigned char *val, + size_t val_len ); int x509_write_extensions( unsigned char **p, unsigned char *start, asn1_named_data *first ); int x509_write_names( unsigned char **p, unsigned char *start,
diff --git a/include/polarssl/x509_csr.h b/include/polarssl/x509_csr.h index b660587..8b4892a 100644 --- a/include/polarssl/x509_csr.h +++ b/include/polarssl/x509_csr.h
@@ -3,7 +3,7 @@ * * \brief X.509 certificate signing request parsing and writing * - * 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> @@ -204,7 +204,8 @@ unsigned char ns_cert_type ); /** - * \brief Generic function to add to or replace an extension in the CSR + * \brief Generic function to add to or replace an extension in the + * CSR * * \param ctx CSR context to use * \param oid OID of the extension
diff --git a/library/aes.c b/library/aes.c index 7fc7af4..ca5c906 100644 --- a/library/aes.c +++ b/library/aes.c
@@ -461,7 +461,8 @@ /* * AES key schedule (encryption) */ -int aes_setkey_enc( aes_context *ctx, const unsigned char *key, unsigned int keysize ) +int aes_setkey_enc( aes_context *ctx, const unsigned char *key, + unsigned int keysize ) { unsigned int i; uint32_t *RK; @@ -576,7 +577,8 @@ /* * AES key schedule (decryption) */ -int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int keysize ) +int aes_setkey_dec( aes_context *ctx, const unsigned char *key, + unsigned int keysize ) { int i, j; aes_context cty; @@ -1387,7 +1389,8 @@ len = aes_test_ctr_len[u]; memcpy( buf, aes_test_ctr_ct[u], len ); - aes_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block, buf, buf ); + aes_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block, + buf, buf ); if( memcmp( buf, aes_test_ctr_pt[u], len ) != 0 ) { @@ -1402,7 +1405,8 @@ len = aes_test_ctr_len[u]; memcpy( buf, aes_test_ctr_pt[u], len ); - aes_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block, buf, buf ); + aes_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block, + buf, buf ); if( memcmp( buf, aes_test_ctr_ct[u], len ) != 0 ) {
diff --git a/library/arc4.c b/library/arc4.c index 464f800..d722c56 100644 --- a/library/arc4.c +++ b/library/arc4.c
@@ -49,7 +49,8 @@ /* * ARC4 key schedule */ -void arc4_setup( arc4_context *ctx, const unsigned char *key, unsigned int keylen ) +void arc4_setup( arc4_context *ctx, const unsigned char *key, + unsigned int keylen ) { int i, j, a; unsigned int k;
diff --git a/library/asn1parse.c b/library/asn1parse.c index ed024de..7cd9bf6 100644 --- a/library/asn1parse.c +++ b/library/asn1parse.c
@@ -91,7 +91,8 @@ if( ( end - *p ) < 5 ) return( POLARSSL_ERR_ASN1_OUT_OF_DATA ); - *len = ( (*p)[1] << 24 ) | ( (*p)[2] << 16 ) | ( (*p)[3] << 8 ) | (*p)[4]; + *len = ( (*p)[1] << 24 ) | ( (*p)[2] << 16 ) | ( (*p)[3] << 8 ) | + (*p)[4]; (*p) += 5; break;
diff --git a/library/bignum.c b/library/bignum.c index 5a8d17d..8b63ba8 100644 --- a/library/bignum.c +++ b/library/bignum.c
@@ -1469,7 +1469,8 @@ /* * Montgomery multiplication: A = A * B * R^-1 mod N (HAC 14.36) */ -static void mpi_montmul( mpi *A, const mpi *B, const mpi *N, t_uint mm, const mpi *T ) +static void mpi_montmul( mpi *A, const mpi *B, const mpi *N, t_uint mm, + const mpi *T ) { size_t i, n, m; t_uint u0, u1, *d;
diff --git a/library/blowfish.c b/library/blowfish.c index adbabce..7271471 100644 --- a/library/blowfish.c +++ b/library/blowfish.c
@@ -155,7 +155,8 @@ /* * Blowfish key schedule */ -int blowfish_setkey( blowfish_context *ctx, const unsigned char *key, unsigned int keysize ) +int blowfish_setkey( blowfish_context *ctx, const unsigned char *key, + unsigned int keysize ) { unsigned int i, j, k; uint32_t data, datal, datar; @@ -357,7 +358,8 @@ while( length-- ) { if( n == 0 ) { - blowfish_crypt_ecb( ctx, BLOWFISH_ENCRYPT, nonce_counter, stream_block ); + blowfish_crypt_ecb( ctx, BLOWFISH_ENCRYPT, nonce_counter, + stream_block ); for( i = BLOWFISH_BLOCKSIZE; i > 0; i-- ) if( ++nonce_counter[i - 1] != 0 )
diff --git a/library/camellia.c b/library/camellia.c index caa2965..524e6ff 100644 --- a/library/camellia.c +++ b/library/camellia.c
@@ -111,82 +111,82 @@ static const unsigned char FSb[256] = { - 112, 130, 44, 236, 179, 39, 192, 229, 228, 133, 87, 53, 234, 12, 174, 65, - 35, 239, 107, 147, 69, 25, 165, 33, 237, 14, 79, 78, 29, 101, 146, 189, - 134, 184, 175, 143, 124, 235, 31, 206, 62, 48, 220, 95, 94, 197, 11, 26, - 166, 225, 57, 202, 213, 71, 93, 61, 217, 1, 90, 214, 81, 86, 108, 77, - 139, 13, 154, 102, 251, 204, 176, 45, 116, 18, 43, 32, 240, 177, 132, 153, - 223, 76, 203, 194, 52, 126, 118, 5, 109, 183, 169, 49, 209, 23, 4, 215, - 20, 88, 58, 97, 222, 27, 17, 28, 50, 15, 156, 22, 83, 24, 242, 34, - 254, 68, 207, 178, 195, 181, 122, 145, 36, 8, 232, 168, 96, 252, 105, 80, - 170, 208, 160, 125, 161, 137, 98, 151, 84, 91, 30, 149, 224, 255, 100, 210, - 16, 196, 0, 72, 163, 247, 117, 219, 138, 3, 230, 218, 9, 63, 221, 148, - 135, 92, 131, 2, 205, 74, 144, 51, 115, 103, 246, 243, 157, 127, 191, 226, - 82, 155, 216, 38, 200, 55, 198, 59, 129, 150, 111, 75, 19, 190, 99, 46, - 233, 121, 167, 140, 159, 110, 188, 142, 41, 245, 249, 182, 47, 253, 180, 89, - 120, 152, 6, 106, 231, 70, 113, 186, 212, 37, 171, 66, 136, 162, 141, 250, - 114, 7, 185, 85, 248, 238, 172, 10, 54, 73, 42, 104, 60, 56, 241, 164, - 64, 40, 211, 123, 187, 201, 67, 193, 21, 227, 173, 244, 119, 199, 128, 158 + 112, 130, 44, 236, 179, 39, 192, 229, 228, 133, 87, 53, 234, 12, 174, 65, + 35, 239, 107, 147, 69, 25, 165, 33, 237, 14, 79, 78, 29, 101, 146, 189, + 134, 184, 175, 143, 124, 235, 31, 206, 62, 48, 220, 95, 94, 197, 11, 26, + 166, 225, 57, 202, 213, 71, 93, 61, 217, 1, 90, 214, 81, 86, 108, 77, + 139, 13, 154, 102, 251, 204, 176, 45, 116, 18, 43, 32, 240, 177, 132, 153, + 223, 76, 203, 194, 52, 126, 118, 5, 109, 183, 169, 49, 209, 23, 4, 215, + 20, 88, 58, 97, 222, 27, 17, 28, 50, 15, 156, 22, 83, 24, 242, 34, + 254, 68, 207, 178, 195, 181, 122, 145, 36, 8, 232, 168, 96, 252, 105, 80, + 170, 208, 160, 125, 161, 137, 98, 151, 84, 91, 30, 149, 224, 255, 100, 210, + 16, 196, 0, 72, 163, 247, 117, 219, 138, 3, 230, 218, 9, 63, 221, 148, + 135, 92, 131, 2, 205, 74, 144, 51, 115, 103, 246, 243, 157, 127, 191, 226, + 82, 155, 216, 38, 200, 55, 198, 59, 129, 150, 111, 75, 19, 190, 99, 46, + 233, 121, 167, 140, 159, 110, 188, 142, 41, 245, 249, 182, 47, 253, 180, 89, + 120, 152, 6, 106, 231, 70, 113, 186, 212, 37, 171, 66, 136, 162, 141, 250, + 114, 7, 185, 85, 248, 238, 172, 10, 54, 73, 42, 104, 60, 56, 241, 164, + 64, 40, 211, 123, 187, 201, 67, 193, 21, 227, 173, 244, 119, 199, 128, 158 }; static const unsigned char FSb2[256] = { - 224, 5, 88, 217, 103, 78, 129, 203, 201, 11, 174, 106, 213, 24, 93, 130, - 70, 223, 214, 39, 138, 50, 75, 66, 219, 28, 158, 156, 58, 202, 37, 123, - 13, 113, 95, 31, 248, 215, 62, 157, 124, 96, 185, 190, 188, 139, 22, 52, - 77, 195, 114, 149, 171, 142, 186, 122, 179, 2, 180, 173, 162, 172, 216, 154, - 23, 26, 53, 204, 247, 153, 97, 90, 232, 36, 86, 64, 225, 99, 9, 51, - 191, 152, 151, 133, 104, 252, 236, 10, 218, 111, 83, 98, 163, 46, 8, 175, - 40, 176, 116, 194, 189, 54, 34, 56, 100, 30, 57, 44, 166, 48, 229, 68, - 253, 136, 159, 101, 135, 107, 244, 35, 72, 16, 209, 81, 192, 249, 210, 160, - 85, 161, 65, 250, 67, 19, 196, 47, 168, 182, 60, 43, 193, 255, 200, 165, - 32, 137, 0, 144, 71, 239, 234, 183, 21, 6, 205, 181, 18, 126, 187, 41, - 15, 184, 7, 4, 155, 148, 33, 102, 230, 206, 237, 231, 59, 254, 127, 197, - 164, 55, 177, 76, 145, 110, 141, 118, 3, 45, 222, 150, 38, 125, 198, 92, - 211, 242, 79, 25, 63, 220, 121, 29, 82, 235, 243, 109, 94, 251, 105, 178, - 240, 49, 12, 212, 207, 140, 226, 117, 169, 74, 87, 132, 17, 69, 27, 245, - 228, 14, 115, 170, 241, 221, 89, 20, 108, 146, 84, 208, 120, 112, 227, 73, - 128, 80, 167, 246, 119, 147, 134, 131, 42, 199, 91, 233, 238, 143, 1, 61 + 224, 5, 88, 217, 103, 78, 129, 203, 201, 11, 174, 106, 213, 24, 93, 130, + 70, 223, 214, 39, 138, 50, 75, 66, 219, 28, 158, 156, 58, 202, 37, 123, + 13, 113, 95, 31, 248, 215, 62, 157, 124, 96, 185, 190, 188, 139, 22, 52, + 77, 195, 114, 149, 171, 142, 186, 122, 179, 2, 180, 173, 162, 172, 216, 154, + 23, 26, 53, 204, 247, 153, 97, 90, 232, 36, 86, 64, 225, 99, 9, 51, + 191, 152, 151, 133, 104, 252, 236, 10, 218, 111, 83, 98, 163, 46, 8, 175, + 40, 176, 116, 194, 189, 54, 34, 56, 100, 30, 57, 44, 166, 48, 229, 68, + 253, 136, 159, 101, 135, 107, 244, 35, 72, 16, 209, 81, 192, 249, 210, 160, + 85, 161, 65, 250, 67, 19, 196, 47, 168, 182, 60, 43, 193, 255, 200, 165, + 32, 137, 0, 144, 71, 239, 234, 183, 21, 6, 205, 181, 18, 126, 187, 41, + 15, 184, 7, 4, 155, 148, 33, 102, 230, 206, 237, 231, 59, 254, 127, 197, + 164, 55, 177, 76, 145, 110, 141, 118, 3, 45, 222, 150, 38, 125, 198, 92, + 211, 242, 79, 25, 63, 220, 121, 29, 82, 235, 243, 109, 94, 251, 105, 178, + 240, 49, 12, 212, 207, 140, 226, 117, 169, 74, 87, 132, 17, 69, 27, 245, + 228, 14, 115, 170, 241, 221, 89, 20, 108, 146, 84, 208, 120, 112, 227, 73, + 128, 80, 167, 246, 119, 147, 134, 131, 42, 199, 91, 233, 238, 143, 1, 61 }; static const unsigned char FSb3[256] = { - 56, 65, 22, 118, 217, 147, 96, 242, 114, 194, 171, 154, 117, 6, 87, 160, - 145, 247, 181, 201, 162, 140, 210, 144, 246, 7, 167, 39, 142, 178, 73, 222, - 67, 92, 215, 199, 62, 245, 143, 103, 31, 24, 110, 175, 47, 226, 133, 13, - 83, 240, 156, 101, 234, 163, 174, 158, 236, 128, 45, 107, 168, 43, 54, 166, - 197, 134, 77, 51, 253, 102, 88, 150, 58, 9, 149, 16, 120, 216, 66, 204, - 239, 38, 229, 97, 26, 63, 59, 130, 182, 219, 212, 152, 232, 139, 2, 235, - 10, 44, 29, 176, 111, 141, 136, 14, 25, 135, 78, 11, 169, 12, 121, 17, - 127, 34, 231, 89, 225, 218, 61, 200, 18, 4, 116, 84, 48, 126, 180, 40, - 85, 104, 80, 190, 208, 196, 49, 203, 42, 173, 15, 202, 112, 255, 50, 105, - 8, 98, 0, 36, 209, 251, 186, 237, 69, 129, 115, 109, 132, 159, 238, 74, - 195, 46, 193, 1, 230, 37, 72, 153, 185, 179, 123, 249, 206, 191, 223, 113, - 41, 205, 108, 19, 100, 155, 99, 157, 192, 75, 183, 165, 137, 95, 177, 23, - 244, 188, 211, 70, 207, 55, 94, 71, 148, 250, 252, 91, 151, 254, 90, 172, - 60, 76, 3, 53, 243, 35, 184, 93, 106, 146, 213, 33, 68, 81, 198, 125, - 57, 131, 220, 170, 124, 119, 86, 5, 27, 164, 21, 52, 30, 28, 248, 82, - 32, 20, 233, 189, 221, 228, 161, 224, 138, 241, 214, 122, 187, 227, 64, 79 + 56, 65, 22, 118, 217, 147, 96, 242, 114, 194, 171, 154, 117, 6, 87, 160, + 145, 247, 181, 201, 162, 140, 210, 144, 246, 7, 167, 39, 142, 178, 73, 222, + 67, 92, 215, 199, 62, 245, 143, 103, 31, 24, 110, 175, 47, 226, 133, 13, + 83, 240, 156, 101, 234, 163, 174, 158, 236, 128, 45, 107, 168, 43, 54, 166, + 197, 134, 77, 51, 253, 102, 88, 150, 58, 9, 149, 16, 120, 216, 66, 204, + 239, 38, 229, 97, 26, 63, 59, 130, 182, 219, 212, 152, 232, 139, 2, 235, + 10, 44, 29, 176, 111, 141, 136, 14, 25, 135, 78, 11, 169, 12, 121, 17, + 127, 34, 231, 89, 225, 218, 61, 200, 18, 4, 116, 84, 48, 126, 180, 40, + 85, 104, 80, 190, 208, 196, 49, 203, 42, 173, 15, 202, 112, 255, 50, 105, + 8, 98, 0, 36, 209, 251, 186, 237, 69, 129, 115, 109, 132, 159, 238, 74, + 195, 46, 193, 1, 230, 37, 72, 153, 185, 179, 123, 249, 206, 191, 223, 113, + 41, 205, 108, 19, 100, 155, 99, 157, 192, 75, 183, 165, 137, 95, 177, 23, + 244, 188, 211, 70, 207, 55, 94, 71, 148, 250, 252, 91, 151, 254, 90, 172, + 60, 76, 3, 53, 243, 35, 184, 93, 106, 146, 213, 33, 68, 81, 198, 125, + 57, 131, 220, 170, 124, 119, 86, 5, 27, 164, 21, 52, 30, 28, 248, 82, + 32, 20, 233, 189, 221, 228, 161, 224, 138, 241, 214, 122, 187, 227, 64, 79 }; static const unsigned char FSb4[256] = { - 112, 44, 179, 192, 228, 87, 234, 174, 35, 107, 69, 165, 237, 79, 29, 146, - 134, 175, 124, 31, 62, 220, 94, 11, 166, 57, 213, 93, 217, 90, 81, 108, - 139, 154, 251, 176, 116, 43, 240, 132, 223, 203, 52, 118, 109, 169, 209, 4, - 20, 58, 222, 17, 50, 156, 83, 242, 254, 207, 195, 122, 36, 232, 96, 105, - 170, 160, 161, 98, 84, 30, 224, 100, 16, 0, 163, 117, 138, 230, 9, 221, - 135, 131, 205, 144, 115, 246, 157, 191, 82, 216, 200, 198, 129, 111, 19, 99, - 233, 167, 159, 188, 41, 249, 47, 180, 120, 6, 231, 113, 212, 171, 136, 141, - 114, 185, 248, 172, 54, 42, 60, 241, 64, 211, 187, 67, 21, 173, 119, 128, - 130, 236, 39, 229, 133, 53, 12, 65, 239, 147, 25, 33, 14, 78, 101, 189, - 184, 143, 235, 206, 48, 95, 197, 26, 225, 202, 71, 61, 1, 214, 86, 77, - 13, 102, 204, 45, 18, 32, 177, 153, 76, 194, 126, 5, 183, 49, 23, 215, - 88, 97, 27, 28, 15, 22, 24, 34, 68, 178, 181, 145, 8, 168, 252, 80, - 208, 125, 137, 151, 91, 149, 255, 210, 196, 72, 247, 219, 3, 218, 63, 148, - 92, 2, 74, 51, 103, 243, 127, 226, 155, 38, 55, 59, 150, 75, 190, 46, - 121, 140, 110, 142, 245, 182, 253, 89, 152, 106, 70, 186, 37, 66, 162, 250, - 7, 85, 238, 10, 73, 104, 56, 164, 40, 123, 201, 193, 227, 244, 199, 158 + 112, 44, 179, 192, 228, 87, 234, 174, 35, 107, 69, 165, 237, 79, 29, 146, + 134, 175, 124, 31, 62, 220, 94, 11, 166, 57, 213, 93, 217, 90, 81, 108, + 139, 154, 251, 176, 116, 43, 240, 132, 223, 203, 52, 118, 109, 169, 209, 4, + 20, 58, 222, 17, 50, 156, 83, 242, 254, 207, 195, 122, 36, 232, 96, 105, + 170, 160, 161, 98, 84, 30, 224, 100, 16, 0, 163, 117, 138, 230, 9, 221, + 135, 131, 205, 144, 115, 246, 157, 191, 82, 216, 200, 198, 129, 111, 19, 99, + 233, 167, 159, 188, 41, 249, 47, 180, 120, 6, 231, 113, 212, 171, 136, 141, + 114, 185, 248, 172, 54, 42, 60, 241, 64, 211, 187, 67, 21, 173, 119, 128, + 130, 236, 39, 229, 133, 53, 12, 65, 239, 147, 25, 33, 14, 78, 101, 189, + 184, 143, 235, 206, 48, 95, 197, 26, 225, 202, 71, 61, 1, 214, 86, 77, + 13, 102, 204, 45, 18, 32, 177, 153, 76, 194, 126, 5, 183, 49, 23, 215, + 88, 97, 27, 28, 15, 22, 24, 34, 68, 178, 181, 145, 8, 168, 252, 80, + 208, 125, 137, 151, 91, 149, 255, 210, 196, 72, 247, 219, 3, 218, 63, 148, + 92, 2, 74, 51, 103, 243, 127, 226, 155, 38, 55, 59, 150, 75, 190, 46, + 121, 140, 110, 142, 245, 182, 253, 89, 152, 106, 70, 186, 37, 66, 162, 250, + 7, 85, 238, 10, 73, 104, 56, 164, 40, 123, 201, 193, 227, 244, 199, 158 }; #define SBOX1(n) FSb[(n)] @@ -292,7 +292,8 @@ } \ } -static void camellia_feistel(const uint32_t x[2], const uint32_t k[2], uint32_t z[2]) +static void camellia_feistel( const uint32_t x[2], const uint32_t k[2], + uint32_t z[2]) { uint32_t I0, I1; I0 = x[0] ^ k[0]; @@ -319,7 +320,8 @@ /* * Camellia key schedule (encryption) */ -int camellia_setkey_enc( camellia_context *ctx, const unsigned char *key, unsigned int keysize ) +int camellia_setkey_enc( camellia_context *ctx, const unsigned char *key, + unsigned int keysize ) { int idx; size_t i; @@ -423,7 +425,8 @@ /* * Camellia key schedule (decryption) */ -int camellia_setkey_dec( camellia_context *ctx, const unsigned char *key, unsigned int keysize ) +int camellia_setkey_dec( camellia_context *ctx, const unsigned char *key, + unsigned int keysize ) { int idx; size_t i; @@ -653,7 +656,8 @@ while( length-- ) { if( n == 0 ) { - camellia_crypt_ecb( ctx, CAMELLIA_ENCRYPT, nonce_counter, stream_block ); + camellia_crypt_ecb( ctx, CAMELLIA_ENCRYPT, nonce_counter, + stream_block ); for( i = 16; i > 0; i-- ) if( ++nonce_counter[i - 1] != 0 ) @@ -1011,7 +1015,8 @@ len = camellia_test_ctr_len[u]; memcpy( buf, camellia_test_ctr_ct[u], len ); - camellia_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block, buf, buf ); + camellia_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block, + buf, buf ); if( memcmp( buf, camellia_test_ctr_pt[u], len ) != 0 ) { @@ -1026,7 +1031,8 @@ len = camellia_test_ctr_len[u]; memcpy( buf, camellia_test_ctr_pt[u], len ); - camellia_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block, buf, buf ); + camellia_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block, + buf, buf ); if( memcmp( buf, camellia_test_ctr_ct[u], len ) != 0 ) {
diff --git a/library/cipher.c b/library/cipher.c index d3687d7..0693301 100644 --- a/library/cipher.c +++ b/library/cipher.c
@@ -240,8 +240,8 @@ } #endif /* POLARSSL_CIPHER_MODE_AEAD */ -int cipher_update( cipher_context_t *ctx, const unsigned char *input, size_t ilen, - unsigned char *output, size_t *olen ) +int cipher_update( cipher_context_t *ctx, const unsigned char *input, + size_t ilen, unsigned char *output, size_t *olen ) { int ret;
diff --git a/library/cipher_wrap.c b/library/cipher_wrap.c index be44371..a8bf4ab 100644 --- a/library/cipher_wrap.c +++ b/library/cipher_wrap.c
@@ -96,7 +96,8 @@ unsigned char *iv, const unsigned char *input, unsigned char *output ) { #if defined(POLARSSL_CIPHER_MODE_CBC) - return aes_crypt_cbc( (aes_context *) ctx, operation, length, iv, input, output ); + return aes_crypt_cbc( (aes_context *) ctx, operation, length, iv, input, + output ); #else ((void) ctx); ((void) operation); @@ -109,11 +110,13 @@ #endif /* POLARSSL_CIPHER_MODE_CBC */ } -static int aes_crypt_cfb128_wrap( void *ctx, operation_t operation, size_t length, - size_t *iv_off, unsigned char *iv, const unsigned char *input, unsigned char *output ) +static int aes_crypt_cfb128_wrap( void *ctx, operation_t operation, + size_t length, size_t *iv_off, unsigned char *iv, + const unsigned char *input, unsigned char *output ) { #if defined(POLARSSL_CIPHER_MODE_CFB) - return aes_crypt_cfb128( (aes_context *) ctx, operation, length, iv_off, iv, input, output ); + return aes_crypt_cfb128( (aes_context *) ctx, operation, length, iv_off, iv, + input, output ); #else ((void) ctx); ((void) operation); @@ -127,8 +130,8 @@ #endif /* POLARSSL_CIPHER_MODE_CFB */ } -static int aes_crypt_ctr_wrap( void *ctx, size_t length, - size_t *nc_off, unsigned char *nonce_counter, unsigned char *stream_block, +static int aes_crypt_ctr_wrap( void *ctx, size_t length, size_t *nc_off, + unsigned char *nonce_counter, unsigned char *stream_block, const unsigned char *input, unsigned char *output ) { #if defined(POLARSSL_CIPHER_MODE_CTR) @@ -147,12 +150,14 @@ #endif /* POLARSSL_CIPHER_MODE_CTR */ } -static int aes_setkey_dec_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) +static int aes_setkey_dec_wrap( void *ctx, const unsigned char *key, + unsigned int key_length ) { return aes_setkey_dec( (aes_context *) ctx, key, key_length ); } -static int aes_setkey_enc_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) +static int aes_setkey_enc_wrap( void *ctx, const unsigned char *key, + unsigned int key_length ) { return aes_setkey_enc( (aes_context *) ctx, key, key_length ); } @@ -319,7 +324,8 @@ #endif /* POLARSSL_CIPHER_MODE_CTR */ #if defined(POLARSSL_GCM_C) -static int gcm_aes_setkey_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) +static int gcm_aes_setkey_wrap( void *ctx, const unsigned char *key, + unsigned int key_length ) { return gcm_init( (gcm_context *) ctx, POLARSSL_CIPHER_ID_AES, key, key_length ); @@ -379,14 +385,17 @@ static int camellia_crypt_ecb_wrap( void *ctx, operation_t operation, const unsigned char *input, unsigned char *output ) { - return camellia_crypt_ecb( (camellia_context *) ctx, operation, input, output ); + return camellia_crypt_ecb( (camellia_context *) ctx, operation, input, + output ); } -static int camellia_crypt_cbc_wrap( void *ctx, operation_t operation, size_t length, - unsigned char *iv, const unsigned char *input, unsigned char *output ) +static int camellia_crypt_cbc_wrap( void *ctx, operation_t operation, + size_t length, unsigned char *iv, + const unsigned char *input, unsigned char *output ) { #if defined(POLARSSL_CIPHER_MODE_CBC) - return camellia_crypt_cbc( (camellia_context *) ctx, operation, length, iv, input, output ); + return camellia_crypt_cbc( (camellia_context *) ctx, operation, length, iv, + input, output ); #else ((void) ctx); ((void) operation); @@ -399,11 +408,13 @@ #endif /* POLARSSL_CIPHER_MODE_CBC */ } -static int camellia_crypt_cfb128_wrap( void *ctx, operation_t operation, size_t length, - size_t *iv_off, unsigned char *iv, const unsigned char *input, unsigned char *output ) +static int camellia_crypt_cfb128_wrap( void *ctx, operation_t operation, + size_t length, size_t *iv_off, unsigned char *iv, + const unsigned char *input, unsigned char *output ) { #if defined(POLARSSL_CIPHER_MODE_CFB) - return camellia_crypt_cfb128( (camellia_context *) ctx, operation, length, iv_off, iv, input, output ); + return camellia_crypt_cfb128( (camellia_context *) ctx, operation, length, + iv_off, iv, input, output ); #else ((void) ctx); ((void) operation); @@ -417,13 +428,13 @@ #endif /* POLARSSL_CIPHER_MODE_CFB */ } -static int camellia_crypt_ctr_wrap( void *ctx, size_t length, - size_t *nc_off, unsigned char *nonce_counter, unsigned char *stream_block, +static int camellia_crypt_ctr_wrap( void *ctx, size_t length, size_t *nc_off, + unsigned char *nonce_counter, unsigned char *stream_block, const unsigned char *input, unsigned char *output ) { #if defined(POLARSSL_CIPHER_MODE_CTR) - return camellia_crypt_ctr( (camellia_context *) ctx, length, nc_off, nonce_counter, - stream_block, input, output ); + return camellia_crypt_ctr( (camellia_context *) ctx, length, nc_off, + nonce_counter, stream_block, input, output ); #else ((void) ctx); ((void) length); @@ -437,12 +448,14 @@ #endif /* POLARSSL_CIPHER_MODE_CTR */ } -static int camellia_setkey_dec_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) +static int camellia_setkey_dec_wrap( void *ctx, const unsigned char *key, + unsigned int key_length ) { return camellia_setkey_dec( (camellia_context *) ctx, key, key_length ); } -static int camellia_setkey_enc_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) +static int camellia_setkey_enc_wrap( void *ctx, const unsigned char *key, + unsigned int key_length ) { return camellia_setkey_enc( (camellia_context *) ctx, key, key_length ); } @@ -609,7 +622,8 @@ #endif /* POLARSSL_CIPHER_MODE_CTR */ #if defined(POLARSSL_GCM_C) -static int gcm_camellia_setkey_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) +static int gcm_camellia_setkey_wrap( void *ctx, const unsigned char *key, + unsigned int key_length ) { return gcm_init( (gcm_context *) ctx, POLARSSL_CIPHER_ID_CAMELLIA, key, key_length ); @@ -684,7 +698,8 @@ unsigned char *iv, const unsigned char *input, unsigned char *output ) { #if defined(POLARSSL_CIPHER_MODE_CBC) - return des_crypt_cbc( (des_context *) ctx, operation, length, iv, input, output ); + return des_crypt_cbc( (des_context *) ctx, operation, length, iv, input, + output ); #else ((void) ctx); ((void) operation); @@ -701,7 +716,8 @@ unsigned char *iv, const unsigned char *input, unsigned char *output ) { #if defined(POLARSSL_CIPHER_MODE_CBC) - return des3_crypt_cbc( (des3_context *) ctx, operation, length, iv, input, output ); + return des3_crypt_cbc( (des3_context *) ctx, operation, length, iv, input, + output ); #else ((void) ctx); ((void) operation); @@ -714,8 +730,9 @@ #endif /* POLARSSL_CIPHER_MODE_CBC */ } -static int des_crypt_cfb128_wrap( void *ctx, operation_t operation, size_t length, - size_t *iv_off, unsigned char *iv, const unsigned char *input, unsigned char *output ) +static int des_crypt_cfb128_wrap( void *ctx, operation_t operation, + size_t length, size_t *iv_off, unsigned char *iv, + const unsigned char *input, unsigned char *output ) { ((void) ctx); ((void) operation); @@ -728,8 +745,8 @@ return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE; } -static int des_crypt_ctr_wrap( void *ctx, size_t length, - size_t *nc_off, unsigned char *nonce_counter, unsigned char *stream_block, +static int des_crypt_ctr_wrap( void *ctx, size_t length, size_t *nc_off, + unsigned char *nonce_counter, unsigned char *stream_block, const unsigned char *input, unsigned char *output ) { ((void) ctx); @@ -743,42 +760,48 @@ return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE; } -static int des_setkey_dec_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) +static int des_setkey_dec_wrap( void *ctx, const unsigned char *key, + unsigned int key_length ) { ((void) key_length); return des_setkey_dec( (des_context *) ctx, key ); } -static int des_setkey_enc_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) +static int des_setkey_enc_wrap( void *ctx, const unsigned char *key, + unsigned int key_length ) { ((void) key_length); return des_setkey_enc( (des_context *) ctx, key ); } -static int des3_set2key_dec_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) +static int des3_set2key_dec_wrap( void *ctx, const unsigned char *key, + unsigned int key_length ) { ((void) key_length); return des3_set2key_dec( (des3_context *) ctx, key ); } -static int des3_set2key_enc_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) +static int des3_set2key_enc_wrap( void *ctx, const unsigned char *key, + unsigned int key_length ) { ((void) key_length); return des3_set2key_enc( (des3_context *) ctx, key ); } -static int des3_set3key_dec_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) +static int des3_set3key_dec_wrap( void *ctx, const unsigned char *key, + unsigned int key_length ) { ((void) key_length); return des3_set3key_dec( (des3_context *) ctx, key ); } -static int des3_set3key_enc_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) +static int des3_set3key_enc_wrap( void *ctx, const unsigned char *key, + unsigned int key_length ) { ((void) key_length); @@ -916,14 +939,17 @@ static int blowfish_crypt_ecb_wrap( void *ctx, operation_t operation, const unsigned char *input, unsigned char *output ) { - return blowfish_crypt_ecb( (blowfish_context *) ctx, operation, input, output ); + return blowfish_crypt_ecb( (blowfish_context *) ctx, operation, input, + output ); } -static int blowfish_crypt_cbc_wrap( void *ctx, operation_t operation, size_t length, - unsigned char *iv, const unsigned char *input, unsigned char *output ) +static int blowfish_crypt_cbc_wrap( void *ctx, operation_t operation, + size_t length, unsigned char *iv, const unsigned char *input, + unsigned char *output ) { #if defined(POLARSSL_CIPHER_MODE_CBC) - return blowfish_crypt_cbc( (blowfish_context *) ctx, operation, length, iv, input, output ); + return blowfish_crypt_cbc( (blowfish_context *) ctx, operation, length, iv, + input, output ); #else ((void) ctx); ((void) operation); @@ -936,11 +962,13 @@ #endif /* POLARSSL_CIPHER_MODE_CBC */ } -static int blowfish_crypt_cfb64_wrap( void *ctx, operation_t operation, size_t length, - size_t *iv_off, unsigned char *iv, const unsigned char *input, unsigned char *output ) +static int blowfish_crypt_cfb64_wrap( void *ctx, operation_t operation, + size_t length, size_t *iv_off, unsigned char *iv, + const unsigned char *input, unsigned char *output ) { #if defined(POLARSSL_CIPHER_MODE_CFB) - return blowfish_crypt_cfb64( (blowfish_context *) ctx, operation, length, iv_off, iv, input, output ); + return blowfish_crypt_cfb64( (blowfish_context *) ctx, operation, length, + iv_off, iv, input, output ); #else ((void) ctx); ((void) operation); @@ -954,13 +982,13 @@ #endif /* POLARSSL_CIPHER_MODE_CFB */ } -static int blowfish_crypt_ctr_wrap( void *ctx, size_t length, - size_t *nc_off, unsigned char *nonce_counter, unsigned char *stream_block, +static int blowfish_crypt_ctr_wrap( void *ctx, size_t length, size_t *nc_off, + unsigned char *nonce_counter, unsigned char *stream_block, const unsigned char *input, unsigned char *output ) { #if defined(POLARSSL_CIPHER_MODE_CTR) - return blowfish_crypt_ctr( (blowfish_context *) ctx, length, nc_off, nonce_counter, - stream_block, input, output ); + return blowfish_crypt_ctr( (blowfish_context *) ctx, length, nc_off, + nonce_counter, stream_block, input, output ); #else ((void) ctx); ((void) length); @@ -974,7 +1002,8 @@ #endif /* POLARSSL_CIPHER_MODE_CTR */ } -static int blowfish_setkey_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) +static int blowfish_setkey_wrap( void *ctx, const unsigned char *key, + unsigned int key_length ) { return blowfish_setkey( (blowfish_context *) ctx, key, key_length ); }
diff --git a/library/ctr_drbg.c b/library/ctr_drbg.c index 6203fce..2b507d2 100644 --- a/library/ctr_drbg.c +++ b/library/ctr_drbg.c
@@ -336,7 +336,8 @@ */ aes_crypt_ecb( &ctx->aes_ctx, AES_ENCRYPT, ctx->counter, tmp ); - use_len = (output_len > CTR_DRBG_BLOCKSIZE ) ? CTR_DRBG_BLOCKSIZE : output_len; + use_len = (output_len > CTR_DRBG_BLOCKSIZE ) ? CTR_DRBG_BLOCKSIZE : + output_len; /* * Copy random block to destination */
diff --git a/library/des.c b/library/des.c index 6d20758..79c81bc 100644 --- a/library/des.c +++ b/library/des.c
@@ -513,7 +513,8 @@ /* * Triple-DES key schedule (112-bit, encryption) */ -int des3_set2key_enc( des3_context *ctx, const unsigned char key[DES_KEY_SIZE * 2] ) +int des3_set2key_enc( des3_context *ctx, + const unsigned char key[DES_KEY_SIZE * 2] ) { uint32_t sk[96]; @@ -526,7 +527,8 @@ /* * Triple-DES key schedule (112-bit, decryption) */ -int des3_set2key_dec( des3_context *ctx, const unsigned char key[DES_KEY_SIZE * 2] ) +int des3_set2key_dec( des3_context *ctx, + const unsigned char key[DES_KEY_SIZE * 2] ) { uint32_t sk[96]; @@ -562,7 +564,8 @@ /* * Triple-DES key schedule (168-bit, encryption) */ -int des3_set3key_enc( des3_context *ctx, const unsigned char key[DES_KEY_SIZE * 3] ) +int des3_set3key_enc( des3_context *ctx, + const unsigned char key[DES_KEY_SIZE * 3] ) { uint32_t sk[96]; @@ -575,7 +578,8 @@ /* * Triple-DES key schedule (168-bit, decryption) */ -int des3_set3key_dec( des3_context *ctx, const unsigned char key[DES_KEY_SIZE * 3] ) +int des3_set3key_dec( des3_context *ctx, + const unsigned char key[DES_KEY_SIZE * 3] ) { uint32_t sk[96];
diff --git a/library/dhm.c b/library/dhm.c index f869456..41c573d 100644 --- a/library/dhm.c +++ b/library/dhm.c
@@ -402,7 +402,8 @@ /* * Parse DHM parameters */ -int dhm_parse_dhm( dhm_context *dhm, const unsigned char *dhmin, size_t dhminlen ) +int dhm_parse_dhm( dhm_context *dhm, const unsigned char *dhmin, + size_t dhminlen ) { int ret; size_t len;
diff --git a/library/gcm.c b/library/gcm.c index d5761d2..a892076 100644 --- a/library/gcm.c +++ b/library/gcm.c
@@ -808,7 +808,8 @@ return( 1 ); } - ret = gcm_update( &ctx, rest_len, pt[pt_index[i]] + 32, buf + 32 ); + ret = gcm_update( &ctx, rest_len, pt[pt_index[i]] + 32, + buf + 32 ); if( ret != 0 ) { if( verbose != 0 ) @@ -874,7 +875,8 @@ return( 1 ); } - ret = gcm_update( &ctx, rest_len, ct[j * 6 + i] + 32, buf + 32 ); + ret = gcm_update( &ctx, rest_len, ct[j * 6 + i] + 32, + buf + 32 ); if( ret != 0 ) { if( verbose != 0 )
diff --git a/library/md2.c b/library/md2.c index af6b595..71f8d0b 100644 --- a/library/md2.c +++ b/library/md2.c
@@ -228,7 +228,8 @@ /* * MD2 HMAC context setup */ -void md2_hmac_starts( md2_context *ctx, const unsigned char *key, size_t keylen ) +void md2_hmac_starts( md2_context *ctx, const unsigned char *key, + size_t keylen ) { size_t i; unsigned char sum[16]; @@ -258,7 +259,8 @@ /* * MD2 HMAC process buffer */ -void md2_hmac_update( md2_context *ctx, const unsigned char *input, size_t ilen ) +void md2_hmac_update( md2_context *ctx, const unsigned char *input, + size_t ilen ) { md2_update( ctx, input, ilen ); }
diff --git a/library/md4.c b/library/md4.c index 5d3315f..37056d9 100644 --- a/library/md4.c +++ b/library/md4.c
@@ -324,7 +324,8 @@ /* * MD4 HMAC context setup */ -void md4_hmac_starts( md4_context *ctx, const unsigned char *key, size_t keylen ) +void md4_hmac_starts( md4_context *ctx, const unsigned char *key, + size_t keylen ) { size_t i; unsigned char sum[16]; @@ -354,7 +355,8 @@ /* * MD4 HMAC process buffer */ -void md4_hmac_update( md4_context *ctx, const unsigned char *input, size_t ilen ) +void md4_hmac_update( md4_context *ctx, const unsigned char *input, + size_t ilen ) { md4_update( ctx, input, ilen ); }
diff --git a/library/md5.c b/library/md5.c index cc6567f..88d50c6 100644 --- a/library/md5.c +++ b/library/md5.c
@@ -341,7 +341,8 @@ /* * MD5 HMAC context setup */ -void md5_hmac_starts( md5_context *ctx, const unsigned char *key, size_t keylen ) +void md5_hmac_starts( md5_context *ctx, const unsigned char *key, + size_t keylen ) { size_t i; unsigned char sum[16]; @@ -371,7 +372,8 @@ /* * MD5 HMAC process buffer */ -void md5_hmac_update( md5_context *ctx, const unsigned char *input, size_t ilen ) +void md5_hmac_update( md5_context *ctx, const unsigned char *input, + size_t ilen ) { md5_update( ctx, input, ilen ); }
diff --git a/library/md_wrap.c b/library/md_wrap.c index b67b709..9627878 100644 --- a/library/md_wrap.c +++ b/library/md_wrap.c
@@ -81,7 +81,8 @@ md2_starts( (md2_context *) ctx ); } -static void md2_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void md2_update_wrap( void *ctx, const unsigned char *input, + size_t ilen ) { md2_update( (md2_context *) ctx, input, ilen ); } @@ -102,12 +103,14 @@ #endif } -static void md2_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen ) +static void md2_hmac_starts_wrap( void *ctx, const unsigned char *key, + size_t keylen ) { md2_hmac_starts( (md2_context *) ctx, key, keylen ); } -static void md2_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void md2_hmac_update_wrap( void *ctx, const unsigned char *input, + size_t ilen ) { md2_hmac_update( (md2_context *) ctx, input, ilen ); } @@ -167,7 +170,8 @@ md4_starts( (md4_context *) ctx ); } -static void md4_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void md4_update_wrap( void *ctx, const unsigned char *input, + size_t ilen ) { md4_update( (md4_context *) ctx, input, ilen ); } @@ -188,12 +192,14 @@ #endif } -static void md4_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen ) +static void md4_hmac_starts_wrap( void *ctx, const unsigned char *key, + size_t keylen ) { md4_hmac_starts( (md4_context *) ctx, key, keylen ); } -static void md4_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void md4_hmac_update_wrap( void *ctx, const unsigned char *input, + size_t ilen ) { md4_hmac_update( (md4_context *) ctx, input, ilen ); } @@ -251,7 +257,8 @@ md5_starts( (md5_context *) ctx ); } -static void md5_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void md5_update_wrap( void *ctx, const unsigned char *input, + size_t ilen ) { md5_update( (md5_context *) ctx, input, ilen ); } @@ -272,12 +279,14 @@ #endif } -static void md5_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen ) +static void md5_hmac_starts_wrap( void *ctx, const unsigned char *key, + size_t keylen ) { md5_hmac_starts( (md5_context *) ctx, key, keylen ); } -static void md5_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void md5_hmac_update_wrap( void *ctx, const unsigned char *input, + size_t ilen ) { md5_hmac_update( (md5_context *) ctx, input, ilen ); } @@ -335,7 +344,8 @@ ripemd160_starts( (ripemd160_context *) ctx ); } -static void ripemd160_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void ripemd160_update_wrap( void *ctx, const unsigned char *input, + size_t ilen ) { ripemd160_update( (ripemd160_context *) ctx, input, ilen ); } @@ -356,12 +366,14 @@ #endif } -static void ripemd160_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen ) +static void ripemd160_hmac_starts_wrap( void *ctx, const unsigned char *key, + size_t keylen ) { ripemd160_hmac_starts( (ripemd160_context *) ctx, key, keylen ); } -static void ripemd160_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void ripemd160_hmac_update_wrap( void *ctx, const unsigned char *input, + size_t ilen ) { ripemd160_hmac_update( (ripemd160_context *) ctx, input, ilen ); } @@ -419,7 +431,8 @@ sha1_starts( (sha1_context *) ctx ); } -static void sha1_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void sha1_update_wrap( void *ctx, const unsigned char *input, + size_t ilen ) { sha1_update( (sha1_context *) ctx, input, ilen ); } @@ -440,12 +453,14 @@ #endif } -static void sha1_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen ) +static void sha1_hmac_starts_wrap( void *ctx, const unsigned char *key, + size_t keylen ) { sha1_hmac_starts( (sha1_context *) ctx, key, keylen ); } -static void sha1_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void sha1_hmac_update_wrap( void *ctx, const unsigned char *input, + size_t ilen ) { sha1_hmac_update( (sha1_context *) ctx, input, ilen ); } @@ -506,7 +521,8 @@ sha256_starts( (sha256_context *) ctx, 1 ); } -static void sha224_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void sha224_update_wrap( void *ctx, const unsigned char *input, + size_t ilen ) { sha256_update( (sha256_context *) ctx, input, ilen ); } @@ -533,12 +549,14 @@ #endif } -static void sha224_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen ) +static void sha224_hmac_starts_wrap( void *ctx, const unsigned char *key, + size_t keylen ) { sha256_hmac_starts( (sha256_context *) ctx, key, keylen, 1 ); } -static void sha224_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void sha224_hmac_update_wrap( void *ctx, const unsigned char *input, + size_t ilen ) { sha256_hmac_update( (sha256_context *) ctx, input, ilen ); } @@ -599,7 +617,8 @@ sha256_starts( (sha256_context *) ctx, 0 ); } -static void sha256_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void sha256_update_wrap( void *ctx, const unsigned char *input, + size_t ilen ) { sha256_update( (sha256_context *) ctx, input, ilen ); } @@ -626,12 +645,14 @@ #endif } -static void sha256_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen ) +static void sha256_hmac_starts_wrap( void *ctx, const unsigned char *key, + size_t keylen ) { sha256_hmac_starts( (sha256_context *) ctx, key, keylen, 0 ); } -static void sha256_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void sha256_hmac_update_wrap( void *ctx, const unsigned char *input, + size_t ilen ) { sha256_hmac_update( (sha256_context *) ctx, input, ilen ); } @@ -696,7 +717,8 @@ sha512_starts( (sha512_context *) ctx, 1 ); } -static void sha384_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void sha384_update_wrap( void *ctx, const unsigned char *input, + size_t ilen ) { sha512_update( (sha512_context *) ctx, input, ilen ); } @@ -723,12 +745,14 @@ #endif } -static void sha384_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen ) +static void sha384_hmac_starts_wrap( void *ctx, const unsigned char *key, + size_t keylen ) { sha512_hmac_starts( (sha512_context *) ctx, key, keylen, 1 ); } -static void sha384_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void sha384_hmac_update_wrap( void *ctx, const unsigned char *input, + size_t ilen ) { sha512_hmac_update( (sha512_context *) ctx, input, ilen ); } @@ -789,7 +813,8 @@ sha512_starts( (sha512_context *) ctx, 0 ); } -static void sha512_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void sha512_update_wrap( void *ctx, const unsigned char *input, + size_t ilen ) { sha512_update( (sha512_context *) ctx, input, ilen ); } @@ -816,12 +841,14 @@ #endif } -static void sha512_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen ) +static void sha512_hmac_starts_wrap( void *ctx, const unsigned char *key, + size_t keylen ) { sha512_hmac_starts( (sha512_context *) ctx, key, keylen, 0 ); } -static void sha512_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void sha512_hmac_update_wrap( void *ctx, const unsigned char *input, + size_t ilen ) { sha512_hmac_update( (sha512_context *) ctx, input, ilen ); }
diff --git a/library/memory_buffer_alloc.c b/library/memory_buffer_alloc.c index 5409a93..caeaa46 100644 --- a/library/memory_buffer_alloc.c +++ b/library/memory_buffer_alloc.c
@@ -281,7 +281,8 @@ // Found location, split block if > memory_header + 4 room left // - if( cur->size - len < sizeof(memory_header) + POLARSSL_MEMORY_ALIGN_MULTIPLE ) + if( cur->size - len < sizeof(memory_header) + + POLARSSL_MEMORY_ALIGN_MULTIPLE ) { cur->alloc = 1;
diff --git a/library/net.c b/library/net.c index 4a4cf5f..be30fbd 100644 --- a/library/net.c +++ b/library/net.c
@@ -114,10 +114,11 @@ /* * htons() is not always available. - * By default go for LITTLE_ENDIAN variant. Otherwise hope for _BYTE_ORDER and __BIG_ENDIAN - * to help determine endianness. + * By default go for LITTLE_ENDIAN variant. Otherwise hope for _BYTE_ORDER and + * __BIG_ENDIAN to help determine endianness. */ -#if defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && __BYTE_ORDER == __BIG_ENDIAN +#if defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && \ + __BYTE_ORDER == __BIG_ENDIAN #define POLARSSL_HTONS(n) (n) #define POLARSSL_HTONL(n) (n) #else
diff --git a/library/pem.c b/library/pem.c index 2f639d0..2775ef9 100644 --- a/library/pem.c +++ b/library/pem.c
@@ -57,7 +57,8 @@ /* * Read a 16-byte hex string and convert it to binary */ -static int pem_get_iv( const unsigned char *s, unsigned char *iv, size_t iv_len ) +static int pem_get_iv( const unsigned char *s, unsigned char *iv, + size_t iv_len ) { size_t i, j, k;
diff --git a/library/pkcs11.c b/library/pkcs11.c index 3dacaf5..c61287a 100644 --- a/library/pkcs11.c +++ b/library/pkcs11.c
@@ -54,7 +54,8 @@ goto cleanup; } - if( pkcs11h_certificate_getCertificateBlob( pkcs11_cert, NULL, &cert_blob_size ) != CKR_OK ) + if( pkcs11h_certificate_getCertificateBlob( pkcs11_cert, NULL, + &cert_blob_size ) != CKR_OK ) { ret = 3; goto cleanup; @@ -67,7 +68,8 @@ goto cleanup; } - if( pkcs11h_certificate_getCertificateBlob( pkcs11_cert, cert_blob, &cert_blob_size ) != CKR_OK ) + if( pkcs11h_certificate_getCertificateBlob( pkcs11_cert, cert_blob, + &cert_blob_size ) != CKR_OK ) { ret = 5; goto cleanup;
diff --git a/library/pkcs12.c b/library/pkcs12.c index 637c057..2b130a2 100644 --- a/library/pkcs12.c +++ b/library/pkcs12.c
@@ -1,7 +1,7 @@ /* * PKCS#12 Personal Information Exchange Syntax * - * 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> @@ -96,7 +96,8 @@ memset(&salt, 0, sizeof(asn1_buf)); memset(&unipwd, 0, sizeof(unipwd)); - if( ( ret = pkcs12_parse_pbe_params( pbe_params, &salt, &iterations ) ) != 0 ) + if( ( ret = pkcs12_parse_pbe_params( pbe_params, &salt, + &iterations ) ) != 0 ) return( ret ); for(i = 0; i < pwdlen; i++)
diff --git a/library/pkcs5.c b/library/pkcs5.c index 2271d97..e8642a6 100644 --- a/library/pkcs5.c +++ b/library/pkcs5.c
@@ -162,8 +162,11 @@ if( md_info == NULL ) return( POLARSSL_ERR_PKCS5_FEATURE_UNAVAILABLE ); - if( ( ret = asn1_get_alg( &p, end, &enc_scheme_oid, &enc_scheme_params ) ) != 0 ) + if( ( ret = asn1_get_alg( &p, end, &enc_scheme_oid, + &enc_scheme_params ) ) != 0 ) + { return( POLARSSL_ERR_PKCS5_INVALID_FORMAT + ret ); + } if ( oid_get_cipher_alg( &enc_scheme_oid, &cipher_alg ) != 0 ) return( POLARSSL_ERR_PKCS5_FEATURE_UNAVAILABLE );
diff --git a/library/pkwrite.c b/library/pkwrite.c index 81ac7fe..3b0bbdb 100644 --- a/library/pkwrite.c +++ b/library/pkwrite.c
@@ -73,7 +73,8 @@ ASN1_CHK_ADD( len, asn1_write_mpi( p, start, &rsa->N ) ); ASN1_CHK_ADD( len, asn1_write_len( p, start, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( p, start, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ); + ASN1_CHK_ADD( len, asn1_write_tag( p, start, ASN1_CONSTRUCTED | + ASN1_SEQUENCE ) ); return( (int) len ); } @@ -191,7 +192,8 @@ par_len ) ); ASN1_CHK_ADD( len, asn1_write_len( &c, buf, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( &c, buf, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ); + ASN1_CHK_ADD( len, asn1_write_tag( &c, buf, ASN1_CONSTRUCTED | + ASN1_SEQUENCE ) ); return( (int) len ); } @@ -218,7 +220,8 @@ ASN1_CHK_ADD( len, asn1_write_int( &c, buf, 0 ) ); ASN1_CHK_ADD( len, asn1_write_len( &c, buf, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( &c, buf, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ); + ASN1_CHK_ADD( len, asn1_write_tag( &c, buf, ASN1_CONSTRUCTED | + ASN1_SEQUENCE ) ); } else #endif /* POLARSSL_RSA_C */ @@ -271,7 +274,8 @@ ASN1_CHK_ADD( len, asn1_write_int( &c, buf, 1 ) ); ASN1_CHK_ADD( len, asn1_write_len( &c, buf, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( &c, buf, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ); + ASN1_CHK_ADD( len, asn1_write_tag( &c, buf, ASN1_CONSTRUCTED | + ASN1_SEQUENCE ) ); } else #endif /* POLARSSL_ECP_C */
diff --git a/library/sha1.c b/library/sha1.c index ee5cdc3..4b2d063 100644 --- a/library/sha1.c +++ b/library/sha1.c
@@ -374,7 +374,8 @@ /* * SHA-1 HMAC context setup */ -void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key, size_t keylen ) +void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key, + size_t keylen ) { size_t i; unsigned char sum[20]; @@ -404,7 +405,8 @@ /* * SHA-1 HMAC process buffer */ -void sha1_hmac_update( sha1_context *ctx, const unsigned char *input, size_t ilen ) +void sha1_hmac_update( sha1_context *ctx, const unsigned char *input, + size_t ilen ) { sha1_update( ctx, input, ilen ); }
diff --git a/library/sha256.c b/library/sha256.c index 064ba3b..9e70ff9 100644 --- a/library/sha256.c +++ b/library/sha256.c
@@ -243,7 +243,8 @@ /* * SHA-256 process buffer */ -void sha256_update( sha256_context *ctx, const unsigned char *input, size_t ilen ) +void sha256_update( sha256_context *ctx, const unsigned char *input, + size_t ilen ) { size_t fill; uint32_t left; @@ -407,7 +408,8 @@ /* * SHA-256 HMAC process buffer */ -void sha256_hmac_update( sha256_context *ctx, const unsigned char *input, size_t ilen ) +void sha256_hmac_update( sha256_context *ctx, const unsigned char *input, + size_t ilen ) { sha256_update( ctx, input, ilen ); }
diff --git a/library/sha512.c b/library/sha512.c index a55a94b..5537e8d 100644 --- a/library/sha512.c +++ b/library/sha512.c
@@ -236,7 +236,8 @@ /* * SHA-512 process buffer */ -void sha512_update( sha512_context *ctx, const unsigned char *input, size_t ilen ) +void sha512_update( sha512_context *ctx, const unsigned char *input, + size_t ilen ) { size_t fill; unsigned int left;
diff --git a/library/ssl_cache.c b/library/ssl_cache.c index 69f7114..9e49b9a 100644 --- a/library/ssl_cache.c +++ b/library/ssl_cache.c
@@ -105,7 +105,9 @@ */ if( entry->peer_cert.p != NULL ) { - session->peer_cert = (x509_crt *) polarssl_malloc( sizeof(x509_crt) ); + session->peer_cert = + (x509_crt *) polarssl_malloc( sizeof(x509_crt) ); + if( session->peer_cert == NULL ) { ret = 1; @@ -224,7 +226,8 @@ /* * max_entries not reached, create new entry */ - cur = (ssl_cache_entry *) polarssl_malloc( sizeof(ssl_cache_entry) ); + cur = (ssl_cache_entry *) + polarssl_malloc( sizeof(ssl_cache_entry) ); if( cur == NULL ) { ret = 1; @@ -261,7 +264,8 @@ */ if( session->peer_cert != NULL ) { - cur->peer_cert.p = (unsigned char *) polarssl_malloc( session->peer_cert->raw.len ); + cur->peer_cert.p = (unsigned char *) + polarssl_malloc( session->peer_cert->raw.len ); if( cur->peer_cert.p == NULL ) { ret = 1;
diff --git a/library/ssl_ciphersuites.c b/library/ssl_ciphersuites.c index 6688989..e88c5d4 100644 --- a/library/ssl_ciphersuites.c +++ b/library/ssl_ciphersuites.c
@@ -1575,7 +1575,8 @@ return supported_ciphersuites; }; -const ssl_ciphersuite_t *ssl_ciphersuite_from_string( const char *ciphersuite_name ) +const ssl_ciphersuite_t *ssl_ciphersuite_from_string( + const char *ciphersuite_name ) { const ssl_ciphersuite_t *cur = ciphersuite_definitions;
diff --git a/library/ssl_cli.c b/library/ssl_cli.c index b23743b..6f21f62 100644 --- a/library/ssl_cli.c +++ b/library/ssl_cli.c
@@ -918,8 +918,8 @@ if( ssl->minor_ver < ssl->min_minor_ver ) { SSL_DEBUG_MSG( 1, ( "server only supports ssl smaller than minimum" - " [%d:%d] < [%d:%d]", ssl->major_ver, ssl->minor_ver, - buf[4], buf[5] ) ); + " [%d:%d] < [%d:%d]", ssl->major_ver, + ssl->minor_ver, buf[4], buf[5] ) ); ssl_send_alert_message( ssl, SSL_ALERT_LEVEL_FATAL, SSL_ALERT_MSG_PROTOCOL_VERSION ); @@ -1074,7 +1074,8 @@ SSL_DEBUG_MSG( 3, ( "found renegotiation extension" ) ); renegotiation_info_seen = 1; - if( ( ret = ssl_parse_renegotiation_info( ssl, ext + 4, ext_size ) ) != 0 ) + if( ( ret = ssl_parse_renegotiation_info( ssl, ext + 4, + ext_size ) ) != 0 ) return( ret ); break; @@ -1751,7 +1752,8 @@ * ServerDHParams params; * }; */ - if( ( ret = md_init_ctx( &ctx, md_info_from_type( md_alg ) ) ) != 0 ) + if( ( ret = md_init_ctx( &ctx, + md_info_from_type( md_alg ) ) ) != 0 ) { SSL_DEBUG_RET( 1, "md_init_ctx", ret ); return( ret );
diff --git a/library/ssl_srv.c b/library/ssl_srv.c index 13057ab..be56f21 100644 --- a/library/ssl_srv.c +++ b/library/ssl_srv.c
@@ -953,7 +953,8 @@ if( ssl->minor_ver < ssl->min_minor_ver ) { SSL_DEBUG_MSG( 1, ( "client only supports ssl smaller than minimum" - " [%d:%d] < [%d:%d]", ssl->major_ver, ssl->minor_ver, + " [%d:%d] < [%d:%d]", + ssl->major_ver, ssl->minor_ver, ssl->min_major_ver, ssl->min_minor_ver ) ); ssl_send_alert_message( ssl, SSL_ALERT_LEVEL_FATAL, @@ -1028,7 +1029,8 @@ p = buf + 6 + ciph_len; ssl->session_negotiate->length = sess_len; - memset( ssl->session_negotiate->id, 0, sizeof( ssl->session_negotiate->id ) ); + memset( ssl->session_negotiate->id, 0, + sizeof( ssl->session_negotiate->id ) ); memcpy( ssl->session_negotiate->id, p, ssl->session_negotiate->length ); p += sess_len; @@ -2222,9 +2224,8 @@ } if( ( ret = dhm_make_params( &ssl->handshake->dhm_ctx, - (int) mpi_size( &ssl->handshake->dhm_ctx.P ), - p, - &len, ssl->f_rng, ssl->p_rng ) ) != 0 ) + (int) mpi_size( &ssl->handshake->dhm_ctx.P ), + p, &len, ssl->f_rng, ssl->p_rng ) ) != 0 ) { SSL_DEBUG_RET( 1, "dhm_make_params", ret ); return( ret ); @@ -2758,7 +2759,7 @@ ciphersuite_info->key_exchange == POLARSSL_KEY_EXCHANGE_ECDH_ECDSA ) { if( ( ret = ecdh_read_public( &ssl->handshake->ecdh_ctx, - ssl->in_msg + 4, ssl->in_hslen - 4 ) ) != 0 ) + ssl->in_msg + 4, ssl->in_hslen - 4 ) ) != 0 ) { SSL_DEBUG_RET( 1, "ecdh_read_public", ret ); return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_RP );
diff --git a/library/ssl_tls.c b/library/ssl_tls.c index f3e082b..480c5e5 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c
@@ -722,7 +722,8 @@ memset( &transform->ctx_deflate, 0, sizeof( transform->ctx_deflate ) ); memset( &transform->ctx_inflate, 0, sizeof( transform->ctx_inflate ) ); - if( deflateInit( &transform->ctx_deflate, Z_DEFAULT_COMPRESSION ) != Z_OK || + if( deflateInit( &transform->ctx_deflate, + Z_DEFAULT_COMPRESSION ) != Z_OK || inflateInit( &transform->ctx_inflate ) != Z_OK ) { SSL_DEBUG_MSG( 1, ( "Failed to initialize compression" ) ); @@ -1123,8 +1124,8 @@ * Generate IV */ ret = ssl->f_rng( ssl->p_rng, - ssl->transform_out->iv_enc + ssl->transform_out->fixed_ivlen, - ssl->transform_out->ivlen - ssl->transform_out->fixed_ivlen ); + ssl->transform_out->iv_enc + ssl->transform_out->fixed_ivlen, + ssl->transform_out->ivlen - ssl->transform_out->fixed_ivlen ); if( ret != 0 ) return( ret ); @@ -1133,7 +1134,7 @@ ssl->transform_out->ivlen - ssl->transform_out->fixed_ivlen ); SSL_DEBUG_BUF( 4, "IV used", ssl->out_iv, - ssl->transform_out->ivlen - ssl->transform_out->fixed_ivlen ); + ssl->transform_out->ivlen - ssl->transform_out->fixed_ivlen ); /* * Fix pointer positions and message length with added IV @@ -1254,7 +1255,8 @@ SSL_DEBUG_MSG( 3, ( "before encrypt: msglen = %d, " "including %d bytes of IV and %d bytes of padding", - ssl->out_msglen, ssl->transform_out->ivlen, padlen + 1 ) ); + ssl->out_msglen, ssl->transform_out->ivlen, + padlen + 1 ) ); SSL_DEBUG_BUF( 4, "before encrypt: output payload", ssl->out_iv, ssl->out_msglen ); @@ -1524,8 +1526,10 @@ if( ssl->in_msglen < minlen + ssl->transform_in->ivlen || ssl->in_msglen < minlen + ssl->transform_in->maclen + 1 ) { - SSL_DEBUG_MSG( 1, ( "msglen (%d) < max( ivlen(%d), maclen (%d) + 1 ) ( + expl IV )", - ssl->in_msglen, ssl->transform_in->ivlen, ssl->transform_in->maclen ) ); + SSL_DEBUG_MSG( 1, ( "msglen (%d) < max( ivlen(%d), maclen (%d) " + "+ 1 ) ( + expl IV )", ssl->in_msglen, + ssl->transform_in->ivlen, + ssl->transform_in->maclen ) ); return( POLARSSL_ERR_SSL_INVALID_MAC ); } @@ -1843,7 +1847,8 @@ return( POLARSSL_ERR_SSL_COMPRESSION_FAILED ); } - ssl->out_msglen = SSL_BUFFER_LEN - ssl->transform_out->ctx_deflate.avail_out; + ssl->out_msglen = SSL_BUFFER_LEN - + ssl->transform_out->ctx_deflate.avail_out; SSL_DEBUG_MSG( 3, ( "after compression: msglen = %d, ", ssl->out_msglen ) ); @@ -1888,7 +1893,8 @@ return( POLARSSL_ERR_SSL_COMPRESSION_FAILED ); } - ssl->in_msglen = SSL_MAX_CONTENT_LEN - ssl->transform_in->ctx_inflate.avail_out; + ssl->in_msglen = SSL_MAX_CONTENT_LEN - + ssl->transform_in->ctx_inflate.avail_out; SSL_DEBUG_MSG( 3, ( "after decompression: msglen = %d, ", ssl->in_msglen ) ); @@ -2183,7 +2189,8 @@ * TLS encrypted messages can have up to 256 bytes of padding */ if( ssl->minor_ver >= SSL_MINOR_VERSION_1 && - ssl->in_msglen > ssl->transform_in->minlen + SSL_MAX_CONTENT_LEN + 256 ) + ssl->in_msglen > ssl->transform_in->minlen + + SSL_MAX_CONTENT_LEN + 256 ) { SSL_DEBUG_MSG( 1, ( "bad message length" ) ); return( POLARSSL_ERR_SSL_INVALID_RECORD ); @@ -3236,7 +3243,8 @@ ssl->state++; /* - * Switch to our negotiated transform and session parameters for outbound data. + * Switch to our negotiated transform and session parameters for outbound + * data. */ SSL_DEBUG_MSG( 3, ( "switching to new transform spec for outbound data" ) ); ssl->transform_out = ssl->transform_negotiate; @@ -3276,7 +3284,8 @@ ssl->handshake->calc_finished( ssl, buf, ssl->endpoint ^ 1 ); /* - * Switch to our negotiated transform and session parameters for inbound data. + * Switch to our negotiated transform and session parameters for inbound + * data. */ SSL_DEBUG_MSG( 3, ( "switching to new transform spec for inbound data" ) ); ssl->transform_in = ssl->transform_negotiate; @@ -3707,7 +3716,8 @@ ssl->ciphersuite_list[SSL_MINOR_VERSION_3] = ciphersuites; } -void ssl_set_ciphersuites_for_version( ssl_context *ssl, const int *ciphersuites, +void ssl_set_ciphersuites_for_version( ssl_context *ssl, + const int *ciphersuites, int major, int minor ) { if( major != SSL_MAJOR_VERSION_3 ) @@ -3855,7 +3865,8 @@ ssl->psk_identity_len = psk_identity_len; ssl->psk = (unsigned char *) polarssl_malloc( ssl->psk_len ); - ssl->psk_identity = (unsigned char *) polarssl_malloc( ssl->psk_identity_len ); + ssl->psk_identity = (unsigned char *) + polarssl_malloc( ssl->psk_identity_len ); if( ssl->psk == NULL || ssl->psk_identity == NULL ) return( POLARSSL_ERR_SSL_MALLOC_FAILED ); @@ -4344,7 +4355,8 @@ if( ssl->disable_renegotiation == SSL_RENEGOTIATION_DISABLED || ( ssl->secure_renegotiation == SSL_LEGACY_RENEGOTIATION && - ssl->allow_legacy_renegotiation == SSL_LEGACY_NO_RENEGOTIATION ) ) + ssl->allow_legacy_renegotiation == + SSL_LEGACY_NO_RENEGOTIATION ) ) { SSL_DEBUG_MSG( 3, ( "ignoring renegotiation, sending alert" ) );
diff --git a/library/version.c b/library/version.c index 120d62d..400a8fe 100644 --- a/library/version.c +++ b/library/version.c
@@ -1,7 +1,7 @@ /* * Version information * - * 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> @@ -43,12 +43,14 @@ void version_get_string( char *string ) { - memcpy( string, POLARSSL_VERSION_STRING, sizeof( POLARSSL_VERSION_STRING ) ); + memcpy( string, POLARSSL_VERSION_STRING, + sizeof( POLARSSL_VERSION_STRING ) ); } void version_get_string_full( char *string ) { - memcpy( string, POLARSSL_VERSION_STRING_FULL, sizeof( POLARSSL_VERSION_STRING_FULL ) ); + memcpy( string, POLARSSL_VERSION_STRING_FULL, + sizeof( POLARSSL_VERSION_STRING_FULL ) ); } #endif /* POLARSSL_VERSION_C */
diff --git a/library/x509_create.c b/library/x509_create.c index 8f7a789..8976c72 100644 --- a/library/x509_create.c +++ b/library/x509_create.c
@@ -65,7 +65,8 @@ oid = OID_AT_COUNTRY; else if( c - s == 1 && strncasecmp( s, "O", 1 ) == 0 ) oid = OID_AT_ORGANIZATION; - else if( c - s == 16 && strncasecmp( s, "organizationName", 16 ) == 0 ) + else if( c - s == 16 && + strncasecmp( s, "organizationName", 16 ) == 0 ) oid = OID_AT_ORGANIZATION; else if( c - s == 1 && strncasecmp( s, "L", 1 ) == 0 ) oid = OID_AT_LOCALITY; @@ -75,11 +76,13 @@ oid = OID_PKCS9_EMAIL; else if( c - s == 2 && strncasecmp( s, "OU", 2 ) == 0 ) oid = OID_AT_ORG_UNIT; - else if( c - s == 22 && strncasecmp( s, "organizationalUnitName", 22 ) == 0 ) + else if( c - s == 22 && + strncasecmp( s, "organizationalUnitName", 22 ) == 0 ) oid = OID_AT_ORG_UNIT; else if( c - s == 2 && strncasecmp( s, "ST", 2 ) == 0 ) oid = OID_AT_STATE; - else if( c - s == 19 && strncasecmp( s, "stateOrProvinceName", 19 ) == 0 ) + else if( c - s == 19 && + strncasecmp( s, "stateOrProvinceName", 19 ) == 0 ) oid = OID_AT_STATE; else if( c - s == 12 && strncasecmp( s, "emailAddress", 12 ) == 0 ) oid = OID_PKCS9_EMAIL; @@ -105,9 +108,11 @@ oid = OID_AT_INITIALS; else if( c - s == 9 && strncasecmp( s, "pseudonym", 9 ) == 0 ) oid = OID_AT_PSEUDONYM; - else if( c - s == 19 && strncasecmp( s, "generationQualifier", 19 ) == 0 ) + else if( c - s == 19 && + strncasecmp( s, "generationQualifier", 19 ) == 0 ) oid = OID_AT_GENERATION_QUALIFIER; - else if( c - s == 15 && strncasecmp( s, "domainComponent", 15 ) == 0 ) + else if( c - s == 15 && + strncasecmp( s, "domainComponent", 15 ) == 0 ) oid = OID_DOMAIN_COMPONENT; else if( c - s == 2 && strncasecmp( s, "DC", 2 ) == 0 ) oid = OID_DOMAIN_COMPONENT; @@ -204,10 +209,12 @@ ASN1_CHK_ADD( len, asn1_write_oid( p, start, oid, oid_len ) ); ASN1_CHK_ADD( len, asn1_write_len( p, start, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( p, start, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ); + ASN1_CHK_ADD( len, asn1_write_tag( p, start, ASN1_CONSTRUCTED | + ASN1_SEQUENCE ) ); ASN1_CHK_ADD( len, asn1_write_len( p, start, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( p, start, ASN1_CONSTRUCTED | ASN1_SET ) ); + ASN1_CHK_ADD( len, asn1_write_tag( p, start, ASN1_CONSTRUCTED | + ASN1_SET ) ); return( (int) len ); } @@ -228,7 +235,8 @@ } ASN1_CHK_ADD( len, asn1_write_len( p, start, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( p, start, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ); + ASN1_CHK_ADD( len, asn1_write_tag( p, start, ASN1_CONSTRUCTED | + ASN1_SEQUENCE ) ); return( (int) len ); } @@ -283,7 +291,8 @@ ASN1_CHK_ADD( len, asn1_write_tag( p, start, ASN1_OID ) ); ASN1_CHK_ADD( len, asn1_write_len( p, start, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( p, start, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ); + ASN1_CHK_ADD( len, asn1_write_tag( p, start, ASN1_CONSTRUCTED | + ASN1_SEQUENCE ) ); return( (int) len ); }
diff --git a/library/x509_crl.c b/library/x509_crl.c index 7ab4056..a63a679 100644 --- a/library/x509_crl.c +++ b/library/x509_crl.c
@@ -224,10 +224,12 @@ if( ( ret = x509_get_serial( p, end2, &cur_entry->serial ) ) != 0 ) return( ret ); - if( ( ret = x509_get_time( p, end2, &cur_entry->revocation_date ) ) != 0 ) + if( ( ret = x509_get_time( p, end2, + &cur_entry->revocation_date ) ) != 0 ) return( ret ); - if( ( ret = x509_get_crl_entry_ext( p, end2, &cur_entry->entry_ext ) ) != 0 ) + if( ( ret = x509_get_crl_entry_ext( p, end2, + &cur_entry->entry_ext ) ) != 0 ) return( ret ); if ( *p < end )
diff --git a/library/x509_crt.c b/library/x509_crt.c index 4278d6e..7946068 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c
@@ -819,7 +819,8 @@ } /* - * Parse one or more PEM certificates from a buffer and add them to the chained list + * Parse one or more PEM certificates from a buffer and add them to the chained + * list */ int x509_crt_parse( x509_crt *chain, const unsigned char *buf, size_t buflen ) { @@ -970,7 +971,8 @@ 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) @@ -1692,8 +1694,11 @@ if( NULL != f_vrfy ) { - if( ( ret = f_vrfy( p_vrfy, trust_ca, path_cnt + 1, &ca_flags ) ) != 0 ) + if( ( ret = f_vrfy( p_vrfy, trust_ca, path_cnt + 1, + &ca_flags ) ) != 0 ) + { return( ret ); + } } }
diff --git a/library/x509write_crt.c b/library/x509write_crt.c index 302b877..df7ab64 100644 --- a/library/x509write_crt.c +++ b/library/x509write_crt.c
@@ -1,7 +1,7 @@ /* * X.509 certificate writing * - * 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> @@ -155,7 +155,8 @@ } ASN1_CHK_ADD( len, asn1_write_len( &c, buf, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( &c, buf, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ); + ASN1_CHK_ADD( len, asn1_write_tag( &c, buf, ASN1_CONSTRUCTED | + ASN1_SEQUENCE ) ); return x509write_crt_set_extension( ctx, OID_BASIC_CONSTRAINTS, OID_SIZE( OID_BASIC_CONSTRAINTS ), @@ -203,7 +204,8 @@ ASN1_CHK_ADD( len, asn1_write_tag( &c, buf, ASN1_CONTEXT_SPECIFIC | 0 ) ); ASN1_CHK_ADD( len, asn1_write_len( &c, buf, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( &c, buf, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ); + ASN1_CHK_ADD( len, asn1_write_tag( &c, buf, ASN1_CONSTRUCTED | + ASN1_SEQUENCE ) ); return x509write_crt_set_extension( ctx, OID_AUTHORITY_KEY_IDENTIFIER, OID_SIZE( OID_AUTHORITY_KEY_IDENTIFIER ), @@ -317,9 +319,11 @@ */ ASN1_CHK_ADD( len, x509_write_extensions( &c, tmp_buf, ctx->extensions ) ); ASN1_CHK_ADD( len, asn1_write_len( &c, tmp_buf, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ); + ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONSTRUCTED | + ASN1_SEQUENCE ) ); ASN1_CHK_ADD( len, asn1_write_len( &c, tmp_buf, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTED | 3 ) ); + ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONTEXT_SPECIFIC | + ASN1_CONSTRUCTED | 3 ) ); /* * SubjectPublicKeyInfo @@ -349,7 +353,8 @@ len += sub_len; ASN1_CHK_ADD( len, asn1_write_len( &c, tmp_buf, sub_len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ); + ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONSTRUCTED | + ASN1_SEQUENCE ) ); /* * Issuer ::= Name @@ -374,10 +379,12 @@ ASN1_CHK_ADD( sub_len, asn1_write_int( &c, tmp_buf, ctx->version ) ); len += sub_len; ASN1_CHK_ADD( len, asn1_write_len( &c, tmp_buf, sub_len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTED | 0 ) ); + ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONTEXT_SPECIFIC | + ASN1_CONSTRUCTED | 0 ) ); ASN1_CHK_ADD( len, asn1_write_len( &c, tmp_buf, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ); + ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONSTRUCTED | + ASN1_SEQUENCE ) ); /* * Make signature @@ -402,7 +409,8 @@ len += sig_and_oid_len; ASN1_CHK_ADD( len, asn1_write_len( &c2, buf, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( &c2, buf, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ); + ASN1_CHK_ADD( len, asn1_write_tag( &c2, buf, ASN1_CONSTRUCTED | + ASN1_SEQUENCE ) ); return( (int) len ); }
diff --git a/library/x509write_csr.c b/library/x509write_csr.c index 6e7bed4..ff766e1 100644 --- a/library/x509write_csr.c +++ b/library/x509write_csr.c
@@ -1,7 +1,7 @@ /* * X.509 Certificate Signing Request writing * - * 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> @@ -150,20 +150,24 @@ if( len ) { ASN1_CHK_ADD( len, asn1_write_len( &c, tmp_buf, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ); + ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONSTRUCTED | + ASN1_SEQUENCE ) ); ASN1_CHK_ADD( len, asn1_write_len( &c, tmp_buf, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONSTRUCTED | ASN1_SET ) ); + ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONSTRUCTED | + ASN1_SET ) ); ASN1_CHK_ADD( len, asn1_write_oid( &c, tmp_buf, OID_PKCS9_CSR_EXT_REQ, OID_SIZE( OID_PKCS9_CSR_EXT_REQ ) ) ); ASN1_CHK_ADD( len, asn1_write_len( &c, tmp_buf, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ); + ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONSTRUCTED | + ASN1_SEQUENCE ) ); } ASN1_CHK_ADD( len, asn1_write_len( &c, tmp_buf, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONSTRUCTED | ASN1_CONTEXT_SPECIFIC ) ); + ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONSTRUCTED | + ASN1_CONTEXT_SPECIFIC ) ); ASN1_CHK_ADD( pub_len, pk_write_pubkey_der( ctx->key, tmp_buf, c - tmp_buf ) ); @@ -181,7 +185,8 @@ ASN1_CHK_ADD( len, asn1_write_int( &c, tmp_buf, 0 ) ); ASN1_CHK_ADD( len, asn1_write_len( &c, tmp_buf, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ); + ASN1_CHK_ADD( len, asn1_write_tag( &c, tmp_buf, ASN1_CONSTRUCTED | + ASN1_SEQUENCE ) ); /* * Prepare signature @@ -212,7 +217,8 @@ len += sig_and_oid_len; ASN1_CHK_ADD( len, asn1_write_len( &c2, buf, len ) ); - ASN1_CHK_ADD( len, asn1_write_tag( &c2, buf, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ); + ASN1_CHK_ADD( len, asn1_write_tag( &c2, buf, ASN1_CONSTRUCTED | + ASN1_SEQUENCE ) ); return( (int) len ); }