1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-30 22:43:08 +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 @@
/*
* Camellia 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>
@ -35,6 +35,12 @@
#include "polarssl/camellia.h"
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#define polarssl_printf printf
#endif
#if !defined(POLARSSL_CAMELLIA_ALT)
/*
@ -889,8 +895,8 @@ int camellia_self_test( int verbose )
v = j & 1;
if( verbose != 0 )
printf( " CAMELLIA-ECB-%3d (%s): ", 128 + u * 64,
(v == CAMELLIA_DECRYPT) ? "dec" : "enc");
polarssl_printf( " CAMELLIA-ECB-%3d (%s): ", 128 + u * 64,
(v == CAMELLIA_DECRYPT) ? "dec" : "enc");
for (i = 0; i < CAMELLIA_TESTS_ECB; i++ ) {
memcpy( key, camellia_test_ecb_key[u][i], 16 + 8 * u);
@ -910,18 +916,18 @@ int camellia_self_test( int verbose )
if( memcmp( buf, dst, 16 ) != 0 )
{
if( verbose != 0 )
printf( "failed\n" );
polarssl_printf( "failed\n" );
return( 1 );
}
}
if( verbose != 0 )
printf( "passed\n" );
polarssl_printf( "passed\n" );
}
if( verbose != 0 )
printf( "\n" );
polarssl_printf( "\n" );
#if defined(POLARSSL_CIPHER_MODE_CBC)
/*
@ -933,8 +939,8 @@ int camellia_self_test( int verbose )
v = j & 1;
if( verbose != 0 )
printf( " CAMELLIA-CBC-%3d (%s): ", 128 + u * 64,
( v == CAMELLIA_DECRYPT ) ? "dec" : "enc" );
polarssl_printf( " CAMELLIA-CBC-%3d (%s): ", 128 + u * 64,
( v == CAMELLIA_DECRYPT ) ? "dec" : "enc" );
memcpy( src, camellia_test_cbc_iv, 16);
memcpy( dst, camellia_test_cbc_iv, 16);
@ -963,19 +969,19 @@ int camellia_self_test( int verbose )
if( memcmp( buf, dst, 16 ) != 0 )
{
if( verbose != 0 )
printf( "failed\n" );
polarssl_printf( "failed\n" );
return( 1 );
}
}
if( verbose != 0 )
printf( "passed\n" );
polarssl_printf( "passed\n" );
}
#endif /* POLARSSL_CIPHER_MODE_CBC */
if( verbose != 0 )
printf( "\n" );
polarssl_printf( "\n" );
#if defined(POLARSSL_CIPHER_MODE_CTR)
/*
@ -987,8 +993,8 @@ int camellia_self_test( int verbose )
v = i & 1;
if( verbose != 0 )
printf( " CAMELLIA-CTR-128 (%s): ",
( v == CAMELLIA_DECRYPT ) ? "dec" : "enc" );
polarssl_printf( " CAMELLIA-CTR-128 (%s): ",
( v == CAMELLIA_DECRYPT ) ? "dec" : "enc" );
memcpy( nonce_counter, camellia_test_ctr_nonce_counter[u], 16 );
memcpy( key, camellia_test_ctr_key[u], 16 );
@ -1006,7 +1012,7 @@ int camellia_self_test( int verbose )
if( memcmp( buf, camellia_test_ctr_pt[u], len ) != 0 )
{
if( verbose != 0 )
printf( "failed\n" );
polarssl_printf( "failed\n" );
return( 1 );
}
@ -1021,18 +1027,18 @@ int camellia_self_test( int verbose )
if( memcmp( buf, camellia_test_ctr_ct[u], len ) != 0 )
{
if( verbose != 0 )
printf( "failed\n" );
polarssl_printf( "failed\n" );
return( 1 );
}
}
if( verbose != 0 )
printf( "passed\n" );
polarssl_printf( "passed\n" );
}
if( verbose != 0 )
printf( "\n" );
polarssl_printf( "\n" );
#endif /* POLARSSL_CIPHER_MODE_CTR */
return ( 0 );