#include "compat.h"
#include "regs.h"
#include "intern.h"
#include "desc_constr.h"
#include "jr.h"
#include "error.h"
#include "sg_sw_sec4.h"
#include "key_gen.h"
#include "caamalg_desc.h"
#include <linux/unaligned.h>
#include <crypto/internal/aead.h>
#include <crypto/internal/engine.h>
#include <crypto/internal/skcipher.h>
#include <crypto/xts.h>
#include <linux/dma-mapping.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/string.h>
#define CAAM_CRA_PRIORITY …
#define CAAM_MAX_KEY_SIZE …
#define AEAD_DESC_JOB_IO_LEN …
#define GCM_DESC_JOB_IO_LEN …
#define AUTHENC_DESC_JOB_IO_LEN …
#define CHACHAPOLY_DESC_JOB_IO_LEN …
#define DESC_MAX_USED_BYTES …
#define DESC_MAX_USED_LEN …
struct caam_alg_entry { … };
struct caam_aead_alg { … };
struct caam_skcipher_alg { … };
struct caam_ctx { … };
struct caam_skcipher_req_ctx { … };
struct caam_aead_req_ctx { … };
static int aead_null_set_sh_desc(struct crypto_aead *aead)
{ … }
static int aead_set_sh_desc(struct crypto_aead *aead)
{ … }
static int aead_setauthsize(struct crypto_aead *authenc,
unsigned int authsize)
{ … }
static int gcm_set_sh_desc(struct crypto_aead *aead)
{ … }
static int gcm_setauthsize(struct crypto_aead *authenc, unsigned int authsize)
{ … }
static int rfc4106_set_sh_desc(struct crypto_aead *aead)
{ … }
static int rfc4106_setauthsize(struct crypto_aead *authenc,
unsigned int authsize)
{ … }
static int rfc4543_set_sh_desc(struct crypto_aead *aead)
{ … }
static int rfc4543_setauthsize(struct crypto_aead *authenc,
unsigned int authsize)
{ … }
static int chachapoly_set_sh_desc(struct crypto_aead *aead)
{ … }
static int chachapoly_setauthsize(struct crypto_aead *aead,
unsigned int authsize)
{ … }
static int chachapoly_setkey(struct crypto_aead *aead, const u8 *key,
unsigned int keylen)
{ … }
static int aead_setkey(struct crypto_aead *aead,
const u8 *key, unsigned int keylen)
{ … }
static int des3_aead_setkey(struct crypto_aead *aead, const u8 *key,
unsigned int keylen)
{ … }
static int gcm_setkey(struct crypto_aead *aead,
const u8 *key, unsigned int keylen)
{ … }
static int rfc4106_setkey(struct crypto_aead *aead,
const u8 *key, unsigned int keylen)
{ … }
static int rfc4543_setkey(struct crypto_aead *aead,
const u8 *key, unsigned int keylen)
{ … }
static int skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key,
unsigned int keylen, const u32 ctx1_iv_off)
{ … }
static int aes_skcipher_setkey(struct crypto_skcipher *skcipher,
const u8 *key, unsigned int keylen)
{ … }
static int rfc3686_skcipher_setkey(struct crypto_skcipher *skcipher,
const u8 *key, unsigned int keylen)
{ … }
static int ctr_skcipher_setkey(struct crypto_skcipher *skcipher,
const u8 *key, unsigned int keylen)
{ … }
static int des_skcipher_setkey(struct crypto_skcipher *skcipher,
const u8 *key, unsigned int keylen)
{ … }
static int des3_skcipher_setkey(struct crypto_skcipher *skcipher,
const u8 *key, unsigned int keylen)
{ … }
static int xts_skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key,
unsigned int keylen)
{ … }
struct aead_edesc { … };
struct skcipher_edesc { … };
static void caam_unmap(struct device *dev, struct scatterlist *src,
struct scatterlist *dst, int src_nents,
int dst_nents,
dma_addr_t iv_dma, int ivsize, dma_addr_t sec4_sg_dma,
int sec4_sg_bytes)
{ … }
static void aead_unmap(struct device *dev,
struct aead_edesc *edesc,
struct aead_request *req)
{ … }
static void skcipher_unmap(struct device *dev, struct skcipher_edesc *edesc,
struct skcipher_request *req)
{ … }
static void aead_crypt_done(struct device *jrdev, u32 *desc, u32 err,
void *context)
{ … }
static inline u8 *skcipher_edesc_iv(struct skcipher_edesc *edesc)
{ … }
static void skcipher_crypt_done(struct device *jrdev, u32 *desc, u32 err,
void *context)
{ … }
static void init_aead_job(struct aead_request *req,
struct aead_edesc *edesc,
bool all_contig, bool encrypt)
{ … }
static void init_gcm_job(struct aead_request *req,
struct aead_edesc *edesc,
bool all_contig, bool encrypt)
{ … }
static void init_chachapoly_job(struct aead_request *req,
struct aead_edesc *edesc, bool all_contig,
bool encrypt)
{ … }
static void init_authenc_job(struct aead_request *req,
struct aead_edesc *edesc,
bool all_contig, bool encrypt)
{ … }
static void init_skcipher_job(struct skcipher_request *req,
struct skcipher_edesc *edesc,
const bool encrypt)
{ … }
static struct aead_edesc *aead_edesc_alloc(struct aead_request *req,
int desc_bytes, bool *all_contig_ptr,
bool encrypt)
{ … }
static int aead_enqueue_req(struct device *jrdev, struct aead_request *req)
{ … }
static inline int chachapoly_crypt(struct aead_request *req, bool encrypt)
{ … }
static int chachapoly_encrypt(struct aead_request *req)
{ … }
static int chachapoly_decrypt(struct aead_request *req)
{ … }
static inline int aead_crypt(struct aead_request *req, bool encrypt)
{ … }
static int aead_encrypt(struct aead_request *req)
{ … }
static int aead_decrypt(struct aead_request *req)
{ … }
static int aead_do_one_req(struct crypto_engine *engine, void *areq)
{ … }
static inline int gcm_crypt(struct aead_request *req, bool encrypt)
{ … }
static int gcm_encrypt(struct aead_request *req)
{ … }
static int gcm_decrypt(struct aead_request *req)
{ … }
static int ipsec_gcm_encrypt(struct aead_request *req)
{ … }
static int ipsec_gcm_decrypt(struct aead_request *req)
{ … }
static struct skcipher_edesc *skcipher_edesc_alloc(struct skcipher_request *req,
int desc_bytes)
{ … }
static int skcipher_do_one_req(struct crypto_engine *engine, void *areq)
{ … }
static inline bool xts_skcipher_ivsize(struct skcipher_request *req)
{ … }
static inline int skcipher_crypt(struct skcipher_request *req, bool encrypt)
{ … }
static int skcipher_encrypt(struct skcipher_request *req)
{ … }
static int skcipher_decrypt(struct skcipher_request *req)
{ … }
static struct caam_skcipher_alg driver_algs[] = …;
static struct caam_aead_alg driver_aeads[] = …;
static int caam_init_common(struct caam_ctx *ctx, struct caam_alg_entry *caam,
bool uses_dkp)
{ … }
static int caam_cra_init(struct crypto_skcipher *tfm)
{ … }
static int caam_aead_init(struct crypto_aead *tfm)
{ … }
static void caam_exit_common(struct caam_ctx *ctx)
{ … }
static void caam_cra_exit(struct crypto_skcipher *tfm)
{ … }
static void caam_aead_exit(struct crypto_aead *tfm)
{ … }
void caam_algapi_exit(void)
{ … }
static void caam_skcipher_alg_init(struct caam_skcipher_alg *t_alg)
{ … }
static void caam_aead_alg_init(struct caam_aead_alg *t_alg)
{ … }
int caam_algapi_init(struct device *ctrldev)
{ … }