mirror of
https://github.com/Mbed-TLS/mbedtls-framework.git
synced 2026-08-24 20:19:52 +00:00
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 <[email protected]>
This commit is contained in:
@@ -26,7 +26,6 @@ enum {
|
|||||||
PSA_AEAD_VERIFY,
|
PSA_AEAD_VERIFY,
|
||||||
PSA_ASYMMETRIC_DECRYPT,
|
PSA_ASYMMETRIC_DECRYPT,
|
||||||
PSA_ASYMMETRIC_ENCRYPT,
|
PSA_ASYMMETRIC_ENCRYPT,
|
||||||
PSA_CAN_DO_HASH,
|
|
||||||
PSA_CIPHER_ABORT,
|
PSA_CIPHER_ABORT,
|
||||||
PSA_CIPHER_DECRYPT,
|
PSA_CIPHER_DECRYPT,
|
||||||
PSA_CIPHER_DECRYPT_SETUP,
|
PSA_CIPHER_DECRYPT_SETUP,
|
||||||
|
|||||||
@@ -1544,68 +1544,6 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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_status_t psa_cipher_abort(
|
||||||
psa_cipher_operation_t *operation
|
psa_cipher_operation_t *operation
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1705,73 +1705,6 @@ fail:
|
|||||||
return 0; // This shouldn't happen!
|
return 0; // This shouldn't happen!
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
// Returns 1 for success, 0 for failure
|
||||||
int psa_cipher_abort_wrapper(
|
int psa_cipher_abort_wrapper(
|
||||||
uint8_t *in_params, size_t in_params_len,
|
uint8_t *in_params, size_t in_params_len,
|
||||||
@@ -8893,10 +8826,6 @@ psa_status_t psa_crypto_call(psa_msg_t msg)
|
|||||||
ok = psa_asymmetric_encrypt_wrapper(in_params, in_params_len,
|
ok = psa_asymmetric_encrypt_wrapper(in_params, in_params_len,
|
||||||
&out_params, &out_params_len);
|
&out_params, &out_params_len);
|
||||||
break;
|
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:
|
case PSA_CIPHER_ABORT:
|
||||||
ok = psa_cipher_abort_wrapper(in_params, in_params_len,
|
ok = psa_cipher_abort_wrapper(in_params, in_params_len,
|
||||||
&out_params, &out_params_len);
|
&out_params, &out_params_len);
|
||||||
|
|||||||
Reference in New Issue
Block a user