Merge branch 'cleanup' into development

* cleanup:
  change test function includes to use one convention
  cleanup library and some basic tests. Includes, add guards to includes
  modify include .gitignore to ignore check_config generated when build fails due to incorrect config
  fix bug in makefile that a test doesn't count as a fail even if an assertion fails by inverting logic
  fix style issues with tests/suites/helpers.function
  fix always true assertion
This commit is contained in:
Manuel Pégourié-Gonnard 2015-02-10 11:36:55 +00:00
commit d3cae19df8
136 changed files with 363 additions and 271 deletions

1
include/.gitignore vendored
View file

@ -1,3 +1,4 @@
Makefile
*.sln
*.vcxproj
polarssl/check_config

View file

@ -30,7 +30,7 @@
#include POLARSSL_CONFIG_FILE
#endif
#include <string.h>
#include <stddef.h>
#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
#include <basetsd.h>

View file

@ -30,7 +30,7 @@
#include POLARSSL_CONFIG_FILE
#endif
#include <string.h>
#include <stddef.h>
#if !defined(POLARSSL_ARC4_ALT)
// Regular implementation

View file

@ -30,12 +30,12 @@
#include POLARSSL_CONFIG_FILE
#endif
#include <stddef.h>
#if defined(POLARSSL_BIGNUM_C)
#include "bignum.h"
#endif
#include <string.h>
/**
* \addtogroup asn1_module
* \{

View file

@ -24,7 +24,7 @@
#ifndef POLARSSL_BASE64_H
#define POLARSSL_BASE64_H
#include <string.h>
#include <stddef.h>
#define POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL -0x002A /**< Output buffer too small. */
#define POLARSSL_ERR_BASE64_INVALID_CHARACTER -0x002C /**< Invalid character in input. */

View file

@ -24,14 +24,14 @@
#ifndef POLARSSL_BIGNUM_H
#define POLARSSL_BIGNUM_H
#include <string.h>
#if !defined(POLARSSL_CONFIG_FILE)
#include "config.h"
#else
#include POLARSSL_CONFIG_FILE
#endif
#include <stddef.h>
#if defined(POLARSSL_FS_IO)
#include <stdio.h>
#endif

View file

@ -30,7 +30,7 @@
#include POLARSSL_CONFIG_FILE
#endif
#include <string.h>
#include <stddef.h>
#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
#include <basetsd.h>

View file

@ -30,7 +30,7 @@
#include POLARSSL_CONFIG_FILE
#endif
#include <string.h>
#include <stddef.h>
#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
#include <basetsd.h>

View file

@ -33,6 +33,8 @@
#include POLARSSL_CONFIG_FILE
#endif
#include <stddef.h>
#if defined(POLARSSL_GCM_C) || defined(POLARSSL_CCM_C)
#define POLARSSL_CIPHER_MODE_AEAD
#endif
@ -41,8 +43,6 @@
#define POLARSSL_CIPHER_MODE_WITH_PADDING
#endif
#include <string.h>
#if defined(_MSC_VER) && !defined(inline)
#define inline _inline
#else

View file

@ -31,6 +31,7 @@
#else
#include POLARSSL_CONFIG_FILE
#endif
#include "cipher.h"
#ifdef __cplusplus

View file

@ -24,8 +24,6 @@
#ifndef POLARSSL_CTR_DRBG_H
#define POLARSSL_CTR_DRBG_H
#include <string.h>
#include "aes.h"
#define POLARSSL_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED -0x0034 /**< The entropy source failed. */

View file

@ -29,7 +29,9 @@
#else
#include POLARSSL_CONFIG_FILE
#endif
#include "ssl.h"
#if defined(POLARSSL_ECP_C)
#include "ecp.h"
#endif

View file

@ -30,7 +30,7 @@
#include POLARSSL_CONFIG_FILE
#endif
#include <string.h>
#include <stddef.h>
#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
#include <basetsd.h>

View file

@ -24,14 +24,14 @@
#ifndef POLARSSL_ENTROPY_H
#define POLARSSL_ENTROPY_H
#include <string.h>
#if !defined(POLARSSL_CONFIG_FILE)
#include "config.h"
#else
#include POLARSSL_CONFIG_FILE
#endif
#include <stddef.h>
#if defined(POLARSSL_SHA512_C) && !defined(POLARSSL_ENTROPY_FORCE_SHA256)
#include "sha512.h"
#define POLARSSL_ENTROPY_SHA512_ACCUMULATOR

View file

@ -24,14 +24,14 @@
#ifndef POLARSSL_ENTROPY_POLL_H
#define POLARSSL_ENTROPY_POLL_H
#include <string.h>
#if !defined(POLARSSL_CONFIG_FILE)
#include "config.h"
#else
#include POLARSSL_CONFIG_FILE
#endif
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif

View file

@ -24,7 +24,7 @@
#ifndef POLARSSL_ERROR_H
#define POLARSSL_ERROR_H
#include <string.h>
#include <stddef.h>
/**
* Error code layout.

View file

@ -24,7 +24,7 @@
#ifndef POLARSSL_HAVEGE_H
#define POLARSSL_HAVEGE_H
#include <string.h>
#include <stddef.h>
#define COLLECT_SIZE 1024

View file

@ -26,7 +26,7 @@
#ifndef POLARSSL_MD_H
#define POLARSSL_MD_H
#include <string.h>
#include <stddef.h>
#if defined(_MSC_VER) && !defined(inline)
#define inline _inline

View file

@ -30,7 +30,7 @@
#include POLARSSL_CONFIG_FILE
#endif
#include <string.h>
#include <stddef.h>
#define POLARSSL_ERR_MD2_FILE_IO_ERROR -0x0070 /**< Read/write error in file. */

View file

@ -30,7 +30,7 @@
#include POLARSSL_CONFIG_FILE
#endif
#include <string.h>
#include <stddef.h>
#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
#include <basetsd.h>

View file

@ -30,7 +30,7 @@
#include POLARSSL_CONFIG_FILE
#endif
#include <string.h>
#include <stddef.h>
#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
#include <basetsd.h>

View file

@ -31,6 +31,7 @@
#else
#include POLARSSL_CONFIG_FILE
#endif
#include "md.h"
#ifdef __cplusplus

View file

@ -30,7 +30,7 @@
#include POLARSSL_CONFIG_FILE
#endif
#include <stdlib.h>
#include <stddef.h>
/**
* \name SECTION: Module settings

View file

@ -24,7 +24,7 @@
#ifndef POLARSSL_NET_H
#define POLARSSL_NET_H
#include <string.h>
#include <stddef.h>
#define POLARSSL_ERR_NET_UNKNOWN_HOST -0x0056 /**< Failed to get an IP address for the given hostname. */
#define POLARSSL_ERR_NET_SOCKET_FAILED -0x0042 /**< Failed to open a socket. */

View file

@ -24,14 +24,17 @@
#ifndef POLARSSL_OID_H
#define POLARSSL_OID_H
#include <string.h>
#if !defined(POLARSSL_CONFIG_FILE)
#include "config.h"
#else
#include POLARSSL_CONFIG_FILE
#endif
#include "asn1.h"
#include "pk.h"
#include <stddef.h>
#if defined(POLARSSL_CIPHER_C)
#include "cipher.h"
#endif

View file

@ -42,7 +42,6 @@ typedef INT32 int32_t;
#include <inttypes.h>
#endif
#define PADLOCK_RNG 0x000C
#define PADLOCK_ACE 0x00C0
#define PADLOCK_PHE 0x0C00

View file

@ -27,10 +27,10 @@
#ifndef POLARSSL_PBKDF2_H
#define POLARSSL_PBKDF2_H
#include <string.h>
#include "md.h"
#include <stddef.h>
#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
#include <basetsd.h>
typedef UINT32 uint32_t;

View file

@ -24,7 +24,7 @@
#ifndef POLARSSL_PEM_H
#define POLARSSL_PEM_H
#include <string.h>
#include <stddef.h>
/**
* \name PEM Error codes

View file

@ -24,12 +24,12 @@
#ifndef POLARSSL_PKCS12_H
#define POLARSSL_PKCS12_H
#include <string.h>
#include "md.h"
#include "cipher.h"
#include "asn1.h"
#include <stddef.h>
#define POLARSSL_ERR_PKCS12_BAD_INPUT_DATA -0x1F80 /**< Bad input parameters to function. */
#define POLARSSL_ERR_PKCS12_FEATURE_UNAVAILABLE -0x1F00 /**< Feature not available, e.g. unsupported encryption scheme. */
#define POLARSSL_ERR_PKCS12_PBE_INVALID_FORMAT -0x1E80 /**< PBE ASN.1 data not as expected. */

View file

@ -26,11 +26,11 @@
#ifndef POLARSSL_PKCS5_H
#define POLARSSL_PKCS5_H
#include <string.h>
#include "asn1.h"
#include "md.h"
#include <stddef.h>
#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
#include <basetsd.h>
typedef UINT32 uint32_t;

View file

@ -35,8 +35,6 @@
#define POLARSSL_PLATFORM_MEMORY
#endif
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -50,6 +48,7 @@ extern "C" {
*/
#if !defined(POLARSSL_PLATFORM_NO_STD_FUNCTIONS)
#include <stdio.h>
#include <stdlib.h>
#if !defined(POLARSSL_PLATFORM_STD_PRINTF)
#define POLARSSL_PLATFORM_STD_PRINTF printf /**< Default printf to use */
@ -88,10 +87,10 @@ extern void (*polarssl_free)( void *ptr );
*/
int platform_set_malloc_free( void * (*malloc_func)( size_t ),
void (*free_func)( void * ) );
#else /* POLARSSL_PLATFORM_ENTROPY */
#else /* !POLARSSL_PLATFORM_MEMORY */
#define polarssl_malloc malloc
#define polarssl_free free
#endif /* POLARSSL_PLATFORM_ENTROPY */
#endif /* POLARSSL_PLATFORM_MEMORY */
/*
* The function pointers for printf

View file

@ -30,7 +30,7 @@
#include POLARSSL_CONFIG_FILE
#endif
#include <string.h>
#include <stddef.h>
#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
#include <basetsd.h>

View file

@ -30,7 +30,7 @@
#include POLARSSL_CONFIG_FILE
#endif
#include <string.h>
#include <stddef.h>
#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
#include <basetsd.h>

View file

@ -30,7 +30,7 @@
#include POLARSSL_CONFIG_FILE
#endif
#include <string.h>
#include <stddef.h>
#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
#include <basetsd.h>

View file

@ -30,7 +30,7 @@
#include POLARSSL_CONFIG_FILE
#endif
#include <string.h>
#include <stddef.h>
#if defined(_MSC_VER) || defined(__WATCOMC__)
#define UL64(x) x##ui64

View file

@ -31,7 +31,6 @@
#endif
#include "x509.h"
#include "x509_crl.h"
/**

View file

@ -30,7 +30,7 @@
#include POLARSSL_CONFIG_FILE
#endif
#include <string.h>
#include <stddef.h>
#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
#include <basetsd.h>

View file

@ -34,6 +34,8 @@
#if defined(POLARSSL_AES_C)
#include <string.h>
#include "polarssl/aes.h"
#if defined(POLARSSL_PADLOCK_C)
#include "polarssl/padlock.h"
@ -42,11 +44,14 @@
#include "polarssl/aesni.h"
#endif
#if defined(POLARSSL_SELF_TEST)
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
#endif /* POLARSSL_PLATFORM_C */
#endif /* POLARSSL_SELF_TEST */
#if !defined(POLARSSL_AES_ALT)
@ -926,7 +931,6 @@ int aes_crypt_cfb128( aes_context *ctx,
/*
* AES-CFB8 buffer encryption/decryption
*/
#include <stdio.h>
int aes_crypt_cfb8( aes_context *ctx,
int mode,
size_t length,
@ -996,9 +1000,6 @@ int aes_crypt_ctr( aes_context *ctx,
#endif /* !POLARSSL_AES_ALT */
#if defined(POLARSSL_SELF_TEST)
#include <stdio.h>
/*
* AES test vectors from:
*

View file

@ -34,7 +34,8 @@
#if defined(POLARSSL_AESNI_C)
#include "polarssl/aesni.h"
#include <stdio.h>
#include <string.h>
#if defined(POLARSSL_HAVE_X86_64)

View file

@ -35,11 +35,16 @@
#include "polarssl/arc4.h"
#include <string.h>
#if defined(POLARSSL_SELF_TEST)
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
#endif /* POLARSSL_PLATFORM_C */
#endif /* POLARSSL_SELF_TEST */
#if !defined(POLARSSL_ARC4_ALT)
@ -126,10 +131,6 @@ int arc4_crypt( arc4_context *ctx, size_t length, const unsigned char *input,
#endif /* !POLARSSL_ARC4_ALT */
#if defined(POLARSSL_SELF_TEST)
#include <string.h>
#include <stdio.h>
/*
* ARC4 tests vectors as posted by Eric Rescorla in sep. 1994:
*

View file

@ -30,6 +30,8 @@
#include "polarssl/asn1.h"
#include <string.h>
#if defined(POLARSSL_BIGNUM_C)
#include "polarssl/bignum.h"
#endif
@ -37,13 +39,11 @@
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdlib.h>
#define polarssl_malloc malloc
#define polarssl_free free
#endif
#include <string.h>
#include <stdlib.h>
/* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;

View file

@ -30,6 +30,8 @@
#include "polarssl/asn1write.h"
#include <string.h>
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else

View file

@ -37,11 +37,15 @@ typedef UINT32 uint32_t;
#include <inttypes.h>
#endif
#if defined(POLARSSL_SELF_TEST)
#include <string.h>
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
#endif /* POLARSSL_PLATFORM_C */
#endif /* POLARSSL_SELF_TEST */
static const unsigned char base64_enc_map[64] =
{
@ -221,9 +225,6 @@ int base64_decode( unsigned char *dst, size_t *dlen,
#if defined(POLARSSL_SELF_TEST)
#include <string.h>
#include <stdio.h>
static const unsigned char base64_test_dec[64] =
{
0x24, 0x48, 0x6E, 0x56, 0x87, 0x62, 0x5A, 0xBD,

View file

@ -38,16 +38,18 @@
#include "polarssl/bignum.h"
#include "polarssl/bn_mul.h"
#include <string.h>
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#include <stdlib.h>
#define polarssl_printf printf
#define polarssl_malloc malloc
#define polarssl_free free
#endif
#include <stdlib.h>
/* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;

View file

@ -36,6 +36,8 @@
#include "polarssl/blowfish.h"
#include <string.h>
#if !defined(POLARSSL_BLOWFISH_ALT)
/* Implementation that should never be optimized out by the compiler */

View file

@ -36,11 +36,15 @@
#include "polarssl/camellia.h"
#if defined(POLARSSL_SELF_TEST)
#include <string.h>
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
#endif /* POLARSSL_PLATFORM_C */
#endif /* POLARSSL_SELF_TEST */
#if !defined(POLARSSL_CAMELLIA_ALT)
@ -689,8 +693,6 @@ int camellia_crypt_ctr( camellia_context *ctx,
#if defined(POLARSSL_SELF_TEST)
#include <stdio.h>
/*
* Camellia test vectors from:
*

View file

@ -39,6 +39,17 @@
#include "polarssl/ccm.h"
#include <string.h>
#if defined(POLARSSL_SELF_TEST) && defined(POLARSSL_AES_C)
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif /* POLARSSL_PLATFORM_C */
#endif /* POLARSSL_SELF_TEST && POLARSSL_AES_C */
/* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
@ -333,14 +344,6 @@ int ccm_auth_decrypt( ccm_context *ctx, size_t length,
#if defined(POLARSSL_SELF_TEST) && defined(POLARSSL_AES_C)
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
/*
* Examples 1 to 3 from SP800-38C Appendix C
*/

View file

@ -35,6 +35,9 @@
#include "polarssl/cipher.h"
#include "polarssl/cipher_wrap.h"
#include <stdlib.h>
#include <string.h>
#if defined(POLARSSL_GCM_C)
#include "polarssl/gcm.h"
#endif
@ -43,8 +46,6 @@
#include "polarssl/ccm.h"
#endif
#include <stdlib.h>
#if defined(POLARSSL_ARC4_C) || defined(POLARSSL_CIPHER_NULL_CIPHER)
#define POLARSSL_CIPHER_MODE_STREAM
#endif

View file

@ -65,12 +65,11 @@
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdlib.h>
#define polarssl_malloc malloc
#define polarssl_free free
#endif
#include <stdlib.h>
#if defined(POLARSSL_GCM_C)
/* shared by all GCM ciphers */
static void *gcm_ctx_alloc( void )

View file

@ -35,15 +35,20 @@
#include "polarssl/ctr_drbg.h"
#include <string.h>
#if defined(POLARSSL_FS_IO)
#include <stdio.h>
#endif
#if defined(POLARSSL_SELF_TEST)
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
#endif /* POLARSSL_PLATFORM_C */
#endif /* POLARSSL_SELF_TEST */
/* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) {
@ -443,8 +448,6 @@ int ctr_drbg_update_seed_file( ctr_drbg_context *ctx, const char *path )
#if defined(POLARSSL_SELF_TEST)
#include <stdio.h>
static unsigned char entropy_source_pr[96] =
{ 0xc1, 0x80, 0x81, 0xa6, 0x5d, 0x44, 0x02, 0x16,
0x19, 0xb3, 0xf1, 0x80, 0xb1, 0xc9, 0x20, 0x02,

View file

@ -31,8 +31,8 @@
#include "polarssl/debug.h"
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
#if !defined snprintf

View file

@ -36,11 +36,16 @@
#include "polarssl/des.h"
#include <string.h>
#if defined(POLARSSL_SELF_TEST)
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
#endif /* POLARSSL_PLATFORM_C */
#endif /* POLARSSL_SELF_TEST */
#if !defined(POLARSSL_DES_ALT)
@ -802,9 +807,6 @@ int des3_crypt_cbc( des3_context *ctx,
#endif /* !POLARSSL_DES_ALT */
#if defined(POLARSSL_SELF_TEST)
#include <stdio.h>
/*
* DES and 3DES test vectors from:
*

View file

@ -35,6 +35,8 @@
#include "polarssl/dhm.h"
#include <string.h>
#if defined(POLARSSL_PEM_PARSE_C)
#include "polarssl/pem.h"
#endif

View file

@ -37,6 +37,8 @@
#include "polarssl/ecdh.h"
#include <string.h>
/*
* Generate public key: simple wrapper around ecp_gen_keypair
*/

View file

@ -37,6 +37,8 @@
#include "polarssl/ecdsa.h"
#include "polarssl/asn1write.h"
#include <string.h>
#if defined(POLARSSL_ECDSA_DETERMINISTIC)
#include "polarssl/hmac_drbg.h"
#endif

View file

@ -51,16 +51,17 @@
#include "polarssl/ecp.h"
#include <string.h>
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdlib.h>
#define polarssl_printf printf
#define polarssl_malloc malloc
#define polarssl_free free
#endif
#include <stdlib.h>
#if defined(_MSC_VER) && !defined strcasecmp && !defined(EFIX64) && \
!defined(EFI32)
#define strcasecmp _stricmp

View file

@ -30,6 +30,8 @@
#include "polarssl/ecp.h"
#include <string.h>
#if defined(_MSC_VER) && !defined(inline)
#define inline _inline
#else

View file

@ -31,10 +31,21 @@
#include "polarssl/entropy.h"
#include "polarssl/entropy_poll.h"
#include <string.h>
#if defined(POLARSSL_FS_IO)
#include <stdio.h>
#endif
#if defined(POLARSSL_SELF_TEST)
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif /* POLARSSL_PLATFORM_C */
#endif /* POLARSSL_SELF_TEST */
#if defined(POLARSSL_HAVEGE_C)
#include "polarssl/havege.h"
#endif
@ -378,14 +389,6 @@ int entropy_update_seed_file( entropy_context *ctx, const char *path )
#endif /* POLARSSL_FS_IO */
#if defined(POLARSSL_SELF_TEST)
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
/*
* Dummy source function
*/

View file

@ -32,6 +32,7 @@
#include "polarssl/entropy_poll.h"
#if defined(POLARSSL_TIMING_C)
#include <string.h>
#include "polarssl/timing.h"
#endif
#if defined(POLARSSL_HAVEGE_C)

View file

@ -28,10 +28,13 @@
#if defined(POLARSSL_ERROR_C) || defined(POLARSSL_ERROR_STRERROR_DUMMY)
#include "polarssl/error.h"
#include <string.h>
#endif
#if defined(POLARSSL_ERROR_C)
#include <stdio.h>
#if defined(POLARSSL_AES_C)
#include "polarssl/aes.h"
#endif
@ -172,9 +175,6 @@
#include "polarssl/xtea.h"
#endif
#include <stdio.h>
#include <string.h>
#if defined(_MSC_VER) && !defined snprintf && !defined(EFIX64) && \
!defined(EFI32)
#define snprintf _snprintf
@ -746,8 +746,6 @@ void error_strerror( int ret, char *buf, size_t buflen )
#if defined(POLARSSL_ERROR_STRERROR_DUMMY)
#include <string.h>
/*
* Provide an non-function in case POLARSSL_ERROR_C is not defined
*/

View file

@ -40,15 +40,20 @@
#include "polarssl/gcm.h"
#include <string.h>
#if defined(POLARSSL_AESNI_C)
#include "polarssl/aesni.h"
#endif
#if defined(POLARSSL_SELF_TEST) && defined(POLARSSL_AES_C)
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
#endif /* POLARSSL_PLATFORM_C */
#endif /* POLARSSL_SELF_TEST && POLARSSL_AES_C */
/*
* 32-bit integer manipulation macros (big endian)
@ -496,9 +501,6 @@ void gcm_free( gcm_context *ctx )
}
#if defined(POLARSSL_SELF_TEST) && defined(POLARSSL_AES_C)
#include <stdio.h>
/*
* AES-GCM test vectors from:
*

View file

@ -36,15 +36,20 @@
#include "polarssl/hmac_drbg.h"
#include <string.h>
#if defined(POLARSSL_FS_IO)
#include <stdio.h>
#endif
#if defined(POLARSSL_SELF_TEST)
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
#endif /* POLARSSL_SELF_TEST */
#endif /* POLARSSL_PLATFORM_C */
/* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) {
@ -376,8 +381,6 @@ int hmac_drbg_update_seed_file( hmac_drbg_context *ctx, const char *path )
#if defined(POLARSSL_SELF_TEST)
#include <stdio.h>
#if !defined(POLARSSL_SHA1_C)
/* Dummy checkup routine */
int hmac_drbg_self_test( int verbose )

View file

@ -36,6 +36,7 @@
#include "polarssl/md_wrap.h"
#include <stdlib.h>
#include <string.h>
#if defined(_MSC_VER) && !defined strcasecmp && !defined(EFIX64) && \
!defined(EFI32)

View file

@ -36,15 +36,18 @@
#include "polarssl/md2.h"
#if defined(POLARSSL_FS_IO) || defined(POLARSSL_SELF_TEST)
#if defined(POLARSSL_FS_IO)
#include <stdio.h>
#endif
#if defined(POLARSSL_SELF_TEST)
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
#endif /* POLARSSL_PLATFORM_C */
#endif /* POLARSSL_SELF_TEST */
/* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) {

View file

@ -36,15 +36,20 @@
#include "polarssl/md4.h"
#if defined(POLARSSL_FS_IO) || defined(POLARSSL_SELF_TEST)
#include <string.h>
#if defined(POLARSSL_FS_IO)
#include <stdio.h>
#endif
#if defined(POLARSSL_SELF_TEST)
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
#endif /* POLARSSL_PLATFORM_C */
#endif /* POLARSSL_SELF_TEST */
/* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) {

View file

@ -35,15 +35,20 @@
#include "polarssl/md5.h"
#if defined(POLARSSL_FS_IO) || defined(POLARSSL_SELF_TEST)
#include <string.h>
#if defined(POLARSSL_FS_IO)
#include <stdio.h>
#endif
#if defined(POLARSSL_SELF_TEST)
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
#endif /* POLARSSL_PLATFORM_C */
#endif /* POLARSSL_SELF_TEST */
/* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) {

View file

@ -65,12 +65,11 @@
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdlib.h>
#define polarssl_malloc malloc
#define polarssl_free free
#endif
#include <stdlib.h>
/* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;

View file

@ -33,8 +33,13 @@
#include <string.h>
#if defined(POLARSSL_MEMORY_DEBUG)
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#endif
#define polarssl_fprintf fprintf
#endif /* POLARSSL_PLATFORM_C */
#endif /* POLARSSL_MEMORY_DEBUG */
#if defined(POLARSSL_MEMORY_BACKTRACE)
#include <execinfo.h>
#endif
@ -43,12 +48,6 @@
#include "polarssl/threading.h"
#endif
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#define polarssl_fprintf fprintf
#endif
/* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;

View file

@ -30,6 +30,8 @@
#include "polarssl/net.h"
#include <string.h>
#if (defined(_WIN32) || defined(_WIN32_WCE)) && !defined(EFIX64) && \
!defined(EFI32)

View file

@ -33,12 +33,13 @@
#include "polarssl/oid.h"
#include "polarssl/rsa.h"
#include <stdio.h>
#include <string.h>
#if defined(POLARSSL_X509_USE_C) || defined(POLARSSL_X509_CREATE_C)
#include "polarssl/x509.h"
#endif
#include <stdio.h>
/*
* Macro to automatically add the size of #define'd OIDs
*/

View file

@ -27,6 +27,7 @@
#endif
#if defined(POLARSSL_PEM_PARSE_C) || defined(POLARSSL_PEM_WRITE_C)
#include "polarssl/pem.h"
#include "polarssl/base64.h"
#include "polarssl/des.h"
@ -34,15 +35,16 @@
#include "polarssl/md5.h"
#include "polarssl/cipher.h"
#include <string.h>
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdlib.h>
#define polarssl_malloc malloc
#define polarssl_free free
#endif
#include <stdlib.h>
/* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;

View file

@ -27,7 +27,6 @@
#endif
#if defined(POLARSSL_PK_C)
#include "polarssl/pk.h"
#include "polarssl/pk_wrap.h"

View file

@ -27,12 +27,13 @@
#endif
#if defined(POLARSSL_PK_C)
#include "polarssl/pk_wrap.h"
/* Even if RSA not activated, for the sake of RSA-alt */
#include "polarssl/rsa.h"
#include <string.h>
#if defined(POLARSSL_ECP_C)
#include "polarssl/ecp.h"
#endif

View file

@ -27,6 +27,7 @@
#include "polarssl/pkcs11.h"
#if defined(POLARSSL_PKCS11_C)
#include "polarssl/md.h"
#include "polarssl/oid.h"
#include "polarssl/x509_crt.h"

View file

@ -38,6 +38,8 @@
#include "polarssl/asn1.h"
#include "polarssl/cipher.h"
#include <string.h>
#if defined(POLARSSL_ARC4_C)
#include "polarssl/arc4.h"
#endif

View file

@ -43,9 +43,12 @@
#include "polarssl/cipher.h"
#include "polarssl/oid.h"
#include <string.h>
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
@ -295,8 +298,6 @@ int pkcs5_self_test( int verbose )
}
#else
#include <stdio.h>
#define MAX_TESTS 6
size_t plen[MAX_TESTS] =

View file

@ -32,6 +32,8 @@
#include "polarssl/asn1.h"
#include "polarssl/oid.h"
#include <string.h>
#if defined(POLARSSL_RSA_C)
#include "polarssl/rsa.h"
#endif

View file

@ -32,6 +32,8 @@
#include "polarssl/asn1write.h"
#include "polarssl/oid.h"
#include <string.h>
#if defined(POLARSSL_RSA_C)
#include "polarssl/rsa.h"
#endif

View file

@ -36,19 +36,20 @@
#include "polarssl/ripemd160.h"
#if defined(POLARSSL_FS_IO) || defined(POLARSSL_SELF_TEST)
#include <string.h>
#if defined(POLARSSL_FS_IO)
#include <stdio.h>
#endif
#if defined(POLARSSL_SELF_TEST)
#include <string.h>
#endif
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
#endif /* POLARSSL_PLATFORM_C */
#endif /* POLARSSL_SELF_TEST */
/*
* 32-bit integer manipulation macros (little endian)

View file

@ -37,16 +37,20 @@
#include "polarssl/rsa.h"
#include "polarssl/oid.h"
#include <string.h>
#if defined(POLARSSL_PKCS1_V21)
#include "polarssl/md.h"
#endif
#if defined(POLARSSL_PKCS1_V15) && !defined(__OpenBSD__)
#include <stdlib.h>
#include <stdio.h>
#endif
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif

View file

@ -35,15 +35,20 @@
#include "polarssl/sha1.h"
#if defined(POLARSSL_FS_IO) || defined(POLARSSL_SELF_TEST)
#include <string.h>
#if defined(POLARSSL_FS_IO)
#include <stdio.h>
#endif
#if defined(POLARSSL_SELF_TEST)
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
#endif /* POLARSSL_PLATFORM_C */
#endif /* POLARSSL_SELF_TEST */
/* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) {

View file

@ -35,15 +35,20 @@
#include "polarssl/sha256.h"
#if defined(POLARSSL_FS_IO) || defined(POLARSSL_SELF_TEST)
#include <string.h>
#if defined(POLARSSL_FS_IO)
#include <stdio.h>
#endif
#if defined(POLARSSL_SELF_TEST)
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
#endif /* POLARSSL_PLATFORM_C */
#endif /* POLARSSL_SELF_TEST */
/* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) {

View file

@ -35,15 +35,20 @@
#include "polarssl/sha512.h"
#if defined(POLARSSL_FS_IO) || defined(POLARSSL_SELF_TEST)
#include <string.h>
#if defined(POLARSSL_FS_IO)
#include <stdio.h>
#endif
#if defined(POLARSSL_SELF_TEST)
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
#endif /* POLARSSL_PLATFORM_C */
#endif /* POLARSSL_SELF_TEST */
/* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) {

View file

@ -34,15 +34,16 @@
#include "polarssl/ssl_cache.h"
#include <string.h>
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdlib.h>
#define polarssl_malloc malloc
#define polarssl_free free
#endif
#include <stdlib.h>
void ssl_cache_init( ssl_cache_context *cache )
{
memset( cache, 0, sizeof( ssl_cache_context ) );

View file

@ -33,7 +33,8 @@
#include "polarssl/ssl_ciphersuites.h"
#include "polarssl/ssl.h"
#include <stdlib.h>
// #include <stdlib.h>
#include <string.h>
#if defined(_MSC_VER) && !defined strcasecmp && !defined(EFIX64) && \
!defined(EFI32)

View file

@ -31,16 +31,16 @@
#include "polarssl/debug.h"
#include "polarssl/ssl.h"
#include <string.h>
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdlib.h>
#define polarssl_malloc malloc
#define polarssl_free free
#endif
#include <stdlib.h>
#include <stdio.h>
#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
#include <basetsd.h>
typedef UINT32 uint32_t;

View file

@ -30,6 +30,9 @@
#include "polarssl/debug.h"
#include "polarssl/ssl.h"
#include <string.h>
#if defined(POLARSSL_ECP_C)
#include "polarssl/ecp.h"
#endif
@ -37,13 +40,11 @@
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdlib.h>
#define polarssl_malloc malloc
#define polarssl_free free
#endif
#include <stdlib.h>
#include <stdio.h>
#if defined(POLARSSL_HAVE_TIME)
#include <time.h>
#endif

View file

@ -39,6 +39,8 @@
#include "polarssl/debug.h"
#include "polarssl/ssl.h"
#include <string.h>
#if defined(POLARSSL_X509_CRT_PARSE_C) && \
defined(POLARSSL_X509_CHECK_EXTENDED_KEY_USAGE)
#include "polarssl/oid.h"
@ -47,12 +49,11 @@
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdlib.h>
#define polarssl_malloc malloc
#define polarssl_free free
#endif
#include <stdlib.h>
#if defined(_MSC_VER) && !defined strcasecmp && !defined(EFIX64) && \
!defined(EFI32)
#define strcasecmp _stricmp

View file

@ -41,6 +41,9 @@
#include "polarssl/x509.h"
#include "polarssl/asn1.h"
#include "polarssl/oid.h"
#include <string.h>
#if defined(POLARSSL_PEM_PARSE_C)
#include "polarssl/pem.h"
#endif
@ -48,21 +51,19 @@
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#include <stdlib.h>
#define polarssl_printf printf
#define polarssl_malloc malloc
#define polarssl_free free
#endif
#include <string.h>
#include <stdlib.h>
#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)
#include <windows.h>
#else
#include <time.h>
#endif
#include <stdio.h>
#if defined(POLARSSL_FS_IO)
#if !defined(_WIN32)
#include <sys/types.h>

View file

@ -32,6 +32,8 @@
#include "polarssl/asn1write.h"
#include "polarssl/oid.h"
#include <string.h>
#if defined(_MSC_VER) && !defined strncasecmp && !defined(EFIX64) && \
!defined(EFI32)
#define strncasecmp _strnicmp

View file

@ -40,6 +40,9 @@
#include "polarssl/x509_crl.h"
#include "polarssl/oid.h"
#include <string.h>
#if defined(POLARSSL_PEM_PARSE_C)
#include "polarssl/pem.h"
#endif
@ -47,14 +50,12 @@
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdlib.h>
#define polarssl_malloc malloc
#define polarssl_free free
#endif
#include <string.h>
#include <stdlib.h>
#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)
#include <windows.h>
#else
#include <time.h>

View file

@ -40,6 +40,10 @@
#include "polarssl/x509_crt.h"
#include "polarssl/oid.h"
#include <stdio.h>
#include <string.h>
#if defined(POLARSSL_PEM_PARSE_C)
#include "polarssl/pem.h"
#endif
@ -47,6 +51,7 @@
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdlib.h>
#define polarssl_malloc malloc
#define polarssl_free free
#endif
@ -55,22 +60,19 @@
#include "polarssl/threading.h"
#endif
#include <string.h>
#include <stdlib.h>
#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)
#include <windows.h>
#else
#include <time.h>
#endif
#include <stdio.h>
#if defined(POLARSSL_FS_IO)
#include <stdio.h>
#if !defined(_WIN32) || defined(EFIX64) || defined(EFI32)
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#endif
#endif /* !_WIN32 || EFIX64 || EFI32 */
#endif
/* Implementation that should never be optimized out by the compiler */

View file

@ -40,6 +40,9 @@
#include "polarssl/x509_csr.h"
#include "polarssl/oid.h"
#include <string.h>
#if defined(POLARSSL_PEM_PARSE_C)
#include "polarssl/pem.h"
#endif
@ -47,13 +50,11 @@
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdlib.h>
#define polarssl_malloc malloc
#define polarssl_free free
#endif
#include <string.h>
#include <stdlib.h>
#if defined(POLARSSL_FS_IO) || defined(EFIX64) || defined(EFI32)
#include <stdio.h>
#endif

View file

@ -39,6 +39,8 @@
#include "polarssl/asn1write.h"
#include "polarssl/sha1.h"
#include <string.h>
#if defined(POLARSSL_PEM_WRITE_C)
#include "polarssl/pem.h"
#endif /* POLARSSL_PEM_WRITE_C */

View file

@ -37,13 +37,13 @@
#include "polarssl/oid.h"
#include "polarssl/asn1write.h"
#include <string.h>
#include <stdlib.h>
#if defined(POLARSSL_PEM_WRITE_C)
#include "polarssl/pem.h"
#endif
#include <string.h>
#include <stdlib.h>
/* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;

View file

@ -30,11 +30,16 @@
#include "polarssl/xtea.h"
#include <string.h>
#if defined(POLARSSL_SELF_TEST)
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#endif
#endif /* POLARSSL_PLATFORM_C */
#endif /* POLARSSL_SELF_TEST */
#if !defined(POLARSSL_XTEA_ALT)
@ -190,9 +195,6 @@ int xtea_crypt_cbc( xtea_context *ctx, int mode, size_t length,
#if defined(POLARSSL_SELF_TEST)
#include <string.h>
#include <stdio.h>
/*
* XTEA tests vectors (non-official)
*/

View file

@ -417,9 +417,9 @@ ifndef WINDOWS
do \
echo " - $${i}"; \
RESULT=`$(CHECK_PRELOAD) ./$${i} | grep -v 'PASS$$' | grep -v -- '----' | grep -v '^$$'`; \
FAILED=`echo $$RESULT |grep FAILED`; \
PASSED=`echo $$RESULT |grep PASSED`; \
echo " $$RESULT"; \
if [ "$$FAILED" != "" ]; \
if [ "$$PASSED" == "" ]; \
then \
echo "**** Failed ***************"; \
RETURN=1; \

View file

@ -65,12 +65,12 @@ print TEST_FILE << "END";
#include POLARSSL_CONFIG_FILE
#endif
$test_helpers
$suite_pre_code
$suite_header
$suite_post_code
$test_helpers
END
$test_main =~ s/SUITE_PRE_DEP/$suite_pre_code/;

View file

@ -1,6 +1,9 @@
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#include <stdio.h>
#define polarssl_printf printf
#define polarssl_fprintf fprintf
#define polarssl_malloc malloc
#define polarssl_free free
#endif
@ -43,7 +46,7 @@ static int unhexify(unsigned char *obuf, const char *ibuf)
{
unsigned char c, c2;
int len = strlen(ibuf) / 2;
assert(!(strlen(ibuf) %1)); // must be even number of bytes
assert( strlen(ibuf) % 2 == 0 ); // must be even number of bytes
while (*ibuf != 0)
{
@ -73,14 +76,14 @@ static int unhexify(unsigned char *obuf, const char *ibuf)
return len;
}
static void hexify(unsigned char *obuf, const unsigned char *ibuf, int len)
static void hexify( unsigned char *obuf, const unsigned char *ibuf, int len )
{
unsigned char l, h;
while (len != 0)
while( len != 0 )
{
h = (*ibuf) / 16;
l = (*ibuf) % 16;
h = *ibuf / 16;
l = *ibuf % 16;
if( h < 10 )
*obuf++ = '0' + h;
@ -107,7 +110,7 @@ static void hexify(unsigned char *obuf, const unsigned char *ibuf, int len)
static unsigned char *zero_alloc( size_t len )
{
void *p;
size_t actual_len = len != 0 ? len : 1;
size_t actual_len = ( len != 0 ) ? len : 1;
p = polarssl_malloc( actual_len );
assert( p != NULL );
@ -131,7 +134,7 @@ static unsigned char *unhexify_alloc( const char *ibuf, size_t *olen )
{
unsigned char *obuf;
*olen = strlen(ibuf) / 2;
*olen = strlen( ibuf ) / 2;
if( *olen == 0 )
return( zero_alloc( *olen ) );
@ -269,9 +272,11 @@ static int rnd_pseudo_rand( void *rng_state, unsigned char *output, size_t len )
for( i = 0; i < 32; i++ )
{
info->v0 += (((info->v1 << 4) ^ (info->v1 >> 5)) + info->v1) ^ (sum + k[sum & 3]);
info->v0 += ( ( ( info->v1 << 4 ) ^ ( info->v1 >> 5 ) )
+ info->v1 ) ^ ( sum + k[sum & 3] );
sum += delta;
info->v1 += (((info->v0 << 4) ^ (info->v0 >> 5)) + info->v0) ^ (sum + k[(sum>>11) & 3]);
info->v1 += ( ( ( info->v0 << 4 ) ^ ( info->v0 >> 5 ) )
+ info->v0 ) ^ ( sum + k[( sum>>11 ) & 3] );
}
PUT_UINT32_BE( info->v0, result, 0 );

View file

@ -1,15 +1,3 @@
#include <stdio.h>
#include <string.h>
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#define polarssl_printf printf
#define polarssl_fprintf fprintf
#define polarssl_malloc malloc
#define polarssl_free free
#endif
#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C)
#include "polarssl/memory_buffer_alloc.h"
#endif

Some files were not shown because too many files have changed in this diff Show more