mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-10 15:40:30 +00:00
psasim: fix max line length in generated files
Prevent generated files from having lines longer than 100 chars which would trigger CI failures on code style checks. Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
9dc928990f
commit
4848f9d64f
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -606,7 +606,9 @@ EOF
|
||||
my ($n1, $n2) = split(/,\s*/, $argname);
|
||||
print $fh <<EOF;
|
||||
|
||||
ok = psasim_deserialise_${argtype}(&pos, &remaining, &$n1, &$n2);
|
||||
ok = psasim_deserialise_${argtype}(
|
||||
&pos, &remaining,
|
||||
&$n1, &$n2);
|
||||
if (!ok) {
|
||||
goto fail;
|
||||
}
|
||||
@ -615,7 +617,9 @@ EOF
|
||||
my ($n1, $n2) = split(/,\s*/, $argname);
|
||||
print $fh <<EOF;
|
||||
|
||||
ok = psasim_deserialise_${argtype}(&pos, &remaining, &$n1, &$n2);
|
||||
ok = psasim_deserialise_${argtype}(
|
||||
&pos, &remaining,
|
||||
&$n1, &$n2);
|
||||
if (!ok) {
|
||||
goto fail;
|
||||
}
|
||||
@ -625,7 +629,9 @@ EOF
|
||||
my $server_specific = ($argtype =~ /^psa_\w+_operation_t/) ? "server_" : "";
|
||||
print $fh <<EOF;
|
||||
|
||||
ok = psasim_${server_specific}deserialise_${argtype}(&pos, &remaining, &$argname);
|
||||
ok = psasim_${server_specific}deserialise_${argtype}(
|
||||
&pos, &remaining,
|
||||
&$argname);
|
||||
if (!ok) {
|
||||
goto fail;
|
||||
}
|
||||
@ -641,7 +647,7 @@ EOF
|
||||
|
||||
my @outputs = grep($_->{is_output}, @$args);
|
||||
|
||||
my $sep1 = ($ret_type eq "void") ? ";" : " +";
|
||||
my $sep1 = (($ret_type eq "void") and ($#outputs < 0)) ? ";" : " +";
|
||||
|
||||
print $fh <<EOF;
|
||||
|
||||
@ -691,7 +697,9 @@ EOF
|
||||
if ($ret_type ne "void") {
|
||||
print $fh <<EOF;
|
||||
|
||||
ok = psasim_serialise_${ret_type}(&rpos, &rremain, $ret_name);
|
||||
ok = psasim_serialise_${ret_type}(
|
||||
&rpos, &rremain,
|
||||
$ret_name);
|
||||
if (!ok) {
|
||||
goto fail;
|
||||
}
|
||||
@ -711,7 +719,9 @@ EOF
|
||||
if ($argtype eq "buffer") {
|
||||
print $fh <<EOF;
|
||||
|
||||
ok = psasim_serialise_buffer(&rpos, &rremain, $argname);
|
||||
ok = psasim_serialise_buffer(
|
||||
&rpos, &rremain,
|
||||
$argname);
|
||||
if (!ok) {
|
||||
goto fail;
|
||||
}
|
||||
@ -719,7 +729,9 @@ EOF
|
||||
} elsif ($argtype eq "psa_key_production_parameters_t") {
|
||||
print $fh <<EOF;
|
||||
|
||||
ok = psasim_serialise_psa_key_production_parameters_t(&rpos, &rremain, $argname);
|
||||
ok = psasim_serialise_psa_key_production_parameters_t(
|
||||
&rpos, &rremain,
|
||||
$argname);
|
||||
if (!ok) {
|
||||
goto fail;
|
||||
}
|
||||
@ -735,7 +747,9 @@ EOF
|
||||
|
||||
print $fh <<EOF;
|
||||
|
||||
ok = psasim_${server_specific}serialise_${argtype}(&rpos, &rremain, $argname);
|
||||
ok = psasim_${server_specific}serialise_${argtype}(
|
||||
&rpos, &rremain,
|
||||
$argname);
|
||||
if (!ok) {
|
||||
goto fail;
|
||||
}
|
||||
@ -790,7 +804,8 @@ EOF
|
||||
|
||||
print $fh <<EOF;
|
||||
|
||||
size_t needed = psasim_serialise_begin_needs() +
|
||||
size_t needed =
|
||||
psasim_serialise_begin_needs() +
|
||||
EOF
|
||||
|
||||
my $args = $f->{args};
|
||||
@ -803,12 +818,12 @@ EOF
|
||||
$argtype =~ s/^const //;
|
||||
|
||||
print $fh <<EOF;
|
||||
psasim_serialise_${argtype}_needs($argname)$sep
|
||||
psasim_serialise_${argtype}_needs($argname)$sep
|
||||
EOF
|
||||
}
|
||||
|
||||
print $fh <<EOF if $#$args < 0;
|
||||
0;
|
||||
0;
|
||||
EOF
|
||||
|
||||
print $fh <<EOF;
|
||||
@ -848,7 +863,9 @@ EOF
|
||||
$argtype =~ s/^const //;
|
||||
|
||||
print $fh <<EOF;
|
||||
ok = psasim_serialise_${argtype}(&pos, &remaining, $argname);
|
||||
ok = psasim_serialise_${argtype}(
|
||||
&pos, &remaining,
|
||||
$argname);
|
||||
if (!ok) {
|
||||
goto fail;
|
||||
}
|
||||
@ -892,7 +909,9 @@ EOF
|
||||
|
||||
print $fh <<EOF if $ret_type ne "void";
|
||||
|
||||
ok = psasim_deserialise_$ret_type(&rpos, &rremain, &$ret_name);
|
||||
ok = psasim_deserialise_$ret_type(
|
||||
&rpos, &rremain,
|
||||
&$ret_name);
|
||||
if (!ok) {
|
||||
goto fail;
|
||||
}
|
||||
@ -911,7 +930,9 @@ EOF
|
||||
if ($argtype eq "buffer") {
|
||||
print $fh <<EOF;
|
||||
|
||||
ok = psasim_deserialise_return_buffer(&rpos, &rremain, $argname);
|
||||
ok = psasim_deserialise_return_buffer(
|
||||
&rpos, &rremain,
|
||||
$argname);
|
||||
if (!ok) {
|
||||
goto fail;
|
||||
}
|
||||
@ -925,7 +946,9 @@ EOF
|
||||
|
||||
print $fh <<EOF;
|
||||
|
||||
ok = psasim_deserialise_${argtype}(&rpos, &rremain, $argname);
|
||||
ok = psasim_deserialise_${argtype}(
|
||||
&rpos, &rremain,
|
||||
$argname);
|
||||
if (!ok) {
|
||||
goto fail;
|
||||
}
|
||||
@ -1013,7 +1036,7 @@ sub output_signature
|
||||
|
||||
print $fh "\n$ret_type $name(\n";
|
||||
|
||||
print $fh " void\n)\n" if $#$args < 0; # No arguments
|
||||
print $fh " void\n )\n" if $#$args < 0; # No arguments
|
||||
|
||||
for my $i (0 .. $#$args) {
|
||||
my $arg = $args->[$i];
|
||||
|
@ -63,8 +63,10 @@ typedef struct psasim_operation_s {
|
||||
|
||||
#define MAX_LIVE_HANDLES_PER_CLASS 100 /* this many slots */
|
||||
|
||||
static psa_hash_operation_t hash_operations[MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t hash_operation_handles[MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psa_hash_operation_t hash_operations[
|
||||
MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t hash_operation_handles[
|
||||
MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t next_hash_operation_handle = 1;
|
||||
|
||||
/* Get a free slot */
|
||||
@ -101,8 +103,10 @@ static ssize_t find_hash_slot_by_handle(psasim_client_handle_t handle)
|
||||
return -1; /* not found */
|
||||
}
|
||||
|
||||
static psa_aead_operation_t aead_operations[MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t aead_operation_handles[MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psa_aead_operation_t aead_operations[
|
||||
MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t aead_operation_handles[
|
||||
MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t next_aead_operation_handle = 1;
|
||||
|
||||
/* Get a free slot */
|
||||
@ -139,8 +143,10 @@ static ssize_t find_aead_slot_by_handle(psasim_client_handle_t handle)
|
||||
return -1; /* not found */
|
||||
}
|
||||
|
||||
static psa_mac_operation_t mac_operations[MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t mac_operation_handles[MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psa_mac_operation_t mac_operations[
|
||||
MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t mac_operation_handles[
|
||||
MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t next_mac_operation_handle = 1;
|
||||
|
||||
/* Get a free slot */
|
||||
@ -177,8 +183,10 @@ static ssize_t find_mac_slot_by_handle(psasim_client_handle_t handle)
|
||||
return -1; /* not found */
|
||||
}
|
||||
|
||||
static psa_cipher_operation_t cipher_operations[MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t cipher_operation_handles[MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psa_cipher_operation_t cipher_operations[
|
||||
MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t cipher_operation_handles[
|
||||
MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t next_cipher_operation_handle = 1;
|
||||
|
||||
/* Get a free slot */
|
||||
@ -215,8 +223,10 @@ static ssize_t find_cipher_slot_by_handle(psasim_client_handle_t handle)
|
||||
return -1; /* not found */
|
||||
}
|
||||
|
||||
static psa_key_derivation_operation_t key_derivation_operations[MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t key_derivation_operation_handles[MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psa_key_derivation_operation_t key_derivation_operations[
|
||||
MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t key_derivation_operation_handles[
|
||||
MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t next_key_derivation_operation_handle = 1;
|
||||
|
||||
/* Get a free slot */
|
||||
@ -253,8 +263,10 @@ static ssize_t find_key_derivation_slot_by_handle(psasim_client_handle_t handle)
|
||||
return -1; /* not found */
|
||||
}
|
||||
|
||||
static psa_sign_hash_interruptible_operation_t sign_hash_interruptible_operations[MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t sign_hash_interruptible_operation_handles[MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psa_sign_hash_interruptible_operation_t sign_hash_interruptible_operations[
|
||||
MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t sign_hash_interruptible_operation_handles[
|
||||
MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t next_sign_hash_interruptible_operation_handle = 1;
|
||||
|
||||
/* Get a free slot */
|
||||
@ -291,8 +303,10 @@ static ssize_t find_sign_hash_interruptible_slot_by_handle(psasim_client_handle_
|
||||
return -1; /* not found */
|
||||
}
|
||||
|
||||
static psa_verify_hash_interruptible_operation_t verify_hash_interruptible_operations[MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t verify_hash_interruptible_operation_handles[MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psa_verify_hash_interruptible_operation_t verify_hash_interruptible_operations[
|
||||
MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t verify_hash_interruptible_operation_handles[
|
||||
MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t next_verify_hash_interruptible_operation_handle = 1;
|
||||
|
||||
/* Get a free slot */
|
||||
@ -403,7 +417,8 @@ int psasim_deserialise_begin(uint8_t **pos, size_t *remaining)
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_serialise_unsigned_int_needs(unsigned int value)
|
||||
size_t psasim_serialise_unsigned_int_needs(
|
||||
unsigned int value)
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
@ -438,7 +453,8 @@ int psasim_deserialise_unsigned_int(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_serialise_int_needs(int value)
|
||||
size_t psasim_serialise_int_needs(
|
||||
int value)
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
@ -473,7 +489,8 @@ int psasim_deserialise_int(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_serialise_size_t_needs(size_t value)
|
||||
size_t psasim_serialise_size_t_needs(
|
||||
size_t value)
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
@ -508,7 +525,8 @@ int psasim_deserialise_size_t(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_serialise_uint16_t_needs(uint16_t value)
|
||||
size_t psasim_serialise_uint16_t_needs(
|
||||
uint16_t value)
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
@ -543,7 +561,8 @@ int psasim_deserialise_uint16_t(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_serialise_uint32_t_needs(uint32_t value)
|
||||
size_t psasim_serialise_uint32_t_needs(
|
||||
uint32_t value)
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
@ -578,7 +597,8 @@ int psasim_deserialise_uint32_t(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_serialise_uint64_t_needs(uint64_t value)
|
||||
size_t psasim_serialise_uint64_t_needs(
|
||||
uint64_t value)
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
@ -784,7 +804,7 @@ int psasim_deserialise_psa_key_production_parameters_t(uint8_t **pos,
|
||||
}
|
||||
memcpy(data_length, *pos, sizeof(*data_length));
|
||||
|
||||
if ((size_t)len != (sizeof(data_length) + sizeof(**params) + *data_length)) {
|
||||
if ((size_t) len != (sizeof(data_length) + sizeof(**params) + *data_length)) {
|
||||
return 0; /* wrong length */
|
||||
}
|
||||
|
||||
@ -809,7 +829,8 @@ int psasim_deserialise_psa_key_production_parameters_t(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_serialise_psa_status_t_needs(psa_status_t value)
|
||||
size_t psasim_serialise_psa_status_t_needs(
|
||||
psa_status_t value)
|
||||
{
|
||||
return psasim_serialise_int_needs(value);
|
||||
}
|
||||
@ -828,7 +849,8 @@ int psasim_deserialise_psa_status_t(uint8_t **pos,
|
||||
return psasim_deserialise_int(pos, remaining, value);
|
||||
}
|
||||
|
||||
size_t psasim_serialise_psa_algorithm_t_needs(psa_algorithm_t value)
|
||||
size_t psasim_serialise_psa_algorithm_t_needs(
|
||||
psa_algorithm_t value)
|
||||
{
|
||||
return psasim_serialise_unsigned_int_needs(value);
|
||||
}
|
||||
@ -847,7 +869,8 @@ int psasim_deserialise_psa_algorithm_t(uint8_t **pos,
|
||||
return psasim_deserialise_unsigned_int(pos, remaining, value);
|
||||
}
|
||||
|
||||
size_t psasim_serialise_psa_key_derivation_step_t_needs(psa_key_derivation_step_t value)
|
||||
size_t psasim_serialise_psa_key_derivation_step_t_needs(
|
||||
psa_key_derivation_step_t value)
|
||||
{
|
||||
return psasim_serialise_uint16_t_needs(value);
|
||||
}
|
||||
@ -866,7 +889,8 @@ int psasim_deserialise_psa_key_derivation_step_t(uint8_t **pos,
|
||||
return psasim_deserialise_uint16_t(pos, remaining, value);
|
||||
}
|
||||
|
||||
size_t psasim_serialise_psa_hash_operation_t_needs(psa_hash_operation_t value)
|
||||
size_t psasim_serialise_psa_hash_operation_t_needs(
|
||||
psa_hash_operation_t value)
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
@ -901,7 +925,8 @@ int psasim_deserialise_psa_hash_operation_t(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_server_serialise_psa_hash_operation_t_needs(psa_hash_operation_t *operation)
|
||||
size_t psasim_server_serialise_psa_hash_operation_t_needs(
|
||||
psa_hash_operation_t *operation)
|
||||
{
|
||||
(void) operation;
|
||||
|
||||
@ -959,7 +984,8 @@ int psasim_server_deserialise_psa_hash_operation_t(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_serialise_psa_aead_operation_t_needs(psa_aead_operation_t value)
|
||||
size_t psasim_serialise_psa_aead_operation_t_needs(
|
||||
psa_aead_operation_t value)
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
@ -994,7 +1020,8 @@ int psasim_deserialise_psa_aead_operation_t(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_server_serialise_psa_aead_operation_t_needs(psa_aead_operation_t *operation)
|
||||
size_t psasim_server_serialise_psa_aead_operation_t_needs(
|
||||
psa_aead_operation_t *operation)
|
||||
{
|
||||
(void) operation;
|
||||
|
||||
@ -1052,7 +1079,8 @@ int psasim_server_deserialise_psa_aead_operation_t(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_serialise_psa_key_attributes_t_needs(psa_key_attributes_t value)
|
||||
size_t psasim_serialise_psa_key_attributes_t_needs(
|
||||
psa_key_attributes_t value)
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
@ -1087,7 +1115,8 @@ int psasim_deserialise_psa_key_attributes_t(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_serialise_psa_mac_operation_t_needs(psa_mac_operation_t value)
|
||||
size_t psasim_serialise_psa_mac_operation_t_needs(
|
||||
psa_mac_operation_t value)
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
@ -1122,7 +1151,8 @@ int psasim_deserialise_psa_mac_operation_t(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_server_serialise_psa_mac_operation_t_needs(psa_mac_operation_t *operation)
|
||||
size_t psasim_server_serialise_psa_mac_operation_t_needs(
|
||||
psa_mac_operation_t *operation)
|
||||
{
|
||||
(void) operation;
|
||||
|
||||
@ -1180,7 +1210,8 @@ int psasim_server_deserialise_psa_mac_operation_t(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_serialise_psa_cipher_operation_t_needs(psa_cipher_operation_t value)
|
||||
size_t psasim_serialise_psa_cipher_operation_t_needs(
|
||||
psa_cipher_operation_t value)
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
@ -1215,7 +1246,8 @@ int psasim_deserialise_psa_cipher_operation_t(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_server_serialise_psa_cipher_operation_t_needs(psa_cipher_operation_t *operation)
|
||||
size_t psasim_server_serialise_psa_cipher_operation_t_needs(
|
||||
psa_cipher_operation_t *operation)
|
||||
{
|
||||
(void) operation;
|
||||
|
||||
@ -1273,7 +1305,8 @@ int psasim_server_deserialise_psa_cipher_operation_t(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_serialise_psa_key_derivation_operation_t_needs(psa_key_derivation_operation_t value)
|
||||
size_t psasim_serialise_psa_key_derivation_operation_t_needs(
|
||||
psa_key_derivation_operation_t value)
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
@ -1308,7 +1341,8 @@ int psasim_deserialise_psa_key_derivation_operation_t(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_server_serialise_psa_key_derivation_operation_t_needs(psa_key_derivation_operation_t *operation)
|
||||
size_t psasim_server_serialise_psa_key_derivation_operation_t_needs(
|
||||
psa_key_derivation_operation_t *operation)
|
||||
{
|
||||
(void) operation;
|
||||
|
||||
@ -1366,7 +1400,8 @@ int psasim_server_deserialise_psa_key_derivation_operation_t(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_serialise_psa_sign_hash_interruptible_operation_t_needs(psa_sign_hash_interruptible_operation_t value)
|
||||
size_t psasim_serialise_psa_sign_hash_interruptible_operation_t_needs(
|
||||
psa_sign_hash_interruptible_operation_t value)
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
@ -1401,7 +1436,8 @@ int psasim_deserialise_psa_sign_hash_interruptible_operation_t(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_server_serialise_psa_sign_hash_interruptible_operation_t_needs(psa_sign_hash_interruptible_operation_t *operation)
|
||||
size_t psasim_server_serialise_psa_sign_hash_interruptible_operation_t_needs(
|
||||
psa_sign_hash_interruptible_operation_t *operation)
|
||||
{
|
||||
(void) operation;
|
||||
|
||||
@ -1459,7 +1495,8 @@ int psasim_server_deserialise_psa_sign_hash_interruptible_operation_t(uint8_t **
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_serialise_psa_verify_hash_interruptible_operation_t_needs(psa_verify_hash_interruptible_operation_t value)
|
||||
size_t psasim_serialise_psa_verify_hash_interruptible_operation_t_needs(
|
||||
psa_verify_hash_interruptible_operation_t value)
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
@ -1494,7 +1531,8 @@ int psasim_deserialise_psa_verify_hash_interruptible_operation_t(uint8_t **pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_server_serialise_psa_verify_hash_interruptible_operation_t_needs(psa_verify_hash_interruptible_operation_t *operation)
|
||||
size_t psasim_server_serialise_psa_verify_hash_interruptible_operation_t_needs(
|
||||
psa_verify_hash_interruptible_operation_t *operation)
|
||||
{
|
||||
(void) operation;
|
||||
|
||||
@ -1552,7 +1590,8 @@ int psasim_server_deserialise_psa_verify_hash_interruptible_operation_t(uint8_t
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t psasim_serialise_mbedtls_svc_key_id_t_needs(mbedtls_svc_key_id_t value)
|
||||
size_t psasim_serialise_mbedtls_svc_key_id_t_needs(
|
||||
mbedtls_svc_key_id_t value)
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
@ -1589,18 +1628,32 @@ int psasim_deserialise_mbedtls_svc_key_id_t(uint8_t **pos,
|
||||
|
||||
void psa_sim_serialize_reset(void)
|
||||
{
|
||||
memset(hash_operation_handles, 0, sizeof(hash_operation_handles));
|
||||
memset(hash_operations, 0, sizeof(hash_operations));
|
||||
memset(aead_operation_handles, 0, sizeof(aead_operation_handles));
|
||||
memset(aead_operations, 0, sizeof(aead_operations));
|
||||
memset(mac_operation_handles, 0, sizeof(mac_operation_handles));
|
||||
memset(mac_operations, 0, sizeof(mac_operations));
|
||||
memset(cipher_operation_handles, 0, sizeof(cipher_operation_handles));
|
||||
memset(cipher_operations, 0, sizeof(cipher_operations));
|
||||
memset(key_derivation_operation_handles, 0, sizeof(key_derivation_operation_handles));
|
||||
memset(key_derivation_operations, 0, sizeof(key_derivation_operations));
|
||||
memset(sign_hash_interruptible_operation_handles, 0, sizeof(sign_hash_interruptible_operation_handles));
|
||||
memset(sign_hash_interruptible_operations, 0, sizeof(sign_hash_interruptible_operations));
|
||||
memset(verify_hash_interruptible_operation_handles, 0, sizeof(verify_hash_interruptible_operation_handles));
|
||||
memset(verify_hash_interruptible_operations, 0, sizeof(verify_hash_interruptible_operations));
|
||||
memset(hash_operation_handles, 0,
|
||||
sizeof(hash_operation_handles));
|
||||
memset(hash_operations, 0,
|
||||
sizeof(hash_operations));
|
||||
memset(aead_operation_handles, 0,
|
||||
sizeof(aead_operation_handles));
|
||||
memset(aead_operations, 0,
|
||||
sizeof(aead_operations));
|
||||
memset(mac_operation_handles, 0,
|
||||
sizeof(mac_operation_handles));
|
||||
memset(mac_operations, 0,
|
||||
sizeof(mac_operations));
|
||||
memset(cipher_operation_handles, 0,
|
||||
sizeof(cipher_operation_handles));
|
||||
memset(cipher_operations, 0,
|
||||
sizeof(cipher_operations));
|
||||
memset(key_derivation_operation_handles, 0,
|
||||
sizeof(key_derivation_operation_handles));
|
||||
memset(key_derivation_operations, 0,
|
||||
sizeof(key_derivation_operations));
|
||||
memset(sign_hash_interruptible_operation_handles, 0,
|
||||
sizeof(sign_hash_interruptible_operation_handles));
|
||||
memset(sign_hash_interruptible_operations, 0,
|
||||
sizeof(sign_hash_interruptible_operations));
|
||||
memset(verify_hash_interruptible_operation_handles, 0,
|
||||
sizeof(verify_hash_interruptible_operation_handles));
|
||||
memset(verify_hash_interruptible_operations, 0,
|
||||
sizeof(verify_hash_interruptible_operations));
|
||||
}
|
||||
|
@ -107,7 +107,8 @@ int psasim_deserialise_begin(uint8_t **pos, size_t *remaining);
|
||||
* \c psasim_serialise_unsigned_int() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_serialise_unsigned_int_needs(unsigned int value);
|
||||
size_t psasim_serialise_unsigned_int_needs(
|
||||
unsigned int value);
|
||||
|
||||
/** Serialise an `unsigned int` into a buffer.
|
||||
*
|
||||
@ -149,7 +150,8 @@ int psasim_deserialise_unsigned_int(uint8_t **pos,
|
||||
* \c psasim_serialise_int() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_serialise_int_needs(int value);
|
||||
size_t psasim_serialise_int_needs(
|
||||
int value);
|
||||
|
||||
/** Serialise an `int` into a buffer.
|
||||
*
|
||||
@ -191,7 +193,8 @@ int psasim_deserialise_int(uint8_t **pos,
|
||||
* \c psasim_serialise_size_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_serialise_size_t_needs(size_t value);
|
||||
size_t psasim_serialise_size_t_needs(
|
||||
size_t value);
|
||||
|
||||
/** Serialise a `size_t` into a buffer.
|
||||
*
|
||||
@ -233,7 +236,8 @@ int psasim_deserialise_size_t(uint8_t **pos,
|
||||
* \c psasim_serialise_uint16_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_serialise_uint16_t_needs(uint16_t value);
|
||||
size_t psasim_serialise_uint16_t_needs(
|
||||
uint16_t value);
|
||||
|
||||
/** Serialise an `uint16_t` into a buffer.
|
||||
*
|
||||
@ -275,7 +279,8 @@ int psasim_deserialise_uint16_t(uint8_t **pos,
|
||||
* \c psasim_serialise_uint32_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_serialise_uint32_t_needs(uint32_t value);
|
||||
size_t psasim_serialise_uint32_t_needs(
|
||||
uint32_t value);
|
||||
|
||||
/** Serialise an `uint32_t` into a buffer.
|
||||
*
|
||||
@ -317,7 +322,8 @@ int psasim_deserialise_uint32_t(uint8_t **pos,
|
||||
* \c psasim_serialise_uint64_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_serialise_uint64_t_needs(uint64_t value);
|
||||
size_t psasim_serialise_uint64_t_needs(
|
||||
uint64_t value);
|
||||
|
||||
/** Serialise an `uint64_t` into a buffer.
|
||||
*
|
||||
@ -476,7 +482,8 @@ int psasim_deserialise_psa_key_production_parameters_t(uint8_t **pos, size_t *re
|
||||
* \c psasim_serialise_psa_status_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_serialise_psa_status_t_needs(psa_status_t value);
|
||||
size_t psasim_serialise_psa_status_t_needs(
|
||||
psa_status_t value);
|
||||
|
||||
/** Serialise a `psa_status_t` into a buffer.
|
||||
*
|
||||
@ -518,7 +525,8 @@ int psasim_deserialise_psa_status_t(uint8_t **pos,
|
||||
* \c psasim_serialise_psa_algorithm_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_serialise_psa_algorithm_t_needs(psa_algorithm_t value);
|
||||
size_t psasim_serialise_psa_algorithm_t_needs(
|
||||
psa_algorithm_t value);
|
||||
|
||||
/** Serialise a `psa_algorithm_t` into a buffer.
|
||||
*
|
||||
@ -560,7 +568,8 @@ int psasim_deserialise_psa_algorithm_t(uint8_t **pos,
|
||||
* \c psasim_serialise_psa_key_derivation_step_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_serialise_psa_key_derivation_step_t_needs(psa_key_derivation_step_t value);
|
||||
size_t psasim_serialise_psa_key_derivation_step_t_needs(
|
||||
psa_key_derivation_step_t value);
|
||||
|
||||
/** Serialise a `psa_key_derivation_step_t` into a buffer.
|
||||
*
|
||||
@ -602,7 +611,8 @@ int psasim_deserialise_psa_key_derivation_step_t(uint8_t **pos,
|
||||
* \c psasim_serialise_psa_hash_operation_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_serialise_psa_hash_operation_t_needs(psa_hash_operation_t value);
|
||||
size_t psasim_serialise_psa_hash_operation_t_needs(
|
||||
psa_hash_operation_t value);
|
||||
|
||||
/** Serialise a `psa_hash_operation_t` into a buffer.
|
||||
*
|
||||
@ -644,7 +654,8 @@ int psasim_deserialise_psa_hash_operation_t(uint8_t **pos,
|
||||
* \c psasim_serialise_psa_hash_operation_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_server_serialise_psa_hash_operation_t_needs(psa_hash_operation_t *value);
|
||||
size_t psasim_server_serialise_psa_hash_operation_t_needs(
|
||||
psa_hash_operation_t *value);
|
||||
|
||||
/** Serialise a `psa_hash_operation_t` into a buffer on the server side.
|
||||
*
|
||||
@ -686,7 +697,8 @@ int psasim_server_deserialise_psa_hash_operation_t(uint8_t **pos,
|
||||
* \c psasim_serialise_psa_aead_operation_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_serialise_psa_aead_operation_t_needs(psa_aead_operation_t value);
|
||||
size_t psasim_serialise_psa_aead_operation_t_needs(
|
||||
psa_aead_operation_t value);
|
||||
|
||||
/** Serialise a `psa_aead_operation_t` into a buffer.
|
||||
*
|
||||
@ -728,7 +740,8 @@ int psasim_deserialise_psa_aead_operation_t(uint8_t **pos,
|
||||
* \c psasim_serialise_psa_aead_operation_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_server_serialise_psa_aead_operation_t_needs(psa_aead_operation_t *value);
|
||||
size_t psasim_server_serialise_psa_aead_operation_t_needs(
|
||||
psa_aead_operation_t *value);
|
||||
|
||||
/** Serialise a `psa_aead_operation_t` into a buffer on the server side.
|
||||
*
|
||||
@ -770,7 +783,8 @@ int psasim_server_deserialise_psa_aead_operation_t(uint8_t **pos,
|
||||
* \c psasim_serialise_psa_key_attributes_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_serialise_psa_key_attributes_t_needs(psa_key_attributes_t value);
|
||||
size_t psasim_serialise_psa_key_attributes_t_needs(
|
||||
psa_key_attributes_t value);
|
||||
|
||||
/** Serialise a `psa_key_attributes_t` into a buffer.
|
||||
*
|
||||
@ -812,7 +826,8 @@ int psasim_deserialise_psa_key_attributes_t(uint8_t **pos,
|
||||
* \c psasim_serialise_psa_mac_operation_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_serialise_psa_mac_operation_t_needs(psa_mac_operation_t value);
|
||||
size_t psasim_serialise_psa_mac_operation_t_needs(
|
||||
psa_mac_operation_t value);
|
||||
|
||||
/** Serialise a `psa_mac_operation_t` into a buffer.
|
||||
*
|
||||
@ -854,7 +869,8 @@ int psasim_deserialise_psa_mac_operation_t(uint8_t **pos,
|
||||
* \c psasim_serialise_psa_mac_operation_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_server_serialise_psa_mac_operation_t_needs(psa_mac_operation_t *value);
|
||||
size_t psasim_server_serialise_psa_mac_operation_t_needs(
|
||||
psa_mac_operation_t *value);
|
||||
|
||||
/** Serialise a `psa_mac_operation_t` into a buffer on the server side.
|
||||
*
|
||||
@ -896,7 +912,8 @@ int psasim_server_deserialise_psa_mac_operation_t(uint8_t **pos,
|
||||
* \c psasim_serialise_psa_cipher_operation_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_serialise_psa_cipher_operation_t_needs(psa_cipher_operation_t value);
|
||||
size_t psasim_serialise_psa_cipher_operation_t_needs(
|
||||
psa_cipher_operation_t value);
|
||||
|
||||
/** Serialise a `psa_cipher_operation_t` into a buffer.
|
||||
*
|
||||
@ -938,7 +955,8 @@ int psasim_deserialise_psa_cipher_operation_t(uint8_t **pos,
|
||||
* \c psasim_serialise_psa_cipher_operation_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_server_serialise_psa_cipher_operation_t_needs(psa_cipher_operation_t *value);
|
||||
size_t psasim_server_serialise_psa_cipher_operation_t_needs(
|
||||
psa_cipher_operation_t *value);
|
||||
|
||||
/** Serialise a `psa_cipher_operation_t` into a buffer on the server side.
|
||||
*
|
||||
@ -980,7 +998,8 @@ int psasim_server_deserialise_psa_cipher_operation_t(uint8_t **pos,
|
||||
* \c psasim_serialise_psa_key_derivation_operation_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_serialise_psa_key_derivation_operation_t_needs(psa_key_derivation_operation_t value);
|
||||
size_t psasim_serialise_psa_key_derivation_operation_t_needs(
|
||||
psa_key_derivation_operation_t value);
|
||||
|
||||
/** Serialise a `psa_key_derivation_operation_t` into a buffer.
|
||||
*
|
||||
@ -1022,7 +1041,8 @@ int psasim_deserialise_psa_key_derivation_operation_t(uint8_t **pos,
|
||||
* \c psasim_serialise_psa_key_derivation_operation_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_server_serialise_psa_key_derivation_operation_t_needs(psa_key_derivation_operation_t *value);
|
||||
size_t psasim_server_serialise_psa_key_derivation_operation_t_needs(
|
||||
psa_key_derivation_operation_t *value);
|
||||
|
||||
/** Serialise a `psa_key_derivation_operation_t` into a buffer on the server side.
|
||||
*
|
||||
@ -1064,7 +1084,8 @@ int psasim_server_deserialise_psa_key_derivation_operation_t(uint8_t **pos,
|
||||
* \c psasim_serialise_psa_sign_hash_interruptible_operation_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_serialise_psa_sign_hash_interruptible_operation_t_needs(psa_sign_hash_interruptible_operation_t value);
|
||||
size_t psasim_serialise_psa_sign_hash_interruptible_operation_t_needs(
|
||||
psa_sign_hash_interruptible_operation_t value);
|
||||
|
||||
/** Serialise a `psa_sign_hash_interruptible_operation_t` into a buffer.
|
||||
*
|
||||
@ -1106,7 +1127,8 @@ int psasim_deserialise_psa_sign_hash_interruptible_operation_t(uint8_t **pos,
|
||||
* \c psasim_serialise_psa_sign_hash_interruptible_operation_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_server_serialise_psa_sign_hash_interruptible_operation_t_needs(psa_sign_hash_interruptible_operation_t *value);
|
||||
size_t psasim_server_serialise_psa_sign_hash_interruptible_operation_t_needs(
|
||||
psa_sign_hash_interruptible_operation_t *value);
|
||||
|
||||
/** Serialise a `psa_sign_hash_interruptible_operation_t` into a buffer on the server side.
|
||||
*
|
||||
@ -1148,7 +1170,8 @@ int psasim_server_deserialise_psa_sign_hash_interruptible_operation_t(uint8_t **
|
||||
* \c psasim_serialise_psa_verify_hash_interruptible_operation_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_serialise_psa_verify_hash_interruptible_operation_t_needs(psa_verify_hash_interruptible_operation_t value);
|
||||
size_t psasim_serialise_psa_verify_hash_interruptible_operation_t_needs(
|
||||
psa_verify_hash_interruptible_operation_t value);
|
||||
|
||||
/** Serialise a `psa_verify_hash_interruptible_operation_t` into a buffer.
|
||||
*
|
||||
@ -1190,7 +1213,8 @@ int psasim_deserialise_psa_verify_hash_interruptible_operation_t(uint8_t **pos,
|
||||
* \c psasim_serialise_psa_verify_hash_interruptible_operation_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_server_serialise_psa_verify_hash_interruptible_operation_t_needs(psa_verify_hash_interruptible_operation_t *value);
|
||||
size_t psasim_server_serialise_psa_verify_hash_interruptible_operation_t_needs(
|
||||
psa_verify_hash_interruptible_operation_t *value);
|
||||
|
||||
/** Serialise a `psa_verify_hash_interruptible_operation_t` into a buffer on the server side.
|
||||
*
|
||||
@ -1232,7 +1256,8 @@ int psasim_server_deserialise_psa_verify_hash_interruptible_operation_t(uint8_t
|
||||
* \c psasim_serialise_mbedtls_svc_key_id_t() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_serialise_mbedtls_svc_key_id_t_needs(mbedtls_svc_key_id_t value);
|
||||
size_t psasim_serialise_mbedtls_svc_key_id_t_needs(
|
||||
mbedtls_svc_key_id_t value);
|
||||
|
||||
/** Serialise a `mbedtls_svc_key_id_t` into a buffer.
|
||||
*
|
||||
|
@ -145,7 +145,8 @@ sub declare_needs
|
||||
* \\c psasim_serialise_$type_d() to serialise
|
||||
* the given value.
|
||||
*/
|
||||
size_t psasim_${server}serialise_${type_d}_needs($type ${ptr}value);
|
||||
size_t psasim_${server}serialise_${type_d}_needs(
|
||||
$type ${ptr}value);
|
||||
EOF
|
||||
}
|
||||
|
||||
@ -451,7 +452,8 @@ sub define_needs
|
||||
|
||||
return <<EOF;
|
||||
|
||||
size_t psasim_serialise_${type_d}_needs($type value)
|
||||
size_t psasim_serialise_${type_d}_needs(
|
||||
$type value)
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
@ -467,7 +469,8 @@ sub define_server_needs
|
||||
|
||||
return <<EOF;
|
||||
|
||||
size_t psasim_server_serialise_${type_d}_needs($type *operation)
|
||||
size_t psasim_server_serialise_${type_d}_needs(
|
||||
$type *operation)
|
||||
{
|
||||
(void) operation;
|
||||
|
||||
@ -489,7 +492,8 @@ sub define_needs_isa
|
||||
|
||||
return <<EOF;
|
||||
|
||||
size_t psasim_serialise_${type_d}_needs($type value)
|
||||
size_t psasim_serialise_${type_d}_needs(
|
||||
$type value)
|
||||
{
|
||||
return psasim_serialise_${isa_d}_needs(value);
|
||||
}
|
||||
@ -857,7 +861,7 @@ int psasim_deserialise_psa_key_production_parameters_t(uint8_t **pos,
|
||||
}
|
||||
memcpy(data_length, *pos, sizeof(*data_length));
|
||||
|
||||
if ((size_t)len != (sizeof(data_length) + sizeof(**params) + *data_length)) {
|
||||
if ((size_t) len != (sizeof(data_length) + sizeof(**params) + *data_length)) {
|
||||
return 0; /* wrong length */
|
||||
}
|
||||
|
||||
@ -968,8 +972,10 @@ sub define_operation_type_data_and_functions
|
||||
|
||||
return <<EOF;
|
||||
|
||||
static psa_${type}_operation_t ${type}_operations[MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t ${type}_operation_handles[MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psa_${type}_operation_t ${type}_operations[
|
||||
MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t ${type}_operation_handles[
|
||||
MAX_LIVE_HANDLES_PER_CLASS];
|
||||
static psasim_client_handle_t next_${type}_operation_handle = 1;
|
||||
|
||||
/* Get a free slot */
|
||||
@ -1105,8 +1111,10 @@ EOF
|
||||
my $what = $1; # e.g. "hash_operation"
|
||||
|
||||
$code .= <<EOF;
|
||||
memset(${what}_handles, 0, sizeof(${what}_handles));
|
||||
memset(${what}s, 0, sizeof(${what}s));
|
||||
memset(${what}_handles, 0,
|
||||
sizeof(${what}_handles));
|
||||
memset(${what}s, 0,
|
||||
sizeof(${what}s));
|
||||
EOF
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user