psasim: use ser_params and ser_result variable names in client; 'params' is needed by some PSA functions
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
diff --git a/tests/psa-client-server/psasim/src/psa_sim_crypto_client.c b/tests/psa-client-server/psasim/src/psa_sim_crypto_client.c
index 613aa1f..1ae2dd7 100644
--- a/tests/psa-client-server/psasim/src/psa_sim_crypto_client.c
+++ b/tests/psa-client-server/psasim/src/psa_sim_crypto_client.c
@@ -129,21 +129,21 @@
psa_aead_operation_t *operation
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
size_t needed = psasim_serialise_begin_needs() +
psasim_serialise_psa_aead_operation_t_needs(*operation);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -156,13 +156,13 @@
}
ok = psa_crypto_call(PSA_AEAD_ABORT,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_AEAD_ABORT server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -181,8 +181,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -198,8 +198,8 @@
size_t *plaintext_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -212,13 +212,13 @@
psasim_serialise_buffer_needs(plaintext, plaintext_size) +
psasim_serialise_size_t_needs(*plaintext_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -255,13 +255,13 @@
}
ok = psa_crypto_call(PSA_AEAD_DECRYPT,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_AEAD_DECRYPT server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -285,8 +285,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -298,8 +298,8 @@
psa_algorithm_t alg
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -308,13 +308,13 @@
psasim_serialise_mbedtls_svc_key_id_t_needs(key) +
psasim_serialise_psa_algorithm_t_needs(alg);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -335,13 +335,13 @@
}
ok = psa_crypto_call(PSA_AEAD_DECRYPT_SETUP,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_AEAD_DECRYPT_SETUP server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -360,8 +360,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -377,8 +377,8 @@
size_t *ciphertext_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -391,13 +391,13 @@
psasim_serialise_buffer_needs(ciphertext, ciphertext_size) +
psasim_serialise_size_t_needs(*ciphertext_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -434,13 +434,13 @@
}
ok = psa_crypto_call(PSA_AEAD_ENCRYPT,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_AEAD_ENCRYPT server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -464,8 +464,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -477,8 +477,8 @@
psa_algorithm_t alg
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -487,13 +487,13 @@
psasim_serialise_mbedtls_svc_key_id_t_needs(key) +
psasim_serialise_psa_algorithm_t_needs(alg);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -514,13 +514,13 @@
}
ok = psa_crypto_call(PSA_AEAD_ENCRYPT_SETUP,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_AEAD_ENCRYPT_SETUP server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -539,8 +539,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -554,8 +554,8 @@
size_t *tag_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -566,13 +566,13 @@
psasim_serialise_buffer_needs(tag, tag_size) +
psasim_serialise_size_t_needs(*tag_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -601,13 +601,13 @@
}
ok = psa_crypto_call(PSA_AEAD_FINISH,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_AEAD_FINISH server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -646,8 +646,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -659,8 +659,8 @@
size_t *nonce_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -669,13 +669,13 @@
psasim_serialise_buffer_needs(nonce, nonce_size) +
psasim_serialise_size_t_needs(*nonce_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -696,13 +696,13 @@
}
ok = psa_crypto_call(PSA_AEAD_GENERATE_NONCE,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_AEAD_GENERATE_NONCE server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -731,8 +731,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -744,8 +744,8 @@
size_t plaintext_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -754,13 +754,13 @@
psasim_serialise_size_t_needs(ad_length) +
psasim_serialise_size_t_needs(plaintext_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -781,13 +781,13 @@
}
ok = psa_crypto_call(PSA_AEAD_SET_LENGTHS,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_AEAD_SET_LENGTHS server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -806,8 +806,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -818,8 +818,8 @@
const uint8_t *nonce, size_t nonce_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -827,13 +827,13 @@
psasim_serialise_psa_aead_operation_t_needs(*operation) +
psasim_serialise_buffer_needs(nonce, nonce_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -850,13 +850,13 @@
}
ok = psa_crypto_call(PSA_AEAD_SET_NONCE,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_AEAD_SET_NONCE server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -875,8 +875,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -889,8 +889,8 @@
size_t *output_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -900,13 +900,13 @@
psasim_serialise_buffer_needs(output, output_size) +
psasim_serialise_size_t_needs(*output_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -931,13 +931,13 @@
}
ok = psa_crypto_call(PSA_AEAD_UPDATE,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_AEAD_UPDATE server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -966,8 +966,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -978,8 +978,8 @@
const uint8_t *input, size_t input_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -987,13 +987,13 @@
psasim_serialise_psa_aead_operation_t_needs(*operation) +
psasim_serialise_buffer_needs(input, input_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -1010,13 +1010,13 @@
}
ok = psa_crypto_call(PSA_AEAD_UPDATE_AD,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_AEAD_UPDATE_AD server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -1035,8 +1035,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -1049,8 +1049,8 @@
const uint8_t *tag, size_t tag_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -1060,13 +1060,13 @@
psasim_serialise_size_t_needs(*plaintext_length) +
psasim_serialise_buffer_needs(tag, tag_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -1091,13 +1091,13 @@
}
ok = psa_crypto_call(PSA_AEAD_VERIFY,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_AEAD_VERIFY server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -1126,8 +1126,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -1137,21 +1137,21 @@
psa_cipher_operation_t *operation
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
size_t needed = psasim_serialise_begin_needs() +
psasim_serialise_psa_cipher_operation_t_needs(*operation);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -1164,13 +1164,13 @@
}
ok = psa_crypto_call(PSA_CIPHER_ABORT,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_CIPHER_ABORT server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -1189,8 +1189,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -1204,8 +1204,8 @@
size_t *output_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -1216,13 +1216,13 @@
psasim_serialise_buffer_needs(output, output_size) +
psasim_serialise_size_t_needs(*output_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -1251,13 +1251,13 @@
}
ok = psa_crypto_call(PSA_CIPHER_DECRYPT,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_CIPHER_DECRYPT server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -1281,8 +1281,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -1294,8 +1294,8 @@
psa_algorithm_t alg
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -1304,13 +1304,13 @@
psasim_serialise_mbedtls_svc_key_id_t_needs(key) +
psasim_serialise_psa_algorithm_t_needs(alg);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -1331,13 +1331,13 @@
}
ok = psa_crypto_call(PSA_CIPHER_DECRYPT_SETUP,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_CIPHER_DECRYPT_SETUP server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -1356,8 +1356,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -1371,8 +1371,8 @@
size_t *output_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -1383,13 +1383,13 @@
psasim_serialise_buffer_needs(output, output_size) +
psasim_serialise_size_t_needs(*output_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -1418,13 +1418,13 @@
}
ok = psa_crypto_call(PSA_CIPHER_ENCRYPT,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_CIPHER_ENCRYPT server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -1448,8 +1448,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -1461,8 +1461,8 @@
psa_algorithm_t alg
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -1471,13 +1471,13 @@
psasim_serialise_mbedtls_svc_key_id_t_needs(key) +
psasim_serialise_psa_algorithm_t_needs(alg);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -1498,13 +1498,13 @@
}
ok = psa_crypto_call(PSA_CIPHER_ENCRYPT_SETUP,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_CIPHER_ENCRYPT_SETUP server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -1523,8 +1523,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -1536,8 +1536,8 @@
size_t *output_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -1546,13 +1546,13 @@
psasim_serialise_buffer_needs(output, output_size) +
psasim_serialise_size_t_needs(*output_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -1573,13 +1573,13 @@
}
ok = psa_crypto_call(PSA_CIPHER_FINISH,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_CIPHER_FINISH server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -1608,8 +1608,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -1621,8 +1621,8 @@
size_t *iv_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -1631,13 +1631,13 @@
psasim_serialise_buffer_needs(iv, iv_size) +
psasim_serialise_size_t_needs(*iv_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -1658,13 +1658,13 @@
}
ok = psa_crypto_call(PSA_CIPHER_GENERATE_IV,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_CIPHER_GENERATE_IV server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -1693,8 +1693,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -1705,8 +1705,8 @@
const uint8_t *iv, size_t iv_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -1714,13 +1714,13 @@
psasim_serialise_psa_cipher_operation_t_needs(*operation) +
psasim_serialise_buffer_needs(iv, iv_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -1737,13 +1737,13 @@
}
ok = psa_crypto_call(PSA_CIPHER_SET_IV,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_CIPHER_SET_IV server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -1762,8 +1762,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -1776,8 +1776,8 @@
size_t *output_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -1787,13 +1787,13 @@
psasim_serialise_buffer_needs(output, output_size) +
psasim_serialise_size_t_needs(*output_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -1818,13 +1818,13 @@
}
ok = psa_crypto_call(PSA_CIPHER_UPDATE,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_CIPHER_UPDATE server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -1853,8 +1853,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -1864,21 +1864,21 @@
mbedtls_svc_key_id_t key
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
size_t needed = psasim_serialise_begin_needs() +
psasim_serialise_mbedtls_svc_key_id_t_needs(key);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -1891,13 +1891,13 @@
}
ok = psa_crypto_call(PSA_DESTROY_KEY,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_DESTROY_KEY server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -1911,8 +1911,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -1922,21 +1922,21 @@
uint8_t *output, size_t output_size
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
size_t needed = psasim_serialise_begin_needs() +
psasim_serialise_buffer_needs(output, output_size);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -1949,13 +1949,13 @@
}
ok = psa_crypto_call(PSA_GENERATE_RANDOM,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_GENERATE_RANDOM server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -1974,8 +1974,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -1986,8 +1986,8 @@
psa_key_attributes_t *attributes
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -1995,13 +1995,13 @@
psasim_serialise_mbedtls_svc_key_id_t_needs(key) +
psasim_serialise_psa_key_attributes_t_needs(*attributes);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -2018,13 +2018,13 @@
}
ok = psa_crypto_call(PSA_GET_KEY_ATTRIBUTES,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_GET_KEY_ATTRIBUTES server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -2043,8 +2043,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -2054,21 +2054,21 @@
psa_hash_operation_t *operation
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
size_t needed = psasim_serialise_begin_needs() +
psasim_serialise_psa_hash_operation_t_needs(*operation);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -2081,13 +2081,13 @@
}
ok = psa_crypto_call(PSA_HASH_ABORT,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_HASH_ABORT server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -2106,8 +2106,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -2118,8 +2118,8 @@
psa_hash_operation_t *target_operation
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -2127,13 +2127,13 @@
psasim_serialise_psa_hash_operation_t_needs(*source_operation) +
psasim_serialise_psa_hash_operation_t_needs(*target_operation);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -2150,13 +2150,13 @@
}
ok = psa_crypto_call(PSA_HASH_CLONE,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_HASH_CLONE server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -2175,8 +2175,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -2188,8 +2188,8 @@
const uint8_t *hash, size_t hash_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -2198,13 +2198,13 @@
psasim_serialise_buffer_needs(input, input_length) +
psasim_serialise_buffer_needs(hash, hash_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -2225,13 +2225,13 @@
}
ok = psa_crypto_call(PSA_HASH_COMPARE,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_HASH_COMPARE server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -2245,8 +2245,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -2259,8 +2259,8 @@
size_t *hash_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -2270,13 +2270,13 @@
psasim_serialise_buffer_needs(hash, hash_size) +
psasim_serialise_size_t_needs(*hash_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -2301,13 +2301,13 @@
}
ok = psa_crypto_call(PSA_HASH_COMPUTE,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_HASH_COMPUTE server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -2331,8 +2331,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -2344,8 +2344,8 @@
size_t *hash_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -2354,13 +2354,13 @@
psasim_serialise_buffer_needs(hash, hash_size) +
psasim_serialise_size_t_needs(*hash_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -2381,13 +2381,13 @@
}
ok = psa_crypto_call(PSA_HASH_FINISH,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_HASH_FINISH server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -2416,8 +2416,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -2428,8 +2428,8 @@
psa_algorithm_t alg
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -2437,13 +2437,13 @@
psasim_serialise_psa_hash_operation_t_needs(*operation) +
psasim_serialise_psa_algorithm_t_needs(alg);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -2460,13 +2460,13 @@
}
ok = psa_crypto_call(PSA_HASH_SETUP,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_HASH_SETUP server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -2485,8 +2485,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -2497,8 +2497,8 @@
const uint8_t *input, size_t input_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -2506,13 +2506,13 @@
psasim_serialise_psa_hash_operation_t_needs(*operation) +
psasim_serialise_buffer_needs(input, input_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -2529,13 +2529,13 @@
}
ok = psa_crypto_call(PSA_HASH_UPDATE,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_HASH_UPDATE server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -2554,8 +2554,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -2566,8 +2566,8 @@
const uint8_t *hash, size_t hash_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -2575,13 +2575,13 @@
psasim_serialise_psa_hash_operation_t_needs(*operation) +
psasim_serialise_buffer_needs(hash, hash_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -2598,13 +2598,13 @@
}
ok = psa_crypto_call(PSA_HASH_VERIFY,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_HASH_VERIFY server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -2623,8 +2623,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -2636,8 +2636,8 @@
mbedtls_svc_key_id_t *key
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -2646,13 +2646,13 @@
psasim_serialise_buffer_needs(data, data_length) +
psasim_serialise_mbedtls_svc_key_id_t_needs(*key);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -2673,13 +2673,13 @@
}
ok = psa_crypto_call(PSA_IMPORT_KEY,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_IMPORT_KEY server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -2698,8 +2698,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -2709,21 +2709,21 @@
psa_mac_operation_t *operation
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
size_t needed = psasim_serialise_begin_needs() +
psasim_serialise_psa_mac_operation_t_needs(*operation);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -2736,13 +2736,13 @@
}
ok = psa_crypto_call(PSA_MAC_ABORT,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_MAC_ABORT server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -2761,8 +2761,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -2776,8 +2776,8 @@
size_t *mac_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -2788,13 +2788,13 @@
psasim_serialise_buffer_needs(mac, mac_size) +
psasim_serialise_size_t_needs(*mac_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -2823,13 +2823,13 @@
}
ok = psa_crypto_call(PSA_MAC_COMPUTE,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_MAC_COMPUTE server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -2853,8 +2853,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -2866,8 +2866,8 @@
size_t *mac_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -2876,13 +2876,13 @@
psasim_serialise_buffer_needs(mac, mac_size) +
psasim_serialise_size_t_needs(*mac_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -2903,13 +2903,13 @@
}
ok = psa_crypto_call(PSA_MAC_SIGN_FINISH,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_MAC_SIGN_FINISH server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -2938,8 +2938,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -2951,8 +2951,8 @@
psa_algorithm_t alg
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -2961,13 +2961,13 @@
psasim_serialise_mbedtls_svc_key_id_t_needs(key) +
psasim_serialise_psa_algorithm_t_needs(alg);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -2988,13 +2988,13 @@
}
ok = psa_crypto_call(PSA_MAC_SIGN_SETUP,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_MAC_SIGN_SETUP server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -3013,8 +3013,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -3025,8 +3025,8 @@
const uint8_t *input, size_t input_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -3034,13 +3034,13 @@
psasim_serialise_psa_mac_operation_t_needs(*operation) +
psasim_serialise_buffer_needs(input, input_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -3057,13 +3057,13 @@
}
ok = psa_crypto_call(PSA_MAC_UPDATE,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_MAC_UPDATE server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -3082,8 +3082,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -3096,8 +3096,8 @@
const uint8_t *mac, size_t mac_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -3107,13 +3107,13 @@
psasim_serialise_buffer_needs(input, input_length) +
psasim_serialise_buffer_needs(mac, mac_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -3138,13 +3138,13 @@
}
ok = psa_crypto_call(PSA_MAC_VERIFY,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_MAC_VERIFY server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -3158,8 +3158,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -3170,8 +3170,8 @@
const uint8_t *mac, size_t mac_length
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -3179,13 +3179,13 @@
psasim_serialise_psa_mac_operation_t_needs(*operation) +
psasim_serialise_buffer_needs(mac, mac_length);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -3202,13 +3202,13 @@
}
ok = psa_crypto_call(PSA_MAC_VERIFY_FINISH,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_MAC_VERIFY_FINISH server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -3227,8 +3227,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
@@ -3240,8 +3240,8 @@
psa_algorithm_t alg
)
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@@ -3250,13 +3250,13 @@
psasim_serialise_mbedtls_svc_key_id_t_needs(key) +
psasim_serialise_psa_algorithm_t_needs(alg);
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -3277,13 +3277,13 @@
}
ok = psa_crypto_call(PSA_MAC_VERIFY_SETUP,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("PSA_MAC_VERIFY_SETUP server call failed\n");
goto fail;
}
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -3302,8 +3302,8 @@
}
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return status;
}
diff --git a/tests/psa-client-server/psasim/src/psa_sim_generate.pl b/tests/psa-client-server/psasim/src/psa_sim_generate.pl
index fdc3435..a85a62a 100755
--- a/tests/psa-client-server/psasim/src/psa_sim_generate.pl
+++ b/tests/psa-client-server/psasim/src/psa_sim_generate.pl
@@ -748,8 +748,8 @@
print $fh <<EOF;
{
- uint8_t *params = NULL;
- uint8_t *result = NULL;
+ uint8_t *ser_params = NULL;
+ uint8_t *ser_result = NULL;
size_t result_length;
$ret_type $ret_name = $ret_default;
EOF
@@ -780,13 +780,13 @@
print $fh <<EOF;
- params = malloc(needed);
- if (params == NULL) {
+ ser_params = malloc(needed);
+ if (ser_params == NULL) {
status = PSA_ERROR_INSUFFICIENT_MEMORY;
goto fail;
}
- uint8_t *pos = params;
+ uint8_t *pos = ser_params;
size_t remaining = needed;
int ok;
ok = psasim_serialise_begin(&pos, &remaining);
@@ -812,8 +812,8 @@
print $fh <<EOF if $debug;
- printf("client sending %d:\\n", (int)(pos - params));
- dump_buffer(params, (size_t)(pos - params));
+ printf("client sending %d:\\n", (int)(pos - ser_params));
+ dump_buffer(ser_params, (size_t)(pos - ser_params));
EOF
my $enum = uc($name);
@@ -821,7 +821,7 @@
print $fh <<EOF;
ok = psa_crypto_call($enum,
- params, (size_t) (pos - params), &result, &result_length);
+ ser_params, (size_t) (pos - ser_params), &ser_result, &result_length);
if (!ok) {
printf("$enum server call failed\\n");
goto fail;
@@ -831,12 +831,12 @@
print $fh <<EOF if $debug;
printf("client receiving %d:\\n", (int)result_length);
- dump_buffer(result, result_length);
+ dump_buffer(ser_result, result_length);
EOF
print $fh <<EOF;
- uint8_t *rpos = result;
+ uint8_t *rpos = ser_result;
size_t rremain = result_length;
ok = psasim_deserialise_begin(&rpos, &rremain);
@@ -890,8 +890,8 @@
print $fh <<EOF;
fail:
- free(params);
- free(result);
+ free(ser_params);
+ free(ser_result);
return $ret_name;
}