#include <linux/module.h>
#include <linux/slab.h>
#include <linux/crypto.h>
#include <crypto/internal/aead.h>
#include <crypto/internal/cipher.h>
#include <crypto/internal/skcipher.h>
#include <crypto/aes.h>
#include <crypto/sha1.h>
#include <crypto/sha2.h>
#include <crypto/hash.h>
#include <crypto/hmac.h>
#include <crypto/algapi.h>
#include <crypto/authenc.h>
#include <crypto/scatterwalk.h>
#include <crypto/xts.h>
#include <linux/dma-mapping.h>
#include "adf_accel_devices.h"
#include "qat_algs_send.h"
#include "adf_common_drv.h"
#include "qat_crypto.h"
#include "icp_qat_hw.h"
#include "icp_qat_fw.h"
#include "icp_qat_fw_la.h"
#include "qat_bl.h"
#define QAT_AES_HW_CONFIG_ENC(alg, mode) …
#define QAT_AES_HW_CONFIG_DEC(alg, mode) …
#define QAT_AES_HW_CONFIG_DEC_NO_CONV(alg, mode) …
#define HW_CAP_AES_V2(accel_dev) …
static DEFINE_MUTEX(algs_lock);
static unsigned int active_devs;
struct qat_alg_cd { … } __aligned(…);
struct qat_alg_aead_ctx { … };
struct qat_alg_skcipher_ctx { … };
static int qat_get_inter_state_size(enum icp_qat_hw_auth_algo qat_hash_alg)
{ … }
static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash,
struct qat_alg_aead_ctx *ctx,
const u8 *auth_key,
unsigned int auth_keylen)
{ … }
static void qat_alg_init_common_hdr(struct icp_qat_fw_comn_req_hdr *header)
{ … }
static int qat_alg_aead_init_enc_session(struct crypto_aead *aead_tfm,
int alg,
struct crypto_authenc_keys *keys,
int mode)
{ … }
static int qat_alg_aead_init_dec_session(struct crypto_aead *aead_tfm,
int alg,
struct crypto_authenc_keys *keys,
int mode)
{ … }
static void qat_alg_skcipher_init_com(struct qat_alg_skcipher_ctx *ctx,
struct icp_qat_fw_la_bulk_req *req,
struct icp_qat_hw_cipher_algo_blk *cd,
const u8 *key, unsigned int keylen)
{ … }
static void qat_alg_skcipher_init_enc(struct qat_alg_skcipher_ctx *ctx,
int alg, const u8 *key,
unsigned int keylen, int mode)
{ … }
static void qat_alg_xts_reverse_key(const u8 *key_forward, unsigned int keylen,
u8 *key_reverse)
{ … }
static void qat_alg_skcipher_init_dec(struct qat_alg_skcipher_ctx *ctx,
int alg, const u8 *key,
unsigned int keylen, int mode)
{ … }
static int qat_alg_validate_key(int key_len, int *alg, int mode)
{ … }
static int qat_alg_aead_init_sessions(struct crypto_aead *tfm, const u8 *key,
unsigned int keylen, int mode)
{ … }
static int qat_alg_skcipher_init_sessions(struct qat_alg_skcipher_ctx *ctx,
const u8 *key,
unsigned int keylen,
int mode)
{ … }
static int qat_alg_aead_rekey(struct crypto_aead *tfm, const u8 *key,
unsigned int keylen)
{ … }
static int qat_alg_aead_newkey(struct crypto_aead *tfm, const u8 *key,
unsigned int keylen)
{ … }
static int qat_alg_aead_setkey(struct crypto_aead *tfm, const u8 *key,
unsigned int keylen)
{ … }
static void qat_aead_alg_callback(struct icp_qat_fw_la_resp *qat_resp,
struct qat_crypto_request *qat_req)
{ … }
static void qat_alg_update_iv_ctr_mode(struct qat_crypto_request *qat_req)
{ … }
static void qat_alg_update_iv_cbc_mode(struct qat_crypto_request *qat_req)
{ … }
static void qat_alg_update_iv(struct qat_crypto_request *qat_req)
{ … }
static void qat_skcipher_alg_callback(struct icp_qat_fw_la_resp *qat_resp,
struct qat_crypto_request *qat_req)
{ … }
void qat_alg_callback(void *resp)
{ … }
static int qat_alg_send_sym_message(struct qat_crypto_request *qat_req,
struct qat_crypto_instance *inst,
struct crypto_async_request *base)
{ … }
static int qat_alg_aead_dec(struct aead_request *areq)
{ … }
static int qat_alg_aead_enc(struct aead_request *areq)
{ … }
static int qat_alg_skcipher_rekey(struct qat_alg_skcipher_ctx *ctx,
const u8 *key, unsigned int keylen,
int mode)
{ … }
static int qat_alg_skcipher_newkey(struct qat_alg_skcipher_ctx *ctx,
const u8 *key, unsigned int keylen,
int mode)
{ … }
static int qat_alg_skcipher_setkey(struct crypto_skcipher *tfm,
const u8 *key, unsigned int keylen,
int mode)
{ … }
static int qat_alg_skcipher_cbc_setkey(struct crypto_skcipher *tfm,
const u8 *key, unsigned int keylen)
{ … }
static int qat_alg_skcipher_ctr_setkey(struct crypto_skcipher *tfm,
const u8 *key, unsigned int keylen)
{ … }
static int qat_alg_skcipher_xts_setkey(struct crypto_skcipher *tfm,
const u8 *key, unsigned int keylen)
{ … }
static void qat_alg_set_req_iv(struct qat_crypto_request *qat_req)
{ … }
static int qat_alg_skcipher_encrypt(struct skcipher_request *req)
{ … }
static int qat_alg_skcipher_blk_encrypt(struct skcipher_request *req)
{ … }
static int qat_alg_skcipher_xts_encrypt(struct skcipher_request *req)
{ … }
static int qat_alg_skcipher_decrypt(struct skcipher_request *req)
{ … }
static int qat_alg_skcipher_blk_decrypt(struct skcipher_request *req)
{ … }
static int qat_alg_skcipher_xts_decrypt(struct skcipher_request *req)
{ … }
static int qat_alg_aead_init(struct crypto_aead *tfm,
enum icp_qat_hw_auth_algo hash,
const char *hash_name)
{ … }
static int qat_alg_aead_sha1_init(struct crypto_aead *tfm)
{ … }
static int qat_alg_aead_sha256_init(struct crypto_aead *tfm)
{ … }
static int qat_alg_aead_sha512_init(struct crypto_aead *tfm)
{ … }
static void qat_alg_aead_exit(struct crypto_aead *tfm)
{ … }
static int qat_alg_skcipher_init_tfm(struct crypto_skcipher *tfm)
{ … }
static int qat_alg_skcipher_init_xts_tfm(struct crypto_skcipher *tfm)
{ … }
static void qat_alg_skcipher_exit_tfm(struct crypto_skcipher *tfm)
{ … }
static void qat_alg_skcipher_exit_xts_tfm(struct crypto_skcipher *tfm)
{ … }
static struct aead_alg qat_aeads[] = …;
static struct skcipher_alg qat_skciphers[] = …;
int qat_algs_register(void)
{ … }
void qat_algs_unregister(void)
{ … }