1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef QCRYPTO_CIPHERPRIV_H
16#define QCRYPTO_CIPHERPRIV_H
17
18#include "qapi/qapi-types-crypto.h"
19
20typedef struct QCryptoCipherDriver QCryptoCipherDriver;
21
22struct 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
46extern QCryptoAFAlg *
47qcrypto_afalg_cipher_ctx_new(QCryptoCipherAlgorithm alg,
48 QCryptoCipherMode mode,
49 const uint8_t *key,
50 size_t nkey, Error **errp);
51
52extern struct QCryptoCipherDriver qcrypto_cipher_afalg_driver;
53
54#endif
55
56#endif
57