57 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2/*3 * Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.4 */5 6#ifndef _CIPHER_H_7#define _CIPHER_H_8 9#include "common.h"10#include "core.h"11 12#define QCE_MAX_KEY_SIZE 6413 14struct qce_cipher_ctx {15 u8 enc_key[QCE_MAX_KEY_SIZE];16 unsigned int enc_keylen;17 struct crypto_skcipher *fallback;18};19 20/**21 * struct qce_cipher_reqctx - holds private cipher objects per request22 * @flags: operation flags23 * @iv: pointer to the IV24 * @ivsize: IV size25 * @src_nents: source entries26 * @dst_nents: destination entries27 * @result_sg: scatterlist used for result buffer28 * @dst_tbl: destination sg table29 * @dst_sg: destination sg pointer table beginning30 * @src_tbl: source sg table31 * @src_sg: source sg pointer table beginning;32 * @cryptlen: crypto length33 */34struct 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 scatterlist *src_sg;44 unsigned int cryptlen;45 struct skcipher_request fallback_req; // keep at the end46};47 48static inline struct qce_alg_template *to_cipher_tmpl(struct crypto_skcipher *tfm)49{50 struct skcipher_alg *alg = crypto_skcipher_alg(tfm);51 return container_of(alg, struct qce_alg_template, alg.skcipher);52}53 54extern const struct qce_algo_ops skcipher_ops;55 56#endif /* _CIPHER_H_ */57