1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-08 17:42:09 +03:00

Library files moved to use platform layer

This commit is contained in:
Paul Bakker
2014-02-01 22:50:26 +01:00
parent 747a83a0f7
commit 7dc4c44267
40 changed files with 447 additions and 323 deletions

View File

@@ -1,7 +1,7 @@
/*
* Elliptic curves over GF(p): generic 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>
@@ -50,9 +50,10 @@
#include "polarssl/ecp.h"
#if defined(POLARSSL_MEMORY_C)
#include "polarssl/memory.h"
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#define polarssl_printf printf
#define polarssl_malloc malloc
#define polarssl_free free
#endif
@@ -1904,7 +1905,7 @@ int ecp_self_test( int verbose )
#endif
if( verbose != 0 )
printf( " ECP test #1 (constant op_count, base point G): " );
polarssl_printf( " ECP test #1 (constant op_count, base point G): " );
/* Do a dummy multiplication first to trigger precomputation */
MPI_CHK( mpi_lset( &m, 2 ) );
@@ -1933,7 +1934,7 @@ int ecp_self_test( int verbose )
mul_count != mul_c_prev )
{
if( verbose != 0 )
printf( "failed (%u)\n", (unsigned int) i );
polarssl_printf( "failed (%u)\n", (unsigned int) i );
ret = 1;
goto cleanup;
@@ -1941,10 +1942,10 @@ int ecp_self_test( int verbose )
}
if( verbose != 0 )
printf( "passed\n" );
polarssl_printf( "passed\n" );
if( verbose != 0 )
printf( " ECP test #2 (constant op_count, other point): " );
polarssl_printf( " ECP test #2 (constant op_count, other point): " );
/* We computed P = 2G last time, use it */
add_count = 0;
@@ -1970,7 +1971,7 @@ int ecp_self_test( int verbose )
mul_count != mul_c_prev )
{
if( verbose != 0 )
printf( "failed (%u)\n", (unsigned int) i );
polarssl_printf( "failed (%u)\n", (unsigned int) i );
ret = 1;
goto cleanup;
@@ -1978,12 +1979,12 @@ int ecp_self_test( int verbose )
}
if( verbose != 0 )
printf( "passed\n" );
polarssl_printf( "passed\n" );
cleanup:
if( ret < 0 && verbose != 0 )
printf( "Unexpected error, return code = %08X\n", ret );
polarssl_printf( "Unexpected error, return code = %08X\n", ret );
ecp_group_free( &grp );
ecp_point_free( &R );
@@ -1991,7 +1992,7 @@ cleanup:
mpi_free( &m );
if( verbose != 0 )
printf( "\n" );
polarssl_printf( "\n" );
return( ret );
}