mirror of
https://github.com/cuberite/polarssl.git
synced 2025-09-29 08:24:11 -04:00
Have psa_sim_serialise.pl generate psa_sim_serialize_reset()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
This commit is contained in:
parent
aaf7e859a4
commit
2468896857
@ -711,4 +711,6 @@ void psa_sim_serialize_reset(void)
|
|||||||
{
|
{
|
||||||
memset(hash_operation_handles, 0, sizeof(hash_operation_handles));
|
memset(hash_operation_handles, 0, sizeof(hash_operation_handles));
|
||||||
memset(hash_operations, 0, sizeof(hash_operations));
|
memset(hash_operations, 0, sizeof(hash_operations));
|
||||||
|
memset(aead_operation_handles, 0, sizeof(aead_operation_handles));
|
||||||
|
memset(aead_operations, 0, sizeof(aead_operations));
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,10 @@
|
|||||||
* don't contain pointers.
|
* don't contain pointers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** Reset all operation slots.
|
||||||
|
*
|
||||||
|
* Should be called when all clients have disconnected.
|
||||||
|
*/
|
||||||
void psa_sim_serialize_reset(void);
|
void psa_sim_serialize_reset(void);
|
||||||
|
|
||||||
/** Return how much buffer space is needed by \c psasim_serialise_begin().
|
/** Return how much buffer space is needed by \c psasim_serialise_begin().
|
||||||
|
@ -105,6 +105,7 @@ if ($which eq "h") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print define_server_serialize_reset(@types);
|
||||||
} else {
|
} else {
|
||||||
die("internal error - shouldn't happen");
|
die("internal error - shouldn't happen");
|
||||||
}
|
}
|
||||||
@ -329,6 +330,12 @@ sub h_header
|
|||||||
* don't contain pointers.
|
* don't contain pointers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** Reset all operation slots.
|
||||||
|
*
|
||||||
|
* Should be called when all clients have disconnected.
|
||||||
|
*/
|
||||||
|
void psa_sim_serialize_reset(void);
|
||||||
|
|
||||||
/** Return how much buffer space is needed by \c psasim_serialise_begin().
|
/** Return how much buffer space is needed by \c psasim_serialise_begin().
|
||||||
*
|
*
|
||||||
* \return The number of bytes needed in the buffer for
|
* \return The number of bytes needed in the buffer for
|
||||||
@ -907,6 +914,33 @@ int psasim_deserialise_begin(uint8_t **pos, size_t *remaining)
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Return the code for psa_sim_serialize_reset()
|
||||||
|
sub define_server_serialize_reset
|
||||||
|
{
|
||||||
|
my @types = @_;
|
||||||
|
|
||||||
|
my $code = <<EOF;
|
||||||
|
|
||||||
|
void psa_sim_serialize_reset(void)
|
||||||
|
{
|
||||||
|
EOF
|
||||||
|
|
||||||
|
for my $type (@types) {
|
||||||
|
next unless $type =~ /^psa_(\w+_operation)_t$/;
|
||||||
|
|
||||||
|
my $what = $1; # e.g. "hash_operation"
|
||||||
|
|
||||||
|
$code .= <<EOF;
|
||||||
|
memset(${what}_handles, 0, sizeof(${what}_handles));
|
||||||
|
memset(${what}s, 0, sizeof(${what}s));
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
$code .= <<EOF;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
# Horrible way to align first, second and third lines of function signature to
|
# Horrible way to align first, second and third lines of function signature to
|
||||||
# appease uncrustify (these are the 2nd-4th lines of code, indices 1, 2 and 3)
|
# appease uncrustify (these are the 2nd-4th lines of code, indices 1, 2 and 3)
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user