]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virCryptoEncryptDataAESgnutls: Don't secure erase gnutls_datum_t structs
authorPeter Krempa <pkrempa@redhat.com>
Thu, 8 Dec 2022 09:56:28 +0000 (10:56 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 19 Dec 2022 13:40:26 +0000 (14:40 +0100)
'gnutls_datum_t' simply holds pointers to the encryption key and its
length. There's absolutely no point in securely erasing that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/vircrypto.c

index 828e822d8e746e92f6a7d4318dc6d50f12f88a22..1bddb333dcbd533aa254fb0fcc5a8ad0cb19a4e1 100644 (file)
@@ -164,8 +164,6 @@ virCryptoEncryptDataAESgnutls(gnutls_cipher_algorithm_t gnutls_enc_alg,
     /* Encrypt the data and free the memory for cipher operations */
     rc = gnutls_cipher_encrypt(handle, ciphertext, ciphertextlen);
     gnutls_cipher_deinit(handle);
-    virSecureErase(&enc_key, sizeof(gnutls_datum_t));
-    virSecureErase(&iv_buf, sizeof(gnutls_datum_t));
     if (rc < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("failed to encrypt the data: '%s'"),
@@ -180,8 +178,6 @@ virCryptoEncryptDataAESgnutls(gnutls_cipher_algorithm_t gnutls_enc_alg,
  error:
     virSecureErase(ciphertext, ciphertextlen);
     g_free(ciphertext);
-    virSecureErase(&enc_key, sizeof(gnutls_datum_t));
-    virSecureErase(&iv_buf, sizeof(gnutls_datum_t));
     return -1;
 }