mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
crypto: virtio - Refacotor virtio_crypto driver for new virito crypto services
In current virtio crypto device driver, some common data structures and implementations that should be used by other virtio crypto algorithms (e.g. asymmetric crypto algorithms) introduce symmetric crypto algorithms specific implementations. This patch refactors these pieces of code so that they can be reused by other virtio crypto algorithms. Acked-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Xin Zeng <xin.zeng@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
@@ -83,26 +83,16 @@ struct virtio_crypto_sym_session_info {
|
||||
__u64 session_id;
|
||||
};
|
||||
|
||||
struct virtio_crypto_ablkcipher_ctx {
|
||||
struct virtio_crypto *vcrypto;
|
||||
struct crypto_tfm *tfm;
|
||||
|
||||
struct virtio_crypto_sym_session_info enc_sess_info;
|
||||
struct virtio_crypto_sym_session_info dec_sess_info;
|
||||
};
|
||||
struct virtio_crypto_request;
|
||||
typedef void (*virtio_crypto_data_callback)
|
||||
(struct virtio_crypto_request *vc_req, int len);
|
||||
|
||||
struct virtio_crypto_request {
|
||||
/* Cipher or aead */
|
||||
uint32_t type;
|
||||
uint8_t status;
|
||||
struct virtio_crypto_ablkcipher_ctx *ablkcipher_ctx;
|
||||
struct ablkcipher_request *ablkcipher_req;
|
||||
struct virtio_crypto_op_data_req *req_data;
|
||||
struct scatterlist **sgs;
|
||||
uint8_t *iv;
|
||||
/* Encryption? */
|
||||
bool encrypt;
|
||||
struct data_queue *dataq;
|
||||
virtio_crypto_data_callback alg_cb;
|
||||
};
|
||||
|
||||
int virtcrypto_devmgr_add_dev(struct virtio_crypto *vcrypto_dev);
|
||||
@@ -119,10 +109,6 @@ void virtcrypto_dev_stop(struct virtio_crypto *vcrypto);
|
||||
int virtio_crypto_ablkcipher_crypt_req(
|
||||
struct crypto_engine *engine,
|
||||
struct ablkcipher_request *req);
|
||||
void virtio_crypto_ablkcipher_finalize_req(
|
||||
struct virtio_crypto_request *vc_req,
|
||||
struct ablkcipher_request *req,
|
||||
int err);
|
||||
|
||||
void
|
||||
virtcrypto_clear_request(struct virtio_crypto_request *vc_req);
|
||||
|
||||
Reference in New Issue
Block a user