Commit 50fb5704 authored by Ilya Lesokhin's avatar Ilya Lesokhin Committed by Herbert Xu

crypto: aesni-intel - RFC4106 can zero copy when !PageHighMem

In the common case of !PageHighMem we can do zero copy crypto
even if sg crosses a pages boundary.
Signed-off-by: default avatarIlya Lesokhin <ilyal@mellanox.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent f262c770
...@@ -740,9 +740,11 @@ static int helper_rfc4106_encrypt(struct aead_request *req) ...@@ -740,9 +740,11 @@ static int helper_rfc4106_encrypt(struct aead_request *req)
*((__be32 *)(iv+12)) = counter; *((__be32 *)(iv+12)) = counter;
if (sg_is_last(req->src) && if (sg_is_last(req->src) &&
req->src->offset + req->src->length <= PAGE_SIZE && (!PageHighMem(sg_page(req->src)) ||
req->src->offset + req->src->length <= PAGE_SIZE) &&
sg_is_last(req->dst) && sg_is_last(req->dst) &&
req->dst->offset + req->dst->length <= PAGE_SIZE) { (!PageHighMem(sg_page(req->dst)) ||
req->dst->offset + req->dst->length <= PAGE_SIZE)) {
one_entry_in_sg = 1; one_entry_in_sg = 1;
scatterwalk_start(&src_sg_walk, req->src); scatterwalk_start(&src_sg_walk, req->src);
assoc = scatterwalk_map(&src_sg_walk); assoc = scatterwalk_map(&src_sg_walk);
...@@ -822,9 +824,11 @@ static int helper_rfc4106_decrypt(struct aead_request *req) ...@@ -822,9 +824,11 @@ static int helper_rfc4106_decrypt(struct aead_request *req)
*((__be32 *)(iv+12)) = counter; *((__be32 *)(iv+12)) = counter;
if (sg_is_last(req->src) && if (sg_is_last(req->src) &&
req->src->offset + req->src->length <= PAGE_SIZE && (!PageHighMem(sg_page(req->src)) ||
req->src->offset + req->src->length <= PAGE_SIZE) &&
sg_is_last(req->dst) && sg_is_last(req->dst) &&
req->dst->offset + req->dst->length <= PAGE_SIZE) { (!PageHighMem(sg_page(req->dst)) ||
req->dst->offset + req->dst->length <= PAGE_SIZE)) {
one_entry_in_sg = 1; one_entry_in_sg = 1;
scatterwalk_start(&src_sg_walk, req->src); scatterwalk_start(&src_sg_walk, req->src);
assoc = scatterwalk_map(&src_sg_walk); assoc = scatterwalk_map(&src_sg_walk);
......
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