#define pr_fmt(fmt) …
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/crypto.h>
#include <linux/skbuff.h>
#include <linux/rtnetlink.h>
#include <linux/highmem.h>
#include <linux/scatterlist.h>
#include <crypto/aes.h>
#include <crypto/algapi.h>
#include <crypto/hash.h>
#include <crypto/gcm.h>
#include <crypto/sha1.h>
#include <crypto/sha2.h>
#include <crypto/authenc.h>
#include <crypto/ctr.h>
#include <crypto/gf128mul.h>
#include <crypto/internal/aead.h>
#include <crypto/null.h>
#include <crypto/internal/skcipher.h>
#include <crypto/aead.h>
#include <crypto/scatterwalk.h>
#include <crypto/internal/hash.h>
#include "t4fw_api.h"
#include "t4_msg.h"
#include "chcr_core.h"
#include "chcr_algo.h"
#include "chcr_crypto.h"
#define IV …
static unsigned int sgl_ent_len[] = …;
static unsigned int dsgl_ent_len[] = …;
static u32 round_constant[11] = …;
static int chcr_handle_cipher_resp(struct skcipher_request *req,
unsigned char *input, int err);
static inline struct chcr_aead_ctx *AEAD_CTX(struct chcr_context *ctx)
{ … }
static inline struct ablk_ctx *ABLK_CTX(struct chcr_context *ctx)
{ … }
static inline struct hmac_ctx *HMAC_CTX(struct chcr_context *ctx)
{ … }
static inline struct chcr_gcm_ctx *GCM_CTX(struct chcr_aead_ctx *gctx)
{ … }
static inline struct chcr_authenc_ctx *AUTHENC_CTX(struct chcr_aead_ctx *gctx)
{ … }
static inline struct uld_ctx *ULD_CTX(struct chcr_context *ctx)
{ … }
static inline void chcr_init_hctx_per_wr(struct chcr_ahash_req_ctx *reqctx)
{ … }
static int sg_nents_xlen(struct scatterlist *sg, unsigned int reqlen,
unsigned int entlen,
unsigned int skip)
{ … }
static inline int get_aead_subtype(struct crypto_aead *aead)
{ … }
void chcr_verify_tag(struct aead_request *req, u8 *input, int *err)
{ … }
static int chcr_inc_wrcount(struct chcr_dev *dev)
{ … }
static inline void chcr_dec_wrcount(struct chcr_dev *dev)
{ … }
static inline int chcr_handle_aead_resp(struct aead_request *req,
unsigned char *input,
int err)
{ … }
static void get_aes_decrypt_key(unsigned char *dec_key,
const unsigned char *key,
unsigned int keylength)
{ … }
static struct crypto_shash *chcr_alloc_shash(unsigned int ds)
{ … }
static int chcr_compute_partial_hash(struct shash_desc *desc,
char *iopad, char *result_hash,
int digest_size)
{ … }
static void chcr_change_order(char *buf, int ds)
{ … }
static inline int is_hmac(struct crypto_tfm *tfm)
{ … }
static inline void dsgl_walk_init(struct dsgl_walk *walk,
struct cpl_rx_phys_dsgl *dsgl)
{ … }
static inline void dsgl_walk_end(struct dsgl_walk *walk, unsigned short qid,
int pci_chan_id)
{ … }
static inline void dsgl_walk_add_page(struct dsgl_walk *walk,
size_t size,
dma_addr_t addr)
{ … }
static void dsgl_walk_add_sg(struct dsgl_walk *walk,
struct scatterlist *sg,
unsigned int slen,
unsigned int skip)
{ … }
static inline void ulptx_walk_init(struct ulptx_walk *walk,
struct ulptx_sgl *ulp)
{ … }
static inline void ulptx_walk_end(struct ulptx_walk *walk)
{ … }
static inline void ulptx_walk_add_page(struct ulptx_walk *walk,
size_t size,
dma_addr_t addr)
{ … }
static void ulptx_walk_add_sg(struct ulptx_walk *walk,
struct scatterlist *sg,
unsigned int len,
unsigned int skip)
{ … }
static inline int get_cryptoalg_subtype(struct crypto_skcipher *tfm)
{ … }
static int cxgb4_is_crypto_q_full(struct net_device *dev, unsigned int idx)
{ … }
static int generate_copy_rrkey(struct ablk_ctx *ablkctx,
struct _key_ctx *key_ctx)
{ … }
static int chcr_hash_ent_in_wr(struct scatterlist *src,
unsigned int minsg,
unsigned int space,
unsigned int srcskip)
{ … }
static int chcr_sg_ent_in_wr(struct scatterlist *src,
struct scatterlist *dst,
unsigned int minsg,
unsigned int space,
unsigned int srcskip,
unsigned int dstskip)
{ … }
static int chcr_cipher_fallback(struct crypto_skcipher *cipher,
struct skcipher_request *req,
u8 *iv,
unsigned short op_type)
{ … }
static inline int get_qidxs(struct crypto_async_request *req,
unsigned int *txqidx, unsigned int *rxqidx)
{ … }
static inline void create_wreq(struct chcr_context *ctx,
struct chcr_wr *chcr_req,
struct crypto_async_request *req,
unsigned int imm,
int hash_sz,
unsigned int len16,
unsigned int sc_len,
unsigned int lcb)
{ … }
static struct sk_buff *create_cipher_wr(struct cipher_wr_param *wrparam)
{ … }
static inline int chcr_keyctx_ck_size(unsigned int keylen)
{ … }
static int chcr_cipher_fallback_setkey(struct crypto_skcipher *cipher,
const u8 *key,
unsigned int keylen)
{ … }
static int chcr_aes_cbc_setkey(struct crypto_skcipher *cipher,
const u8 *key,
unsigned int keylen)
{ … }
static int chcr_aes_ctr_setkey(struct crypto_skcipher *cipher,
const u8 *key,
unsigned int keylen)
{ … }
static int chcr_aes_rfc3686_setkey(struct crypto_skcipher *cipher,
const u8 *key,
unsigned int keylen)
{ … }
static void ctr_add_iv(u8 *dstiv, u8 *srciv, u32 add)
{ … }
static unsigned int adjust_ctr_overflow(u8 *iv, u32 bytes)
{ … }
static int chcr_update_tweak(struct skcipher_request *req, u8 *iv,
u32 isfinal)
{ … }
static int chcr_update_cipher_iv(struct skcipher_request *req,
struct cpl_fw6_pld *fw6_pld, u8 *iv)
{ … }
static int chcr_final_cipher_iv(struct skcipher_request *req,
struct cpl_fw6_pld *fw6_pld, u8 *iv)
{ … }
static int chcr_handle_cipher_resp(struct skcipher_request *req,
unsigned char *input, int err)
{ … }
static int process_cipher(struct skcipher_request *req,
unsigned short qid,
struct sk_buff **skb,
unsigned short op_type)
{ … }
static int chcr_aes_encrypt(struct skcipher_request *req)
{ … }
static int chcr_aes_decrypt(struct skcipher_request *req)
{ … }
static int chcr_device_init(struct chcr_context *ctx)
{ … }
static int chcr_init_tfm(struct crypto_skcipher *tfm)
{ … }
static int chcr_rfc3686_init(struct crypto_skcipher *tfm)
{ … }
static void chcr_exit_tfm(struct crypto_skcipher *tfm)
{ … }
static int get_alg_config(struct algo_param *params,
unsigned int auth_size)
{ … }
static inline void chcr_free_shash(struct crypto_shash *base_hash)
{ … }
static struct sk_buff *create_hash_wr(struct ahash_request *req,
struct hash_wr_param *param)
{ … }
static int chcr_ahash_update(struct ahash_request *req)
{ … }
static void create_last_hash_block(char *bfr_ptr, unsigned int bs, u64 scmd1)
{ … }
static int chcr_ahash_final(struct ahash_request *req)
{ … }
static int chcr_ahash_finup(struct ahash_request *req)
{ … }
static int chcr_hmac_init(struct ahash_request *areq);
static int chcr_sha_init(struct ahash_request *areq);
static int chcr_ahash_digest(struct ahash_request *req)
{ … }
static int chcr_ahash_continue(struct ahash_request *req)
{ … }
static inline void chcr_handle_ahash_resp(struct ahash_request *req,
unsigned char *input,
int err)
{ … }
int chcr_handle_resp(struct crypto_async_request *req, unsigned char *input,
int err)
{ … }
static int chcr_ahash_export(struct ahash_request *areq, void *out)
{ … }
static int chcr_ahash_import(struct ahash_request *areq, const void *in)
{ … }
static int chcr_ahash_setkey(struct crypto_ahash *tfm, const u8 *key,
unsigned int keylen)
{ … }
static int chcr_aes_xts_setkey(struct crypto_skcipher *cipher, const u8 *key,
unsigned int key_len)
{ … }
static int chcr_sha_init(struct ahash_request *areq)
{ … }
static int chcr_sha_cra_init(struct crypto_tfm *tfm)
{ … }
static int chcr_hmac_init(struct ahash_request *areq)
{ … }
static int chcr_hmac_cra_init(struct crypto_tfm *tfm)
{ … }
static void chcr_hmac_cra_exit(struct crypto_tfm *tfm)
{ … }
inline void chcr_aead_common_exit(struct aead_request *req)
{ … }
static int chcr_aead_common_init(struct aead_request *req)
{ … }
static int chcr_aead_need_fallback(struct aead_request *req, int dst_nents,
int aadmax, int wrlen,
unsigned short op_type)
{ … }
static int chcr_aead_fallback(struct aead_request *req, unsigned short op_type)
{ … }
static struct sk_buff *create_authenc_wr(struct aead_request *req,
unsigned short qid,
int size)
{ … }
int chcr_aead_dma_map(struct device *dev,
struct aead_request *req,
unsigned short op_type)
{ … }
void chcr_aead_dma_unmap(struct device *dev,
struct aead_request *req,
unsigned short op_type)
{ … }
void chcr_add_aead_src_ent(struct aead_request *req,
struct ulptx_sgl *ulptx)
{ … }
void chcr_add_aead_dst_ent(struct aead_request *req,
struct cpl_rx_phys_dsgl *phys_cpl,
unsigned short qid)
{ … }
void chcr_add_cipher_src_ent(struct skcipher_request *req,
void *ulptx,
struct cipher_wr_param *wrparam)
{ … }
void chcr_add_cipher_dst_ent(struct skcipher_request *req,
struct cpl_rx_phys_dsgl *phys_cpl,
struct cipher_wr_param *wrparam,
unsigned short qid)
{ … }
void chcr_add_hash_src_ent(struct ahash_request *req,
struct ulptx_sgl *ulptx,
struct hash_wr_param *param)
{ … }
int chcr_hash_dma_map(struct device *dev,
struct ahash_request *req)
{ … }
void chcr_hash_dma_unmap(struct device *dev,
struct ahash_request *req)
{ … }
int chcr_cipher_dma_map(struct device *dev,
struct skcipher_request *req)
{ … }
void chcr_cipher_dma_unmap(struct device *dev,
struct skcipher_request *req)
{ … }
static int set_msg_len(u8 *block, unsigned int msglen, int csize)
{ … }
static int generate_b0(struct aead_request *req, u8 *ivptr,
unsigned short op_type)
{ … }
static inline int crypto_ccm_check_iv(const u8 *iv)
{ … }
static int ccm_format_packet(struct aead_request *req,
u8 *ivptr,
unsigned int sub_type,
unsigned short op_type,
unsigned int assoclen)
{ … }
static void fill_sec_cpl_for_aead(struct cpl_tx_sec_pdu *sec_cpl,
unsigned int dst_size,
struct aead_request *req,
unsigned short op_type)
{ … }
static int aead_ccm_validate_input(unsigned short op_type,
struct aead_request *req,
struct chcr_aead_ctx *aeadctx,
unsigned int sub_type)
{ … }
static struct sk_buff *create_aead_ccm_wr(struct aead_request *req,
unsigned short qid,
int size)
{ … }
static struct sk_buff *create_gcm_wr(struct aead_request *req,
unsigned short qid,
int size)
{ … }
static int chcr_aead_cra_init(struct crypto_aead *tfm)
{ … }
static void chcr_aead_cra_exit(struct crypto_aead *tfm)
{ … }
static int chcr_authenc_null_setauthsize(struct crypto_aead *tfm,
unsigned int authsize)
{ … }
static int chcr_authenc_setauthsize(struct crypto_aead *tfm,
unsigned int authsize)
{ … }
static int chcr_gcm_setauthsize(struct crypto_aead *tfm, unsigned int authsize)
{ … }
static int chcr_4106_4309_setauthsize(struct crypto_aead *tfm,
unsigned int authsize)
{ … }
static int chcr_ccm_setauthsize(struct crypto_aead *tfm,
unsigned int authsize)
{ … }
static int chcr_ccm_common_setkey(struct crypto_aead *aead,
const u8 *key,
unsigned int keylen)
{ … }
static int chcr_aead_ccm_setkey(struct crypto_aead *aead,
const u8 *key,
unsigned int keylen)
{ … }
static int chcr_aead_rfc4309_setkey(struct crypto_aead *aead, const u8 *key,
unsigned int keylen)
{ … }
static int chcr_gcm_setkey(struct crypto_aead *aead, const u8 *key,
unsigned int keylen)
{ … }
static int chcr_authenc_setkey(struct crypto_aead *authenc, const u8 *key,
unsigned int keylen)
{ … }
static int chcr_aead_digest_null_setkey(struct crypto_aead *authenc,
const u8 *key, unsigned int keylen)
{ … }
static int chcr_aead_op(struct aead_request *req,
int size,
create_wr_t create_wr_fn)
{ … }
static int chcr_aead_encrypt(struct aead_request *req)
{ … }
static int chcr_aead_decrypt(struct aead_request *req)
{ … }
static struct chcr_alg_template driver_algs[] = …;
static int chcr_unregister_alg(void)
{ … }
#define SZ_AHASH_CTX …
#define SZ_AHASH_H_CTX …
#define SZ_AHASH_REQ_CTX …
static int chcr_register_alg(void)
{ … }
int start_crypto(void)
{ … }
int stop_crypto(void)
{ … }