#include <linux/kernel.h>
#include <linux/module.h>
#include <crypto/algapi.h>
#include <crypto/internal/skcipher.h>
#include <crypto/internal/des.h>
#include <crypto/xts.h>
#include <crypto/sm4.h>
#include <crypto/scatterwalk.h>
#include "cc_driver.h"
#include "cc_lli_defs.h"
#include "cc_buffer_mgr.h"
#include "cc_cipher.h"
#include "cc_request_mgr.h"
#define MAX_SKCIPHER_SEQ_LEN …
#define template_skcipher …
struct cc_user_key_info { … };
struct cc_hw_key_info { … };
struct cc_cpp_key_info { … };
enum cc_key_type { … };
struct cc_cipher_ctx { … };
static void cc_cipher_complete(struct device *dev, void *cc_req, int err);
static inline enum cc_key_type cc_key_type(struct crypto_tfm *tfm)
{ … }
static int validate_keys_sizes(struct cc_cipher_ctx *ctx_p, u32 size)
{ … }
static int validate_data_size(struct cc_cipher_ctx *ctx_p,
unsigned int size)
{ … }
static int cc_cipher_init(struct crypto_tfm *tfm)
{ … }
static void cc_cipher_exit(struct crypto_tfm *tfm)
{ … }
static enum cc_hw_crypto_key cc_slot_to_hw_key(u8 slot_num)
{ … }
static u8 cc_slot_to_cpp_key(u8 slot_num)
{ … }
static inline enum cc_key_type cc_slot_to_key_type(u8 slot_num)
{ … }
static int cc_cipher_sethkey(struct crypto_skcipher *sktfm, const u8 *key,
unsigned int keylen)
{ … }
static int cc_cipher_setkey(struct crypto_skcipher *sktfm, const u8 *key,
unsigned int keylen)
{ … }
static int cc_out_setup_mode(struct cc_cipher_ctx *ctx_p)
{ … }
static void cc_setup_readiv_desc(struct crypto_tfm *tfm,
struct cipher_req_ctx *req_ctx,
unsigned int ivsize, struct cc_hw_desc desc[],
unsigned int *seq_size)
{ … }
static void cc_setup_state_desc(struct crypto_tfm *tfm,
struct cipher_req_ctx *req_ctx,
unsigned int ivsize, unsigned int nbytes,
struct cc_hw_desc desc[],
unsigned int *seq_size)
{ … }
static void cc_setup_xex_state_desc(struct crypto_tfm *tfm,
struct cipher_req_ctx *req_ctx,
unsigned int ivsize, unsigned int nbytes,
struct cc_hw_desc desc[],
unsigned int *seq_size)
{ … }
static int cc_out_flow_mode(struct cc_cipher_ctx *ctx_p)
{ … }
static void cc_setup_key_desc(struct crypto_tfm *tfm,
struct cipher_req_ctx *req_ctx,
unsigned int nbytes, struct cc_hw_desc desc[],
unsigned int *seq_size)
{ … }
static void cc_setup_mlli_desc(struct crypto_tfm *tfm,
struct cipher_req_ctx *req_ctx,
struct scatterlist *dst, struct scatterlist *src,
unsigned int nbytes, void *areq,
struct cc_hw_desc desc[], unsigned int *seq_size)
{ … }
static void cc_setup_flow_desc(struct crypto_tfm *tfm,
struct cipher_req_ctx *req_ctx,
struct scatterlist *dst, struct scatterlist *src,
unsigned int nbytes, struct cc_hw_desc desc[],
unsigned int *seq_size)
{ … }
static void cc_cipher_complete(struct device *dev, void *cc_req, int err)
{ … }
static int cc_cipher_process(struct skcipher_request *req,
enum drv_crypto_direction direction)
{ … }
static int cc_cipher_encrypt(struct skcipher_request *req)
{ … }
static int cc_cipher_decrypt(struct skcipher_request *req)
{ … }
static const struct cc_alg_template skcipher_algs[] = …;
static struct cc_crypto_alg *cc_create_alg(const struct cc_alg_template *tmpl,
struct device *dev)
{ … }
int cc_cipher_free(struct cc_drvdata *drvdata)
{ … }
int cc_cipher_alloc(struct cc_drvdata *drvdata)
{ … }