Skip to content

Commit

Permalink
Fix formatting in bignum test functions
Browse files Browse the repository at this point in the history
Signed-off-by: Werner Lewis <[email protected]>
  • Loading branch information
wernerlewis committed Aug 1, 2022
1 parent 3e005f3 commit 3d52e44
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 95 deletions.
81 changes: 36 additions & 45 deletions tests/suites/test_suite_mpi.function
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,8 @@ exit:
/* END_CASE */

/* BEGIN_CASE */
void mbedtls_mpi_write_binary( char * input_X,
data_t * input_A, int output_size,
int result )
void mbedtls_mpi_write_binary( char * input_X, data_t * input_A,
int output_size, int result )
{
mbedtls_mpi X;
unsigned char buf[1000];
Expand Down Expand Up @@ -464,9 +463,8 @@ exit:
/* END_CASE */

/* BEGIN_CASE */
void mbedtls_mpi_write_binary_le( char * input_X,
data_t * input_A, int output_size,
int result )
void mbedtls_mpi_write_binary_le( char * input_X, data_t * input_A,
int output_size, int result )
{
mbedtls_mpi X;
unsigned char buf[1000];
Expand Down Expand Up @@ -496,8 +494,7 @@ exit:
/* END_CASE */

/* BEGIN_CASE depends_on:MBEDTLS_FS_IO */
void mbedtls_mpi_read_file( char * input_file,
data_t * input_A, int result )
void mbedtls_mpi_read_file( char * input_file, data_t * input_A, int result )
{
mbedtls_mpi X;
unsigned char buf[1000];
Expand Down Expand Up @@ -532,8 +529,7 @@ exit:
/* END_CASE */

/* BEGIN_CASE depends_on:MBEDTLS_FS_IO */
void mbedtls_mpi_write_file( char * input_X,
char * output_file )
void mbedtls_mpi_write_file( char * input_X, char * output_file )
{
mbedtls_mpi X, Y;
FILE *file_out, *file_in;
Expand Down Expand Up @@ -626,8 +622,8 @@ exit:
/* END_CASE */

/* BEGIN_CASE */
void mbedtls_mpi_gcd( char * input_X,
char * input_Y, char * input_A )
void mbedtls_mpi_gcd( char * input_X, char * input_Y,
char * input_A )
{
mbedtls_mpi A, X, Y, Z;
mbedtls_mpi_init( &A ); mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y ); mbedtls_mpi_init( &Z );
Expand Down Expand Up @@ -659,8 +655,8 @@ exit:
/* END_CASE */

/* BEGIN_CASE */
void mbedtls_mpi_cmp_mpi( char * input_X,
char * input_Y, int input_A )
void mbedtls_mpi_cmp_mpi( char * input_X, char * input_Y,
int input_A )
{
mbedtls_mpi X, Y;
mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y );
Expand Down Expand Up @@ -700,8 +696,8 @@ exit:
/* END_CASE */

/* BEGIN_CASE */
void mbedtls_mpi_cmp_abs( char * input_X,
char * input_Y, int input_A )
void mbedtls_mpi_cmp_abs( char * input_X, char * input_Y,
int input_A )
{
mbedtls_mpi X, Y;
mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y );
Expand Down Expand Up @@ -860,8 +856,8 @@ exit:
/* END_CASE */

/* BEGIN_CASE */
void mbedtls_mpi_add_mpi( char * input_X,
char * input_Y, char * input_A )
void mbedtls_mpi_add_mpi( char * input_X, char * input_Y,
char * input_A )
{
mbedtls_mpi X, Y, Z, A;
mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y ); mbedtls_mpi_init( &Z ); mbedtls_mpi_init( &A );
Expand Down Expand Up @@ -890,8 +886,7 @@ exit:
/* END_CASE */

/* BEGIN_CASE */
void mbedtls_mpi_add_mpi_inplace( char * input_X,
char * input_A )
void mbedtls_mpi_add_mpi_inplace( char * input_X, char * input_A )
{
mbedtls_mpi X, A;
mbedtls_mpi_init( &X ); mbedtls_mpi_init( &A );
Expand Down Expand Up @@ -920,8 +915,8 @@ exit:


/* BEGIN_CASE */
void mbedtls_mpi_add_abs( char * input_X,
char * input_Y, char * input_A )
void mbedtls_mpi_add_abs( char * input_X, char * input_Y,
char * input_A )
{
mbedtls_mpi X, Y, Z, A;
mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y ); mbedtls_mpi_init( &Z ); mbedtls_mpi_init( &A );
Expand Down Expand Up @@ -968,8 +963,8 @@ exit:
/* END_CASE */

/* BEGIN_CASE */
void mbedtls_mpi_sub_mpi( char * input_X,
char * input_Y, char * input_A )
void mbedtls_mpi_sub_mpi( char * input_X, char * input_Y,
char * input_A )
{
mbedtls_mpi X, Y, Z, A;
mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y ); mbedtls_mpi_init( &Z ); mbedtls_mpi_init( &A );
Expand Down Expand Up @@ -998,9 +993,8 @@ exit:
/* END_CASE */

/* BEGIN_CASE */
void mbedtls_mpi_sub_abs( char * input_X,
char * input_Y, char * input_A,
int sub_result )
void mbedtls_mpi_sub_abs( char * input_X, char * input_Y,
char * input_A, int sub_result )
{
mbedtls_mpi X, Y, Z, A;
int res;
Expand Down Expand Up @@ -1053,8 +1047,8 @@ exit:
/* END_CASE */

/* BEGIN_CASE */
void mbedtls_mpi_mul_mpi( char * input_X,
char * input_Y, char * input_A )
void mbedtls_mpi_mul_mpi( char * input_X, char * input_Y,
char * input_A )
{
mbedtls_mpi X, Y, Z, A;
mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y ); mbedtls_mpi_init( &Z ); mbedtls_mpi_init( &A );
Expand All @@ -1073,8 +1067,7 @@ exit:

/* BEGIN_CASE */
void mbedtls_mpi_mul_int( char * input_X, int input_Y,
char * input_A,
char * result_comparison )
char * input_A, char * result_comparison )
{
mbedtls_mpi X, Z, A;
mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Z ); mbedtls_mpi_init( &A );
Expand All @@ -1096,9 +1089,9 @@ exit:
/* END_CASE */

/* BEGIN_CASE */
void mbedtls_mpi_div_mpi( char * input_X,
char * input_Y, char * input_A,
char * input_B, int div_result )
void mbedtls_mpi_div_mpi( char * input_X, char * input_Y,
char * input_A, char * input_B,
int div_result )
{
mbedtls_mpi X, Y, Q, R, A, B;
int res;
Expand Down Expand Up @@ -1127,8 +1120,8 @@ exit:

/* BEGIN_CASE */
void mbedtls_mpi_div_int( char * input_X, int input_Y,
char * input_A,
char * input_B, int div_result )
char * input_A, char * input_B,
int div_result )
{
mbedtls_mpi X, Q, R, A, B;
int res;
Expand All @@ -1155,9 +1148,8 @@ exit:
/* END_CASE */

/* BEGIN_CASE */
void mbedtls_mpi_mod_mpi( char * input_X,
char * input_Y, char * input_A,
int div_result )
void mbedtls_mpi_mod_mpi( char * input_X, char * input_Y,
char * input_A, int div_result )
{
mbedtls_mpi X, Y, A;
int res;
Expand Down Expand Up @@ -1202,9 +1194,9 @@ exit:
/* END_CASE */

/* BEGIN_CASE */
void mbedtls_mpi_exp_mod( char * input_A,
char * input_E, char * input_N,
char * input_X, int exp_result )
void mbedtls_mpi_exp_mod( char * input_A, char * input_E,
char * input_N, char * input_X,
int exp_result )
{
mbedtls_mpi A, E, N, RR, Z, X;
int res;
Expand Down Expand Up @@ -1283,9 +1275,8 @@ exit:
/* END_CASE */

/* BEGIN_CASE */
void mbedtls_mpi_inv_mod( char * input_X,
char * input_Y, char * input_A,
int div_result )
void mbedtls_mpi_inv_mod( char * input_X, char * input_Y,
char * input_A, int div_result )
{
mbedtls_mpi X, Y, Z, A;
int res;
Expand Down
15 changes: 7 additions & 8 deletions tests/suites/test_suite_pk.function
Original file line number Diff line number Diff line change
Expand Up @@ -645,9 +645,8 @@ void mbedtls_pk_check_pair( char * pub_file, char * prv_file, int ret )

/* BEGIN_CASE depends_on:MBEDTLS_RSA_C */
void pk_rsa_verify_test_vec( data_t * message_str, int digest, int mod,
char * input_N,
char * input_E, data_t * result_str,
int result )
char * input_N, char * input_E,
data_t * result_str, int result )
{
unsigned char hash_result[MBEDTLS_MD_MAX_SIZE];
mbedtls_rsa_context *rsa;
Expand Down Expand Up @@ -694,9 +693,9 @@ exit:
/* BEGIN_CASE depends_on:MBEDTLS_RSA_C */
void pk_rsa_verify_ext_test_vec( data_t * message_str, int digest,
int mod, char * input_N,
char * input_E,
data_t * result_str, int pk_type,
int mgf1_hash_id, int salt_len, int result )
char * input_E, data_t * result_str,
int pk_type, int mgf1_hash_id,
int salt_len, int result )
{
unsigned char hash_result[MBEDTLS_MD_MAX_SIZE];
mbedtls_rsa_context *rsa;
Expand Down Expand Up @@ -1007,8 +1006,8 @@ exit:
/* BEGIN_CASE depends_on:MBEDTLS_RSA_C */
void pk_rsa_decrypt_test_vec( data_t * cipher, int mod,
char * input_P, char * input_Q,
char * input_N,
char * input_E, data_t * clear, int ret )
char * input_N, char * input_E,
data_t * clear, int ret )
{
unsigned char output[256];
mbedtls_test_rnd_pseudo_info rnd_info;
Expand Down
17 changes: 7 additions & 10 deletions tests/suites/test_suite_pkcs1_v15.function
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ exit:
/* END_CASE */

/* BEGIN_CASE */
void pkcs1_rsaes_v15_decrypt( int mod, char * input_P,
char * input_Q,
char * input_N, char * input_E,
int hash, data_t * result_str,
char * seed, data_t * message_str,
int result )
void pkcs1_rsaes_v15_decrypt( int mod, char * input_P, char * input_Q,
char * input_N, char * input_E, int hash,
data_t * result_str, char * seed,
data_t * message_str, int result )
{
unsigned char output[128];
mbedtls_rsa_context ctx;
Expand Down Expand Up @@ -321,10 +319,9 @@ exit:
/* END_CASE */

/* BEGIN_CASE */
void pkcs1_rsassa_v15_verify( int mod, char * input_N,
char * input_E, int digest,
int hash, data_t * message_str, char * salt,
data_t * result_str, int result )
void pkcs1_rsassa_v15_verify( int mod, char * input_N, char * input_E,
int digest, int hash, data_t * message_str,
char * salt, data_t * result_str, int result )
{
unsigned char hash_result[MBEDTLS_MD_MAX_SIZE];
mbedtls_rsa_context ctx;
Expand Down
51 changes: 19 additions & 32 deletions tests/suites/test_suite_rsa.function
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,7 @@ void rsa_init_free( int reinit )
/* BEGIN_CASE */
void mbedtls_rsa_pkcs1_sign( data_t * message_str, int padding_mode,
int digest, int mod, char * input_P,
char * input_Q,
char * input_N, char * input_E,
char * input_Q, char * input_N, char * input_E,
data_t * result_str, int result )
{
unsigned char hash_result[MBEDTLS_MD_MAX_SIZE];
Expand Down Expand Up @@ -601,8 +600,8 @@ exit:
void rsa_pkcs1_sign_raw( data_t * hash_result,
int padding_mode, int mod,
char * input_P, char * input_Q,
char * input_N,
char * input_E, data_t * result_str )
char * input_N, char * input_E,
data_t * result_str )
{
unsigned char output[256];
mbedtls_rsa_context ctx;
Expand Down Expand Up @@ -735,8 +734,7 @@ exit:

/* BEGIN_CASE */
void mbedtls_rsa_pkcs1_encrypt( data_t * message_str, int padding_mode,
int mod, char * input_N,
char * input_E,
int mod, char * input_N, char * input_E,
data_t * result_str, int result )
{
unsigned char output[256];
Expand Down Expand Up @@ -779,8 +777,7 @@ exit:

/* BEGIN_CASE */
void rsa_pkcs1_encrypt_bad_rng( data_t * message_str, int padding_mode,
int mod, char * input_N,
char * input_E,
int mod, char * input_N, char * input_E,
data_t * result_str, int result )
{
unsigned char output[256];
Expand Down Expand Up @@ -820,10 +817,9 @@ exit:
/* BEGIN_CASE */
void mbedtls_rsa_pkcs1_decrypt( data_t * message_str, int padding_mode,
int mod, char * input_P,
char * input_Q,
char * input_N, char * input_E,
int max_output, data_t * result_str,
int result )
char * input_Q, char * input_N,
char * input_E, int max_output,
data_t * result_str, int result )
{
unsigned char output[32];
mbedtls_rsa_context ctx;
Expand Down Expand Up @@ -930,9 +926,8 @@ exit:
/* BEGIN_CASE */
void mbedtls_rsa_private( data_t * message_str, int mod,
char * input_P, char * input_Q,
char * input_N,
char * input_E, data_t * result_str,
int result )
char * input_N, char * input_E,
data_t * result_str, int result )
{
unsigned char output[256];
mbedtls_rsa_context ctx, ctx2; /* Also test mbedtls_rsa_copy() while at it */
Expand Down Expand Up @@ -1014,8 +1009,7 @@ void rsa_check_privkey_null( )
/* END_CASE */

/* BEGIN_CASE */
void mbedtls_rsa_check_pubkey( char * input_N,
char * input_E, int result )
void mbedtls_rsa_check_pubkey( char * input_N, char * input_E, int result )
{
mbedtls_rsa_context ctx;
mbedtls_mpi N, E;
Expand All @@ -1042,13 +1036,10 @@ exit:
/* END_CASE */

/* BEGIN_CASE */
void mbedtls_rsa_check_privkey( int mod, char * input_P,
char * input_Q,
char * input_N, char * input_E,
char * input_D,
char * input_DP,
char * input_DQ,
char * input_QP, int result )
void mbedtls_rsa_check_privkey( int mod, char * input_P, char * input_Q,
char * input_N, char * input_E, char * input_D,
char * input_DP, char * input_DQ, char * input_QP,
int result )
{
mbedtls_rsa_context ctx;

Expand Down Expand Up @@ -1102,14 +1093,10 @@ exit:
/* END_CASE */

/* BEGIN_CASE */
void rsa_check_pubpriv( int mod, char * input_Npub,
char * input_Epub,
char * input_P, char * input_Q,
char * input_N,
char * input_E, char * input_D,
char * input_DP,
char * input_DQ, char * input_QP,
int result )
void rsa_check_pubpriv( int mod, char * input_Npub, char * input_Epub,
char * input_P, char * input_Q, char * input_N,
char * input_E, char * input_D, char * input_DP,
char * input_DQ, char * input_QP, int result )
{
mbedtls_rsa_context pub, prv;

Expand Down

0 comments on commit 3d52e44

Please sign in to comment.