#define pr_fmt(fmt) …
#include <crypto/skcipher.h>
#include <linux/blk-crypto.h>
#include <linux/blk-crypto-profile.h>
#include <linux/blkdev.h>
#include <linux/crypto.h>
#include <linux/mempool.h>
#include <linux/module.h>
#include <linux/random.h>
#include <linux/scatterlist.h>
#include "blk-cgroup.h"
#include "blk-crypto-internal.h"
static unsigned int num_prealloc_bounce_pg = …;
module_param(num_prealloc_bounce_pg, uint, 0);
MODULE_PARM_DESC(…) …;
static unsigned int blk_crypto_num_keyslots = …;
module_param_named(num_keyslots, blk_crypto_num_keyslots, uint, 0);
MODULE_PARM_DESC(…) …;
static unsigned int num_prealloc_fallback_crypt_ctxs = …;
module_param(num_prealloc_fallback_crypt_ctxs, uint, 0);
MODULE_PARM_DESC(…) …;
struct bio_fallback_crypt_ctx { … };
static struct kmem_cache *bio_fallback_crypt_ctx_cache;
static mempool_t *bio_fallback_crypt_ctx_pool;
static DEFINE_MUTEX(tfms_init_lock);
static bool tfms_inited[BLK_ENCRYPTION_MODE_MAX];
static struct blk_crypto_fallback_keyslot { … } *blk_crypto_keyslots;
static struct blk_crypto_profile *blk_crypto_fallback_profile;
static struct workqueue_struct *blk_crypto_wq;
static mempool_t *blk_crypto_bounce_page_pool;
static struct bio_set crypto_bio_split;
static u8 blank_key[BLK_CRYPTO_MAX_KEY_SIZE];
static void blk_crypto_fallback_evict_keyslot(unsigned int slot)
{ … }
static int
blk_crypto_fallback_keyslot_program(struct blk_crypto_profile *profile,
const struct blk_crypto_key *key,
unsigned int slot)
{ … }
static int blk_crypto_fallback_keyslot_evict(struct blk_crypto_profile *profile,
const struct blk_crypto_key *key,
unsigned int slot)
{ … }
static const struct blk_crypto_ll_ops blk_crypto_fallback_ll_ops = …;
static void blk_crypto_fallback_encrypt_endio(struct bio *enc_bio)
{ … }
static struct bio *blk_crypto_fallback_clone_bio(struct bio *bio_src)
{ … }
static bool
blk_crypto_fallback_alloc_cipher_req(struct blk_crypto_keyslot *slot,
struct skcipher_request **ciph_req_ret,
struct crypto_wait *wait)
{ … }
static bool blk_crypto_fallback_split_bio_if_needed(struct bio **bio_ptr)
{ … }
blk_crypto_iv;
static void blk_crypto_dun_to_iv(const u64 dun[BLK_CRYPTO_DUN_ARRAY_SIZE],
union blk_crypto_iv *iv)
{ … }
static bool blk_crypto_fallback_encrypt_bio(struct bio **bio_ptr)
{ … }
static void blk_crypto_fallback_decrypt_bio(struct work_struct *work)
{ … }
static void blk_crypto_fallback_decrypt_endio(struct bio *bio)
{ … }
bool blk_crypto_fallback_bio_prep(struct bio **bio_ptr)
{ … }
int blk_crypto_fallback_evict_key(const struct blk_crypto_key *key)
{ … }
static bool blk_crypto_fallback_inited;
static int blk_crypto_fallback_init(void)
{ … }
int blk_crypto_fallback_start_using_mode(enum blk_crypto_mode_num mode_num)
{ … }