mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
util: implement secure erase with explicit_bzero
This is available on at least FreeBSD and GLibc >= 2.25. Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
03a25597f1
commit
77b9617cd7
@ -537,6 +537,7 @@ libvirt_export_dynamic = cc.first_supported_link_argument([
|
||||
|
||||
functions = [
|
||||
'elf_aux_info',
|
||||
'explicit_bzero',
|
||||
'fallocate',
|
||||
'getauxval',
|
||||
'getegid',
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "virsecureerase.h"
|
||||
|
||||
/**
|
||||
@ -40,7 +42,11 @@ virSecureErase(void *ptr,
|
||||
if (!ptr || size == 0)
|
||||
return;
|
||||
|
||||
#ifdef WITH_EXPLICIT_BZERO
|
||||
explicit_bzero(ptr, size);
|
||||
#else
|
||||
memset(ptr, 0, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user