Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
0004  */
0005 
0006 #ifndef _CIPHER_H_
0007 #define _CIPHER_H_
0008 
0009 #include "common.h"
0010 #include "core.h"
0011 
0012 #define QCE_MAX_KEY_SIZE    64
0013 
0014 struct qce_cipher_ctx {
0015     u8 enc_key[QCE_MAX_KEY_SIZE];
0016     unsigned int enc_keylen;
0017     struct crypto_skcipher *fallback;
0018 };
0019 
0020 /**
0021  * struct qce_cipher_reqctx - holds private cipher objects per request
0022  * @flags: operation flags
0023  * @iv: pointer to the IV
0024  * @ivsize: IV size
0025  * @src_nents: source entries
0026  * @dst_nents: destination entries
0027  * @result_sg: scatterlist used for result buffer
0028  * @dst_tbl: destination sg table
0029  * @dst_sg: destination sg pointer table beginning
0030  * @src_tbl: source sg table
0031  * @src_sg: source sg pointer table beginning;
0032  * @cryptlen: crypto length
0033  */
0034 struct qce_cipher_reqctx {
0035     unsigned long flags;
0036     u8 *iv;
0037     unsigned int ivsize;
0038     int src_nents;
0039     int dst_nents;
0040     struct scatterlist result_sg;
0041     struct sg_table dst_tbl;
0042     struct scatterlist *dst_sg;
0043     struct scatterlist *src_sg;
0044     unsigned int cryptlen;
0045     struct skcipher_request fallback_req;   // keep at the end
0046 };
0047 
0048 static inline struct qce_alg_template *to_cipher_tmpl(struct crypto_skcipher *tfm)
0049 {
0050     struct skcipher_alg *alg = crypto_skcipher_alg(tfm);
0051     return container_of(alg, struct qce_alg_template, alg.skcipher);
0052 }
0053 
0054 extern const struct qce_algo_ops skcipher_ops;
0055 
0056 #endif /* _CIPHER_H_ */