summary refs log tree commit diff stats
path: root/crypto/cipher-gcrypt.c.inc
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2020-08-28 10:05:15 -0700
committerDaniel P. Berrangé <berrange@redhat.com>2020-09-10 11:02:23 +0100
commitda30cd77e1dab21560286627eea9609e8a460ce9 (patch)
treec8103abec4c8d3cea5c8c16ffab81953c691f386 /crypto/cipher-gcrypt.c.inc
parent3eedf5cc9d45f94e2fd229f0a7aaca556a4ac734 (diff)
downloadfocaccia-qemu-da30cd77e1dab21560286627eea9609e8a460ce9.tar.gz
focaccia-qemu-da30cd77e1dab21560286627eea9609e8a460ce9.zip
crypto: Move cipher->driver init to qcrypto_*_cipher_ctx_new
The class vtable should be set by the class initializer.
This will also allow additional subclassing, reducing the
amount of indirection in the hierarchy.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'crypto/cipher-gcrypt.c.inc')
-rw-r--r--crypto/cipher-gcrypt.c.inc2
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/cipher-gcrypt.c.inc b/crypto/cipher-gcrypt.c.inc
index 3b3c85e265..7a1fbc9745 100644
--- a/crypto/cipher-gcrypt.c.inc
+++ b/crypto/cipher-gcrypt.c.inc
@@ -24,6 +24,7 @@
 
 #include <gcrypt.h>
 
+static const struct QCryptoCipherDriver qcrypto_cipher_lib_driver;
 
 bool qcrypto_cipher_supports(QCryptoCipherAlgorithm alg,
                              QCryptoCipherMode mode)
@@ -258,6 +259,7 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
     }
 #endif
 
+    ctx->base.driver = &qcrypto_cipher_lib_driver;
     return &ctx->base;
 
  error: