mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-19 10:05:05 -07:00
Only memset() may have issues with a zero length.
This commit is contained in:
parent
6934a8d0c8
commit
d47ded1867
@ -102,9 +102,6 @@ _sodium_dummy_symbol_to_prevent_memzero_lto(void *const pnt,
|
||||
void
|
||||
sodium_memzero(void * const pnt, const size_t len)
|
||||
{
|
||||
if (len == 0) {
|
||||
return;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
SecureZeroMemory(pnt, len);
|
||||
#elif defined(HAVE_MEMSET_S)
|
||||
@ -116,8 +113,10 @@ sodium_memzero(void * const pnt, const size_t len)
|
||||
#elif defined(HAVE_EXPLICIT_MEMSET)
|
||||
explicit_memset(pnt, 0, len);
|
||||
#elif HAVE_WEAK_SYMBOLS
|
||||
memset(pnt, 0, len);
|
||||
_sodium_dummy_symbol_to_prevent_memzero_lto(pnt, len);
|
||||
if (len > 0U) {
|
||||
memset(pnt, 0, len);
|
||||
_sodium_dummy_symbol_to_prevent_memzero_lto(pnt, len);
|
||||
}
|
||||
# ifdef HAVE_INLINE_ASM
|
||||
__asm__ __volatile__ ("" : : "r"(pnt) : "memory");
|
||||
# endif
|
||||
|
Loading…
Reference in New Issue
Block a user