Commit 97858434 authored by Antoine Ténart's avatar Antoine Ténart Committed by Herbert Xu

crypto: inside-secure - update the context and request later

This move the context and request updates at the end of the cipher and
hash send() functions. This way the context and request fields are set
only when everything else was successful in the send() functions.
Signed-off-by: default avatarAntoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 152bdf4c
...@@ -190,8 +190,6 @@ static int safexcel_aes_send(struct crypto_async_request *async, ...@@ -190,8 +190,6 @@ static int safexcel_aes_send(struct crypto_async_request *async,
int nr_src, nr_dst, n_cdesc = 0, n_rdesc = 0, queued = req->cryptlen; int nr_src, nr_dst, n_cdesc = 0, n_rdesc = 0, queued = req->cryptlen;
int i, ret = 0; int i, ret = 0;
request->req = &req->base;
if (req->src == req->dst) { if (req->src == req->dst) {
nr_src = dma_map_sg(priv->dev, req->src, nr_src = dma_map_sg(priv->dev, req->src,
sg_nents_for_len(req->src, req->cryptlen), sg_nents_for_len(req->src, req->cryptlen),
...@@ -264,10 +262,11 @@ static int safexcel_aes_send(struct crypto_async_request *async, ...@@ -264,10 +262,11 @@ static int safexcel_aes_send(struct crypto_async_request *async,
n_rdesc++; n_rdesc++;
} }
ctx->base.handle_result = safexcel_handle_result;
spin_unlock_bh(&priv->ring[ring].egress_lock); spin_unlock_bh(&priv->ring[ring].egress_lock);
request->req = &req->base;
ctx->base.handle_result = safexcel_handle_result;
*commands = n_cdesc; *commands = n_cdesc;
*results = n_rdesc; *results = n_rdesc;
return 0; return 0;
......
...@@ -198,9 +198,6 @@ static int safexcel_ahash_send(struct crypto_async_request *async, int ring, ...@@ -198,9 +198,6 @@ static int safexcel_ahash_send(struct crypto_async_request *async, int ring,
len -= extra; len -= extra;
} }
request->req = &areq->base;
ctx->base.handle_result = safexcel_handle_result;
spin_lock_bh(&priv->ring[ring].egress_lock); spin_lock_bh(&priv->ring[ring].egress_lock);
/* Add a command descriptor for the cached data, if any */ /* Add a command descriptor for the cached data, if any */
...@@ -291,9 +288,12 @@ static int safexcel_ahash_send(struct crypto_async_request *async, int ring, ...@@ -291,9 +288,12 @@ static int safexcel_ahash_send(struct crypto_async_request *async, int ring,
goto cdesc_rollback; goto cdesc_rollback;
} }
req->processed += len;
spin_unlock_bh(&priv->ring[ring].egress_lock); spin_unlock_bh(&priv->ring[ring].egress_lock);
req->processed += len;
request->req = &areq->base;
ctx->base.handle_result = safexcel_handle_result;
*commands = n_cdesc; *commands = n_cdesc;
*results = 1; *results = 1;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment