linux/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c

// SPDX-License-Identifier: GPL-2.0
/* Marvell OcteonTX CPT driver
 *
 * Copyright (C) 2019 Marvell International Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include <crypto/aes.h>
#include <crypto/authenc.h>
#include <crypto/cryptd.h>
#include <crypto/des.h>
#include <crypto/internal/aead.h>
#include <crypto/sha1.h>
#include <crypto/sha2.h>
#include <crypto/xts.h>
#include <crypto/scatterwalk.h>
#include <linux/rtnetlink.h>
#include <linux/sort.h>
#include <linux/module.h>
#include "otx_cptvf.h"
#include "otx_cptvf_algs.h"
#include "otx_cptvf_reqmgr.h"

#define CPT_MAX_VF_NUM
/* Size of salt in AES GCM mode */
#define AES_GCM_SALT_SIZE
/* Size of IV in AES GCM mode */
#define AES_GCM_IV_SIZE
/* Size of ICV (Integrity Check Value) in AES GCM mode */
#define AES_GCM_ICV_SIZE
/* Offset of IV in AES GCM mode */
#define AES_GCM_IV_OFFSET
#define CONTROL_WORD_LEN
#define KEY2_OFFSET
#define DMA_MODE_FLAG(dma_mode)

/* Truncated SHA digest size */
#define SHA1_TRUNC_DIGEST_SIZE
#define SHA256_TRUNC_DIGEST_SIZE
#define SHA384_TRUNC_DIGEST_SIZE
#define SHA512_TRUNC_DIGEST_SIZE

static DEFINE_MUTEX(mutex);
static int is_crypto_registered;

struct cpt_device_desc {};

struct cpt_device_table {};

static struct cpt_device_table se_devices =;

static struct cpt_device_table ae_devices =;

static inline int get_se_device(struct pci_dev **pdev, int *cpu_num)
{}

static inline int validate_hmac_cipher_null(struct otx_cpt_req_info *cpt_req)
{}

static void otx_cpt_aead_callback(int status, void *arg1, void *arg2)
{}

static void output_iv_copyback(struct crypto_async_request *areq)
{}

static void otx_cpt_skcipher_callback(int status, void *arg1, void *arg2)
{}

static inline void update_input_data(struct otx_cpt_req_info *req_info,
				     struct scatterlist *inp_sg,
				     u32 nbytes, u32 *argcnt)
{}

static inline void update_output_data(struct otx_cpt_req_info *req_info,
				      struct scatterlist *outp_sg,
				      u32 offset, u32 nbytes, u32 *argcnt)
{}

static inline u32 create_ctx_hdr(struct skcipher_request *req, u32 enc,
				 u32 *argcnt)
{}

static inline u32 create_input_list(struct skcipher_request *req, u32 enc,
				    u32 enc_iv_len)
{}

static inline void create_output_list(struct skcipher_request *req,
				      u32 enc_iv_len)
{}

static inline int cpt_enc_dec(struct skcipher_request *req, u32 enc)
{}

static int otx_cpt_skcipher_encrypt(struct skcipher_request *req)
{}

static int otx_cpt_skcipher_decrypt(struct skcipher_request *req)
{}

static int otx_cpt_skcipher_xts_setkey(struct crypto_skcipher *tfm,
				       const u8 *key, u32 keylen)
{}

static int cpt_des_setkey(struct crypto_skcipher *tfm, const u8 *key,
			  u32 keylen, u8 cipher_type)
{}

static int cpt_aes_setkey(struct crypto_skcipher *tfm, const u8 *key,
			  u32 keylen, u8 cipher_type)
{}

static int otx_cpt_skcipher_cbc_aes_setkey(struct crypto_skcipher *tfm,
					   const u8 *key, u32 keylen)
{}

static int otx_cpt_skcipher_ecb_aes_setkey(struct crypto_skcipher *tfm,
					   const u8 *key, u32 keylen)
{}

static int otx_cpt_skcipher_cbc_des3_setkey(struct crypto_skcipher *tfm,
					    const u8 *key, u32 keylen)
{}

static int otx_cpt_skcipher_ecb_des3_setkey(struct crypto_skcipher *tfm,
					    const u8 *key, u32 keylen)
{}

static int otx_cpt_enc_dec_init(struct crypto_skcipher *tfm)
{}

static int cpt_aead_init(struct crypto_aead *tfm, u8 cipher_type, u8 mac_type)
{}

static int otx_cpt_aead_cbc_aes_sha1_init(struct crypto_aead *tfm)
{}

static int otx_cpt_aead_cbc_aes_sha256_init(struct crypto_aead *tfm)
{}

static int otx_cpt_aead_cbc_aes_sha384_init(struct crypto_aead *tfm)
{}

static int otx_cpt_aead_cbc_aes_sha512_init(struct crypto_aead *tfm)
{}

static int otx_cpt_aead_ecb_null_sha1_init(struct crypto_aead *tfm)
{}

static int otx_cpt_aead_ecb_null_sha256_init(struct crypto_aead *tfm)
{}

static int otx_cpt_aead_ecb_null_sha384_init(struct crypto_aead *tfm)
{}

static int otx_cpt_aead_ecb_null_sha512_init(struct crypto_aead *tfm)
{}

static int otx_cpt_aead_gcm_aes_init(struct crypto_aead *tfm)
{}

static void otx_cpt_aead_exit(struct crypto_aead *tfm)
{}

/*
 * This is the Integrity Check Value validation (aka the authentication tag
 * length)
 */
static int otx_cpt_aead_set_authsize(struct crypto_aead *tfm,
				     unsigned int authsize)
{}

static struct otx_cpt_sdesc *alloc_sdesc(struct crypto_shash *alg)
{}

static inline void swap_data32(void *buf, u32 len)
{}

static inline void swap_data64(void *buf, u32 len)
{}

static int copy_pad(u8 mac_type, u8 *out_pad, u8 *in_pad)
{}

static int aead_hmac_init(struct crypto_aead *cipher)
{}

static int otx_cpt_aead_cbc_aes_sha_setkey(struct crypto_aead *cipher,
					   const unsigned char *key,
					   unsigned int keylen)
{}

static int otx_cpt_aead_ecb_null_sha_setkey(struct crypto_aead *cipher,
					    const unsigned char *key,
					    unsigned int keylen)
{}

static int otx_cpt_aead_gcm_aes_setkey(struct crypto_aead *cipher,
				       const unsigned char *key,
				       unsigned int keylen)
{}

static inline u32 create_aead_ctx_hdr(struct aead_request *req, u32 enc,
				      u32 *argcnt)
{}

static inline u32 create_hmac_ctx_hdr(struct aead_request *req, u32 *argcnt,
				      u32 enc)
{}

static inline u32 create_aead_input_list(struct aead_request *req, u32 enc)
{}

static inline u32 create_aead_output_list(struct aead_request *req, u32 enc,
					  u32 mac_len)
{}

static inline u32 create_aead_null_input_list(struct aead_request *req,
					      u32 enc, u32 mac_len)
{}

static inline u32 create_aead_null_output_list(struct aead_request *req,
					       u32 enc, u32 mac_len)
{}

static u32 cpt_aead_enc_dec(struct aead_request *req, u8 reg_type, u8 enc)
{}

static int otx_cpt_aead_encrypt(struct aead_request *req)
{}

static int otx_cpt_aead_decrypt(struct aead_request *req)
{}

static int otx_cpt_aead_null_encrypt(struct aead_request *req)
{}

static int otx_cpt_aead_null_decrypt(struct aead_request *req)
{}

static struct skcipher_alg otx_cpt_skciphers[] =;

static struct aead_alg otx_cpt_aeads[] =;

static inline int is_any_alg_used(void)
{}

static inline int cpt_register_algs(void)
{}

static inline void cpt_unregister_algs(void)
{}

static int compare_func(const void *lptr, const void *rptr)
{}

static void swap_func(void *lptr, void *rptr, int size)
{}

int otx_cpt_crypto_init(struct pci_dev *pdev, struct module *mod,
			enum otx_cptpf_type pf_type,
			enum otx_cptvf_type engine_type,
			int num_queues, int num_devices)
{}

void otx_cpt_crypto_exit(struct pci_dev *pdev, struct module *mod,
			 enum otx_cptvf_type engine_type)
{}