diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-10-19 16:34:07 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-10-19 16:34:07 +0200 |
commit | 56dbdf7bfbe6646843d470450ac17f6700cf0ea0 (patch) | |
tree | a9452d886d8bb81cc8980de313bd81f314453dd4 /crypto/essiv.c | |
parent | 9f23cb019a765abf669a751ce9beb75f93b53200 (diff) | |
parent | c1859a8cfe840386e199c43d5eda79cc692009e4 (diff) |
Merge v6.12.54linux-rolling-lts
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'crypto/essiv.c')
-rw-r--r-- | crypto/essiv.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/crypto/essiv.c b/crypto/essiv.c index e63fc6442e32..aa7ebc123527 100644 --- a/crypto/essiv.c +++ b/crypto/essiv.c @@ -186,9 +186,14 @@ static int essiv_aead_crypt(struct aead_request *req, bool enc) const struct essiv_tfm_ctx *tctx = crypto_aead_ctx(tfm); struct essiv_aead_request_ctx *rctx = aead_request_ctx(req); struct aead_request *subreq = &rctx->aead_req; + int ivsize = crypto_aead_ivsize(tfm); + int ssize = req->assoclen - ivsize; struct scatterlist *src = req->src; int err; + if (ssize < 0) + return -EINVAL; + crypto_cipher_encrypt_one(tctx->essiv_cipher, req->iv, req->iv); /* @@ -198,19 +203,12 @@ static int essiv_aead_crypt(struct aead_request *req, bool enc) */ rctx->assoc = NULL; if (req->src == req->dst || !enc) { - scatterwalk_map_and_copy(req->iv, req->dst, - req->assoclen - crypto_aead_ivsize(tfm), - crypto_aead_ivsize(tfm), 1); + scatterwalk_map_and_copy(req->iv, req->dst, ssize, ivsize, 1); } else { u8 *iv = (u8 *)aead_request_ctx(req) + tctx->ivoffset; - int ivsize = crypto_aead_ivsize(tfm); - int ssize = req->assoclen - ivsize; struct scatterlist *sg; int nents; - if (ssize < 0) - return -EINVAL; - nents = sg_nents_for_len(req->src, ssize); if (nents < 0) return -EINVAL; |