Fix formatting in bignum test functions

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
This commit is contained in:
Werner Lewis 2022-07-06 13:03:36 +01:00
parent f65a327111
commit efda01fb8c
4 changed files with 73 additions and 99 deletions

View file

@ -217,9 +217,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];
@ -249,9 +248,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];
@ -281,8 +279,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];
@ -317,8 +314,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;
@ -411,8 +407,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 );
@ -444,8 +440,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 );
@ -485,8 +481,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 );
@ -645,8 +641,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 );
@ -675,8 +671,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 );
@ -705,8 +700,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 );
@ -753,8 +748,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 );
@ -783,9 +778,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;
@ -838,8 +832,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 );
@ -858,8 +852,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 );
@ -881,9 +874,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;
@ -912,8 +905,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;
@ -940,9 +933,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;
@ -987,9 +979,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;
@ -1068,9 +1060,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;

View file

@ -478,9 +478,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 )
{
mbedtls_rsa_context *rsa;
mbedtls_pk_context pk;
@ -524,9 +523,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 sig_len,
char * input_E, data_t * result_str,
int pk_type, int mgf1_hash_id,
int salt_len, int sig_len,
int result )
{
mbedtls_rsa_context *rsa;
@ -797,8 +796,8 @@ exit:
/* BEGIN_CASE depends_on:MBEDTLS_RSA_C */
void pk_rsa_encrypt_decrypt_test( data_t * message, int mod,
char * input_P, char * input_Q,
char * input_N,
char * input_E, int ret )
char * input_N, char * input_E,
int ret )
{
unsigned char output[300], result[300];
mbedtls_test_rnd_pseudo_info rnd_info;
@ -874,8 +873,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;
@ -931,8 +930,8 @@ exit:
/* BEGIN_CASE depends_on:MBEDTLS_RSA_C:MBEDTLS_USE_PSA_CRYPTO */
void pk_wrap_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;

View file

@ -59,12 +59,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;
@ -317,10 +315,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 )
{
mbedtls_rsa_context ctx;
mbedtls_mpi N, E;

View file

@ -74,8 +74,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 output[256];
@ -153,8 +152,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;
@ -234,8 +233,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];
@ -280,8 +278,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];
@ -323,10 +320,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;
@ -435,9 +431,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 */
@ -519,8 +514,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;
@ -547,13 +541,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;
@ -607,14 +598,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;