mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-26 21:35:35 +00:00
Simplify psa_pake_computation_stage_s structure
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
b09c487546
commit
7b730175b3
@ -1976,7 +1976,7 @@ struct psa_jpake_computation_stage_s {
|
||||
struct psa_pake_computation_stage_s {
|
||||
union {
|
||||
unsigned dummy;
|
||||
psa_jpake_computation_stage_t MBEDTLS_PRIVATE(jpake_computation_stage);
|
||||
psa_jpake_computation_stage_t MBEDTLS_PRIVATE(jpake);
|
||||
} MBEDTLS_PRIVATE(data);
|
||||
};
|
||||
|
||||
|
@ -7203,7 +7203,7 @@ psa_status_t psa_pake_setup(
|
||||
|
||||
if (operation->alg == PSA_ALG_JPAKE) {
|
||||
psa_jpake_computation_stage_t *computation_stage =
|
||||
&operation->computation_stage.data.jpake_computation_stage;
|
||||
&operation->computation_stage.data.jpake;
|
||||
|
||||
computation_stage->state = PSA_PAKE_STATE_SETUP;
|
||||
computation_stage->sequence = PSA_PAKE_SEQ_INVALID;
|
||||
@ -7336,10 +7336,10 @@ psa_status_t psa_pake_set_role(
|
||||
static psa_pake_driver_step_t convert_jpake_computation_stage_to_driver_step(
|
||||
psa_pake_computation_stage_t *stage)
|
||||
{
|
||||
switch (stage->data.jpake_computation_stage.state) {
|
||||
switch (stage->data.jpake.state) {
|
||||
case PSA_PAKE_OUTPUT_X1_X2:
|
||||
case PSA_PAKE_INPUT_X1_X2:
|
||||
switch (stage->data.jpake_computation_stage.sequence) {
|
||||
switch (stage->data.jpake.sequence) {
|
||||
case PSA_PAKE_X1_STEP_KEY_SHARE:
|
||||
return PSA_JPAKE_X1_STEP_KEY_SHARE;
|
||||
break;
|
||||
@ -7363,7 +7363,7 @@ static psa_pake_driver_step_t convert_jpake_computation_stage_to_driver_step(
|
||||
}
|
||||
break;
|
||||
case PSA_PAKE_OUTPUT_X2S:
|
||||
switch (stage->data.jpake_computation_stage.sequence) {
|
||||
switch (stage->data.jpake.sequence) {
|
||||
case PSA_PAKE_X1_STEP_KEY_SHARE:
|
||||
return PSA_JPAKE_X2S_STEP_KEY_SHARE;
|
||||
break;
|
||||
@ -7377,7 +7377,7 @@ static psa_pake_driver_step_t convert_jpake_computation_stage_to_driver_step(
|
||||
}
|
||||
break;
|
||||
case PSA_PAKE_INPUT_X4S:
|
||||
switch (stage->data.jpake_computation_stage.sequence) {
|
||||
switch (stage->data.jpake.sequence) {
|
||||
case PSA_PAKE_X1_STEP_KEY_SHARE:
|
||||
return PSA_JPAKE_X4S_STEP_KEY_SHARE;
|
||||
break;
|
||||
@ -7400,7 +7400,7 @@ static psa_status_t psa_pake_complete_inputs(
|
||||
psa_pake_operation_t *operation)
|
||||
{
|
||||
psa_jpake_computation_stage_t *computation_stage =
|
||||
&operation->computation_stage.data.jpake_computation_stage;
|
||||
&operation->computation_stage.data.jpake;
|
||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||
uint8_t *password = operation->data.inputs.password;
|
||||
size_t password_len = operation->data.inputs.password_len;
|
||||
@ -7439,7 +7439,7 @@ static psa_status_t psa_jpake_output_prologue(
|
||||
psa_pake_step_t step)
|
||||
{
|
||||
psa_jpake_computation_stage_t *computation_stage =
|
||||
&operation->computation_stage.data.jpake_computation_stage;
|
||||
&operation->computation_stage.data.jpake;
|
||||
|
||||
if (computation_stage->state == PSA_PAKE_STATE_INVALID) {
|
||||
return PSA_ERROR_BAD_STATE;
|
||||
@ -7510,7 +7510,7 @@ static psa_status_t psa_jpake_output_epilogue(
|
||||
psa_pake_operation_t *operation)
|
||||
{
|
||||
psa_jpake_computation_stage_t *computation_stage =
|
||||
&operation->computation_stage.data.jpake_computation_stage;
|
||||
&operation->computation_stage.data.jpake;
|
||||
|
||||
if ((computation_stage->state == PSA_PAKE_OUTPUT_X1_X2 &&
|
||||
computation_stage->sequence == PSA_PAKE_X2_STEP_ZK_PROOF) ||
|
||||
@ -7598,7 +7598,7 @@ static psa_status_t psa_jpake_input_prologue(
|
||||
size_t input_length)
|
||||
{
|
||||
psa_jpake_computation_stage_t *computation_stage =
|
||||
&operation->computation_stage.data.jpake_computation_stage;
|
||||
&operation->computation_stage.data.jpake;
|
||||
|
||||
if (computation_stage->state == PSA_PAKE_STATE_INVALID) {
|
||||
return PSA_ERROR_BAD_STATE;
|
||||
@ -7675,7 +7675,7 @@ static psa_status_t psa_jpake_input_epilogue(
|
||||
psa_pake_operation_t *operation)
|
||||
{
|
||||
psa_jpake_computation_stage_t *computation_stage =
|
||||
&operation->computation_stage.data.jpake_computation_stage;
|
||||
&operation->computation_stage.data.jpake;
|
||||
|
||||
if ((computation_stage->state == PSA_PAKE_INPUT_X1_X2 &&
|
||||
computation_stage->sequence == PSA_PAKE_X2_STEP_ZK_PROOF) ||
|
||||
@ -7762,7 +7762,7 @@ psa_status_t psa_pake_get_implicit_key(
|
||||
uint8_t shared_key[MBEDTLS_PSA_PAKE_BUFFER_SIZE];
|
||||
size_t shared_key_len = 0;
|
||||
psa_jpake_computation_stage_t *computation_stage =
|
||||
&operation->computation_stage.data.jpake_computation_stage;
|
||||
&operation->computation_stage.data.jpake;
|
||||
|
||||
if (operation->id == 0) {
|
||||
return PSA_ERROR_BAD_STATE;
|
||||
@ -7821,7 +7821,7 @@ psa_status_t psa_pake_abort(
|
||||
|
||||
if (operation->alg == PSA_ALG_JPAKE) {
|
||||
psa_jpake_computation_stage_t *computation_stage =
|
||||
&operation->computation_stage.data.jpake_computation_stage;
|
||||
&operation->computation_stage.data.jpake;
|
||||
|
||||
computation_stage->input_step = PSA_PAKE_STEP_INVALID;
|
||||
computation_stage->output_step = PSA_PAKE_STEP_INVALID;
|
||||
|
@ -3119,10 +3119,8 @@ void pake_operations(data_t *pw_data, int forced_status_setup_arg, int forced_st
|
||||
PSA_SUCCESS);
|
||||
|
||||
/* Simulate that we are ready to get implicit key. */
|
||||
operation.computation_stage.data.jpake_computation_stage.input_step =
|
||||
PSA_PAKE_STEP_DERIVE;
|
||||
operation.computation_stage.data.jpake_computation_stage.output_step =
|
||||
PSA_PAKE_STEP_DERIVE;
|
||||
operation.computation_stage.data.jpake.input_step = PSA_PAKE_STEP_DERIVE;
|
||||
operation.computation_stage.data.jpake.output_step = PSA_PAKE_STEP_DERIVE;
|
||||
|
||||
/* --- psa_pake_get_implicit_key --- */
|
||||
mbedtls_test_driver_pake_hooks.forced_status = forced_status;
|
||||
|
Loading…
x
Reference in New Issue
Block a user