#include <crypto/internal/hash.h>
#include <crypto/padlock.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/scatterlist.h>
#include <asm/cpu_device_id.h>
struct padlock_sha_desc {
struct shash_desc fallback;
struct crypto_shash *fallback;
static int padlock_sha_init(struct shash_desc *desc)
struct padlock_sha_desc *dctx = shash_desc_ctx(desc);
struct padlock_sha_ctx *ctx = crypto_shash_ctx(desc->tfm);
dctx->fallback.tfm = ctx->fallback;
dctx->fallback.flags = desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
return crypto_shash_init(&dctx->fallback);
static int padlock_sha_update(struct shash_desc *desc,
const u8 *data, unsigned int length)
struct padlock_sha_desc *dctx = shash_desc_ctx(desc);
dctx->fallback.flags = desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
return crypto_shash_update(&dctx->fallback, data, length);
static int padlock_sha_export(struct shash_desc *desc, void *out)
struct padlock_sha_desc *dctx = shash_desc_ctx(desc);
return crypto_shash_export(&dctx->fallback, out);
static int padlock_sha_import(struct shash_desc *desc, const void *in)