/* Encrypt the data and free the memory for cipher operations */
rc = gnutls_cipher_encrypt(handle, ciphertext, ciphertextlen);
gnutls_cipher_deinit(handle);
- memset(&enc_key, 0, sizeof(gnutls_datum_t));
- memset(&iv_buf, 0, sizeof(gnutls_datum_t));
+ 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'"),
error:
virSecureErase(ciphertext, ciphertextlen);
g_free(ciphertext);
- memset(&enc_key, 0, sizeof(gnutls_datum_t));
- memset(&iv_buf, 0, sizeof(gnutls_datum_t));
+ virSecureErase(&enc_key, sizeof(gnutls_datum_t));
+ virSecureErase(&iv_buf, sizeof(gnutls_datum_t));
return -1;
}