mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-29 01:03:57 +03:00
priv: Implement explicit_bzero as a function if not available
Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Alberto Aguirre <albaguirre@gmail.com>
This commit is contained in:
11
src/misc.c
11
src/misc.c
@@ -1052,6 +1052,17 @@ int ssh_match_group(const char *group, const char *object)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(HAVE_EXPLICIT_BZERO)
|
||||
void explicit_bzero(void *s, size_t n)
|
||||
{
|
||||
memset(s, '\0', n);
|
||||
#if defined(HAVE_GCC_VOLATILE_MEMORY_PROTECTION)
|
||||
/* See http://llvm.org/bugs/show_bug.cgi?id=15495 */
|
||||
__asm__ volatile("" : : "g"(s) : "memory");
|
||||
#endif /* HAVE_GCC_VOLATILE_MEMORY_PROTECTION */
|
||||
}
|
||||
#endif /* !HAVE_EXPLICIT_BZERO */
|
||||
|
||||
/** @} */
|
||||
|
||||
/* vim: set ts=4 sw=4 et cindent: */
|
||||
|
||||
Reference in New Issue
Block a user