diff options
Diffstat (limited to 'tests/psa-client-server/psasim/src/psa_sim_serialise.c')
-rw-r--r-- | tests/psa-client-server/psasim/src/psa_sim_serialise.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/psa-client-server/psasim/src/psa_sim_serialise.c b/tests/psa-client-server/psasim/src/psa_sim_serialise.c index 9e8c38b..aaf47db 100644 --- a/tests/psa-client-server/psasim/src/psa_sim_serialise.c +++ b/tests/psa-client-server/psasim/src/psa_sim_serialise.c @@ -10,6 +10,7 @@ */ #include "psa_sim_serialise.h" +#include "util.h" #include <stdlib.h> #include <string.h> @@ -71,8 +72,7 @@ static ssize_t allocate_hash_operation_slot(void) { psasim_client_handle_t handle = next_hash_operation_handle++; if (next_hash_operation_handle == 0) { /* wrapped around */ - fprintf(stderr, "MAX HASH HANDLES REACHED\n"); - exit(1); + FATAL("Hash operation handle wrapped"); } for (ssize_t i = 0; i < MAX_LIVE_HANDLES_PER_CLASS; i++) { @@ -82,6 +82,8 @@ static ssize_t allocate_hash_operation_slot(void) } } + ERROR("All slots are currently used. Unable to allocate a new one."); + return -1; /* all in use */ } @@ -94,7 +96,9 @@ static ssize_t find_hash_slot_by_handle(psasim_client_handle_t handle) } } - return -1; /* all in use */ + ERROR("Unable to find slot by handle %u", handle); + + return -1; /* not found */ } static psa_aead_operation_t aead_operations[MAX_LIVE_HANDLES_PER_CLASS]; @@ -106,8 +110,7 @@ static ssize_t allocate_aead_operation_slot(void) { psasim_client_handle_t handle = next_aead_operation_handle++; if (next_aead_operation_handle == 0) { /* wrapped around */ - fprintf(stderr, "MAX HASH HANDLES REACHED\n"); - exit(1); + FATAL("Aead operation handle wrapped"); } for (ssize_t i = 0; i < MAX_LIVE_HANDLES_PER_CLASS; i++) { @@ -117,6 +120,8 @@ static ssize_t allocate_aead_operation_slot(void) } } + ERROR("All slots are currently used. Unable to allocate a new one."); + return -1; /* all in use */ } @@ -129,7 +134,9 @@ static ssize_t find_aead_slot_by_handle(psasim_client_handle_t handle) } } - return -1; /* all in use */ + ERROR("Unable to find slot by handle %u", handle); + + return -1; /* not found */ } size_t psasim_serialise_begin_needs(void) |