Commit f176e632 authored by Herbert Xu's avatar Herbert Xu

crypto: tcrypt - Fix AEAD chunk testing

My changeset 4b22f0dd

	crypto: tcrpyt - Remove unnecessary kmap/kunmap calls

introduced a typo that broke AEAD chunk testing.  In particular,
axbuf should really be xbuf.

There is also an issue with testing the last segment when encrypting.
The additional part produced by AEAD wasn't tested.  Similarly, on
decryption the additional part of the AEAD input is mistaken for
corruption.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent f3c85bc1
...@@ -481,21 +481,31 @@ static void test_aead(char *algo, int enc, struct aead_testvec *template, ...@@ -481,21 +481,31 @@ static void test_aead(char *algo, int enc, struct aead_testvec *template,
for (k = 0, temp = 0; k < template[i].np; k++) { for (k = 0, temp = 0; k < template[i].np; k++) {
printk(KERN_INFO "page %u\n", k); printk(KERN_INFO "page %u\n", k);
q = &axbuf[IDX[k]]; q = &xbuf[IDX[k]];
hexdump(q, template[i].tap[k]);
n = template[i].tap[k];
if (k == template[i].np - 1)
n += enc ? authsize : -authsize;
hexdump(q, n);
printk(KERN_INFO "%s\n", printk(KERN_INFO "%s\n",
memcmp(q, template[i].result + temp, memcmp(q, template[i].result + temp, n) ?
template[i].tap[k] -
(k < template[i].np - 1 || enc ?
0 : authsize)) ?
"fail" : "pass"); "fail" : "pass");
for (n = 0; q[template[i].tap[k] + n]; n++) q += n;
; if (k == template[i].np - 1 && !enc) {
if (memcmp(q, template[i].input +
temp + n, authsize))
n = authsize;
else
n = 0;
} else {
for (n = 0; q[n]; n++)
;
}
if (n) { if (n) {
printk("Result buffer corruption %u " printk("Result buffer corruption %u "
"bytes:\n", n); "bytes:\n", n);
hexdump(&q[template[i].tap[k]], n); hexdump(q, n);
} }
temp += template[i].tap[k]; temp += template[i].tap[k];
......
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