mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
virCryptoEncryptDataAESgnutls: Use virSecureErase instead of VIR_DISPOSE_N
Clear out the value using virSecureErase and free it with g_free so that VIR_DISPOSE_N can be phased out. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
549305922a
commit
288d051494
@ -25,6 +25,7 @@
|
|||||||
#include "virerror.h"
|
#include "virerror.h"
|
||||||
#include "viralloc.h"
|
#include "viralloc.h"
|
||||||
#include "virrandom.h"
|
#include "virrandom.h"
|
||||||
|
#include "virsecureerase.h"
|
||||||
|
|
||||||
#include <gnutls/gnutls.h>
|
#include <gnutls/gnutls.h>
|
||||||
#include <gnutls/crypto.h>
|
#include <gnutls/crypto.h>
|
||||||
@ -206,7 +207,8 @@ virCryptoEncryptDataAESgnutls(gnutls_cipher_algorithm_t gnutls_enc_alg,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
VIR_DISPOSE_N(ciphertext, ciphertextlen);
|
virSecureErase(ciphertext, ciphertextlen);
|
||||||
|
g_free(ciphertext);
|
||||||
memset(&enc_key, 0, sizeof(gnutls_datum_t));
|
memset(&enc_key, 0, sizeof(gnutls_datum_t));
|
||||||
memset(&iv_buf, 0, sizeof(gnutls_datum_t));
|
memset(&iv_buf, 0, sizeof(gnutls_datum_t));
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user