1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-01 10:06:53 +03:00

Test and document EC blinding overhead

This commit is contained in:
Manuel Pégourié-Gonnard
2013-09-07 11:52:27 +02:00
parent cac5f7d737
commit 337b29c334
2 changed files with 28 additions and 3 deletions

View File

@ -28,6 +28,29 @@ int main( int argc, char *argv[] )
#else
static int myrand( void *rng_state, unsigned char *output, size_t len )
{
size_t use_len;
int rnd;
if( rng_state != NULL )
rng_state = NULL;
while( len > 0 )
{
use_len = len;
if( use_len > sizeof(int) )
use_len = sizeof(int);
rnd = rand();
memcpy( output, &rnd, use_len );
output += use_len;
len -= use_len;
}
return( 0 );
}
static void dhm_bench_case( const char *s, const char *p,
const char *g, const char *x )
{
@ -161,7 +184,7 @@ static void ecp_bench_case( size_t dp, const char *s, const char *m )
set_alarm( 3 );
for( i = 1; ! alarmed; i++ )
ecp_mul( &grp, &R, &M, &grp.G, NULL, NULL );
ecp_mul( &grp, &R, &M, &grp.G, myrand, NULL );
printf( "%9lu mul/s\n", i / 3 );