summary refs log tree commit diff stats
path: root/include/crypto/hmac.h
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2019-07-23 15:29:40 +0100
committerDaniel P. Berrangé <berrange@redhat.com>2019-08-22 10:47:12 +0100
commit133cf1e5b1a9a3cc6f1e47e5edad67d000259dd6 (patch)
tree74c690191bb11a19e2a32a2440bf0af4f9d44d75 /include/crypto/hmac.h
parent00f2cfbbec63fb6f5a7789797a62ccedd22466ea (diff)
downloadfocaccia-qemu-133cf1e5b1a9a3cc6f1e47e5edad67d000259dd6.tar.gz
focaccia-qemu-133cf1e5b1a9a3cc6f1e47e5edad67d000259dd6.zip
crypto: define cleanup functions for use with g_autoptr
Allow crypto structs to be used with g_autoptr, avoiding the need to
explicitly call XXX_free() functions when variables go out of scope on
the stack.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'include/crypto/hmac.h')
-rw-r--r--include/crypto/hmac.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/crypto/hmac.h b/include/crypto/hmac.h
index aa3c97a2ff..ad4d778416 100644
--- a/include/crypto/hmac.h
+++ b/include/crypto/hmac.h
@@ -65,6 +65,8 @@ QCryptoHmac *qcrypto_hmac_new(QCryptoHashAlgorithm alg,
  */
 void qcrypto_hmac_free(QCryptoHmac *hmac);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoHmac, qcrypto_hmac_free)
+
 /**
  * qcrypto_hmac_bytesv:
  * @hmac: the hmac object