mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-05-01 17:46:31 +00:00
- Updated to new rsa_init, rsa_gen_key prototypes
This commit is contained in:
parent
ebcef6d4e8
commit
a802e1ac10
|
@ -81,7 +81,7 @@ int main( void )
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
rsa_init( &rsa, RSA_PKCS_V15, 0, NULL, NULL );
|
rsa_init( &rsa, RSA_PKCS_V15, 0 );
|
||||||
|
|
||||||
if( ( ret = mpi_read_file( &rsa.N, 16, f ) ) != 0 ||
|
if( ( ret = mpi_read_file( &rsa.N, 16, f ) ) != 0 ||
|
||||||
( ret = mpi_read_file( &rsa.E, 16, f ) ) != 0 )
|
( ret = mpi_read_file( &rsa.E, 16, f ) ) != 0 )
|
||||||
|
|
|
@ -82,7 +82,7 @@ int main( void )
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
rsa_init( &rsa, RSA_PKCS_V15, 0, NULL, NULL );
|
rsa_init( &rsa, RSA_PKCS_V15, 0 );
|
||||||
|
|
||||||
if( ( ret = mpi_read_file( &rsa.N , 16, f ) ) != 0 ||
|
if( ( ret = mpi_read_file( &rsa.N , 16, f ) ) != 0 ||
|
||||||
( ret = mpi_read_file( &rsa.E , 16, f ) ) != 0 ||
|
( ret = mpi_read_file( &rsa.E , 16, f ) ) != 0 ||
|
||||||
|
|
|
@ -53,9 +53,9 @@ int main( void )
|
||||||
printf( " ok\n . Generating the RSA key [ %d-bit ]...", KEY_SIZE );
|
printf( " ok\n . Generating the RSA key [ %d-bit ]...", KEY_SIZE );
|
||||||
fflush( stdout );
|
fflush( stdout );
|
||||||
|
|
||||||
rsa_init( &rsa, RSA_PKCS_V15, 0, havege_rand, &hs );
|
rsa_init( &rsa, RSA_PKCS_V15, 0 );
|
||||||
|
|
||||||
if( ( ret = rsa_gen_key( &rsa, KEY_SIZE, EXPONENT ) ) != 0 )
|
if( ( ret = rsa_gen_key( &rsa, havege_rand, &hs, KEY_SIZE, EXPONENT ) ) != 0 )
|
||||||
{
|
{
|
||||||
printf( " failed\n ! rsa_gen_key returned %d\n\n", ret );
|
printf( " failed\n ! rsa_gen_key returned %d\n\n", ret );
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
|
@ -65,7 +65,7 @@ int main( int argc, char *argv[] )
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
rsa_init( &rsa, RSA_PKCS_V15, 0, NULL, NULL );
|
rsa_init( &rsa, RSA_PKCS_V15, 0 );
|
||||||
|
|
||||||
if( ( ret = mpi_read_file( &rsa.N , 16, f ) ) != 0 ||
|
if( ( ret = mpi_read_file( &rsa.N , 16, f ) ) != 0 ||
|
||||||
( ret = mpi_read_file( &rsa.E , 16, f ) ) != 0 ||
|
( ret = mpi_read_file( &rsa.E , 16, f ) ) != 0 ||
|
||||||
|
|
|
@ -63,7 +63,7 @@ int main( int argc, char *argv[] )
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
rsa_init( &rsa, RSA_PKCS_V15, 0, NULL, NULL );
|
rsa_init( &rsa, RSA_PKCS_V15, 0 );
|
||||||
|
|
||||||
if( ( ret = mpi_read_file( &rsa.N, 16, f ) ) != 0 ||
|
if( ( ret = mpi_read_file( &rsa.N, 16, f ) ) != 0 ||
|
||||||
( ret = mpi_read_file( &rsa.E, 16, f ) ) != 0 )
|
( ret = mpi_read_file( &rsa.E, 16, f ) ) != 0 )
|
||||||
|
|
|
@ -264,8 +264,8 @@ int main( void )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(POLARSSL_RSA_C)
|
#if defined(POLARSSL_RSA_C)
|
||||||
rsa_init( &rsa, RSA_PKCS_V15, 0, myrand, NULL );
|
rsa_init( &rsa, RSA_PKCS_V15, 0 );
|
||||||
rsa_gen_key( &rsa, 1024, 65537 );
|
rsa_gen_key( &rsa, myrand, NULL, 1024, 65537 );
|
||||||
|
|
||||||
printf( " RSA-1024 : " );
|
printf( " RSA-1024 : " );
|
||||||
fflush( stdout );
|
fflush( stdout );
|
||||||
|
@ -293,8 +293,8 @@ int main( void )
|
||||||
|
|
||||||
rsa_free( &rsa );
|
rsa_free( &rsa );
|
||||||
|
|
||||||
rsa_init( &rsa, RSA_PKCS_V15, 0, myrand, NULL );
|
rsa_init( &rsa, RSA_PKCS_V15, 0 );
|
||||||
rsa_gen_key( &rsa, 2048, 65537 );
|
rsa_gen_key( &rsa, myrand, NULL, 2048, 65537 );
|
||||||
|
|
||||||
printf( " RSA-2048 : " );
|
printf( " RSA-2048 : " );
|
||||||
fflush( stdout );
|
fflush( stdout );
|
||||||
|
@ -322,8 +322,8 @@ int main( void )
|
||||||
|
|
||||||
rsa_free( &rsa );
|
rsa_free( &rsa );
|
||||||
|
|
||||||
rsa_init( &rsa, RSA_PKCS_V15, 0, myrand, NULL );
|
rsa_init( &rsa, RSA_PKCS_V15, 0 );
|
||||||
rsa_gen_key( &rsa, 4096, 65537 );
|
rsa_gen_key( &rsa, myrand, NULL, 4096, 65537 );
|
||||||
|
|
||||||
printf( " RSA-4096 : " );
|
printf( " RSA-4096 : " );
|
||||||
fflush( stdout );
|
fflush( stdout );
|
||||||
|
|
|
@ -516,7 +516,7 @@ rsa_gen_key:nrbits:exponent:result
|
||||||
havege_init( &hs );
|
havege_init( &hs );
|
||||||
rsa_init( &ctx, 0, 0 );
|
rsa_init( &ctx, 0, 0 );
|
||||||
|
|
||||||
TEST_ASSERT( rsa_gen_key( &ctx, &havege_rand, &hs, {nrbits}, {exponent} ) == {result} );
|
TEST_ASSERT( rsa_gen_key( &ctx, havege_rand, &hs, {nrbits}, {exponent} ) == {result} );
|
||||||
if( {result} == 0 )
|
if( {result} == 0 )
|
||||||
{
|
{
|
||||||
TEST_ASSERT( rsa_check_privkey( &ctx ) == 0 );
|
TEST_ASSERT( rsa_check_privkey( &ctx ) == 0 );
|
||||||
|
|
Loading…
Reference in a new issue