Update psasim generated files TF-PSA-Crypto no longer has `psa_can_do_hash()` (except as a temporary stub to avoid breaking the build of psasim). Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/psasim/src/psa_functions_codes.h b/psasim/src/psa_functions_codes.h index 74746b6..7cb8ea8 100644 --- a/psasim/src/psa_functions_codes.h +++ b/psasim/src/psa_functions_codes.h
@@ -26,7 +26,6 @@ PSA_AEAD_VERIFY, PSA_ASYMMETRIC_DECRYPT, PSA_ASYMMETRIC_ENCRYPT, - PSA_CAN_DO_HASH, PSA_CIPHER_ABORT, PSA_CIPHER_DECRYPT, PSA_CIPHER_DECRYPT_SETUP,
diff --git a/psasim/src/psa_sim_crypto_client.c b/psasim/src/psa_sim_crypto_client.c index 9051f20..67978b8 100644 --- a/psasim/src/psa_sim_crypto_client.c +++ b/psasim/src/psa_sim_crypto_client.c
@@ -1544,68 +1544,6 @@ } -int psa_can_do_hash( - psa_algorithm_t hash_alg - ) -{ - uint8_t *ser_params = NULL; - uint8_t *ser_result = NULL; - size_t result_length; - int value = 0; - - size_t needed = - psasim_serialise_begin_needs() + - psasim_serialise_psa_algorithm_t_needs(hash_alg); - - ser_params = malloc(needed); - if (ser_params == NULL) { - goto fail; - } - - uint8_t *pos = ser_params; - size_t remaining = needed; - int ok; - ok = psasim_serialise_begin(&pos, &remaining); - if (!ok) { - goto fail; - } - ok = psasim_serialise_psa_algorithm_t( - &pos, &remaining, - hash_alg); - if (!ok) { - goto fail; - } - - ok = psa_crypto_call(PSA_CAN_DO_HASH, - ser_params, (size_t) (pos - ser_params), &ser_result, &result_length); - if (!ok) { - printf("PSA_CAN_DO_HASH server call failed\n"); - goto fail; - } - - uint8_t *rpos = ser_result; - size_t rremain = result_length; - - ok = psasim_deserialise_begin(&rpos, &rremain); - if (!ok) { - goto fail; - } - - ok = psasim_deserialise_int( - &rpos, &rremain, - &value); - if (!ok) { - goto fail; - } - -fail: - free(ser_params); - free(ser_result); - - return value; -} - - psa_status_t psa_cipher_abort( psa_cipher_operation_t *operation )
diff --git a/psasim/src/psa_sim_crypto_server.c b/psasim/src/psa_sim_crypto_server.c index bd121c5..2210afc 100644 --- a/psasim/src/psa_sim_crypto_server.c +++ b/psasim/src/psa_sim_crypto_server.c
@@ -1706,73 +1706,6 @@ } // Returns 1 for success, 0 for failure -int psa_can_do_hash_wrapper( - uint8_t *in_params, size_t in_params_len, - uint8_t **out_params, size_t *out_params_len) -{ - int value = 0; - psa_algorithm_t hash_alg; - - uint8_t *pos = in_params; - size_t remaining = in_params_len; - uint8_t *result = NULL; - int ok; - - ok = psasim_deserialise_begin(&pos, &remaining); - if (!ok) { - goto fail; - } - - ok = psasim_deserialise_psa_algorithm_t( - &pos, &remaining, - &hash_alg); - if (!ok) { - goto fail; - } - - // Now we call the actual target function - - value = psa_can_do_hash( - hash_alg - ); - - // NOTE: Should really check there is no overflow as we go along. - size_t result_size = - psasim_serialise_begin_needs() + - psasim_serialise_int_needs(value); - - result = malloc(result_size); - if (result == NULL) { - goto fail; - } - - uint8_t *rpos = result; - size_t rremain = result_size; - - ok = psasim_serialise_begin(&rpos, &rremain); - if (!ok) { - goto fail; - } - - ok = psasim_serialise_int( - &rpos, &rremain, - value); - if (!ok) { - goto fail; - } - - *out_params = result; - *out_params_len = result_size; - - return 1; // success - -fail: - free(result); - - return 0; // This shouldn't happen! -} - -// Returns 1 for success, 0 for failure int psa_cipher_abort_wrapper( uint8_t *in_params, size_t in_params_len, uint8_t **out_params, size_t *out_params_len) @@ -8893,10 +8826,6 @@ ok = psa_asymmetric_encrypt_wrapper(in_params, in_params_len, &out_params, &out_params_len); break; - case PSA_CAN_DO_HASH: - ok = psa_can_do_hash_wrapper(in_params, in_params_len, - &out_params, &out_params_len); - break; case PSA_CIPHER_ABORT: ok = psa_cipher_abort_wrapper(in_params, in_params_len, &out_params, &out_params_len);