--- examples/async_cipher.c | 24 ++++++++++++++++-------- examples/cipher.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 8 deletions(-)
diff --git a/examples/async_cipher.c b/examples/async_cipher.c index 1b58e1b..314c36a 100644 --- a/examples/async_cipher.c +++ b/examples/async_cipher.c @@ -189,13 +189,17 @@ static int test_aes(int cfd) int i; fprintf(stderr, "FAIL: Decrypted data are different from the input data.\n"); - printf("cipher text should be:\t"); + printf("plaintext:"); for (i = 0; i < BLOCK_SIZE; i++) { - printf("%02x ", (unsigned char)ciphertext1[i]); + if ((i % 30) == 0) + printf("\n"); + printf("%02x ", plaintext1[i]); } - printf("\nbut really is:\t\t"); + printf("ciphertext:"); for (i = 0; i < BLOCK_SIZE; i++) { - printf("%02x ", (unsigned char)plaintext1[i]); + if ((i % 30) == 0) + printf("\n"); + printf("%02x ", ciphertext1[i]); } printf("\n"); return 1; @@ -210,13 +214,17 @@ static int test_aes(int cfd) int i; fprintf(stderr, "FAIL: Decrypted data are different from the input data.\n"); - printf("cipher text should be:\t"); + printf("plaintext:"); for (i = 0; i < BLOCK_SIZE; i++) { - printf("%02x ", (unsigned char)ciphertext2[i]); + if ((i % 30) == 0) + printf("\n"); + printf("%02x ", plaintext2[i]); } - printf("\nbut really is:\t\t"); + printf("ciphertext:"); for (i = 0; i < BLOCK_SIZE; i++) { - printf("%02x ", (unsigned char)plaintext2[i]); + if ((i % 30) == 0) + printf("\n"); + printf("%02x ", ciphertext2[i]); } printf("\n"); return 1; diff --git a/examples/cipher.c b/examples/cipher.c index 17ee466..4ad1ec9 100644 --- a/examples/cipher.c +++ b/examples/cipher.c @@ -82,8 +82,22 @@ test_crypto(int cfd) /* Verify the result */ if (memcmp(plaintext, ciphertext, DATA_SIZE) != 0) { + int i; fprintf(stderr, "FAIL: Decrypted data are different from the input data.\n"); + printf("plaintext:"); + for (i = 0; i < DATA_SIZE; i++) { + if ((i % 30) == 0) + printf("\n"); + printf("%02x ", plaintext[i]); + } + printf("ciphertext:"); + for (i = 0; i < DATA_SIZE; i++) { + if ((i % 30) == 0) + printf("\n"); + printf("%02x ", ciphertext[i]); + } + printf("\n"); return 1; } else printf("Test passed\n"); @@ -179,8 +193,22 @@ static int test_aes(int cfd) /* Verify the result */ if (memcmp(plaintext2, ciphertext2, BLOCK_SIZE) != 0) { + int i; fprintf(stderr, "FAIL: Decrypted data are different from the input data.\n"); + printf("plaintext:"); + for (i = 0; i < BLOCK_SIZE; i++) { + if ((i % 30) == 0) + printf("\n"); + printf("%02x ", plaintext2[i]); + } + printf("ciphertext:"); + for (i = 0; i < BLOCK_SIZE; i++) { + if ((i % 30) == 0) + printf("\n"); + printf("%02x ", ciphertext2[i]); + } + printf("\n"); return 1; } -- 1.7.3.2 _______________________________________________ Cryptodev-linux-devel mailing list Cryptodev-linux-devel@gna.org https://mail.gna.org/listinfo/cryptodev-linux-devel