mirror of
https://github.com/torvalds/linux.git
synced 2024-12-25 12:21:37 +00:00
crypto: replace scatterwalk_sg_chain with sg_chain
Signed-off-by: Dan Williams <dan.j.williams@intel.com> [hch: split from a larger patch by Dan] Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
02c4de53ad
commit
c56f6d1270
@ -145,7 +145,7 @@ static int skcipher_alloc_sgl(struct sock *sk)
|
||||
sgl->cur = 0;
|
||||
|
||||
if (sg)
|
||||
scatterwalk_sg_chain(sg, MAX_SGL_ENTS + 1, sgl->sg);
|
||||
sg_chain(sg, MAX_SGL_ENTS + 1, sgl->sg);
|
||||
|
||||
list_add_tail(&sgl->list, &ctx->tsgl);
|
||||
}
|
||||
|
@ -329,13 +329,13 @@ static int crypto_ccm_encrypt(struct aead_request *req)
|
||||
|
||||
sg_init_table(pctx->src, 2);
|
||||
sg_set_buf(pctx->src, odata, 16);
|
||||
scatterwalk_sg_chain(pctx->src, 2, req->src);
|
||||
sg_chain(pctx->src, 2, req->src);
|
||||
|
||||
dst = pctx->src;
|
||||
if (req->src != req->dst) {
|
||||
sg_init_table(pctx->dst, 2);
|
||||
sg_set_buf(pctx->dst, odata, 16);
|
||||
scatterwalk_sg_chain(pctx->dst, 2, req->dst);
|
||||
sg_chain(pctx->dst, 2, req->dst);
|
||||
dst = pctx->dst;
|
||||
}
|
||||
|
||||
@ -400,13 +400,13 @@ static int crypto_ccm_decrypt(struct aead_request *req)
|
||||
|
||||
sg_init_table(pctx->src, 2);
|
||||
sg_set_buf(pctx->src, authtag, 16);
|
||||
scatterwalk_sg_chain(pctx->src, 2, req->src);
|
||||
sg_chain(pctx->src, 2, req->src);
|
||||
|
||||
dst = pctx->src;
|
||||
if (req->src != req->dst) {
|
||||
sg_init_table(pctx->dst, 2);
|
||||
sg_set_buf(pctx->dst, authtag, 16);
|
||||
scatterwalk_sg_chain(pctx->dst, 2, req->dst);
|
||||
sg_chain(pctx->dst, 2, req->dst);
|
||||
dst = pctx->dst;
|
||||
}
|
||||
|
||||
|
@ -200,14 +200,14 @@ static void crypto_gcm_init_common(struct aead_request *req)
|
||||
sg_set_buf(pctx->src, pctx->auth_tag, sizeof(pctx->auth_tag));
|
||||
sg = scatterwalk_ffwd(pctx->src + 1, req->src, req->assoclen);
|
||||
if (sg != pctx->src + 1)
|
||||
scatterwalk_sg_chain(pctx->src, 2, sg);
|
||||
sg_chain(pctx->src, 2, sg);
|
||||
|
||||
if (req->src != req->dst) {
|
||||
sg_init_table(pctx->dst, 3);
|
||||
sg_set_buf(pctx->dst, pctx->auth_tag, sizeof(pctx->auth_tag));
|
||||
sg = scatterwalk_ffwd(pctx->dst + 1, req->dst, req->assoclen);
|
||||
if (sg != pctx->dst + 1)
|
||||
scatterwalk_sg_chain(pctx->dst, 2, sg);
|
||||
sg_chain(pctx->dst, 2, sg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -370,8 +370,7 @@ static int bfin_crypto_crc_handle_queue(struct bfin_crypto_crc *crc,
|
||||
sg_init_table(ctx->bufsl, nsg);
|
||||
sg_set_buf(ctx->bufsl, ctx->buflast, ctx->buflast_len);
|
||||
if (nsg > 1)
|
||||
scatterwalk_sg_chain(ctx->bufsl, nsg,
|
||||
req->src);
|
||||
sg_chain(ctx->bufsl, nsg, req->src);
|
||||
ctx->sg = ctx->bufsl;
|
||||
} else
|
||||
ctx->sg = req->src;
|
||||
|
@ -296,7 +296,7 @@ static int qce_ahash_update(struct ahash_request *req)
|
||||
if (rctx->buflen) {
|
||||
sg_init_table(rctx->sg, 2);
|
||||
sg_set_buf(rctx->sg, rctx->tmpbuf, rctx->buflen);
|
||||
scatterwalk_sg_chain(rctx->sg, 2, req->src);
|
||||
sg_chain(rctx->sg, 2, req->src);
|
||||
req->src = rctx->sg;
|
||||
}
|
||||
|
||||
|
@ -999,7 +999,7 @@ static int sahara_sha_prepare_request(struct ahash_request *req)
|
||||
sg_init_table(rctx->in_sg_chain, 2);
|
||||
sg_set_buf(rctx->in_sg_chain, rctx->rembuf, rctx->buf_cnt);
|
||||
|
||||
scatterwalk_sg_chain(rctx->in_sg_chain, 2, req->src);
|
||||
sg_chain(rctx->in_sg_chain, 2, req->src);
|
||||
|
||||
rctx->total = req->nbytes + rctx->buf_cnt;
|
||||
rctx->in_sg = rctx->in_sg_chain;
|
||||
|
@ -1986,7 +1986,7 @@ static int ahash_process_req(struct ahash_request *areq, unsigned int nbytes)
|
||||
sg_init_table(req_ctx->bufsl, nsg);
|
||||
sg_set_buf(req_ctx->bufsl, req_ctx->buf, req_ctx->nbuf);
|
||||
if (nsg > 1)
|
||||
scatterwalk_sg_chain(req_ctx->bufsl, 2, areq->src);
|
||||
sg_chain(req_ctx->bufsl, 2, areq->src);
|
||||
req_ctx->psrc = req_ctx->bufsl;
|
||||
} else
|
||||
req_ctx->psrc = areq->src;
|
||||
|
@ -25,14 +25,6 @@
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
static inline void scatterwalk_sg_chain(struct scatterlist *sg1, int num,
|
||||
struct scatterlist *sg2)
|
||||
{
|
||||
sg_set_page(&sg1[num - 1], (void *)sg2, 0, 0);
|
||||
sg1[num - 1].page_link &= ~0x02;
|
||||
sg1[num - 1].page_link |= 0x01;
|
||||
}
|
||||
|
||||
static inline void scatterwalk_crypto_chain(struct scatterlist *head,
|
||||
struct scatterlist *sg,
|
||||
int chain, int num)
|
||||
@ -43,7 +35,7 @@ static inline void scatterwalk_crypto_chain(struct scatterlist *head,
|
||||
}
|
||||
|
||||
if (sg)
|
||||
scatterwalk_sg_chain(head, num, sg);
|
||||
sg_chain(head, num, sg);
|
||||
else
|
||||
sg_mark_end(head);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user