Merge branch 'akpm' (patches from Andrew)
[linux/fpc-iii.git] / drivers / crypto / qce / cipher.h
blob7770660bc8533e2d8882e7f13c4c00261b8403ee
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
4 */
6 #ifndef _CIPHER_H_
7 #define _CIPHER_H_
9 #include "common.h"
10 #include "core.h"
12 #define QCE_MAX_KEY_SIZE 64
14 struct qce_cipher_ctx {
15 u8 enc_key[QCE_MAX_KEY_SIZE];
16 unsigned int enc_keylen;
17 struct crypto_sync_skcipher *fallback;
20 /**
21 * struct qce_cipher_reqctx - holds private cipher objects per request
22 * @flags: operation flags
23 * @iv: pointer to the IV
24 * @ivsize: IV size
25 * @src_nents: source entries
26 * @dst_nents: destination entries
27 * @result_sg: scatterlist used for result buffer
28 * @dst_tbl: destination sg table
29 * @dst_sg: destination sg pointer table beginning
30 * @src_tbl: source sg table
31 * @src_sg: source sg pointer table beginning;
32 * @cryptlen: crypto length
34 struct qce_cipher_reqctx {
35 unsigned long flags;
36 u8 *iv;
37 unsigned int ivsize;
38 int src_nents;
39 int dst_nents;
40 struct scatterlist result_sg;
41 struct sg_table dst_tbl;
42 struct scatterlist *dst_sg;
43 struct sg_table src_tbl;
44 struct scatterlist *src_sg;
45 unsigned int cryptlen;
48 static inline struct qce_alg_template *to_cipher_tmpl(struct crypto_skcipher *tfm)
50 struct skcipher_alg *alg = crypto_skcipher_alg(tfm);
51 return container_of(alg, struct qce_alg_template, alg.skcipher);
54 extern const struct qce_algo_ops skcipher_ops;
56 #endif /* _CIPHER_H_ */