aboutsummaryrefslogtreecommitdiff
path: root/crypto/cipher-nettle.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-nettle.c.inc
parent3eedf5cc9d45f94e2fd229f0a7aaca556a4ac734 (diff)
downloadqemu-da30cd77e1dab21560286627eea9609e8a460ce9.zip
qemu-da30cd77e1dab21560286627eea9609e8a460ce9.tar.gz
qemu-da30cd77e1dab21560286627eea9609e8a460ce9.tar.bz2
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-nettle.c.inc')
-rw-r--r--crypto/cipher-nettle.c.inc3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/cipher-nettle.c.inc b/crypto/cipher-nettle.c.inc
index d8371d1..36d57ef 100644
--- a/crypto/cipher-nettle.c.inc
+++ b/crypto/cipher-nettle.c.inc
@@ -34,6 +34,8 @@
#include <nettle/xts.h>
#endif
+static const struct QCryptoCipherDriver qcrypto_cipher_lib_driver;
+
typedef void (*QCryptoCipherNettleFuncWrapper)(const void *ctx,
size_t length,
uint8_t *dst,
@@ -587,6 +589,7 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
ctx->iv = g_new0(uint8_t, ctx->blocksize);
+ ctx->base.driver = &qcrypto_cipher_lib_driver;
return &ctx->base;
error: