X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=test_src%2Fmain-threefish-test.c;h=668eca0e5986144f1953f8b314b418c04fc5668b;hb=877bd61c0f8df66c000d0f9f35d87cddc5dd0957;hp=e40e59a727f37034d0728b1860780e4426053b82;hpb=c239a90de4f9ea98d7c0f5962d200c1a6a6033d1;p=avr-crypto-lib.git diff --git a/test_src/main-threefish-test.c b/test_src/main-threefish-test.c index e40e59a..668eca0 100644 --- a/test_src/main-threefish-test.c +++ b/test_src/main-threefish-test.c @@ -125,6 +125,10 @@ void testrun_stdtest_threefish256(void){ threefish256_enc(data, &ctx); cli_putstr_P(PSTR("\r\ncipher: ")); cli_hexdump_block(data, 32, 4, 16); + cli_putstr_P(PSTR("\r\ndecipher: ")); + threefish256_dec(data, &ctx); + cli_hexdump_block(data, 32, 4, 16); + /* second test */ for(i=0; i<32; ++i){ key[i] = 0x10+i; @@ -143,6 +147,9 @@ void testrun_stdtest_threefish256(void){ threefish256_enc(data, &ctx); cli_putstr_P(PSTR("\r\ncipher: ")); cli_hexdump_block(data, 32, 4, 16); + cli_putstr_P(PSTR("\r\ndecipher: ")); + threefish256_dec(data, &ctx); + cli_hexdump_block(data, 32, 4, 16); } void testrun_stdtest_threefish512(void){ @@ -168,6 +175,10 @@ void testrun_stdtest_threefish512(void){ threefish512_enc(data, &ctx); cli_putstr_P(PSTR("\r\ncipher: ")); cli_hexdump_block(data, 64, 4, 16); + threefish512_dec(data, &ctx); + cli_putstr_P(PSTR("\r\ndecipher: ")); + cli_hexdump_block(data, 64, 4, 16); + for(i=0; i<64; ++i){ key[i] = 0x10+i; @@ -188,6 +199,10 @@ void testrun_stdtest_threefish512(void){ threefish512_enc(data, &ctx); cli_putstr_P(PSTR("\r\ncipher: ")); cli_hexdump_block(data, 64, 4, 16); + threefish512_dec(data, &ctx); + cli_putstr_P(PSTR("\r\ndecipher: ")); + cli_hexdump_block(data, 64, 4, 16); + } void testrun_stdtest_threefish1024(void){ @@ -211,6 +226,9 @@ void testrun_stdtest_threefish1024(void){ threefish1024_enc(data, &ctx); cli_putstr_P(PSTR("\r\ncipher: ")); cli_hexdump_block(data, 128, 4, 16); + threefish1024_dec(data, &ctx); + cli_putstr_P(PSTR("\r\ndecipher: ")); + cli_hexdump_block(data, 128, 4, 16); for(i=0; i<128; ++i){ key[i] = 0x10+i; @@ -229,6 +247,9 @@ void testrun_stdtest_threefish1024(void){ threefish1024_enc(data, &ctx); cli_putstr_P(PSTR("\r\ncipher: ")); cli_hexdump_block(data, 128, 4, 16); + threefish1024_dec(data, &ctx); + cli_putstr_P(PSTR("\r\ndecipher: ")); + cli_hexdump_block(data, 128, 4, 16); } @@ -268,6 +289,12 @@ void testrun_performance_threefish256(void){ ultoa((unsigned long)t, str, 10); cli_putstr(str); + startTimer(1); + threefish256_dec(data, &ctx); + t = stopTimer(); + cli_putstr_P(PSTR("\r\n\tdecrypt time: ")); + ultoa((unsigned long)t, str, 10); + cli_putstr(str); cli_putstr_P(PSTR("\r\n")); } @@ -301,6 +328,13 @@ void testrun_performance_threefish512(void){ ultoa((unsigned long)t, str, 10); cli_putstr(str); + startTimer(1); + threefish512_dec(data, &ctx); + t = stopTimer(); + cli_putstr_P(PSTR("\r\n\tdecrypt time: ")); + ultoa((unsigned long)t, str, 10); + cli_putstr(str); + cli_putstr_P(PSTR("\r\n")); } @@ -334,6 +368,13 @@ void testrun_performance_threefish1024(void){ ultoa((unsigned long)t, str, 10); cli_putstr(str); + startTimer(1); + threefish1024_dec(data, &ctx); + t = stopTimer(); + cli_putstr_P(PSTR("\r\n\tdecrypt time: ")); + ultoa((unsigned long)t, str, 10); + cli_putstr(str); + cli_putstr_P(PSTR("\r\n")); }