From 083745e09739d06ff13975bdfc1721fe4af9205a Mon Sep 17 00:00:00 2001 From: Przemek Stekiel Date: Thu, 23 Feb 2023 17:28:23 +0100 Subject: [PATCH] Fix code style Signed-off-by: Przemek Stekiel --- library/psa_crypto.c | 12 ++++++------ library/psa_crypto_pake.c | 4 ++-- tests/include/test/drivers/pake.h | 3 ++- tests/src/drivers/test_driver_pake.c | 2 +- ...t_suite_psa_crypto_driver_wrappers.function | 18 ++++++++++++------ 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 3823f7ad7..4406fcc3b 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -7609,9 +7609,9 @@ static psa_status_t psa_jpake_output_epilogue( &operation->computation_stage.jpake; if ((computation_stage->state == PSA_PAKE_OUTPUT_X1_X2 && - computation_stage->sequence == PSA_PAKE_X2_STEP_ZK_PROOF) || + computation_stage->sequence == PSA_PAKE_X2_STEP_ZK_PROOF) || (computation_stage->state == PSA_PAKE_OUTPUT_X2S && - computation_stage->sequence == PSA_PAKE_X1_STEP_ZK_PROOF)) { + computation_stage->sequence == PSA_PAKE_X1_STEP_ZK_PROOF)) { computation_stage->state = PSA_PAKE_STATE_READY; computation_stage->output_step++; computation_stage->sequence = PSA_PAKE_SEQ_INVALID; @@ -7791,9 +7791,9 @@ static psa_status_t psa_jpake_input_epilogue( &operation->computation_stage.jpake; if ((computation_stage->state == PSA_PAKE_INPUT_X1_X2 && - computation_stage->sequence == PSA_PAKE_X2_STEP_ZK_PROOF) || + computation_stage->sequence == PSA_PAKE_X2_STEP_ZK_PROOF) || (computation_stage->state == PSA_PAKE_INPUT_X4S && - computation_stage->sequence == PSA_PAKE_X1_STEP_ZK_PROOF)) { + computation_stage->sequence == PSA_PAKE_X1_STEP_ZK_PROOF)) { computation_stage->state = PSA_PAKE_STATE_READY; computation_stage->input_step++; computation_stage->sequence = PSA_PAKE_SEQ_INVALID; @@ -7848,7 +7848,7 @@ psa_status_t psa_pake_input( #if defined(MBEDTLS_PSA_BUILTIN_ALG_JPAKE) status = psa_driver_wrapper_pake_input(operation, convert_jpake_computation_stage_to_driver_step( - &operation->computation_stage.jpake), + &operation->computation_stage.jpake), input, input_length); #else @@ -7897,7 +7897,7 @@ psa_status_t psa_pake_get_implicit_key( #if defined(MBEDTLS_PSA_BUILTIN_ALG_JPAKE) if (operation->alg == PSA_ALG_JPAKE) { psa_jpake_computation_stage_t *computation_stage = - &operation->computation_stage.jpake; + &operation->computation_stage.jpake; if (computation_stage->input_step != PSA_PAKE_STEP_DERIVE || computation_stage->output_step != PSA_PAKE_STEP_DERIVE) { status = PSA_ERROR_BAD_STATE; diff --git a/library/psa_crypto_pake.c b/library/psa_crypto_pake.c index 929db5919..062d0bb68 100644 --- a/library/psa_crypto_pake.c +++ b/library/psa_crypto_pake.c @@ -169,7 +169,7 @@ static psa_status_t psa_pake_ecjpake_setup(mbedtls_psa_pake_operation_t *operati { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; mbedtls_ecjpake_role role = (operation->role == PSA_PAKE_ROLE_CLIENT) ? - MBEDTLS_ECJPAKE_CLIENT : MBEDTLS_ECJPAKE_SERVER; + MBEDTLS_ECJPAKE_CLIENT : MBEDTLS_ECJPAKE_SERVER; mbedtls_ecjpake_init(&operation->ctx.pake); @@ -220,7 +220,7 @@ psa_status_t mbedtls_psa_pake_setup(mbedtls_psa_pake_operation_t *operation, } status = psa_crypto_driver_pake_get_password(inputs, operation->password, - password_len, &actual_password_len); + password_len, &actual_password_len); if (status != PSA_SUCCESS) { goto error; } diff --git a/tests/include/test/drivers/pake.h b/tests/include/test/drivers/pake.h index 99ca8f275..331ee49da 100644 --- a/tests/include/test/drivers/pake.h +++ b/tests/include/test/drivers/pake.h @@ -48,7 +48,8 @@ typedef struct { size_t forced_output_length; } mbedtls_test_driver_pake_hooks_t; -#define MBEDTLS_TEST_DRIVER_PAKE_INIT { PSA_SUCCESS, PSA_SUCCESS, {0, 0, 0, 0, 0, 0}, PSA_SUCCESS, NULL, 0 } +#define MBEDTLS_TEST_DRIVER_PAKE_INIT { PSA_SUCCESS, PSA_SUCCESS, { 0, 0, 0, 0, 0, 0 }, PSA_SUCCESS, \ + NULL, 0 } static inline mbedtls_test_driver_pake_hooks_t mbedtls_test_driver_pake_hooks_init(void) { diff --git a/tests/src/drivers/test_driver_pake.c b/tests/src/drivers/test_driver_pake.c index 7eafe14d8..9c7248308 100644 --- a/tests/src/drivers/test_driver_pake.c +++ b/tests/src/drivers/test_driver_pake.c @@ -185,7 +185,7 @@ psa_status_t mbedtls_test_transparent_pake_abort( mbedtls_test_driver_pake_hooks.hits.abort++; #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \ - defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_PAKE) + defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_PAKE) mbedtls_test_driver_pake_hooks.driver_status = libtestdriver1_mbedtls_psa_pake_abort( operation); diff --git a/tests/suites/test_suite_psa_crypto_driver_wrappers.function b/tests/suites/test_suite_psa_crypto_driver_wrappers.function index b0aac5357..a32da21ce 100644 --- a/tests/suites/test_suite_psa_crypto_driver_wrappers.function +++ b/tests/suites/test_suite_psa_crypto_driver_wrappers.function @@ -3050,7 +3050,8 @@ void pake_operations(data_t *pw_data, int forced_status_setup_arg, int forced_st /* --- psa_pake_input (driver: setup, input) --- */ mbedtls_test_driver_pake_hooks.forced_setup_status = forced_status_setup; mbedtls_test_driver_pake_hooks.forced_status = forced_status; - memset(&mbedtls_test_driver_pake_hooks.hits, 0, sizeof(mbedtls_test_driver_pake_hooks.hits)); + memset(&mbedtls_test_driver_pake_hooks.hits, 0, + sizeof(mbedtls_test_driver_pake_hooks.hits)); TEST_EQUAL(psa_pake_input(&operation, PSA_PAKE_STEP_KEY_SHARE, input_buffer, size_key_share), expected_status); @@ -3062,7 +3063,8 @@ void pake_operations(data_t *pw_data, int forced_status_setup_arg, int forced_st /* --- psa_pake_output (driver: setup, output) --- */ mbedtls_test_driver_pake_hooks.forced_setup_status = forced_status_setup; mbedtls_test_driver_pake_hooks.forced_status = forced_status; - memset(&mbedtls_test_driver_pake_hooks.hits, 0, sizeof(mbedtls_test_driver_pake_hooks.hits)); + memset(&mbedtls_test_driver_pake_hooks.hits, 0, + sizeof(mbedtls_test_driver_pake_hooks.hits)); TEST_EQUAL(psa_pake_output(&operation, PSA_PAKE_STEP_KEY_SHARE, output_buffer, output_size, &output_len), expected_status); @@ -3074,7 +3076,8 @@ void pake_operations(data_t *pw_data, int forced_status_setup_arg, int forced_st /* --- psa_pake_input (driver: setup, input, (abort)) --- */ mbedtls_test_driver_pake_hooks.forced_setup_status = forced_status_setup; mbedtls_test_driver_pake_hooks.forced_status = forced_status; - memset(&mbedtls_test_driver_pake_hooks.hits, 0, sizeof(mbedtls_test_driver_pake_hooks.hits)); + memset(&mbedtls_test_driver_pake_hooks.hits, 0, + sizeof(mbedtls_test_driver_pake_hooks.hits)); TEST_EQUAL(psa_pake_input(&operation, PSA_PAKE_STEP_KEY_SHARE, input_buffer, size_key_share), expected_status); @@ -3088,7 +3091,8 @@ void pake_operations(data_t *pw_data, int forced_status_setup_arg, int forced_st /* --- psa_pake_output (driver: setup, output, (abort)) --- */ mbedtls_test_driver_pake_hooks.forced_setup_status = forced_status_setup; mbedtls_test_driver_pake_hooks.forced_status = forced_status; - memset(&mbedtls_test_driver_pake_hooks.hits, 0, sizeof(mbedtls_test_driver_pake_hooks.hits)); + memset(&mbedtls_test_driver_pake_hooks.hits, 0, + sizeof(mbedtls_test_driver_pake_hooks.hits)); if (forced_output->len > 0) { mbedtls_test_driver_pake_hooks.forced_output = forced_output->x; mbedtls_test_driver_pake_hooks.forced_output_length = forced_output->len; @@ -3123,7 +3127,8 @@ void pake_operations(data_t *pw_data, int forced_status_setup_arg, int forced_st /* --- psa_pake_get_implicit_key --- */ mbedtls_test_driver_pake_hooks.forced_status = forced_status; - memset(&mbedtls_test_driver_pake_hooks.hits, 0, sizeof(mbedtls_test_driver_pake_hooks.hits)); + memset(&mbedtls_test_driver_pake_hooks.hits, 0, + sizeof(mbedtls_test_driver_pake_hooks.hits)); TEST_EQUAL(psa_pake_get_implicit_key(&operation, &implicit_key), expected_status); TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total, 2); @@ -3140,7 +3145,8 @@ void pake_operations(data_t *pw_data, int forced_status_setup_arg, int forced_st /* --- psa_pake_abort --- */ mbedtls_test_driver_pake_hooks.forced_status = forced_status; - memset(&mbedtls_test_driver_pake_hooks.hits, 0, sizeof(mbedtls_test_driver_pake_hooks.hits)); + memset(&mbedtls_test_driver_pake_hooks.hits, 0, + sizeof(mbedtls_test_driver_pake_hooks.hits)); TEST_EQUAL(psa_pake_abort(&operation), expected_status); TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total, 1); TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.abort, 1);