Use explicit_bzero if available.

This commit is contained in:
Milan Broz
2018-10-04 15:21:01 +02:00
parent 37e0150f70
commit 9df042c0b8
3 changed files with 9 additions and 1 deletions

View File

@@ -124,8 +124,12 @@ int crypt_storage_encrypt(struct crypt_storage *ctx, uint64_t sector,
/* Memzero helper (memset on stack can be optimized out) */
static inline void crypt_backend_memzero(void *s, size_t n)
{
#ifdef HAVE_EXPLICIT_BZERO
explicit_bzero(s, n);
#else
volatile uint8_t *p = (volatile uint8_t *)s;
while(n--) *p++ = 0;
#endif
}
#endif /* _CRYPTO_BACKEND_H */