linux/drivers/crypto/starfive/jh7110-aes.c

// SPDX-License-Identifier: GPL-2.0
/*
 * StarFive AES acceleration driver
 *
 * Copyright (c) 2022 StarFive Technology
 */

#include <crypto/engine.h>
#include <crypto/gcm.h>
#include <crypto/internal/aead.h>
#include <crypto/internal/skcipher.h>
#include <crypto/scatterwalk.h>
#include "jh7110-cryp.h"
#include <linux/err.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/string.h>

#define STARFIVE_AES_REGS_OFFSET
#define STARFIVE_AES_AESDIO0R
#define STARFIVE_AES_KEY0
#define STARFIVE_AES_KEY1
#define STARFIVE_AES_KEY2
#define STARFIVE_AES_KEY3
#define STARFIVE_AES_KEY4
#define STARFIVE_AES_KEY5
#define STARFIVE_AES_KEY6
#define STARFIVE_AES_KEY7
#define STARFIVE_AES_CSR
#define STARFIVE_AES_IV0
#define STARFIVE_AES_IV1
#define STARFIVE_AES_IV2
#define STARFIVE_AES_IV3
#define STARFIVE_AES_NONCE0
#define STARFIVE_AES_NONCE1
#define STARFIVE_AES_NONCE2
#define STARFIVE_AES_NONCE3
#define STARFIVE_AES_ALEN0
#define STARFIVE_AES_ALEN1
#define STARFIVE_AES_MLEN0
#define STARFIVE_AES_MLEN1
#define STARFIVE_AES_IVLEN

#define FLG_MODE_MASK
#define FLG_ENCRYPT

/* Misc */
#define CCM_B0_ADATA
#define AES_BLOCK_32

static inline int starfive_aes_wait_busy(struct starfive_cryp_dev *cryp)
{}

static inline int starfive_aes_wait_keydone(struct starfive_cryp_dev *cryp)
{}

static inline int starfive_aes_wait_gcmdone(struct starfive_cryp_dev *cryp)
{}

static inline int is_gcm(struct starfive_cryp_dev *cryp)
{}

static inline bool is_encrypt(struct starfive_cryp_dev *cryp)
{}

static void starfive_aes_aead_hw_start(struct starfive_cryp_ctx *ctx, u32 hw_mode)
{}

static inline void starfive_aes_set_alen(struct starfive_cryp_ctx *ctx)
{}

static inline void starfive_aes_set_mlen(struct starfive_cryp_ctx *ctx)
{}

static inline int starfive_aes_ccm_check_iv(const u8 *iv)
{}

static int starfive_aes_write_iv(struct starfive_cryp_ctx *ctx, u32 *iv)
{}

static inline void starfive_aes_get_iv(struct starfive_cryp_dev *cryp, u32 *iv)
{}

static inline void starfive_aes_write_nonce(struct starfive_cryp_ctx *ctx, u32 *nonce)
{}

static int starfive_aes_write_key(struct starfive_cryp_ctx *ctx)
{}

static int starfive_aes_ccm_init(struct starfive_cryp_ctx *ctx)
{}

static int starfive_aes_hw_init(struct starfive_cryp_ctx *ctx)
{}

static int starfive_aes_read_authtag(struct starfive_cryp_ctx *ctx)
{}

static void starfive_aes_finish_req(struct starfive_cryp_ctx *ctx)
{}

static int starfive_aes_gcm_write_adata(struct starfive_cryp_ctx *ctx)
{}

static int starfive_aes_ccm_write_adata(struct starfive_cryp_ctx *ctx)
{}

static void starfive_aes_dma_done(void *param)
{}

static void starfive_aes_dma_init(struct starfive_cryp_dev *cryp)
{}

static int starfive_aes_dma_xfer(struct starfive_cryp_dev *cryp,
				 struct scatterlist *src,
				 struct scatterlist *dst,
				 int len)
{}

static int starfive_aes_map_sg(struct starfive_cryp_dev *cryp,
			       struct scatterlist *src,
			       struct scatterlist *dst)
{}

static int starfive_aes_do_one_req(struct crypto_engine *engine, void *areq)
{}

static int starfive_aes_init_tfm(struct crypto_skcipher *tfm,
				 const char *alg_name)
{}

static void starfive_aes_exit_tfm(struct crypto_skcipher *tfm)
{}

static int starfive_aes_aead_do_one_req(struct crypto_engine *engine, void *areq)
{}

static int starfive_aes_aead_init_tfm(struct crypto_aead *tfm,
				      const char *alg_name)
{}

static void starfive_aes_aead_exit_tfm(struct crypto_aead *tfm)
{}

static bool starfive_aes_check_unaligned(struct starfive_cryp_dev *cryp,
					 struct scatterlist *src,
					 struct scatterlist *dst)
{}

static int starfive_aes_do_fallback(struct skcipher_request *req, bool enc)
{}

static int starfive_aes_crypt(struct skcipher_request *req, unsigned long flags)
{}

static int starfive_aes_aead_do_fallback(struct aead_request *req, bool enc)
{}

static int starfive_aes_aead_crypt(struct aead_request *req, unsigned long flags)
{}

static int starfive_aes_setkey(struct crypto_skcipher *tfm, const u8 *key,
			       unsigned int keylen)
{}

static int starfive_aes_aead_setkey(struct crypto_aead *tfm, const u8 *key,
				    unsigned int keylen)
{}

static int starfive_aes_gcm_setauthsize(struct crypto_aead *tfm,
					unsigned int authsize)
{}

static int starfive_aes_ccm_setauthsize(struct crypto_aead *tfm,
					unsigned int authsize)
{}

static int starfive_aes_ecb_encrypt(struct skcipher_request *req)
{}

static int starfive_aes_ecb_decrypt(struct skcipher_request *req)
{}

static int starfive_aes_cbc_encrypt(struct skcipher_request *req)
{}

static int starfive_aes_cbc_decrypt(struct skcipher_request *req)
{}

static int starfive_aes_ctr_encrypt(struct skcipher_request *req)
{}

static int starfive_aes_ctr_decrypt(struct skcipher_request *req)
{}

static int starfive_aes_gcm_encrypt(struct aead_request *req)
{}

static int starfive_aes_gcm_decrypt(struct aead_request *req)
{}

static int starfive_aes_ccm_encrypt(struct aead_request *req)
{}

static int starfive_aes_ccm_decrypt(struct aead_request *req)
{}

static int starfive_aes_ecb_init_tfm(struct crypto_skcipher *tfm)
{}

static int starfive_aes_cbc_init_tfm(struct crypto_skcipher *tfm)
{}

static int starfive_aes_ctr_init_tfm(struct crypto_skcipher *tfm)
{}

static int starfive_aes_ccm_init_tfm(struct crypto_aead *tfm)
{}

static int starfive_aes_gcm_init_tfm(struct crypto_aead *tfm)
{}

static struct skcipher_engine_alg skcipher_algs[] =;

static struct aead_engine_alg aead_algs[] =;

int starfive_aes_register_algs(void)
{}

void starfive_aes_unregister_algs(void)
{}