linux/drivers/crypto/hisilicon/sec/sec_algs.c

// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2016-2017 HiSilicon Limited. */
#include <linux/crypto.h>
#include <linux/dma-mapping.h>
#include <linux/dmapool.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/slab.h>

#include <crypto/aes.h>
#include <crypto/algapi.h>
#include <crypto/internal/des.h>
#include <crypto/skcipher.h>
#include <crypto/xts.h>
#include <crypto/internal/skcipher.h>

#include "sec_drv.h"

#define SEC_MAX_CIPHER_KEY
#define SEC_REQ_LIMIT

struct sec_c_alg_cfg {};

static const struct sec_c_alg_cfg sec_c_alg_cfgs[] =;

/*
 * Mutex used to ensure safe operation of reference count of
 * alg providers
 */
static DEFINE_MUTEX(algs_lock);
static unsigned int active_devs;

static void sec_alg_skcipher_init_template(struct sec_alg_tfm_ctx *ctx,
					   struct sec_bd_info *req,
					   enum sec_cipher_alg alg)
{}

static void sec_alg_skcipher_init_context(struct crypto_skcipher *atfm,
					  const u8 *key,
					  unsigned int keylen,
					  enum sec_cipher_alg alg)
{}

static void sec_free_hw_sgl(struct sec_hw_sgl *hw_sgl,
			    dma_addr_t psec_sgl, struct sec_dev_info *info)
{}

static int sec_alloc_and_fill_hw_sgl(struct sec_hw_sgl **sec_sgl,
				     dma_addr_t *psec_sgl,
				     struct scatterlist *sgl,
				     int count,
				     struct sec_dev_info *info,
				     gfp_t gfp)
{}

static int sec_alg_skcipher_setkey(struct crypto_skcipher *tfm,
				   const u8 *key, unsigned int keylen,
				   enum sec_cipher_alg alg)
{}

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

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

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

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

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

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

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

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

static void sec_alg_free_el(struct sec_request_el *el,
			    struct sec_dev_info *info)
{}

/* queuelock must be held */
static int sec_send_request(struct sec_request *sec_req, struct sec_queue *queue)
{}

static void sec_skcipher_alg_callback(struct sec_bd_info *sec_resp,
				      struct crypto_async_request *req_base)
{}

void sec_alg_callback(struct sec_bd_info *resp, void *shadow)
{}

static int sec_alg_alloc_and_calc_split_sizes(int length, size_t **split_sizes,
					      int *steps, gfp_t gfp)
{}

static int sec_map_and_split_sg(struct scatterlist *sgl, size_t *split_sizes,
				int steps, struct scatterlist ***splits,
				int **splits_nents,
				int sgl_len_in,
				struct device *dev, gfp_t gfp)
{}

/*
 * Reverses the sec_map_and_split_sg call for messages not yet added to
 * the queues.
 */
static void sec_unmap_sg_on_err(struct scatterlist *sgl, int steps,
				struct scatterlist **splits, int *splits_nents,
				int sgl_len_in, struct device *dev)
{}

static struct sec_request_el
*sec_alg_alloc_and_fill_el(struct sec_bd_info *template, int encrypt,
			   int el_size, bool different_dest,
			   struct scatterlist *sgl_in, int n_ents_in,
			   struct scatterlist *sgl_out, int n_ents_out,
			   struct sec_dev_info *info, gfp_t gfp)
{}

static int sec_alg_skcipher_crypto(struct skcipher_request *skreq,
				   bool encrypt)
{}

static int sec_alg_skcipher_encrypt(struct skcipher_request *req)
{}

static int sec_alg_skcipher_decrypt(struct skcipher_request *req)
{}

static int sec_alg_skcipher_init(struct crypto_skcipher *tfm)
{}

static void sec_alg_skcipher_exit(struct crypto_skcipher *tfm)
{}

static int sec_alg_skcipher_init_with_queue(struct crypto_skcipher *tfm)
{}

static void sec_alg_skcipher_exit_with_queue(struct crypto_skcipher *tfm)
{}

static struct skcipher_alg sec_algs[] =;

int sec_algs_register(void)
{}

void sec_algs_unregister(void)
{}