Add more protection to mbedtls_platform_zeroize
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
6147511bc0
commit
ac3cf7c20b
1 changed files with 9 additions and 0 deletions
|
@ -125,6 +125,15 @@ void mbedtls_platform_zeroize(void *buf, size_t len)
|
||||||
SecureZeroMemory(buf, len);
|
SecureZeroMemory(buf, len);
|
||||||
#else
|
#else
|
||||||
memset_func(buf, 0, len);
|
memset_func(buf, 0, len);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
/* For clang and gcc, pretend that we have some assembly that reads the
|
||||||
|
* zero'd memory as an additional protection against being optimised away. */
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wvla"
|
||||||
|
asm volatile ("" : : "m" (*(char (*)[len]) buf) : );
|
||||||
|
#pragma clang diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue