mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 19:14:21 +01:00
- Updated test to conform to new prototype of rsa_init, rsa_pkcs1_encrypt and rsa_gen_key
This commit is contained in:
parent
21eb2802fe
commit
ebcef6d4e8
@ -38,7 +38,7 @@ rsa_pkcs1_sign:message_hex_string:padding_mode:digest:mod:radix_P:input_P:radix_
|
||||
int msg_len;
|
||||
|
||||
mpi_init( &P1, &Q1, &H, &G, NULL );
|
||||
rsa_init( &ctx, {padding_mode}, 0, &myrand, NULL );
|
||||
rsa_init( &ctx, {padding_mode}, 0 );
|
||||
|
||||
memset( message_str, 0x00, 1000 );
|
||||
memset( hash_result, 0x00, 1000 );
|
||||
@ -123,7 +123,7 @@ rsa_pkcs1_verify:message_hex_string:padding_mode:digest:mod:radix_N:input_N:radi
|
||||
rsa_context ctx;
|
||||
int msg_len;
|
||||
|
||||
rsa_init( &ctx, {padding_mode}, 0, &myrand, NULL );
|
||||
rsa_init( &ctx, {padding_mode}, 0 );
|
||||
memset( message_str, 0x00, 1000 );
|
||||
memset( hash_result, 0x00, 1000 );
|
||||
memset( result_str, 0x00, 1000 );
|
||||
@ -194,7 +194,7 @@ rsa_pkcs1_sign_raw:message_hex_string:hash_result_string:padding_mode:mod:radix_
|
||||
int msg_len, hash_len;
|
||||
|
||||
mpi_init( &P1, &Q1, &H, &G, NULL );
|
||||
rsa_init( &ctx, {padding_mode}, 0, &myrand, NULL );
|
||||
rsa_init( &ctx, {padding_mode}, 0 );
|
||||
|
||||
memset( message_str, 0x00, 1000 );
|
||||
memset( hash_result, 0x00, 1000 );
|
||||
@ -238,7 +238,7 @@ rsa_pkcs1_verify_raw:message_hex_string:hash_result_string:padding_mode:mod:radi
|
||||
rsa_context ctx;
|
||||
int msg_len, hash_len;
|
||||
|
||||
rsa_init( &ctx, {padding_mode}, 0, &myrand, NULL );
|
||||
rsa_init( &ctx, {padding_mode}, 0 );
|
||||
memset( message_str, 0x00, 1000 );
|
||||
memset( hash_result, 0x00, 1000 );
|
||||
memset( result_str, 0x00, 1000 );
|
||||
@ -266,7 +266,7 @@ rsa_pkcs1_encrypt:message_hex_string:padding_mode:mod:radix_N:input_N:radix_E:in
|
||||
rsa_context ctx;
|
||||
int msg_len;
|
||||
|
||||
rsa_init( &ctx, {padding_mode}, 0, &myrand, NULL );
|
||||
rsa_init( &ctx, {padding_mode}, 0 );
|
||||
memset( message_str, 0x00, 1000 );
|
||||
memset( output, 0x00, 1000 );
|
||||
memset( output_str, 0x00, 1000 );
|
||||
@ -279,7 +279,7 @@ rsa_pkcs1_encrypt:message_hex_string:padding_mode:mod:radix_N:input_N:radix_E:in
|
||||
|
||||
msg_len = unhexify( message_str, {message_hex_string} );
|
||||
|
||||
TEST_ASSERT( rsa_pkcs1_encrypt( &ctx, RSA_PUBLIC, msg_len, message_str, output ) == {result} );
|
||||
TEST_ASSERT( rsa_pkcs1_encrypt( &ctx, &myrand, NULL, RSA_PUBLIC, msg_len, message_str, output ) == {result} );
|
||||
if( {result} == 0 )
|
||||
{
|
||||
hexify( output_str, output, ctx.len );
|
||||
@ -298,7 +298,7 @@ rsa_pkcs1_encrypt_bad_rng:message_hex_string:padding_mode:mod:radix_N:input_N:ra
|
||||
rsa_context ctx;
|
||||
int msg_len;
|
||||
|
||||
rsa_init( &ctx, {padding_mode}, 0, &badrand, NULL );
|
||||
rsa_init( &ctx, {padding_mode}, 0 );
|
||||
memset( message_str, 0x00, 1000 );
|
||||
memset( output, 0x00, 1000 );
|
||||
memset( output_str, 0x00, 1000 );
|
||||
@ -311,7 +311,7 @@ rsa_pkcs1_encrypt_bad_rng:message_hex_string:padding_mode:mod:radix_N:input_N:ra
|
||||
|
||||
msg_len = unhexify( message_str, {message_hex_string} );
|
||||
|
||||
TEST_ASSERT( rsa_pkcs1_encrypt( &ctx, RSA_PUBLIC, msg_len, message_str, output ) == {result} );
|
||||
TEST_ASSERT( rsa_pkcs1_encrypt( &ctx, &badrand, NULL, RSA_PUBLIC, msg_len, message_str, output ) == {result} );
|
||||
if( {result} == 0 )
|
||||
{
|
||||
hexify( output_str, output, ctx.len );
|
||||
@ -332,7 +332,7 @@ rsa_pkcs1_decrypt:message_hex_string:padding_mode:mod:radix_P:input_P:radix_Q:in
|
||||
int output_len;
|
||||
|
||||
mpi_init( &P1, &Q1, &H, &G, NULL );
|
||||
rsa_init( &ctx, {padding_mode}, 0, &myrand, NULL );
|
||||
rsa_init( &ctx, {padding_mode}, 0 );
|
||||
|
||||
memset( message_str, 0x00, 1000 );
|
||||
memset( output, 0x00, 1000 );
|
||||
@ -376,7 +376,7 @@ rsa_public:message_hex_string:mod:radix_N:input_N:radix_E:input_E:result_hex_str
|
||||
unsigned char output_str[1000];
|
||||
rsa_context ctx;
|
||||
|
||||
rsa_init( &ctx, RSA_PKCS_V15, 0, &myrand, NULL );
|
||||
rsa_init( &ctx, RSA_PKCS_V15, 0 );
|
||||
memset( message_str, 0x00, 1000 );
|
||||
memset( output, 0x00, 1000 );
|
||||
memset( output_str, 0x00, 1000 );
|
||||
@ -409,7 +409,7 @@ rsa_private:message_hex_string:mod:radix_P:input_P:radix_Q:input_Q:radix_N:input
|
||||
mpi P1, Q1, H, G;
|
||||
|
||||
mpi_init( &P1, &Q1, &H, &G, NULL );
|
||||
rsa_init( &ctx, RSA_PKCS_V15, 0, &myrand, NULL );
|
||||
rsa_init( &ctx, RSA_PKCS_V15, 0 );
|
||||
|
||||
memset( message_str, 0x00, 1000 );
|
||||
memset( output, 0x00, 1000 );
|
||||
@ -459,7 +459,7 @@ rsa_check_pubkey:radix_N:input_N:radix_E:input_E:result
|
||||
{
|
||||
rsa_context ctx;
|
||||
|
||||
rsa_init( &ctx, RSA_PKCS_V15, 0, &myrand, NULL );
|
||||
rsa_init( &ctx, RSA_PKCS_V15, 0 );
|
||||
|
||||
if( strlen( {input_N} ) )
|
||||
{
|
||||
@ -479,7 +479,7 @@ rsa_check_privkey:mod:radix_P:input_P:radix_Q:input_Q:radix_N:input_N:radix_E:in
|
||||
{
|
||||
rsa_context ctx;
|
||||
|
||||
rsa_init( &ctx, RSA_PKCS_V15, 0, &myrand, NULL );
|
||||
rsa_init( &ctx, RSA_PKCS_V15, 0 );
|
||||
|
||||
ctx.len = {mod} / 8;
|
||||
if( strlen( {input_P} ) )
|
||||
@ -514,9 +514,9 @@ rsa_gen_key:nrbits:exponent:result
|
||||
havege_state hs;
|
||||
|
||||
havege_init( &hs );
|
||||
rsa_init( &ctx, 0, 0, havege_rand, &hs );
|
||||
rsa_init( &ctx, 0, 0 );
|
||||
|
||||
TEST_ASSERT( rsa_gen_key( &ctx, {nrbits}, {exponent} ) == {result} );
|
||||
TEST_ASSERT( rsa_gen_key( &ctx, &havege_rand, &hs, {nrbits}, {exponent} ) == {result} );
|
||||
if( {result} == 0 )
|
||||
{
|
||||
TEST_ASSERT( rsa_check_privkey( &ctx ) == 0 );
|
||||
|
Loading…
Reference in New Issue
Block a user