@@ -40,7 +40,7 @@ static void crypto_finalize_request(struct crypto_engine *engine,
enginectx = crypto_tfm_ctx(engine->cur_reqs[i].req->tfm);
if (engine->cur_reqs[i].prepared &&
enginectx->op.unprepare_request) {
- ret = enginectx->op.unprepare_request(engine, engine->cur_reqs[i].req);
+ ret = enginectx->op.unprepare_request(engine, engine->cur_reqs[i].req, i);
if (ret)
dev_err(engine->dev, "failed to unprepare request\n");
}
@@ -143,7 +143,7 @@ static void crypto_pump_requests(struct crypto_engine *engine,
enginectx = crypto_tfm_ctx(async_req->tfm);
if (enginectx->op.prepare_request) {
- ret = enginectx->op.prepare_request(engine, async_req);
+ ret = enginectx->op.prepare_request(engine, async_req, engine->ct);
if (ret) {
dev_err(engine->dev, "failed to prepare request: %d\n",
ret);
@@ -78,7 +78,7 @@ static int sun8i_ce_cipher_fallback(struct skcipher_request *areq)
return err;
}
-static int sun8i_ce_cipher_prepare(struct crypto_engine *engine, void *async_req)
+static int sun8i_ce_cipher_prepare(struct crypto_engine *engine, void *async_req, int slot)
{
struct skcipher_request *areq = container_of(async_req, struct skcipher_request, base);
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq);
@@ -96,7 +96,6 @@ static int sun8i_ce_cipher_prepare(struct crypto_engine *engine, void *async_req
int flow, i;
int nr_sgs = 0;
int nr_sgd = 0;
- int slot = 0;
int err = 0;
if (slot < 0 || slot >= MAXTASK)
@@ -296,7 +295,7 @@ int sun8i_ce_cipher_run(struct crypto_engine *engine, void *areq)
return 0;
}
-static int sun8i_ce_cipher_unprepare(struct crypto_engine *engine, void *async_req)
+static int sun8i_ce_cipher_unprepare(struct crypto_engine *engine, void *async_req, int slot)
{
struct skcipher_request *areq = container_of(async_req, struct skcipher_request, base);
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq);
@@ -308,7 +307,6 @@ static int sun8i_ce_cipher_unprepare(struct crypto_engine *engine, void *async_r
unsigned int ivsize, offset;
int nr_sgs = rctx->nr_sgs;
int nr_sgd = rctx->nr_sgd;
- int slot = 0;
int flow;
flow = rctx->flow;
@@ -213,7 +213,7 @@ static int omap_aes_gcm_handle_queue(struct omap_aes_dev *dd,
return 0;
}
-static int omap_aes_gcm_prepare_req(struct crypto_engine *engine, void *areq)
+static int omap_aes_gcm_prepare_req(struct crypto_engine *engine, void *areq, int slot)
{
struct aead_request *req = container_of(areq, struct aead_request,
base);
@@ -427,7 +427,7 @@ static int omap_aes_handle_queue(struct omap_aes_dev *dd,
}
static int omap_aes_prepare_req(struct crypto_engine *engine,
- void *areq)
+ void *areq, int slot)
{
struct skcipher_request *req = container_of(areq, struct skcipher_request, base);
struct omap_aes_ctx *ctx = crypto_skcipher_ctx(
@@ -632,7 +632,7 @@ static int omap_aes_ctr_decrypt(struct skcipher_request *req)
}
static int omap_aes_prepare_req(struct crypto_engine *engine,
- void *req);
+ void *req, int slot);
static int omap_aes_crypt_req(struct crypto_engine *engine,
void *req);
@@ -524,7 +524,7 @@ static int omap_des_handle_queue(struct omap_des_dev *dd,
}
static int omap_des_prepare_req(struct crypto_engine *engine,
- void *areq)
+ void *areq, int slot)
{
struct skcipher_request *req = container_of(areq, struct skcipher_request, base);
struct omap_des_ctx *ctx = crypto_skcipher_ctx(
@@ -711,7 +711,7 @@ static int omap_des_cbc_decrypt(struct skcipher_request *req)
}
static int omap_des_prepare_req(struct crypto_engine *engine,
- void *areq);
+ void *areq, int slot);
static int omap_des_crypt_req(struct crypto_engine *engine,
void *areq);
@@ -684,7 +684,7 @@ static int stm32_cryp_cpu_start(struct stm32_cryp *cryp)
static int stm32_cryp_cipher_one_req(struct crypto_engine *engine, void *areq);
static int stm32_cryp_prepare_cipher_req(struct crypto_engine *engine,
- void *areq);
+ void *areq, int slot);
static int stm32_cryp_init_tfm(struct crypto_skcipher *tfm)
{
@@ -700,7 +700,7 @@ static int stm32_cryp_init_tfm(struct crypto_skcipher *tfm)
static int stm32_cryp_aead_one_req(struct crypto_engine *engine, void *areq);
static int stm32_cryp_prepare_aead_req(struct crypto_engine *engine,
- void *areq);
+ void *areq, int slot);
static int stm32_cryp_aes_aead_init(struct crypto_aead *tfm)
{
@@ -1015,7 +1015,7 @@ static int stm32_cryp_prepare_req(struct skcipher_request *req,
}
static int stm32_cryp_prepare_cipher_req(struct crypto_engine *engine,
- void *areq)
+ void *areq, int slot)
{
struct skcipher_request *req = container_of(areq,
struct skcipher_request,
@@ -1039,7 +1039,7 @@ static int stm32_cryp_cipher_one_req(struct crypto_engine *engine, void *areq)
return stm32_cryp_cpu_start(cryp);
}
-static int stm32_cryp_prepare_aead_req(struct crypto_engine *engine, void *areq)
+static int stm32_cryp_prepare_aead_req(struct crypto_engine *engine, void *areq, int slot)
{
struct aead_request *req = container_of(areq, struct aead_request,
base);
@@ -824,7 +824,7 @@ static int stm32_hash_hw_init(struct stm32_hash_dev *hdev,
}
static int stm32_hash_one_request(struct crypto_engine *engine, void *areq);
-static int stm32_hash_prepare_req(struct crypto_engine *engine, void *areq);
+static int stm32_hash_prepare_req(struct crypto_engine *engine, void *areq, int slot);
static int stm32_hash_handle_queue(struct stm32_hash_dev *hdev,
struct ahash_request *req)
@@ -832,7 +832,7 @@ static int stm32_hash_handle_queue(struct stm32_hash_dev *hdev,
return crypto_transfer_hash_request_to_engine(hdev->engine, req);
}
-static int stm32_hash_prepare_req(struct crypto_engine *engine, void *areq)
+static int stm32_hash_prepare_req(struct crypto_engine *engine, void *areq, int slot)
{
struct ahash_request *req = container_of(areq, struct ahash_request,
base);
@@ -85,9 +85,9 @@ struct crypto_engine {
*/
struct crypto_engine_op {
int (*prepare_request)(struct crypto_engine *engine,
- void *areq);
+ void *areq, int slot);
int (*unprepare_request)(struct crypto_engine *engine,
- void *areq);
+ void *areq, int slot);
int (*do_one_request)(struct crypto_engine *engine,
void *areq);
};
prepare/unprepare functions should be able to know which slot in a batch should be used for preparing a request. Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com> --- crypto/crypto_engine.c | 4 ++-- drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c | 6 ++---- drivers/crypto/omap-aes-gcm.c | 2 +- drivers/crypto/omap-aes.c | 4 ++-- drivers/crypto/omap-des.c | 4 ++-- drivers/crypto/stm32/stm32-cryp.c | 8 ++++---- drivers/crypto/stm32/stm32-hash.c | 4 ++-- include/crypto/engine.h | 4 ++-- 8 files changed, 17 insertions(+), 19 deletions(-)