Commit 1e4b2263 authored by Clay Haapala's avatar Clay Haapala Committed by David S. Miller

[CRYPTO]: Fix digest.c kmapping sg entries > page in length.

Below is the patch, against 2.6.7-rc2, to fix crypto/digest.c to do
multiple kmap()/kunmap() for scatterlist entries which have a size
greater than a single page, originally found and fixed by
N.C.Krishna Murthy <krmurthy@cisco.com>.
Signed-off-by: default avatarClay Haapala <chaapala@cisco.com>
Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
parent 65cfd027
...@@ -29,11 +29,26 @@ static void update(struct crypto_tfm *tfm, ...@@ -29,11 +29,26 @@ static void update(struct crypto_tfm *tfm,
unsigned int i; unsigned int i;
for (i = 0; i < nsg; i++) { for (i = 0; i < nsg; i++) {
char *p = crypto_kmap(sg[i].page, 0) + sg[i].offset;
tfm->__crt_alg->cra_digest.dia_update(crypto_tfm_ctx(tfm), struct page *pg = sg[i].page;
p, sg[i].length); unsigned int offset = sg[i].offset;
unsigned int l = sg[i].length;
do {
unsigned int bytes_from_page = min(l, ((unsigned int)
(PAGE_SIZE)) -
offset);
char *p = crypto_kmap(pg, 0) + offset;
tfm->__crt_alg->cra_digest.dia_update
(crypto_tfm_ctx(tfm), p,
bytes_from_page);
crypto_kunmap(p, 0); crypto_kunmap(p, 0);
crypto_yield(tfm); crypto_yield(tfm);
offset = 0;
pg++;
l -= bytes_from_page;
} while (l > 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