summary refs log tree commit diff stats
path: root/crypto/cipher.c
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.c
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.c')
-rw-r--r--crypto/cipher.c7
1 files changed, 0 insertions, 7 deletions
diff --git a/crypto/cipher.c b/crypto/cipher.c
index 737fc0735d..3711b552fa 100644
--- a/crypto/cipher.c
+++ b/crypto/cipher.c
@@ -164,13 +164,9 @@ QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgorithm alg,
                                   Error **errp)
 {
     QCryptoCipher *cipher = NULL;
-    const QCryptoCipherDriver *drv = NULL;
 
 #ifdef CONFIG_AF_ALG
     cipher = qcrypto_afalg_cipher_ctx_new(alg, mode, key, nkey, NULL);
-    if (cipher) {
-        drv = &qcrypto_cipher_afalg_driver;
-    }
 #endif
 
     if (!cipher) {
@@ -178,13 +174,10 @@ QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgorithm alg,
         if (!cipher) {
             return NULL;
         }
-
-        drv = &qcrypto_cipher_lib_driver;
     }
 
     cipher->alg = alg;
     cipher->mode = mode;
-    cipher->driver = drv;
 
     return cipher;
 }