qxl: check release info object
[qemu.git] / crypto / cipherpriv.h
1 /*
2 * QEMU Crypto cipher driver supports
3 *
4 * Copyright (c) 2017 HUAWEI TECHNOLOGIES CO., LTD.
5 *
6 * Authors:
7 * Longpeng(Mike) <longpeng2@huawei.com>
8 *
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.
12 *
13 */
14
15 #ifndef QCRYPTO_CIPHERPRIV_H
16 #define QCRYPTO_CIPHERPRIV_H
17
18 #include "qapi/qapi-types-crypto.h"
19
20 typedef struct QCryptoCipherDriver QCryptoCipherDriver;
21
22 struct QCryptoCipherDriver {
23 int (*cipher_encrypt)(QCryptoCipher *cipher,
24 const void *in,
25 void *out,
26 size_t len,
27 Error **errp);
28
29 int (*cipher_decrypt)(QCryptoCipher *cipher,
30 const void *in,
31 void *out,
32 size_t len,
33 Error **errp);
34
35 int (*cipher_setiv)(QCryptoCipher *cipher,
36 const uint8_t *iv, size_t niv,
37 Error **errp);
38
39 void (*cipher_free)(QCryptoCipher *cipher);
40 };
41
42 #ifdef CONFIG_AF_ALG
43
44 #include "afalgpriv.h"
45
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);
51
52 extern struct QCryptoCipherDriver qcrypto_cipher_afalg_driver;
53
54 #endif
55
56 #endif