Commit 0f2c8319 authored by Herbert Xu's avatar Herbert Xu

crypto: rsa-pkcs1pad - Remove bogus page splitting

The helper pkcs1pad_sg_set_buf tries to split a buffer that crosses
a page boundary into two SG entries.  This is unnecessary.  This
patch removes that.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent c0d20d22
...@@ -103,7 +103,7 @@ struct pkcs1pad_inst_ctx { ...@@ -103,7 +103,7 @@ struct pkcs1pad_inst_ctx {
struct pkcs1pad_request { struct pkcs1pad_request {
struct akcipher_request child_req; struct akcipher_request child_req;
struct scatterlist in_sg[3], out_sg[2]; struct scatterlist in_sg[2], out_sg[1];
uint8_t *in_buf, *out_buf; uint8_t *in_buf, *out_buf;
}; };
...@@ -163,19 +163,10 @@ static int pkcs1pad_get_max_size(struct crypto_akcipher *tfm) ...@@ -163,19 +163,10 @@ static int pkcs1pad_get_max_size(struct crypto_akcipher *tfm)
static void pkcs1pad_sg_set_buf(struct scatterlist *sg, void *buf, size_t len, static void pkcs1pad_sg_set_buf(struct scatterlist *sg, void *buf, size_t len,
struct scatterlist *next) struct scatterlist *next)
{ {
int nsegs = next ? 1 : 0; int nsegs = next ? 2 : 1;
if (offset_in_page(buf) + len <= PAGE_SIZE) { sg_init_table(sg, nsegs);
nsegs += 1; sg_set_buf(sg, buf, len);
sg_init_table(sg, nsegs);
sg_set_buf(sg, buf, len);
} else {
nsegs += 2;
sg_init_table(sg, nsegs);
sg_set_buf(sg + 0, buf, PAGE_SIZE - offset_in_page(buf));
sg_set_buf(sg + 1, buf + PAGE_SIZE - offset_in_page(buf),
offset_in_page(buf) + len - PAGE_SIZE);
}
if (next) if (next)
sg_chain(sg, nsegs, next); sg_chain(sg, nsegs, next);
......
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