fw: Protect zeroisation against compiler optimisation.

The memset() responsible for the zeroisation of the secure_ctx under
the compute_cdi() function in FW's main.c, was optimised away by the
compiler. Instead of using memset(), secure_wipe() is introduced
which uses a volatile keyword to prevent the compiler to try to
optimise it. Secure_wipe() is now used on all locations handling
removal of sensitive data.
This commit is contained in:
dehanj 2024-02-02 14:20:21 +01:00
parent c85b5311cd
commit 3a6a60ff26
No known key found for this signature in database
GPG key ID: 3707A9DBF4BB8F1A
3 changed files with 10 additions and 3 deletions

View file

@ -28,5 +28,5 @@ void *memset(void *dest, int c, unsigned n);
void memcpy_s(void *dest, size_t destsize, const void *src, size_t n);
void wordcpy_s(void *dest, size_t destsize, const void *src, size_t n);
int memeq(void *dest, const void *src, size_t n);
void secure_wipe(void *v, size_t n);
#endif