diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2020-08-28 10:05:15 -0700 |
---|---|---|
committer | Daniel P. Berrangé <berrange@redhat.com> | 2020-09-10 11:02:23 +0100 |
commit | da30cd77e1dab21560286627eea9609e8a460ce9 (patch) | |
tree | c8103abec4c8d3cea5c8c16ffab81953c691f386 /crypto/cipher-afalg.c | |
parent | 3eedf5cc9d45f94e2fd229f0a7aaca556a4ac734 (diff) | |
download | qemu-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-afalg.c')
-rw-r--r-- | crypto/cipher-afalg.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/cipher-afalg.c b/crypto/cipher-afalg.c index 86e5249..052355a 100644 --- a/crypto/cipher-afalg.c +++ b/crypto/cipher-afalg.c @@ -58,6 +58,8 @@ qcrypto_afalg_cipher_format_name(QCryptoCipherAlgorithm alg, return name; } +static const struct QCryptoCipherDriver qcrypto_cipher_afalg_driver; + QCryptoCipher * qcrypto_afalg_cipher_ctx_new(QCryptoCipherAlgorithm alg, QCryptoCipherMode mode, @@ -109,6 +111,7 @@ qcrypto_afalg_cipher_ctx_new(QCryptoCipherAlgorithm alg, } afalg->cmsg = CMSG_FIRSTHDR(afalg->msg); + afalg->base.driver = &qcrypto_cipher_afalg_driver; return &afalg->base; } @@ -222,7 +225,7 @@ static void qcrypto_afalg_comm_ctx_free(QCryptoCipher *cipher) qcrypto_afalg_comm_free(afalg); } -const struct QCryptoCipherDriver qcrypto_cipher_afalg_driver = { +static const struct QCryptoCipherDriver qcrypto_cipher_afalg_driver = { .cipher_encrypt = qcrypto_afalg_cipher_encrypt, .cipher_decrypt = qcrypto_afalg_cipher_decrypt, .cipher_setiv = qcrypto_afalg_cipher_setiv, |