Resolves conflicts in basic-build-test.sh

This commit is contained in:
Simon Butcher 2016-04-05 14:09:12 +01:00
commit bbe2ee9bf3
6 changed files with 62 additions and 38 deletions

View File

@ -2469,6 +2469,8 @@
//#define MBEDTLS_PLATFORM_STD_PRINTF printf /**< Default printf to use, can be undefined */ //#define MBEDTLS_PLATFORM_STD_PRINTF printf /**< Default printf to use, can be undefined */
/* Note: your snprintf must correclty zero-terminate the buffer! */ /* Note: your snprintf must correclty zero-terminate the buffer! */
//#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */ //#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */
//#define MBEDTLS_PLATFORM_STD_EXIT_SUCCESS 0 /**< Default exit value to use, can be undefined */
//#define MBEDTLS_PLATFORM_STD_EXIT_FAILURE 1 /**< Default exit value to use, can be undefined */
/* To Use Function Macros MBEDTLS_PLATFORM_C must be enabled */ /* To Use Function Macros MBEDTLS_PLATFORM_C must be enabled */
/* MBEDTLS_PLATFORM_XXX_MACRO and MBEDTLS_PLATFORM_XXX_ALT cannot both be defined */ /* MBEDTLS_PLATFORM_XXX_MACRO and MBEDTLS_PLATFORM_XXX_ALT cannot both be defined */

View File

@ -64,7 +64,13 @@ extern "C" {
#define MBEDTLS_PLATFORM_STD_FREE free /**< Default free to use */ #define MBEDTLS_PLATFORM_STD_FREE free /**< Default free to use */
#endif #endif
#if !defined(MBEDTLS_PLATFORM_STD_EXIT) #if !defined(MBEDTLS_PLATFORM_STD_EXIT)
#define MBEDTLS_PLATFORM_STD_EXIT exit /**< Default free to use */ #define MBEDTLS_PLATFORM_STD_EXIT exit /**< Default exit to use */
#endif
#if !defined(MBEDTLS_PLATFORM_STD_EXIT_SUCCESS)
#define MBEDTLS_PLATFORM_STD_EXIT_SUCCESS EXIT_SUCCESS /**< Default exit value to use */
#endif
#if !defined(MBEDTLS_PLATFORM_STD_EXIT_FAILURE)
#define MBEDTLS_PLATFORM_STD_EXIT_FAILURE EXIT_FAILURE /**< Default exit value to use */
#endif #endif
#else /* MBEDTLS_PLATFORM_NO_STD_FUNCTIONS */ #else /* MBEDTLS_PLATFORM_NO_STD_FUNCTIONS */
#if defined(MBEDTLS_PLATFORM_STD_MEM_HDR) #if defined(MBEDTLS_PLATFORM_STD_MEM_HDR)
@ -207,6 +213,20 @@ int mbedtls_platform_set_exit( void (*exit_func)( int status ) );
#endif /* MBEDTLS_PLATFORM_EXIT_MACRO */ #endif /* MBEDTLS_PLATFORM_EXIT_MACRO */
#endif /* MBEDTLS_PLATFORM_EXIT_ALT */ #endif /* MBEDTLS_PLATFORM_EXIT_ALT */
/*
* The default exit values
*/
#if defined(MBEDTLS_PLATFORM_STD_EXIT_SUCCESS)
#define MBEDTLS_EXIT_SUCCESS MBEDTLS_PLATFORM_STD_EXIT_SUCCESS
#else
#define MBEDTLS_EXIT_SUCCESS 0
#endif
#if defined(MBEDTLS_PLATFORM_STD_EXIT_FAILURE)
#define MBEDTLS_EXIT_FAILURE MBEDTLS_PLATFORM_STD_EXIT_FAILURE
#else
#define MBEDTLS_EXIT_FAILURE 1
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -52,15 +52,18 @@
#include "mbedtls/ecjpake.h" #include "mbedtls/ecjpake.h"
#include "mbedtls/timing.h" #include "mbedtls/timing.h"
#include <stdio.h>
#include <string.h> #include <string.h>
#if defined(MBEDTLS_PLATFORM_C) #if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h" #include "mbedtls/platform.h"
#else #else
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#define mbedtls_printf printf #define mbedtls_printf printf
#define mbedtls_snprintf snprintf #define mbedtls_snprintf snprintf
#define mbedtls_exit exit
#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS
#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
#endif #endif
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
@ -99,8 +102,7 @@ static int run_test_snprintf( void )
int main( int argc, char *argv[] ) int main( int argc, char *argv[] )
{ {
int ret = 0, v, suites_tested = 0, suites_failed = 0, int v, suites_tested = 0, suites_failed = 0;
exitcode = EXIT_SUCCESS;
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
unsigned char buf[1000000]; unsigned char buf[1000000];
#endif #endif
@ -115,7 +117,7 @@ int main( int argc, char *argv[] )
if( pointer != NULL ) if( pointer != NULL )
{ {
mbedtls_printf( "all-bits-zero is not a NULL pointer\n" ); mbedtls_printf( "all-bits-zero is not a NULL pointer\n" );
return( 1 ); mbedtls_exit( MBEDTLS_EXIT_FAILURE );
} }
/* /*
@ -124,7 +126,7 @@ int main( int argc, char *argv[] )
if( run_test_snprintf() != 0 ) if( run_test_snprintf() != 0 )
{ {
mbedtls_printf( "the snprintf implementation is broken\n" ); mbedtls_printf( "the snprintf implementation is broken\n" );
return( 0 ); mbedtls_exit( MBEDTLS_EXIT_FAILURE );
} }
if( argc == 2 && ( strcmp( argv[1], "--quiet" ) == 0 || if( argc == 2 && ( strcmp( argv[1], "--quiet" ) == 0 ||
@ -145,7 +147,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_MD2_C) #if defined(MBEDTLS_MD2_C)
if( ( ret = mbedtls_md2_self_test( v ) ) != 0 ) if( mbedtls_md2_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -153,7 +155,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_MD4_C) #if defined(MBEDTLS_MD4_C)
if( ( ret = mbedtls_md4_self_test( v ) ) != 0 ) if( mbedtls_md4_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -161,7 +163,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_MD5_C) #if defined(MBEDTLS_MD5_C)
if( ( ret = mbedtls_md5_self_test( v ) ) != 0 ) if( mbedtls_md5_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -169,7 +171,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_RIPEMD160_C) #if defined(MBEDTLS_RIPEMD160_C)
if( ( ret = mbedtls_ripemd160_self_test( v ) ) != 0 ) if( mbedtls_ripemd160_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -177,7 +179,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_SHA1_C) #if defined(MBEDTLS_SHA1_C)
if( ( ret = mbedtls_sha1_self_test( v ) ) != 0 ) if( mbedtls_sha1_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -185,7 +187,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_SHA256_C) #if defined(MBEDTLS_SHA256_C)
if( ( ret = mbedtls_sha256_self_test( v ) ) != 0 ) if( mbedtls_sha256_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -193,7 +195,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_SHA512_C) #if defined(MBEDTLS_SHA512_C)
if( ( ret = mbedtls_sha512_self_test( v ) ) != 0 ) if( mbedtls_sha512_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -201,7 +203,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_ARC4_C) #if defined(MBEDTLS_ARC4_C)
if( ( ret = mbedtls_arc4_self_test( v ) ) != 0 ) if( mbedtls_arc4_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -209,7 +211,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_DES_C) #if defined(MBEDTLS_DES_C)
if( ( ret = mbedtls_des_self_test( v ) ) != 0 ) if( mbedtls_des_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -217,7 +219,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_AES_C) #if defined(MBEDTLS_AES_C)
if( ( ret = mbedtls_aes_self_test( v ) ) != 0 ) if( mbedtls_aes_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -225,7 +227,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_GCM_C) && defined(MBEDTLS_AES_C) #if defined(MBEDTLS_GCM_C) && defined(MBEDTLS_AES_C)
if( ( ret = mbedtls_gcm_self_test( v ) ) != 0 ) if( mbedtls_gcm_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -233,7 +235,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_CCM_C) && defined(MBEDTLS_AES_C) #if defined(MBEDTLS_CCM_C) && defined(MBEDTLS_AES_C)
if( ( ret = mbedtls_ccm_self_test( v ) ) != 0 ) if( mbedtls_ccm_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -241,7 +243,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_BASE64_C) #if defined(MBEDTLS_BASE64_C)
if( ( ret = mbedtls_base64_self_test( v ) ) != 0 ) if( mbedtls_base64_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -249,7 +251,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_BIGNUM_C) #if defined(MBEDTLS_BIGNUM_C)
if( ( ret = mbedtls_mpi_self_test( v ) ) != 0 ) if( mbedtls_mpi_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -257,7 +259,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_RSA_C) #if defined(MBEDTLS_RSA_C)
if( ( ret = mbedtls_rsa_self_test( v ) ) != 0 ) if( mbedtls_rsa_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -265,7 +267,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_X509_USE_C) #if defined(MBEDTLS_X509_USE_C)
if( ( ret = mbedtls_x509_self_test( v ) ) != 0 ) if( mbedtls_x509_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -273,7 +275,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_XTEA_C) #if defined(MBEDTLS_XTEA_C)
if( ( ret = mbedtls_xtea_self_test( v ) ) != 0 ) if( mbedtls_xtea_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -281,7 +283,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_CAMELLIA_C) #if defined(MBEDTLS_CAMELLIA_C)
if( ( ret = mbedtls_camellia_self_test( v ) ) != 0 ) if( mbedtls_camellia_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -289,7 +291,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_CTR_DRBG_C) #if defined(MBEDTLS_CTR_DRBG_C)
if( ( ret = mbedtls_ctr_drbg_self_test( v ) ) != 0 ) if( mbedtls_ctr_drbg_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -297,7 +299,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_HMAC_DRBG_C) #if defined(MBEDTLS_HMAC_DRBG_C)
if( ( ret = mbedtls_hmac_drbg_self_test( v ) ) != 0 ) if( mbedtls_hmac_drbg_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -305,7 +307,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_ECP_C) #if defined(MBEDTLS_ECP_C)
if( ( ret = mbedtls_ecp_self_test( v ) ) != 0 ) if( mbedtls_ecp_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -313,7 +315,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_ECJPAKE_C) #if defined(MBEDTLS_ECJPAKE_C)
if( ( ret = mbedtls_ecjpake_self_test( v ) ) != 0 ) if( mbedtls_ecjpake_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -321,7 +323,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_DHM_C) #if defined(MBEDTLS_DHM_C)
if( ( ret = mbedtls_dhm_self_test( v ) ) != 0 ) if( mbedtls_dhm_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -329,7 +331,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_ENTROPY_C) #if defined(MBEDTLS_ENTROPY_C)
if( ( ret = mbedtls_entropy_self_test( v ) ) != 0 ) if( mbedtls_entropy_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -337,7 +339,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_PKCS5_C) #if defined(MBEDTLS_PKCS5_C)
if( ( ret = mbedtls_pkcs5_self_test( v ) ) != 0 ) if( mbedtls_pkcs5_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -347,7 +349,7 @@ int main( int argc, char *argv[] )
/* Slow tests last */ /* Slow tests last */
#if defined(MBEDTLS_TIMING_C) #if defined(MBEDTLS_TIMING_C)
if( ( ret = mbedtls_timing_self_test( v ) ) != 0 ) if( mbedtls_timing_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -367,7 +369,7 @@ int main( int argc, char *argv[] )
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
mbedtls_memory_buffer_alloc_free(); mbedtls_memory_buffer_alloc_free();
if( ( ret = mbedtls_memory_buffer_alloc_self_test( v ) ) != 0 ) if( mbedtls_memory_buffer_alloc_self_test( v ) != 0 )
{ {
suites_failed++; suites_failed++;
} }
@ -393,8 +395,8 @@ int main( int argc, char *argv[] )
} }
if( suites_failed > 0) if( suites_failed > 0)
exitcode = EXIT_FAILURE; mbedtls_exit( MBEDTLS_EXIT_FAILURE );
exit( exitcode ); mbedtls_exit( MBEDTLS_EXIT_SUCCESS );
} }

View File

@ -1,5 +1,5 @@
RSAES-V15 Encryption Test Vector Int RSAES-V15 Encryption Test Vector Int
pkcs1_rsaes_v15_encrypt:1024:16:"bbf82f090682ce9c2338ac2b9da871f7368d07eed41043a440d6b6f07454f51fb8dfbaaf035c02ab61ea48ceeb6fcd4876ed520d60e1ec4619719d8a5b8b807fafb8e0a3dfc737723ee6b4b7d93a2584ee6a649d060953748834b2454598394ee0aab12d7b61a51f527a9a41f6c1687fe2537298ca2a8f5946f8e5fd091dbdcb":16:"11":MBEDTLS_MD_SHA1:"d436e99569fd32a7c8a05bbc90d32c49":"aafd12f659cae63489b479e5076ddec2f06cb58f":"28818cb14236ad18f4527e7f1f7633e96cef021bc3234475d7f61e88702b6335b42a352ed3f3267ac7c3e9ba4af17e45096c63eefd8d9a7cb42dfc52fffb2f5b8afb305b46312c2eb50634123b4437a2287ac57b7509d59a583fb741989a49f32625e9267b4641a6607b7303d35c68489db53c8d387b620d0d46a852e72ea43c":0 pkcs1_rsaes_v15_encrypt:1024:16:"bbf82f090682ce9c2338ac2b9da871f7368d07eed41043a440d6b6f07454f51fb8dfbaaf035c02ab61ea48ceeb6fcd4876ed520d60e1ec4619719d8a5b8b807fafb8e0a3dfc737723ee6b4b7d93a2584ee6a649d060953748834b2454598394ee0aab12d7b61a51f527a9a41f6c1687fe2537298ca2a8f5946f8e5fd091dbdcb":16:"11":MBEDTLS_MD_SHA1:"d436e99569fd32a7c8a05bbc90d32c49":"aafd12f659cae63489b479e5076ddec2f06cb58f67c6697351ff4aec29cdbaabf2fbe3467cc254f81be8e78d765a2e63339fc99a66320db73158a35a255d051758e95ed4abb2cdc69bb454110e827441213ddc8770e93ea141e1fc673e017e97eadc6b968f385c2aecb03bfb32":"6c5ebca6116b1e91316613fbb5e93197270a849122d549122d05815e2626f80d20f7f3f038c98295203c0f7f6bb8c3568455c67dec82bca86be86eff43b56b7ba2d15375f9a42454c2a2c709953a6e4a977462e35fd21a9c2fb3c0ad2a370f7655267bf6f04814784982988e663b869fc8588475af860d499e5a6ffdfc2c6bfd":0
RSAES-V15 Decryption Test Vector Int RSAES-V15 Decryption Test Vector Int
pkcs1_rsaes_v15_decrypt:1024:16:"eecfae81b1b9b3c908810b10a1b5600199eb9f44aef4fda493b81a9e3d84f632124ef0236e5d1e3b7e28fae7aa040a2d5b252176459d1f397541ba2a58fb6599":16:"c97fb1f027f453f6341233eaaad1d9353f6c42d08866b1d05a0f2035028b9d869840b41666b42e92ea0da3b43204b5cfce3352524d0416a5a441e700af461503":16:"bbf82f090682ce9c2338ac2b9da871f7368d07eed41043a440d6b6f07454f51fb8dfbaaf035c02ab61ea48ceeb6fcd4876ed520d60e1ec4619719d8a5b8b807fafb8e0a3dfc737723ee6b4b7d93a2584ee6a649d060953748834b2454598394ee0aab12d7b61a51f527a9a41f6c1687fe2537298ca2a8f5946f8e5fd091dbdcb":16:"11":MBEDTLS_MD_SHA1:"d436e99569fd32a7c8a05bbc90d32c49":"aafd12f659cae63489b479e5076ddec2f06cb58f":"28818cb14236ad18f4527e7f1f7633e96cef021bc3234475d7f61e88702b6335b42a352ed3f3267ac7c3e9ba4af17e45096c63eefd8d9a7cb42dfc52fffb2f5b8afb305b46312c2eb50634123b4437a2287ac57b7509d59a583fb741989a49f32625e9267b4641a6607b7303d35c68489db53c8d387b620d0d46a852e72ea43c":0 pkcs1_rsaes_v15_decrypt:1024:16:"eecfae81b1b9b3c908810b10a1b5600199eb9f44aef4fda493b81a9e3d84f632124ef0236e5d1e3b7e28fae7aa040a2d5b252176459d1f397541ba2a58fb6599":16:"c97fb1f027f453f6341233eaaad1d9353f6c42d08866b1d05a0f2035028b9d869840b41666b42e92ea0da3b43204b5cfce3352524d0416a5a441e700af461503":16:"bbf82f090682ce9c2338ac2b9da871f7368d07eed41043a440d6b6f07454f51fb8dfbaaf035c02ab61ea48ceeb6fcd4876ed520d60e1ec4619719d8a5b8b807fafb8e0a3dfc737723ee6b4b7d93a2584ee6a649d060953748834b2454598394ee0aab12d7b61a51f527a9a41f6c1687fe2537298ca2a8f5946f8e5fd091dbdcb":16:"11":MBEDTLS_MD_SHA1:"d436e99569fd32a7c8a05bbc90d32c49":"aafd12f659cae63489b479e5076ddec2f06cb58f":"28818cb14236ad18f4527e7f1f7633e96cef021bc3234475d7f61e88702b6335b42a352ed3f3267ac7c3e9ba4af17e45096c63eefd8d9a7cb42dfc52fffb2f5b8afb305b46312c2eb50634123b4437a2287ac57b7509d59a583fb741989a49f32625e9267b4641a6607b7303d35c68489db53c8d387b620d0d46a852e72ea43c":0

View File

@ -1,6 +1,6 @@
{ {
"name": "mbedtls", "name": "mbedtls",
"version": "2.2.2", "version": "2.3.0",
"description": "The mbed TLS crypto/SSL/TLS library", "description": "The mbed TLS crypto/SSL/TLS library",
"licenses": [ "licenses": [
{ {