aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crypto/tcrypt.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 59821a22d752..66368022e0bf 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -481,21 +481,31 @@ next_one:
481 481
482 for (k = 0, temp = 0; k < template[i].np; k++) { 482 for (k = 0, temp = 0; k < template[i].np; k++) {
483 printk(KERN_INFO "page %u\n", k); 483 printk(KERN_INFO "page %u\n", k);
484 q = &axbuf[IDX[k]]; 484 q = &xbuf[IDX[k]];
485 hexdump(q, template[i].tap[k]); 485
486 n = template[i].tap[k];
487 if (k == template[i].np - 1)
488 n += enc ? authsize : -authsize;
489 hexdump(q, n);
486 printk(KERN_INFO "%s\n", 490 printk(KERN_INFO "%s\n",
487 memcmp(q, template[i].result + temp, 491 memcmp(q, template[i].result + temp, n) ?
488 template[i].tap[k] -
489 (k < template[i].np - 1 || enc ?
490 0 : authsize)) ?
491 "fail" : "pass"); 492 "fail" : "pass");
492 493
493 for (n = 0; q[template[i].tap[k] + n]; n++) 494 q += n;
494 ; 495 if (k == template[i].np - 1 && !enc) {
496 if (memcmp(q, template[i].input +
497 temp + n, authsize))
498 n = authsize;
499 else
500 n = 0;
501 } else {
502 for (n = 0; q[n]; n++)
503 ;
504 }
495 if (n) { 505 if (n) {
496 printk("Result buffer corruption %u " 506 printk("Result buffer corruption %u "
497 "bytes:\n", n); 507 "bytes:\n", n);
498 hexdump(&q[template[i].tap[k]], n); 508 hexdump(q, n);
499 } 509 }
500 510
501 temp += template[i].tap[k]; 511 temp += template[i].tap[k];