block: fix dangling bs->explicit_options in block.c
[qemu/ar7.git] / crypto / cipherpriv.h
blob77da4c2f321ea3fb4b70cdd2963ceb3ec02e2a9c
1 /*
2 * QEMU Crypto cipher driver supports
4 * Copyright (c) 2017 HUAWEI TECHNOLOGIES CO., LTD.
6 * Authors:
7 * Longpeng(Mike) <longpeng2@huawei.com>
9 * This work is licensed under the terms of the GNU GPL, version 2 or
10 * (at your option) any later version. See the COPYING file in the
11 * top-level directory.
15 #ifndef QCRYPTO_CIPHERPRIV_H
16 #define QCRYPTO_CIPHERPRIV_H
18 #include "qapi-types.h"
20 typedef struct QCryptoCipherDriver QCryptoCipherDriver;
22 struct QCryptoCipherDriver {
23 int (*cipher_encrypt)(QCryptoCipher *cipher,
24 const void *in,
25 void *out,
26 size_t len,
27 Error **errp);
29 int (*cipher_decrypt)(QCryptoCipher *cipher,
30 const void *in,
31 void *out,
32 size_t len,
33 Error **errp);
35 int (*cipher_setiv)(QCryptoCipher *cipher,
36 const uint8_t *iv, size_t niv,
37 Error **errp);
39 void (*cipher_free)(QCryptoCipher *cipher);
42 #ifdef CONFIG_AF_ALG
44 #include "afalgpriv.h"
46 extern QCryptoAFAlg *
47 qcrypto_afalg_cipher_ctx_new(QCryptoCipherAlgorithm alg,
48 QCryptoCipherMode mode,
49 const uint8_t *key,
50 size_t nkey, Error **errp);
52 extern struct QCryptoCipherDriver qcrypto_cipher_afalg_driver;
54 #endif
56 #endif