X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=test_src%2Fmain-camellia-test.c;h=19153b57fcfa4548c537a7a0230ec3cdb89a691c;hb=12883cff6e7d233365e8477e08f90c75fa5a48b2;hp=4d64a506be1605e2e7caea88c5ceedcbb85fb0d3;hpb=d5e258765801a9b13be0e0502de94d7cb8c40629;p=avr-crypto-lib.git diff --git a/test_src/main-camellia-test.c b/test_src/main-camellia-test.c index 4d64a50..19153b5 100644 --- a/test_src/main-camellia-test.c +++ b/test_src/main-camellia-test.c @@ -103,9 +103,40 @@ void test_performance_camellia(void){ /***************************************************************************** * self tests * *****************************************************************************/ +/* +128-bit key +key 01 23 45 67 89 ab cd ef fe dc ba 98 76 54 32 10 +plaintext 01 23 45 67 89 ab cd ef fe dc ba 98 76 54 32 10 +ciphertext 67 67 31 38 54 96 69 73 08 57 06 56 48 ea be 43 +*/ +void testrun_camellia(void){ + + uint8_t data[16] = { 0x01, 0x23, 0x45, 0x67, + 0x89, 0xab, 0xcd, 0xef, + 0xfe, 0xdc, 0xba, 0x98, + 0x76, 0x54, 0x32, 0x10 }; +/* + uint8_t data[16] = { + 0x10, 0x32, 0x54, 0x76, + 0x98, 0xba, 0xdc, 0xfe, + 0xfe, 0xcd, 0xab, 0x89 + 0x67, 0x89, 0x67, 0x01}; +*/ + camellia128_ctx_t ctx; + camellia128_init(data, &ctx); + uart_putstr_P(PSTR("\r\n key: ")); + uart_hexdump(data, 16); + uart_putstr_P(PSTR("\r\n plaintext: ")); + uart_hexdump(data, 16); + camellia128_enc(data, &ctx); + uart_putstr_P(PSTR("\r\n ciphertext: ")); + uart_hexdump(data, 16); + +} + /***************************************************************************** - * main * + * main * *****************************************************************************/ int main (void){ @@ -120,7 +151,7 @@ int main (void){ uart_putstr_P(PSTR(")\r\nloaded and running\r\n")); PGM_P u = PSTR("nessie\0test\0performance\0"); - void_fpt v[] = {testrun_nessie_camellia, testrun_nessie_camellia, test_performance_camellia}; + void_fpt v[] = {testrun_nessie_camellia, testrun_camellia, test_performance_camellia}; while(1){ if (!getnextwordn(str,20)){DEBUG_S("DBG: W1\r\n"); goto error;}