From 288d051494d8dbf5f6b24e503433284b5b6f2d53 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 1 Feb 2021 14:13:53 +0100 Subject: [PATCH] virCryptoEncryptDataAESgnutls: Use virSecureErase instead of VIR_DISPOSE_N MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Daniel P. Berrangé --- src/util/vircrypto.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/vircrypto.c b/src/util/vircrypto.c index c4874550af..d2a42d83e2 100644 --- a/src/util/vircrypto.c +++ b/src/util/vircrypto.c @@ -25,6 +25,7 @@ #include "virerror.h" #include "viralloc.h" #include "virrandom.h" +#include "virsecureerase.h" #include #include @@ -206,7 +207,8 @@ virCryptoEncryptDataAESgnutls(gnutls_cipher_algorithm_t gnutls_enc_alg, return 0; error: - VIR_DISPOSE_N(ciphertext, ciphertextlen); + virSecureErase(ciphertext, ciphertextlen); + g_free(ciphertext); memset(&enc_key, 0, sizeof(gnutls_datum_t)); memset(&iv_buf, 0, sizeof(gnutls_datum_t)); return -1; -- 2.47.2