X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/blobdiff_plain/0f00dc4c8eb47e67bc0f148c2dd109f73a451e0a..57496a500309c335ff9c60d3462757c0c5f04801:/symm/cfb-def.h diff --git a/symm/cfb-def.h b/symm/cfb-def.h index 767f4c42..4f0f38f4 100644 --- a/symm/cfb-def.h +++ b/symm/cfb-def.h @@ -426,12 +426,12 @@ static const octet iv[] = IV; \ static octet ct[sizeof(text)]; \ static octet pt[sizeof(text)]; \ \ -static void hexdump(const octet *p, size_t sz) \ +static void hexdump(const octet *p, size_t sz, size_t off) \ { \ const octet *q = p + sz; \ for (sz = 0; p < q; p++, sz++) { \ printf("%02x", *p); \ - if ((sz + 1) % PRE##_BLKSZ == 0) \ + if ((off + sz + 1) % PRE##_BLKSZ == 0) \ putchar(':'); \ } \ } \ @@ -472,14 +472,14 @@ int main(void) \ } else { \ printf("\nError (sz = %lu)\n", (unsigned long)sz); \ status = 1; \ - printf("\tplaintext = "); hexdump(text, sz); \ - printf(", "); hexdump(text + sz, rest); \ + printf("\tplaintext = "); hexdump(text, sz, 0); \ + printf(", "); hexdump(text + sz, rest, sz); \ fputc('\n', stdout); \ - printf("\tciphertext = "); hexdump(ct, sz); \ - printf(", "); hexdump(ct + sz, rest); \ + printf("\tciphertext = "); hexdump(ct, sz, 0); \ + printf(", "); hexdump(ct + sz, rest, sz); \ fputc('\n', stdout); \ - printf("\trecovered text = "); hexdump(pt, sz); \ - printf(", "); hexdump(pt + sz, rest); \ + printf("\trecovered text = "); hexdump(pt, sz, 0); \ + printf(", "); hexdump(pt + sz, rest, sz); \ fputc('\n', stdout); \ fputc('\n', stdout); \ } \