Rename struct member mode to io_mode

Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
David Horstmann 2023-06-14 15:48:21 +01:00
parent 00ad6bfabe
commit 024e5c5f2e
2 changed files with 9 additions and 9 deletions

View File

@ -2043,7 +2043,7 @@ struct psa_jpake_computation_stage_s {
/* The J-PAKE round we are currently on */ /* The J-PAKE round we are currently on */
psa_jpake_round_t MBEDTLS_PRIVATE(round); psa_jpake_round_t MBEDTLS_PRIVATE(round);
/* The 'mode' we are currently in (inputting or outputting) */ /* The 'mode' we are currently in (inputting or outputting) */
psa_jpake_io_mode_t MBEDTLS_PRIVATE(mode); psa_jpake_io_mode_t MBEDTLS_PRIVATE(io_mode);
/* The number of inputs so far this round */ /* The number of inputs so far this round */
uint8_t MBEDTLS_PRIVATE(inputs); uint8_t MBEDTLS_PRIVATE(inputs);
/* The number of outputs so far this round */ /* The number of outputs so far this round */

View File

@ -7768,7 +7768,7 @@ psa_status_t psa_pake_setup(
&operation->computation_stage.jpake; &operation->computation_stage.jpake;
computation_stage->round = PSA_JPAKE_FIRST; computation_stage->round = PSA_JPAKE_FIRST;
computation_stage->mode = PSA_JPAKE_INPUT; computation_stage->io_mode = PSA_JPAKE_INPUT;
computation_stage->inputs = 0; computation_stage->inputs = 0;
computation_stage->outputs = 0; computation_stage->outputs = 0;
computation_stage->step = PSA_PAKE_STEP_KEY_SHARE; computation_stage->step = PSA_PAKE_STEP_KEY_SHARE;
@ -7947,7 +7947,7 @@ static psa_crypto_driver_pake_step_t convert_jpake_computation_stage_to_driver_s
{ {
if (stage->round == PSA_JPAKE_FIRST) { if (stage->round == PSA_JPAKE_FIRST) {
int is_x1; int is_x1;
if (stage->mode == PSA_JPAKE_OUTPUT) { if (stage->io_mode == PSA_JPAKE_OUTPUT) {
is_x1 = (stage->outputs < 1); is_x1 = (stage->outputs < 1);
} else { } else {
is_x1 = (stage->inputs < 1); is_x1 = (stage->inputs < 1);
@ -7977,7 +7977,7 @@ static psa_crypto_driver_pake_step_t convert_jpake_computation_stage_to_driver_s
} }
} }
} else if (stage->round == PSA_JPAKE_SECOND) { } else if (stage->round == PSA_JPAKE_SECOND) {
if (stage->mode == PSA_JPAKE_OUTPUT) { if (stage->io_mode == PSA_JPAKE_OUTPUT) {
switch (stage->step) { switch (stage->step) {
case PSA_PAKE_STEP_KEY_SHARE: case PSA_PAKE_STEP_KEY_SHARE:
return PSA_JPAKE_X2S_STEP_KEY_SHARE; return PSA_JPAKE_X2S_STEP_KEY_SHARE;
@ -8043,7 +8043,7 @@ static psa_status_t psa_pake_complete_inputs(
psa_jpake_computation_stage_t *computation_stage = psa_jpake_computation_stage_t *computation_stage =
&operation->computation_stage.jpake; &operation->computation_stage.jpake;
computation_stage->round = PSA_JPAKE_FIRST; computation_stage->round = PSA_JPAKE_FIRST;
computation_stage->mode = PSA_JPAKE_INPUT; computation_stage->io_mode = PSA_JPAKE_INPUT;
computation_stage->inputs = 0; computation_stage->inputs = 0;
computation_stage->outputs = 0; computation_stage->outputs = 0;
computation_stage->step = PSA_PAKE_STEP_KEY_SHARE; computation_stage->step = PSA_PAKE_STEP_KEY_SHARE;
@ -8086,8 +8086,8 @@ static psa_status_t psa_jpake_prologue(
computation_stage->outputs == 0) { computation_stage->outputs == 0) {
/* Start of the round, so function decides whether we are inputting /* Start of the round, so function decides whether we are inputting
* or outputting */ * or outputting */
computation_stage->mode = io_mode; computation_stage->io_mode = io_mode;
} else if (computation_stage->mode != io_mode) { } else if (computation_stage->io_mode != io_mode) {
/* Middle of the round so the mode we are in must match the function /* Middle of the round so the mode we are in must match the function
* called by the user */ * called by the user */
return PSA_ERROR_BAD_STATE; return PSA_ERROR_BAD_STATE;
@ -8121,13 +8121,13 @@ static psa_status_t psa_jpake_epilogue(
if (io_mode == PSA_JPAKE_INPUT) { if (io_mode == PSA_JPAKE_INPUT) {
stage->inputs++; stage->inputs++;
if (stage->inputs >= PSA_JPAKE_EXPECTED_INPUTS(stage->round)) { if (stage->inputs >= PSA_JPAKE_EXPECTED_INPUTS(stage->round)) {
stage->mode = PSA_JPAKE_OUTPUT; stage->io_mode = PSA_JPAKE_OUTPUT;
} }
} }
if (io_mode == PSA_JPAKE_OUTPUT) { if (io_mode == PSA_JPAKE_OUTPUT) {
stage->outputs++; stage->outputs++;
if (stage->outputs >= PSA_JPAKE_EXPECTED_OUTPUTS(stage->round)) { if (stage->outputs >= PSA_JPAKE_EXPECTED_OUTPUTS(stage->round)) {
stage->mode = PSA_JPAKE_INPUT; stage->io_mode = PSA_JPAKE_INPUT;
} }
} }
if (stage->inputs >= PSA_JPAKE_EXPECTED_INPUTS(stage->round) && if (stage->inputs >= PSA_JPAKE_EXPECTED_INPUTS(stage->round) &&