]> git.cryptolib.org Git - avr-crypto-lib.git/commitdiff
moving from uart to cli
authorbg <bg@b1d182e4-1ff8-0310-901f-bddb46175740>
Wed, 25 Feb 2009 20:22:32 +0000 (20:22 +0000)
committerbg <bg@b1d182e4-1ff8-0310-901f-bddb46175740>
Wed, 25 Feb 2009 20:22:32 +0000 (20:22 +0000)
42 files changed:
Makefile
hmac-sha1.c
hmac-sha1.h
host/get_test.rb
host/nessie_check.rb
mkfiles/hmac-sha1.mk
test_src/main-a5_1-test.c
test_src/main-aes-test.c
test_src/main-arcfour-test.c
test_src/main-camellia-test.c
test_src/main-cast5-test.c
test_src/main-des-test.c
test_src/main-entropium-test.c
test_src/main-grain-test.c
test_src/main-hmac-sha1-test.c
test_src/main-hmac-sha256-test.c
test_src/main-md5-test.c
test_src/main-mugi-test.c
test_src/main-noekeon-test.c
test_src/main-omac-noekeon-test.c
test_src/main-present-test.c
test_src/main-rc5-test.c
test_src/main-rc6-test.c
test_src/main-seed-test.c
test_src/main-serpent-test.c
test_src/main-sha1-test.c
test_src/main-sha256-test.c
test_src/main-shabea-test.c
test_src/main-shacal1_enc-test.c
test_src/main-shacal2_enc-test.c
test_src/main-skipjack-test.c
test_src/main-tdes-test.c
test_src/main-trivium-test.c
test_src/main-twister224-test.c
test_src/main-twister256-test.c
test_src/main-twister384-test.c
test_src/main-twister512-test.c
test_src/main-xtea-test.c
test_src/nessie_mac_test.c
test_src/uart.c
testvectors/HMAC-Sha-1-512-160.unverified.test-vectors
testvectors/HMAC-Sha-2-512-256.unverified.test-vectors

index c4899a244c8d5033260a743c85cdf10f24e94fe5..e730a4c00a0d01ec728af75fc3ab5fbf7fb2b1df 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -6,13 +6,14 @@ STREAM_CIPHERS :=
 HASHES         :=
 MACS           :=
 PRNGS          := 
+ENCODINGS      :=
 
 # we use the gnu make standard library
 include gmsl
 include avr-makefile.inc
 include mkfiles/*.mk
 
-ALGORITHMS = $(BLOCK_CIPHERS) $(STREAM_CIPHERS) $(HASHES) $(PRNGS) $(MACS)
+ALGORITHMS = $(BLOCK_CIPHERS) $(STREAM_CIPHERS) $(HASHES) $(PRNGS) $(MACS) $(ENCODINGS)
 ALGORITHMS_OBJ = $(patsubst %,%_OBJ, $(ALGORITHMS))
 ALGORITHMS_TEST_BIN = $(patsubst %,%_TEST_BIN, $(ALGORITHMS))
 
@@ -76,6 +77,8 @@ info:
        @echo "    $(MACS)"
        @echo "  PRNG functions:"
        @echo "    $(PRNGS)"
+       @echo "  encodings:"
+       @echo "    $(ENCODINGS)"
 #      @echo "  ALGORITHMS_TEST_BIN:"
 #      @echo "    $(ALGORITHMS_TEST_BIN)"
 #      @echo "  ALGORITHMS_TEST_TARGET_ELF:"
@@ -164,6 +167,7 @@ $(STREAM_CIPHERS_OBJ): $(patsubst %,%_OBJ, $(STREAM_CIPHERS))
 $(HASHES_OBJ): $(patsubst %,%_OBJ, $(HASHES))
 $(PRNGS_OBJ): $(patsubst %,%_OBJ, $(PRNGS))
 $(MACS_OBJ): $(patsubst %,%_OBJ, $(MACS))
+$(ENCODINGS_OBJ): $(patsubst %,%_OBJ, $(ENCODINGS))
 
 #-------------------------------------------------------------------------------
 
@@ -241,6 +245,9 @@ macs: $(patsubst %, %_OBJ, $(MACS))
 .PHONY:  prngs
 prngs: $(patsubst %, %_OBJ, $(PRNGS))
 
+.PHONY:  encodings
+encodings: $(patsubst %, %_OBJ, $(ENCODINGS))
+
 tests: $(ALGORITHMS_TEST_BIN) \
        $(ALGORITHMS_TEST_TARGET_ELF) \
        $(ALGORITHMS_TEST_TARGET_HEX)
index 45a2afb562729aa273352144c7cee4f2612924fc..9271e50c034b31d3deea4a9011131207d0f4eaaa 100644 (file)
 #include <string.h>
 #include "config.h"
 #include "sha1.h"
+#include "hmac-sha1.h"
 
 #define IPAD 0x36
 #define OPAD 0x5C
 
-typedef sha1_ctx_t hmac_sha1_ctx_t;
 
 #ifndef HMAC_SHORTONLY
 
@@ -58,7 +58,7 @@ void hmac_sha1_init(hmac_sha1_ctx_t *s, void* key, uint16_t keylength_b){
        sha1_init(s);
        sha1_nextBlock(s, buffer);
 #if defined SECURE_WIPE_BUFFER
-       memset(buffer, 0, SHA256_BLOCK_BITS/8);
+       memset(buffer, 0, SHA1_BLOCK_BYTES);
 #endif
 }
 
@@ -85,7 +85,7 @@ void hmac_sha1_final(hmac_sha1_ctx_t *s, void* key, uint16_t keylength_b){
        memcpy(s, &a, sizeof(sha1_ctx_t));
 #if defined SECURE_WIPE_BUFFER
        memset(buffer, 0, SHA1_BLOCK_BYTES);
-       memset(a.h, 0, 20);
+       memset(&a, 0, sizeof(sha1_ctx_t));
 #endif 
 }
 
@@ -100,7 +100,7 @@ void hmac_sha1_lastBlock()
  * keylength in bits!
  * message length in bits!
  */
-void hmac_sha1(void* dest, void* key, uint16_t keylength_b, void* msg, uint64_t msglength_b){ /* a one-shot*/
+void hmac_sha1(void* dest, void* key, uint16_t keylength_b, void* msg, uint32_t msglength_b){ /* a one-shot*/
        sha1_ctx_t s;
        uint8_t i;
        uint8_t buffer[SHA1_BLOCK_BYTES];
index 2fdb2432cb7b38769751dc9b40a16dcb1d710301..90c32cd07cd3dc5cb0212793b26dffdefd40aecf 100644 (file)
@@ -1,4 +1,4 @@
-/* hmac-sha256.h */
+/* hmac-sha1.h */
 /*
     This file is part of the AVR-Crypto-Lib.
     Copyright (C) 2008  Daniel Otte (daniel.otte@rub.de)
 #include "sha1.h"
 
 #define HMACSHA1_BITS SHA1_HASH_BITS
-#define HMACSHA1_BYTES ((HMAC_BITS+7)/8)
+#define HMACSHA1_BYTES ((HMACSHA1_BITS+7)/8)
 
 typedef sha1_ctx_t hmac_sha1_ctx_t;
 
 
 void hmac_sha1_init(hmac_sha1_ctx_t *s, void* key, uint16_t keylength_b);
 void hmac_sha1_final(hmac_sha1_ctx_t *s, void* key, uint16_t keylength_b);
-void hmac_sha1(void* dest, void* key, uint16_t keylength_b, void* msg, uint64_t msglength_b);
+void hmac_sha1(void* dest, void* key, uint16_t keylength_b, void* msg, uint32_t msglength_b);
 
 
 #endif /*HMACSHA1_H_*/
index cc8b48acbb3776a7fd30c93cf5c909d5c7a08846..0c3eb1bea1ae0e8a2c5a466fcffd27fb860e8de5 100644 (file)
 
 require 'serialport'
 
-def read_line
+def read_line(error_msg=true)
   s = $sp.gets()
   if s==nil
-    puts "ERROR: read timeout!\n";
+    puts("ERROR: read timeout!\n") if error_msg
        return nil
   end  
   s.gsub(/\006/, '');  
@@ -36,7 +36,7 @@ def readTestVector(param)
   set=0;
   vector=0;
   begin
-    lb = read_line()
+    lb = read_line(false)
        if (m=/unknown command/.match(lb) || m=/[Ee][Rr]{2}[Oo][Rr]/.match(lb))
       puts("ERROR: "+lb);
       exit(2);
index 56bd17be50da837a7385a1df8989dcaf8b8c8c62..d0f2b55a237473155d21a3a0910396c25505bc14 100644 (file)
@@ -47,7 +47,7 @@ def get_next_assign(file, i)
          return nil if file.eof
          l = file.gets().strip()
          if not /[^=]+=[^=]+/.match(l)
-           value += l if /[0-9A-Fa-f]{5}/.match(l)
+           value += l if /^[0-9A-Fa-f]{5}/.match(l)
          end
     end until /[^=]+=[^=]+/.match(l)
        $last_assign[i] = l
@@ -59,7 +59,7 @@ def get_next_assign(file, i)
          return nil if file.eof
          l = file.gets().strip()
          if not /[^=]+=[^=]+/.match(l)
-           value += l if /[0-9A-Fa-f]{5}/.match(l)
+           value += l if /^[0-9A-Fa-f]{5}/.match(l)
          end
     end until /[^=]+=[^=]+/.match(l)
        $last_assign[i] = l
@@ -109,8 +109,8 @@ if ARGV.size==3
     $quiet=true
   end
 else
-  f1 = ARGV[1]
-  f2 = ARGV[2]
+  f1 = ARGV[0]
+  f2 = ARGV[1]
 end
   
 puts("compare("+f1+", "+f2+")")
index d5bec0325c7c3d332def01461fcfb7f3e0b1c8bd..d5d731c960adb4085cf00374517e0cb233f479ff 100644 (file)
@@ -1,7 +1,7 @@
 # Makefile for HMAC-SHA256
 ALGO_NAME := HMAC-SHA1
 
-# comment out the following line for removement of HMAC-SHA256 from the build process
+# comment out the following line for removement of HMAC-SHA1 from the build process
 MACS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := hmac-sha1.o sha1-asm.o
index 98d63fa6f3edcb4bfc3a12326cf801b3426bdebc..79e19caca4eed3a79980f433be43c22824fcd658 100644 (file)
@@ -77,14 +77,14 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
        
index 47ed45972a6d646f8d147156aec7c5a83a5805cf..c505753ab4276f15a6cf93e8ccb583ef14bc76ba 100644 (file)
@@ -84,16 +84,16 @@ void testrun_test_aes(void){
                             0xe0, 0x37, 0x07, 0x34 };
        aes128_ctx_t ctx;
        aes128_init(key, &ctx);
-       uart_putstr_P(PSTR("\r\n\r\n cipher test (FIPS 197):\r\n key:        "));
-       uart_hexdump(key, 16);
-       uart_putstr_P(PSTR("\r\n plaintext:  "));
-       uart_hexdump(data, 16);
+       cli_putstr_P(PSTR("\r\n\r\n cipher test (FIPS 197):\r\n key:        "));
+       cli_hexdump(key, 16);
+       cli_putstr_P(PSTR("\r\n plaintext:  "));
+       cli_hexdump(data, 16);
        aes128_enc(data, &ctx);
-       uart_putstr_P(PSTR("\r\n ciphertext: "));
-       uart_hexdump(data, 16);
+       cli_putstr_P(PSTR("\r\n ciphertext: "));
+       cli_hexdump(data, 16);
        aes128_dec(data, &ctx);
-       uart_putstr_P(PSTR("\r\n plaintext:  "));
-       uart_hexdump(data, 16);
+       cli_putstr_P(PSTR("\r\n plaintext:  "));
+       cli_hexdump(data, 16);
        
        
 }
@@ -106,14 +106,14 @@ void testrun_testkey_aes128(void){
        aes128_ctx_t ctx;
        uint8_t i;
        aes128_init(key, &ctx);
-       uart_putstr_P(PSTR("\r\n\r\n keyschedule test (FIPS 197):\r\n key:   "));
-       uart_hexdump(key, 16);
+       cli_putstr_P(PSTR("\r\n\r\n keyschedule test (FIPS 197):\r\n key:   "));
+       cli_hexdump(key, 16);
        for(i=0; i<11; ++i){
-               uart_putstr_P(PSTR("\r\n index: "));
-               uart_putc('0'+i/10);
-               uart_putc('0'+i%10);
-               uart_putstr_P(PSTR(" roundkey "));
-               uart_hexdump(ctx.key[i].ks, 16);
+               cli_putstr_P(PSTR("\r\n index: "));
+               cli_putc('0'+i/10);
+               cli_putc('0'+i%10);
+               cli_putstr_P(PSTR(" roundkey "));
+               cli_hexdump(ctx.key[i].ks, 16);
        }
 }
 
@@ -128,14 +128,14 @@ void testrun_testkey_aes192(void){
        uint8_t i;
        memset(&ctx, 0, sizeof(aes192_ctx_t));
        aes192_init(key, &ctx);
-       uart_putstr_P(PSTR("\r\n\r\n keyschedule test (FIPS 197):\r\n key:   "));
-       uart_hexdump(key, 24);
+       cli_putstr_P(PSTR("\r\n\r\n keyschedule test (FIPS 197):\r\n key:   "));
+       cli_hexdump(key, 24);
        for(i=0; i<13; ++i){
-               uart_putstr_P(PSTR("\r\n index: "));
-               uart_putc('0'+i/10);
-               uart_putc('0'+i%10);
-               uart_putstr_P(PSTR(" roundkey "));
-               uart_hexdump(ctx.key[i].ks, 16);
+               cli_putstr_P(PSTR("\r\n index: "));
+               cli_putc('0'+i/10);
+               cli_putc('0'+i%10);
+               cli_putstr_P(PSTR(" roundkey "));
+               cli_hexdump(ctx.key[i].ks, 16);
        }
 }
 
@@ -153,14 +153,14 @@ void testrun_testkey_aes256(void){
        uint8_t i;
        memset(&ctx, 0, sizeof(aes256_ctx_t));
        aes256_init(key, &ctx);
-       uart_putstr_P(PSTR("\r\n\r\n keyschedule test (FIPS 197):\r\n key:   "));
-       uart_hexdump(key, 32);
+       cli_putstr_P(PSTR("\r\n\r\n keyschedule test (FIPS 197):\r\n key:   "));
+       cli_hexdump(key, 32);
        for(i=0; i<15; ++i){
-               uart_putstr_P(PSTR("\r\n index: "));
-               uart_putc('0'+i/10);
-               uart_putc('0'+i%10);
-               uart_putstr_P(PSTR(" roundkey "));
-               uart_hexdump(ctx.key[i].ks, 16);
+               cli_putstr_P(PSTR("\r\n index: "));
+               cli_putc('0'+i/10);
+               cli_putc('0'+i%10);
+               cli_putstr_P(PSTR(" roundkey "));
+               cli_hexdump(ctx.key[i].ks, 16);
        }
 }
 
@@ -186,27 +186,27 @@ void testrun_performance_aes128(void){
        startTimer(1);
        aes128_init(key, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        aes128_enc(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tencrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        aes128_dec(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tdecrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 
@@ -225,27 +225,27 @@ void testrun_performance_aes192(void){
        startTimer(1);
        aes192_init(key, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        aes192_enc(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tencrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        aes192_dec(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tdecrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 
@@ -264,36 +264,36 @@ void testrun_performance_aes256(void){
        startTimer(1);
        aes256_init(key, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        aes256_enc(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tencrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        aes256_dec(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tdecrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 void testrun_performance_aes(void){
-       uart_putstr_P(PSTR("\r\n -=AES Performance Test=-\r\n"));
-       uart_putstr_P(PSTR("\r\n       AES-128\r\n"));
+       cli_putstr_P(PSTR("\r\n -=AES Performance Test=-\r\n"));
+       cli_putstr_P(PSTR("\r\n       AES-128\r\n"));
        testrun_performance_aes128();
-       uart_putstr_P(PSTR("\r\n       AES-192\r\n"));
+       cli_putstr_P(PSTR("\r\n       AES-192\r\n"));
        testrun_performance_aes192();
-       uart_putstr_P(PSTR("\r\n       AES-256\r\n"));
+       cli_putstr_P(PSTR("\r\n       AES-256\r\n"));
        testrun_performance_aes256();
 }
 /*****************************************************************************
@@ -318,13 +318,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index f16c2db42344d66198e4c43a4b94841a51176d60..f80fd96a49888b1075e9f9902c4c10e301860063 100644 (file)
@@ -72,18 +72,18 @@ void testrun_performance_arcfour(void){
        startTimer(1);
        arcfour_init(key, 16, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);       
+       cli_putstr(str);        
        
        startTimer(1);
        arcfour_gen(&ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tencrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);       
+       cli_putstr(str);        
        
-       uart_putstr_P(PSTR("\r\n"));    
+       cli_putstr_P(PSTR("\r\n"));     
 }
 
 
@@ -106,13 +106,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 07191e4152bf2dc02eae565c17aba2bdf768fb6a..c54765ac1c9e676d27079ba85df2e957d27440b2 100644 (file)
@@ -75,27 +75,27 @@ void test_performance_camellia(void){
        startTimer(1);
        camellia128_init(key, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        camellia128_enc(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tencrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        camellia128_dec(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tdecrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 
@@ -124,16 +124,16 @@ void testrun_camellia(void){
 
   camellia128_ctx_t ctx;
   camellia128_init(key, &ctx);
-  uart_putstr_P(PSTR("\r\n key:        "));
-  uart_hexdump(data, 16);
-  uart_putstr_P(PSTR("\r\n plaintext:  "));
-  uart_hexdump(data, 16);
+  cli_putstr_P(PSTR("\r\n key:        "));
+  cli_hexdump(data, 16);
+  cli_putstr_P(PSTR("\r\n plaintext:  "));
+  cli_hexdump(data, 16);
   camellia128_enc(data, &ctx);
-  uart_putstr_P(PSTR("\r\n ciphertext: "));
-  uart_hexdump(data, 16);
+  cli_putstr_P(PSTR("\r\n ciphertext: "));
+  cli_hexdump(data, 16);
   camellia128_dec(data, &ctx);
-  uart_putstr_P(PSTR("\r\n decrypted:  "));
-  uart_hexdump(data, 16);
+  cli_putstr_P(PSTR("\r\n decrypted:  "));
+  cli_hexdump(data, 16);
 
 }
 
@@ -157,13 +157,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 2dcc2aef7e63e327ceafe91394e0ed94b5360773..4d2530c03abfc15a9360fb9339a8b2ab07038b6b 100644 (file)
@@ -59,18 +59,18 @@ void testrun_nessie_cast5(void){
 
 void cast5_ctx_dump(cast5_ctx_t *s){
        uint8_t i;
-       uart_putstr("\r\n==== cast5_ctx_dump ====\r\n shortkey: ");
-       uart_putstr(s->shortkey?"yes":"no");
+       cli_putstr("\r\n==== cast5_ctx_dump ====\r\n shortkey: ");
+       cli_putstr(s->shortkey?"yes":"no");
        for(i=0;i<16;++i){
                uint8_t r;
-               uart_putstr("\r\n Km"); uart_hexdump(&i, 1); uart_putc(':');
-               uart_hexdump(&(s->mask[i]), 4);
-               uart_putstr("\r\n Kr"); uart_hexdump(&i, 1); uart_putc(':');
+               cli_putstr("\r\n Km"); cli_hexdump(&i, 1); cli_putc(':');
+               cli_hexdump(&(s->mask[i]), 4);
+               cli_putstr("\r\n Kr"); cli_hexdump(&i, 1); cli_putc(':');
                r = (s->rotl[i/2]);
                if (i&0x01) r >>= 4;
                r &= 0xf;
                r += (s->roth[i>>3]&(1<<(i&0x7)))?0x10:0x00;
-               uart_hexdump(&r, 1);
+               cli_hexdump(&r, 1);
        }
 }
 
@@ -78,32 +78,32 @@ void cast5_ctx_dump(cast5_ctx_t *s){
 void test_encrypt(uint8_t *block, uint8_t *key, uint8_t keylength, bool print){
        cast5_ctx_t s;
        if (print){
-               uart_putstr("\r\nCAST5:\r\n key:\t");
-               uart_hexdump(key, keylength/8);
-               uart_putstr("\r\n plaintext:\t");
-               uart_hexdump(block, 8);
+               cli_putstr("\r\nCAST5:\r\n key:\t");
+               cli_hexdump(key, keylength/8);
+               cli_putstr("\r\n plaintext:\t");
+               cli_hexdump(block, 8);
        }
        cast5_init(key, keylength, &s);
        cast5_enc(block, &s);
        if (print){
-               uart_putstr("\r\n ciphertext:\t");
-               uart_hexdump(block, 8);
+               cli_putstr("\r\n ciphertext:\t");
+               cli_hexdump(block, 8);
        }
 } 
 
 void test_decrypt(uint8_t *block, uint8_t *key, uint8_t keylength, bool print){
        cast5_ctx_t s;
        if (print){
-               uart_putstr("\r\nCAST5:\r\n key:\t");
-               uart_hexdump(key, keylength/8);
-               uart_putstr("\r\n ciphertext:\t");
-               uart_hexdump(block, 8);
+               cli_putstr("\r\nCAST5:\r\n key:\t");
+               cli_hexdump(key, keylength/8);
+               cli_putstr("\r\n ciphertext:\t");
+               cli_hexdump(block, 8);
        }
        cast5_init(key, keylength, &s);
        cast5_dec(block, &s);
        if (print){
-               uart_putstr("\r\n plaintext:\t");
-               uart_hexdump(block, 8);
+               cli_putstr("\r\n plaintext:\t");
+               cli_hexdump(block, 8);
        }
 } 
 
@@ -126,7 +126,7 @@ void testrun_cast5(void){
        test_decrypt(block, key, 40, true);
        
 /**** long test *****/
-       uart_putstr("\r\nmaintance-test");
+       cli_putstr("\r\nmaintance-test");
        uint8_t a[16]= {0x01, 0x23, 0x45, 0x67, 0x12,
                                    0x34, 0x56, 0x78, 0x23, 0x45, 
                                    0x67, 0x89, 0x34, 0x56, 0x78, 
@@ -142,12 +142,12 @@ void testrun_cast5(void){
                test_encrypt(&(b[0]), &(a[0]), 128, false);
                test_encrypt(&(b[8]), &(a[0]), 128, false);
                if ((i&0x000000ff) == 0){
-                       uart_putstr("\r\n");
-                       uart_hexdump(&i, 4);
+                       
+                       cli_hexdump(&i, 4);
                }
        }
-       uart_putstr("\r\na = "); uart_hexdump(a, 16);
-       uart_putstr("\r\nb = "); uart_hexdump(b, 16);
+       cli_putstr("\r\na = "); cli_hexdump(a, 16);
+       cli_putstr("\r\nb = "); cli_hexdump(b, 16);
 
 }
 
@@ -166,27 +166,27 @@ void testrun_performance_cast5(void){
        startTimer(1);
        cast5_init(key, 128, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        cast5_enc(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tencrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        cast5_dec(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tdecrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 /*****************************************************************************
@@ -208,13 +208,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 349c2903d7152cf8090b2c1eb9844c9b363a8cd2..26a641516365c63071a0bae6e7d10ef6d31aeb86 100644 (file)
@@ -81,17 +81,17 @@ void testrun_performance_des(void){
        startTimer(1);
        des_enc(data, data, key);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tencrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        startTimer(1);
        des_dec(data, data, key);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tdecrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr(str);
+       cli_putstr_P(PSTR("\r\n"));
 }
 /*****************************************************************************
  * main                                                
@@ -112,13 +112,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 3f62fb9e39252dce41f3adaf21e84a189377354e..95f3fc1136fb6ef8d6fdbc1111548f092f6ab598 100644 (file)
@@ -47,17 +47,17 @@ void testrun_entropium(void){
        uint32_t i=0;
        while(!uart_getc_nb(&c)){
                entropium_getRandomBlock(data);
-               uart_putstr_P(PSTR("\r\n "));
+               cli_putstr_P(PSTR("\r\n "));
                ultoa(i, str, 10);
                for(c=strlen(str); c<11; ++c){
-                       uart_putc(' ');
+                       cli_putc(' ');
                }
-               uart_putstr(str);
+               cli_putstr(str);
                ++i;
-               uart_putstr_P(PSTR(" : "));
-               uart_hexdump(data, 32);
+               cli_putstr_P(PSTR(" : "));
+               cli_hexdump(data, 32);
        }
-       uart_putstr_P(PSTR("\r\n\r\n"));
+       cli_putstr_P(PSTR("\r\n\r\n"));
 }
 
 
@@ -72,19 +72,19 @@ void testrun_performance_entropium(void){
        startTimer(1);
        entropium_addEntropy(128, data);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tadd entropy time: "));
+       cli_putstr_P(PSTR("\r\n\tadd entropy time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        entropium_getRandomBlock(data);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tget random time:  "));
+       cli_putstr_P(PSTR("\r\n\tget random time:  "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 /*****************************************************************************
  *  main                                                                                                                                        *
@@ -106,13 +106,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
+
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 036faad94490a06930f813491e2da0f7a57eaaf1..04f0333f1b6e75e4430aeee5fa66a209b4e47c11 100644 (file)
@@ -83,17 +83,17 @@ void testrun_std_grain(void){
        /* 1 */
        memset(key, 0, 10);
        memset(iv, 0, 8);
-       uart_putstr_P(PSTR("\r\n=== std test ==="));
-       uart_putstr_P(PSTR("\r\n key: "));
-       uart_hexdump(key, 10);
-       uart_putstr_P(PSTR("\r\n iv:  "));
-       uart_hexdump(key, 8);
+       cli_putstr_P(PSTR("\r\n=== std test ==="));
+       cli_putstr_P(PSTR("\r\n key: "));
+       cli_hexdump(key, 10);
+       cli_putstr_P(PSTR("\r\n iv:  "));
+       cli_hexdump(key, 8);
        grain_init(key, iv, &ctx);
        for(i=0; i<10; ++i){
                out[i] = grain_getbyte_dummy(&ctx);
        }
-       uart_putstr_P(PSTR("\r\n out: "));
-       uart_hexdump(out, 10);
+       cli_putstr_P(PSTR("\r\n out: "));
+       cli_hexdump(out, 10);
        
        /* 2 */
        for(i=0; i<8; ++i){
@@ -105,19 +105,19 @@ void testrun_std_grain(void){
        for(i=0; i<8; ++i){
                iv[i] = i*0x22+1;
        }
-       uart_putstr_P(PSTR("\r\n\r\n key: "));
-       uart_hexdump(key, 10);
-       uart_putstr_P(PSTR("\r\n iv:  "));
-       uart_hexdump(key, 8);
+       cli_putstr_P(PSTR("\r\n\r\n key: "));
+       cli_hexdump(key, 10);
+       cli_putstr_P(PSTR("\r\n iv:  "));
+       cli_hexdump(key, 8);
        grain_init(key, iv, &ctx);
        for(i=0; i<10; ++i){
                out[i] = grain_getbyte_dummy(&ctx);
        }
-       uart_putstr_P(PSTR("\r\n out: "));
-       uart_hexdump(out, 10);
+       cli_putstr_P(PSTR("\r\n out: "));
+       cli_hexdump(out, 10);
        
        
-       uart_putstr_P(PSTR("\r\n\r\n"));
+       cli_putstr_P(PSTR("\r\n\r\n"));
 }
 
 void testrun_performance_grain(void){
@@ -135,18 +135,18 @@ void testrun_performance_grain(void){
        startTimer(1);
        grain_init(key, iv, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);       
+       cli_putstr(str);        
        
        startTimer(1);
        grain_enc(&ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tencrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);       
+       cli_putstr(str);        
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 /*****************************************************************************
@@ -168,13 +168,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 74d331e4b6be8a970142709c2a888433319fd729..f84cfdf95cabfb76c22ab1088fc6f0c118afb704 100644 (file)
@@ -88,13 +88,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 6d80d54022bab645070027bb7fde60d37c1cf1f9..66aafe6901e197904c1baacbefa442cb2e173683 100644 (file)
@@ -88,13 +88,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 90c5971abd1597de3c1e464ebc62d6fe979cd29b..ec51e7d9adaf02b703c85664fa402b4aa757ce3d 100644 (file)
@@ -95,7 +95,7 @@ void testrun_md5(void){
                "12345678901234567890123456789012345678901234567890123456789012345678901234567890"};
        uint16_t i;
        
-       uart_putstr("\r\n=== MD5 test suit ===");
+       cli_putstr("\r\n=== MD5 test suit ===");
        for(i=0; i<7; ++i){
                cli_putstr("\r\n MD5 (\"");
                cli_putstr(testv[i]);
@@ -131,27 +131,27 @@ void testrun_performance_md5(void){
        startTimer(1);
        md5_init(&ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        md5_nextBlock(&ctx, data);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tone-block time: "));
+       cli_putstr_P(PSTR("\r\n\tone-block time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        md5_lastBlock(&ctx, data, 0);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tlast block time: "));
+       cli_putstr_P(PSTR("\r\n\tlast block time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 
@@ -174,13 +174,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 2255d1a6cf6f9a0c81a5f5e064b36236392c65d3..f49340152b7f1ab77907f93562caa7c5dc28c686 100644 (file)
@@ -128,13 +128,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 1907c5e800f65706a6af7c41394343d6c5f7ab4b..acd501d79d70cb320d7738043d3da02d94177d51 100644 (file)
@@ -17,7 +17,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 /*
- * serpent test-suit
+ * noekeon test-suit
  * 
 */
 
@@ -87,42 +87,42 @@ void testrun_nessie_noekeon(void){
 
 
 void testrun_stdtest_rundirect(void* data, void* key){
-       uart_putstr_P(PSTR("\r\n                     "));
-       uart_putstr_P(PSTR("k = "));
-       uart_hexdump(key,16);
+       cli_putstr_P(PSTR("\r\n                     "));
+       cli_putstr_P(PSTR("k = "));
+       cli_hexdump(key,16);
        
-       uart_putstr_P(PSTR("\r\n                     "));
-       uart_putstr_P(PSTR("a = "));
-       uart_hexdump(data,16);
+       cli_putstr_P(PSTR("\r\n                     "));
+       cli_putstr_P(PSTR("a = "));
+       cli_hexdump(data,16);
        
        noekeon_enc(data, key);
-       uart_putstr_P(PSTR("\r\nafter NESSIEencrypt, b = "));
-       uart_hexdump(data,16);
+       cli_putstr_P(PSTR("\r\nafter NESSIEencrypt, b = "));
+       cli_hexdump(data,16);
        
        noekeon_dec(data, key);
-       uart_putstr_P(PSTR("\r\nafter NESSIEdecrypt, a?= "));
-       uart_hexdump(data,16);
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\nafter NESSIEdecrypt, a?= "));
+       cli_hexdump(data,16);
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 void testrun_stdtest_runindirect(void* data, void* key){
        noekeon_ctx_t ctx;
-       uart_putstr_P(PSTR("\r\n                     "));
-       uart_putstr_P(PSTR("k = "));
-       uart_hexdump(key,16);
+       cli_putstr_P(PSTR("\r\n                     "));
+       cli_putstr_P(PSTR("k = "));
+       cli_hexdump(key,16);
        
-       uart_putstr_P(PSTR("\r\n                     "));
-       uart_putstr_P(PSTR("a = "));
-       uart_hexdump(data,16);
+       cli_putstr_P(PSTR("\r\n                     "));
+       cli_putstr_P(PSTR("a = "));
+       cli_hexdump(data,16);
        noekeon_init(key, &ctx);
        noekeon_enc(data, &ctx);
-       uart_putstr_P(PSTR("\r\nafter NESSIEencrypt, b = "));
-       uart_hexdump(data,16);
+       cli_putstr_P(PSTR("\r\nafter NESSIEencrypt, b = "));
+       cli_hexdump(data,16);
        
        noekeon_dec(data, &ctx);
-       uart_putstr_P(PSTR("\r\nafter NESSIEdecrypt, a?= "));
-       uart_hexdump(data,16);
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\nafter NESSIEdecrypt, a?= "));
+       cli_hexdump(data,16);
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 void testrun_stdtest_noekeon(void){
@@ -130,7 +130,7 @@ void testrun_stdtest_noekeon(void){
        uint8_t key3[16];
        noekeon_ctx_t ctx;
        
-       uart_putstr_P(PSTR("\r\nTest vectors for block cipher Noekeon in Indirect-Key Mode:\r\n"));
+       cli_putstr_P(PSTR("\r\nTest vectors for block cipher Noekeon in Indirect-Key Mode:\r\n"));
        
        memset(key,  0, 16);
        memset(data, 0, 16);
@@ -151,7 +151,7 @@ void testrun_stdtest_noekeon(void){
        noekeon_enc(data, &ctx);
        testrun_stdtest_runindirect(data, key3);
        
-       uart_putstr_P(PSTR("\r\nTest vectors for block cipher Noekeon in Direct-Key Mode:\r\n"));
+       cli_putstr_P(PSTR("\r\nTest vectors for block cipher Noekeon in Direct-Key Mode:\r\n"));
        
        memset(key,  0, 16);
        memset(data, 0, 16);
@@ -187,25 +187,25 @@ void testrun_performance_noekeon(void){
        startTimer(1);
        noekeon_init(key, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);       
+       cli_putstr(str);        
        
        startTimer(1);
        noekeon_enc(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tencrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);       
+       cli_putstr(str);        
        
        startTimer(1);
        noekeon_dec(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tdecrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 /*****************************************************************************
  *  main                                                                                                                                        *
@@ -230,13 +230,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index fc5b731ce5d0dc37061bc3866c0011c58121745a..377a921f1199419e4ca450387196e16623c7341e 100644 (file)
@@ -45,16 +45,16 @@ char* algo_name = "OMAC-Noekeon";
 
 void test_mac(void* key, void* data, uint16_t datalength_b){
        uint8_t mac[16];
-       uart_putstr_P(PSTR("\r\n-----------\r\n msg length (bit): 0x"));
-       uart_hexdump(((uint8_t*)&datalength_b)+1, 1);
-       uart_hexdump(((uint8_t*)&datalength_b)+0, 1);   
-       uart_putstr_P(PSTR("\r\n msg: "));
-       uart_hexdump(data, (datalength_b+7)/8);
-       uart_putstr_P(PSTR("\r\n key: "));
-       uart_hexdump(key, 16);
+       cli_putstr_P(PSTR("\r\n-----------\r\n msg length (bit): 0x"));
+       cli_hexdump(((uint8_t*)&datalength_b)+1, 1);
+       cli_hexdump(((uint8_t*)&datalength_b)+0, 1);    
+       cli_putstr_P(PSTR("\r\n msg: "));
+       cli_hexdump(data, (datalength_b+7)/8);
+       cli_putstr_P(PSTR("\r\n key: "));
+       cli_hexdump(key, 16);
        omac_noekeon(mac, data, datalength_b, key, (uint8_t)-1);
-       uart_putstr_P(PSTR("\r\n mac: "));
-       uart_hexdump(mac, 16);
+       cli_putstr_P(PSTR("\r\n mac: "));
+       cli_hexdump(mac, 16);
        
 }
 
@@ -125,27 +125,27 @@ void testrun_performance_omac_noekeon(void){
        startTimer(1);
        omac_noekeon_init(&ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        omac_noekeon_next(data, key, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tone-block time: "));
+       cli_putstr_P(PSTR("\r\n\tone-block time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        omac_noekeon_last(data, 128, key, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tlast block time: "));
+       cli_putstr_P(PSTR("\r\n\tlast block time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 /*****************************************************************************
@@ -167,13 +167,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 7f20922e6196e7b896ab2d17254c2886036921cb..b2371b80b620080ffe66b6f3da416ba22de809d7 100644 (file)
@@ -58,23 +58,23 @@ void testrun_nessie_present(void){
 
 void testrun_selfenc(uint8_t* key, uint8_t* buffer){
        present_ctx_t ctx;
-       uart_putstr_P(PSTR("\r\nkey   : "));
-       uart_hexdump(key, 10);
-       uart_putstr_P(PSTR("\r\nplain : "));
-       uart_hexdump(buffer, 8);
+       cli_putstr_P(PSTR("\r\nkey   : "));
+       cli_hexdump(key, 10);
+       cli_putstr_P(PSTR("\r\nplain : "));
+       cli_hexdump(buffer, 8);
        present_init(key, 80, &ctx);
        present_enc(buffer, &ctx);
-       uart_putstr_P(PSTR("\r\ncipher: "));
-       uart_hexdump(buffer, 8);
+       cli_putstr_P(PSTR("\r\ncipher: "));
+       cli_hexdump(buffer, 8);
        present_dec(buffer, &ctx);
-       uart_putstr_P(PSTR("\r\nplain : "));
-       uart_hexdump(buffer, 8);
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\nplain : "));
+       cli_hexdump(buffer, 8);
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 void testrun_self_present(void){
        uint8_t buffer[8], key[10];
-       uart_putstr_P(PSTR("\r\n\r\n=== Testvectors from the paper ===\r\n"));
+       cli_putstr_P(PSTR("\r\n\r\n=== Testvectors from the paper ===\r\n"));
        
        memset(buffer, 0, 8);
        memset(key, 0, 10);
@@ -120,7 +120,7 @@ void testrun_performance_present(void){
        t = stopTimer();
        print_time_P(PSTR("\tdecrypt time: "), t);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 /*****************************************************************************
@@ -142,13 +142,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index a81158a91503a554837635f861bc73757081a736..fa656b849142f73a2430c0cafde99157370bb052 100644 (file)
@@ -75,31 +75,31 @@ void testrun_performance_rc5(void){
        startTimer(1);
        rc5_init(key, 128, RC5_ROUNDS, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);       
+       cli_putstr(str);        
        
        startTimer(1);
        rc5_enc(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tencrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        startTimer(1);
        rc5_dec(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tdecrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
 
        startTimer(1);
        rc5_free(&ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tfree time: "));
+       cli_putstr_P(PSTR("\r\n\tfree time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr(str);
+       cli_putstr_P(PSTR("\r\n"));
 }
 /*****************************************************************************
  *  main                                                                                                                                        *
@@ -120,13 +120,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 0b1dc7bcf96a9ab866c5e083cfc2992d9d9f06b5..aa1d897a50dc75a214a8bdf6a69abd7ce7cf35d6 100644 (file)
@@ -82,31 +82,31 @@ void testrun_performance_rc6(void){
        startTimer(1);
        rc6_init(key, 128, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);       
+       cli_putstr(str);        
        
        startTimer(1);
        rc6_enc(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tencrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        startTimer(1);
        rc6_dec(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tdecrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
 
        startTimer(1);
        rc6_free(&ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tfree time: "));
+       cli_putstr_P(PSTR("\r\n\tfree time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr(str);
+       cli_putstr_P(PSTR("\r\n"));
 }
 /*****************************************************************************
  *  main                                                                                                                                        *
@@ -127,13 +127,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 8d264dccfef79d8ab5fdbb87ed2036ac7c16753b..768e8d9523c5ec89c31105668492888add4ab774 100644 (file)
@@ -78,27 +78,27 @@ void testrun_performance_seed(void){
        startTimer(1);
        seed_init(key, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        seed_enc(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tencrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        seed_dec(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tdecrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 /*****************************************************************************
@@ -107,26 +107,26 @@ void testrun_performance_seed(void){
 
 void testencrypt(uint8_t* block, uint8_t* key){
        seed_ctx_t ctx;
-       uart_putstr("\r\n==testy-encrypt==\r\n key:   ");
-       uart_hexdump(key,16);
+       cli_putstr("\r\n==testy-encrypt==\r\n key:   ");
+       cli_hexdump(key,16);
        seed_init(key, &ctx);
-       uart_putstr("\r\n plain: ");
-       uart_hexdump(block,16);
+       cli_putstr("\r\n plain: ");
+       cli_hexdump(block,16);
        seed_enc(block, &ctx);
-       uart_putstr("\r\n crypt: ");
-       uart_hexdump(block,16);
+       cli_putstr("\r\n crypt: ");
+       cli_hexdump(block,16);
 }
 
 void testdecrypt(uint8_t* block, uint8_t* key){
        seed_ctx_t ctx;
-       uart_putstr("\r\n==testy-decrypt==\r\n key:   ");
-       uart_hexdump(key,16);
+       cli_putstr("\r\n==testy-decrypt==\r\n key:   ");
+       cli_hexdump(key,16);
        seed_init(key, &ctx);
-       uart_putstr("\r\n crypt: ");
-       uart_hexdump(block,16);
+       cli_putstr("\r\n crypt: ");
+       cli_hexdump(block,16);
        seed_dec(block, &ctx);
-       uart_putstr("\r\n plain: ");
-       uart_hexdump(block,16);
+       cli_putstr("\r\n plain: ");
+       cli_hexdump(block,16);
 }
 
 void testrun_seed(void){
@@ -178,13 +178,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index ae8ad161ce049a1492d72199a569e0d4dfecf815..b7fc4e52b772eb0c498a36d564291cdcaaee1509 100644 (file)
@@ -69,10 +69,10 @@ void testrun_test_serpent(void){
        memset(key, 0, 16);
        serpent_init(key, 128, &ctx);
        for(i=0; i<33; ++i){
-               uart_putstr_P(PSTR("\r\n subkekey "));  
-               uart_hexdump(&i, 1);
-               uart_putstr_P(PSTR(" : "));     
-               uart_hexdump(ctx.k[i], 16);
+               cli_putstr_P(PSTR("\r\n subkekey "));   
+               cli_hexdump(&i, 1);
+               cli_putstr_P(PSTR(" : "));      
+               cli_hexdump(ctx.k[i], 16);
        }
 }
 
@@ -91,27 +91,27 @@ void testrun_performance_serpent(void){
        startTimer(1);
        serpent_init(key, 0, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        serpent_enc(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tencrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        serpent_dec(data, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tdecrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 /*****************************************************************************
  *  main                                                                                                                                        *
@@ -132,13 +132,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index f4376dd549e7a09c193a855c2d9b793ac86f453c..68534431ffb5d0144bd1c2abf158baaa3b04782a 100644 (file)
@@ -70,25 +70,25 @@ void testrun_nessie_sha1(void){
 
 void sha1_ctx_dump(sha1_ctx_t *s){
        uint8_t i;
-       uart_putstr("\r\n==== sha1_ctx_dump ====");
+       cli_putstr("\r\n==== sha1_ctx_dump ====");
        for(i=0;i<5;++i){
-               uart_putstr("\r\na["); uart_hexdump(&i, 1); uart_putstr("]: ");
-               uart_hexdump(&(s->h[i]), 4);
+               cli_putstr("\r\na["); cli_hexdump(&i, 1); cli_putstr("]: ");
+               cli_hexdump(&(s->h[i]), 4);
        }
-       uart_putstr("\r\nlength"); uart_hexdump(&i, 8);
+       cli_putstr("\r\nlength"); cli_hexdump(&i, 8);
 } 
 
 void testrun_sha1(void){
        sha1_hash_t hash;
        sha1(&hash,"abc",3*8);
-       uart_putstr("\r\nsha1(\"abc\") = \r\n\t");
-       uart_hexdump(hash,SHA1_HASH_BITS/8);
+       cli_putstr("\r\nsha1(\"abc\") = \r\n\t");
+       cli_hexdump(hash,SHA1_HASH_BITS/8);
        
        sha1(&hash,"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",448);
-       uart_putstr("\r\nsha1(\"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq\") = \r\n\t");
-       uart_hexdump(hash,SHA1_HASH_BITS/8);
+       cli_putstr("\r\nsha1(\"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq\") = \r\n\t");
+       cli_hexdump(hash,SHA1_HASH_BITS/8);
        
-       uart_putstr("\r\nsha1(1,000,000 * 'a') = \r\n\t");
+       cli_putstr("\r\nsha1(1,000,000 * 'a') = \r\n\t");
        {
                uint8_t block[SHA1_BLOCK_BITS/8];
                uint16_t i;
@@ -101,10 +101,10 @@ void testrun_sha1(void){
                sha1_lastBlock(&s,block,0);
                sha1_ctx2hash(&hash, &s);
        }
-       uart_hexdump(hash,SHA1_HASH_BITS/8);
+       cli_hexdump(hash,SHA1_HASH_BITS/8);
        
 
-       uart_putstr("\r\nx");
+       cli_putstr("\r\nx");
 }
 
 
@@ -112,16 +112,16 @@ void testrun_sha1_2(void){
        sha1_ctx_t ctx;
        sha1_hash_t hash;
        sha1(&hash,"",0);
-       uart_putstr("\r\nsha1(NULL) = \r\n\t");
-       uart_hexdump(hash,SHA1_HASH_BYTES);
+       cli_putstr("\r\nsha1(NULL) = \r\n\t");
+       cli_hexdump(hash,SHA1_HASH_BYTES);
 
        memset(hash, 0, SHA1_HASH_BYTES);
 
        sha1_init(&ctx);
        sha1_lastBlock(&ctx, "", 0);
        sha1_ctx2hash(&hash, &ctx); 
-       uart_putstr("\r\nsha1(NULL) = \r\n\t");
-       uart_hexdump(hash,SHA1_HASH_BYTES);
+       cli_putstr("\r\nsha1(NULL) = \r\n\t");
+       cli_hexdump(hash,SHA1_HASH_BYTES);
 }
 
 
@@ -139,27 +139,27 @@ void testrun_performance_sha1(void){
        startTimer(1);
        sha1_init(&ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        sha1_nextBlock(&ctx, data);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tone-block time: "));
+       cli_putstr_P(PSTR("\r\n\tone-block time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        sha1_lastBlock(&ctx, data, 0);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tlast block time: "));
+       cli_putstr_P(PSTR("\r\n\tlast block time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 
@@ -198,15 +198,15 @@ const hfdesc_t* algolist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;      
        shavs_algolist=(hfdesc_t**)algolist;
        shavs_algo=(hfdesc_t*)&sha1_desc;       
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index f6f48b13d7aadfc36024696f2fe44827a929125d..eafc4a390cb8dc3f5caaa0bbed79a99cd7e73240 100644 (file)
@@ -78,27 +78,27 @@ void testrun_performance_sha256(void){
        startTimer(1);
        sha256_init(&ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        sha256_nextBlock(&ctx, data);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tone-block time: "));
+       cli_putstr_P(PSTR("\r\n\tone-block time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        sha256_lastBlock(&ctx, data, 0);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tlast block time: "));
+       cli_putstr_P(PSTR("\r\n\tlast block time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 /*****************************************************************************
@@ -133,15 +133,15 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        shavs_algolist=(hfdesc_t**)algolist;
        shavs_algo=(hfdesc_t*)&sha256_desc;
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index ba78a7861bf7a04ea7dce1a8b7d92860a2c26021..c577b6b95d13f903014b95ea96d7147726a06848 100644 (file)
@@ -84,19 +84,19 @@ void testrun_performance_shabea(void){
        startTimer(1);
        shabea256(data, key, 256, 1, 16);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tencrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        shabea256(data, key, 256, 0, 16);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tdecrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 /*****************************************************************************
@@ -104,24 +104,24 @@ void testrun_performance_shabea(void){
  *****************************************************************************/
 
 void testencrypt(uint8_t* block, uint8_t* key){
-       uart_putstr("\r\n==testy-encrypt==\r\n key: ");
-       uart_hexdump(key,16);
-       uart_putstr("\r\n plain: ");
-       uart_hexdump(block,32);
+       cli_putstr("\r\n==testy-encrypt==\r\n key: ");
+       cli_hexdump(key,16);
+       cli_putstr("\r\n plain: ");
+       cli_hexdump(block,32);
        shabea256(block,key,128,1,16);
-       uart_putstr("\r\n crypt: ");
-       uart_hexdump(block,32);
+       cli_putstr("\r\n crypt: ");
+       cli_hexdump(block,32);
 }
 
 void testdecrypt(uint8_t* block, uint8_t* key){
 
-       uart_putstr("\r\n==testy-decrypt==\r\n key: ");
-       uart_hexdump(key,16);
-       uart_putstr("\r\n crypt: ");
-       uart_hexdump(block,32);
+       cli_putstr("\r\n==testy-decrypt==\r\n key: ");
+       cli_hexdump(key,16);
+       cli_putstr("\r\n crypt: ");
+       cli_hexdump(block,32);
        shabea256(block,key,128,0,16);
-       uart_putstr("\r\n plain: ");
-       uart_hexdump(block,32);
+       cli_putstr("\r\n plain: ");
+       cli_hexdump(block,32);
 }
 
 void testrun_shabea(void){
@@ -181,13 +181,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index b36ef867aceb882776598f5b7b86406db704f506..a4ff3c62d684287e0747ddcc4b5d78668d9488b4 100644 (file)
@@ -76,7 +76,7 @@ void testrun_performance_shacal1enc(void){
        t = stopTimer();
        print_time_P(PSTR("\tencrypt time: "), t);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 /*****************************************************************************
@@ -98,13 +98,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 53fcc8ee243bdc0df42ddd1f65a93b41a1dc94a1..4e880638a6a9f7017dd9d5682507fe716e132849 100644 (file)
@@ -76,7 +76,7 @@ void testrun_performance_shacal2enc(void){
        t = stopTimer();
        print_time_P(PSTR("\tencrypt time: "), t);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 /*****************************************************************************
@@ -98,13 +98,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 5a648b32bbd18c4e3752ff05491ceb61f85200e3..fd686b6c74ff59bb15d610ba479697e1fa97e5e8 100644 (file)
@@ -72,19 +72,19 @@ void testrun_performance_skipjack(void){
        startTimer(1);
        skipjack_enc(data, key);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tencrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        skipjack_dec(data, key);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tdecrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 /*****************************************************************************
@@ -92,23 +92,23 @@ void testrun_performance_skipjack(void){
  *****************************************************************************/
 
 void testencrypt(uint8_t* block, uint8_t* key){
-       uart_putstr("\r\n==testy-encrypt==\r\n key: ");
-       uart_hexdump(key,10);
-       uart_putstr("\r\n plain: ");
-       uart_hexdump(block,8);
+       cli_putstr("\r\n==testy-encrypt==\r\n key: ");
+       cli_hexdump(key,10);
+       cli_putstr("\r\n plain: ");
+       cli_hexdump(block,8);
        skipjack_enc(block,key);
-       uart_putstr("\r\n crypt: ");
-       uart_hexdump(block,8);
+       cli_putstr("\r\n crypt: ");
+       cli_hexdump(block,8);
 }
 
 void testdecrypt(uint8_t* block, uint8_t* key){
-       uart_putstr("\r\n==testy-decrypt==\r\n key: ");
-       uart_hexdump(key,10);
-       uart_putstr("\r\n crypt: ");
-       uart_hexdump(block,8);
+       cli_putstr("\r\n==testy-decrypt==\r\n key: ");
+       cli_hexdump(key,10);
+       cli_putstr("\r\n crypt: ");
+       cli_hexdump(block,8);
        skipjack_dec(block,key);
-       uart_putstr("\r\n plain: ");
-       uart_hexdump(block,8);
+       cli_putstr("\r\n plain: ");
+       cli_hexdump(block,8);
 }
 
 void testrun_skipjack(void){
@@ -152,13 +152,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index f32c972a58f24d637a1e9ad8a453c60bc8589723..a0107d5d3fa22beb6ad560cb33a1398104306bb4 100644 (file)
@@ -81,17 +81,17 @@ void testrun_performance_tdes(void){
        startTimer(1);
        tdes_enc(data, data, key);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tencrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        startTimer(1);
        tdes_dec(data, data, key);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tdecrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr(str);
+       cli_putstr_P(PSTR("\r\n"));
 }
 /*****************************************************************************
  *  main                                                                                                                                        *
@@ -112,13 +112,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 13d00d7e872f9ab95ae0fe76bc9fbebe00085413..6924c4ff2fd05b3ba11f01e992847ef0fd2a5e57 100644 (file)
@@ -81,18 +81,18 @@ void testrun_performance_trivium(void){
        startTimer(1);
        trivium_init(key, 80, iv, 80, &ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);       
+       cli_putstr(str);        
        
        startTimer(1);
        trivium_enc(&ctx);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tencrypt time: "));
+       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);       
+       cli_putstr(str);        
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 /*****************************************************************************
@@ -114,13 +114,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index d2e0a141b49925f128f427e7b9ec338aaf6900e1..7b8b8ee512d73ca9e87dc3129fe29e1c35401a85 100644 (file)
@@ -88,39 +88,39 @@ void testrun_twister224(void){
                "12345678901234567890123456789012345678901234567890123456789012345678901234567890"};
        uint32_t i;
        
-       uart_putstr_P(PSTR("\r\n=== TWISTER-224 test suit (MD5 test values) ==="));
+       cli_putstr_P(PSTR("\r\n=== TWISTER-224 test suit (MD5 test values) ==="));
        for(i=0; i<7; ++i){
-               uart_putstr_P(PSTR("\r\n TWISTER-224 (\""));
-               uart_putstr(testv[i]);
-               uart_putstr_P(PSTR("\") = \r\n\t"));
+               cli_putstr_P(PSTR("\r\n TWISTER-224 (\""));
+               cli_putstr(testv[i]);
+               cli_putstr_P(PSTR("\") = \r\n\t"));
                twister224(&hash, testv[i], strlen(testv[i])*8);
-               uart_hexdump(hash, 224/8);
+               cli_hexdump(hash, 224/8);
        }
        
-       uart_putstr_P(PSTR("\r\n\r\n=== TWISTER-224 test suit (short test values) ==="));
+       cli_putstr_P(PSTR("\r\n\r\n=== TWISTER-224 test suit (short test values) ==="));
        uint8_t stestv[]= {0x00, 0x00, 0xC0, 0xC0, 0x80, 0x48, 0x50};
        uint8_t stestl[]= {   0,    1,    2,    3,    4,    5,    6};   
        for(i=0; i<7; ++i){
-               uart_putstr_P(PSTR("\r\n TWISTER-224 (\""));
-               uart_hexdump(&(stestv[i]), 1);
-               uart_putstr_P(PSTR("\") = \r\n\t"));
+               cli_putstr_P(PSTR("\r\n TWISTER-224 (\""));
+               cli_hexdump(&(stestv[i]), 1);
+               cli_putstr_P(PSTR("\") = \r\n\t"));
                twister224(&hash, &(stestv[i]), stestl[i]);
-               uart_hexdump(hash, 224/8);
+               cli_hexdump(hash, 224/8);
        }
 #ifdef TWISTER_LONGTEST
-       uart_putstr_P(PSTR("\r\n\r\n=== TWISTER-224 test suit (long test) ==="));
+       cli_putstr_P(PSTR("\r\n\r\n=== TWISTER-224 test suit (long test) ==="));
        char* ltest= "abcdefghbcdefghicdefghijdefghijk"
                            "efghijklfghijklmghijklmnhijklmno"; 
        twister224_ctx_t ctx;
        twister224_init(&ctx);  
-       uart_putstr_P(PSTR("\r\n TWISTER-224 ( 16777216 x \""));
-       uart_putstr(ltest);     
-       uart_putstr_P(PSTR("\") = \r\n\t"));
+       cli_putstr_P(PSTR("\r\n TWISTER-224 ( 16777216 x \""));
+       cli_putstr(ltest);      
+       cli_putstr_P(PSTR("\") = \r\n\t"));
        for(i=0; i<16777216; ++i){
                twister224_nextBlock(&ctx, ltest);
        }
        twister224_ctx2hash(hash, &ctx);
-       uart_hexdump(hash, 224/8);
+       cli_hexdump(hash, 224/8);
 #endif
 }
 
@@ -139,9 +139,9 @@ void testrun_performance_twister224(void){
        startTimer(1);
        twister_small_init(&ctx, 224);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        i=3000;
        while(i--)
@@ -150,9 +150,9 @@ void testrun_performance_twister224(void){
        startTimer(1);
        twister_small_nextBlock(&ctx, data);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tone-block time: "));
+       cli_putstr_P(PSTR("\r\n\tone-block time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        i=3000;
        while(i--)
@@ -161,9 +161,9 @@ void testrun_performance_twister224(void){
        startTimer(1);
        twister_small_lastBlock(&ctx, data, 0);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tlast block time: "));
+       cli_putstr_P(PSTR("\r\n\tlast block time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
 
        i=3000;
        while(i--)
@@ -172,15 +172,15 @@ void testrun_performance_twister224(void){
        startTimer(1);
        twister_small_ctx2hash(data, &ctx, 224);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx2hash time: "));
+       cli_putstr_P(PSTR("\r\n\tctx2hash time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
 
        i=3000;
        while(i--)
                _delay_ms(1);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 
@@ -203,13 +203,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 2a54084b1d4333e404aabd7066f9609ff4ea35b9..2b866613cf43916a7925474a0291e14c1bae7e6a 100644 (file)
@@ -76,7 +76,7 @@ void testrun_nessie_twister256(void){
  *****************************************************************************/
 
 void print_hash(void* hash){
-       uart_hexdump(hash, 256/8);
+       cli_hexdump(hash, 256/8);
 }
 
 void testrun_twister256(void){
@@ -91,35 +91,35 @@ void testrun_twister256(void){
                "12345678901234567890123456789012345678901234567890123456789012345678901234567890"};
        uint32_t i;
        
-       uart_putstr_P(PSTR("\r\n=== TWISTER-256 test suit (MD5 test values) ==="));
+       cli_putstr_P(PSTR("\r\n=== TWISTER-256 test suit (MD5 test values) ==="));
        for(i=0; i<7; ++i){
-               uart_putstr_P(PSTR("\r\n TWISTER-256 (\""));
-               uart_putstr(testv[i]);
-               uart_putstr_P(PSTR("\") = \r\n\t"));
+               cli_putstr_P(PSTR("\r\n TWISTER-256 (\""));
+               cli_putstr(testv[i]);
+               cli_putstr_P(PSTR("\") = \r\n\t"));
                twister256(&hash, testv[i], strlen(testv[i])*8);
                print_hash(hash);
        }
        
-       uart_putstr_P(PSTR("\r\n\r\n=== TWISTER-256 test suit (short test values) ==="));
+       cli_putstr_P(PSTR("\r\n\r\n=== TWISTER-256 test suit (short test values) ==="));
        uint8_t stestv[]= {0x00, 0x00, 0xC0, 0xC0, 0x80, 0x48, 0x50};
        uint8_t stestl[]= {   0,    1,    2,    3,    4,    5,    6};   
        for(i=0; i<7; ++i){
-               uart_putstr_P(PSTR("\r\n TWISTER-256 (\""));
-               uart_hexdump(&(stestv[i]), 1);
-               uart_putstr_P(PSTR("\") = \r\n\t"));
+               cli_putstr_P(PSTR("\r\n TWISTER-256 (\""));
+               cli_hexdump(&(stestv[i]), 1);
+               cli_putstr_P(PSTR("\") = \r\n\t"));
                twister256(&hash, &(stestv[i]), stestl[i]);
                print_hash(hash);
        }
        
 #ifdef TWISTER_LONGTEST
-       uart_putstr_P(PSTR("\r\n\r\n=== TWISTER-256 test suit (long test) ==="));
+       cli_putstr_P(PSTR("\r\n\r\n=== TWISTER-256 test suit (long test) ==="));
        char* ltest= "abcdefghbcdefghicdefghijdefghijk"
                            "efghijklfghijklmghijklmnhijklmno"; 
        twister256_ctx_t ctx;
        twister256_init(&ctx);  
-       uart_putstr_P(PSTR("\r\n TWISTER-256 ( 16777216 x \""));
-       uart_putstr(ltest);     
-       uart_putstr_P(PSTR("\") = \r\n\t"));
+       cli_putstr_P(PSTR("\r\n TWISTER-256 ( 16777216 x \""));
+       cli_putstr(ltest);      
+       cli_putstr_P(PSTR("\") = \r\n\t"));
        for(i=0; i<16777216; ++i){
                twister224_nextBlock(&ctx, ltest);
        }
@@ -143,34 +143,34 @@ void testrun_performance_twister256(void){
        startTimer(1);
        twister_small_init(&ctx, 256);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        twister_small_nextBlock(&ctx, data);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tone-block time: "));
+       cli_putstr_P(PSTR("\r\n\tone-block time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        twister_small_lastBlock(&ctx, data, 0);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tlast block time: "));
+       cli_putstr_P(PSTR("\r\n\tlast block time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        startTimer(1);
        twister_small_ctx2hash(data, &ctx, 256);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx2hash time: "));
+       cli_putstr_P(PSTR("\r\n\tctx2hash time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
 
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 
@@ -193,13 +193,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index b913fa5fa4b89e9109f8e75942bf442c61f70406..a30dda56dd1e790d002ea9f46d0f1e204931da24 100644 (file)
@@ -75,9 +75,9 @@ void testrun_nessie_twister384(void){
  ******************************************************************************/
 
 void print_hash(void* hash){
-       uart_hexdump(hash, 256/8);
-       uart_putstr_P(PSTR("\r\n\t"));
-       uart_hexdump((uint8_t*)hash+256/8, 128/8);
+       cli_hexdump(hash, 256/8);
+       cli_putstr_P(PSTR("\r\n\t"));
+       cli_hexdump((uint8_t*)hash+256/8, 128/8);
        
 }
 
@@ -93,36 +93,36 @@ void testrun_twister384(void){
                "12345678901234567890123456789012345678901234567890123456789012345678901234567890"};
        uint32_t i;
        
-       uart_putstr_P(PSTR("\r\n=== TWISTER-384 test suit (MD5 test values) ==="));
+       cli_putstr_P(PSTR("\r\n=== TWISTER-384 test suit (MD5 test values) ==="));
        for(i=0; i<7; ++i){
-               uart_putstr_P(PSTR("\r\n TWISTER-384 (\""));
-               uart_putstr(testv[i]);
-               uart_putstr_P(PSTR("\") = \r\n\t"));
+               cli_putstr_P(PSTR("\r\n TWISTER-384 (\""));
+               cli_putstr(testv[i]);
+               cli_putstr_P(PSTR("\") = \r\n\t"));
                twister384(&hash, testv[i], strlen(testv[i])*8);
                print_hash(hash);
        //      return;
        }
        
-       uart_putstr_P(PSTR("\r\n\r\n=== TWISTER-384 test suit (short test values) ==="));
+       cli_putstr_P(PSTR("\r\n\r\n=== TWISTER-384 test suit (short test values) ==="));
        uint8_t stestv[]= {0x00, 0x00, 0xC0, 0xC0, 0x80, 0x48, 0x50};
        uint8_t stestl[]= {   0,    1,    2,    3,    4,    5,    6};   
        for(i=0; i<7; ++i){
-               uart_putstr_P(PSTR("\r\n TWISTER-384 (\""));
-               uart_hexdump(&(stestv[i]), 1);
-               uart_putstr_P(PSTR("\") = \r\n\t"));
+               cli_putstr_P(PSTR("\r\n TWISTER-384 (\""));
+               cli_hexdump(&(stestv[i]), 1);
+               cli_putstr_P(PSTR("\") = \r\n\t"));
                twister384(hash, &(stestv[i]), stestl[i]);
                print_hash(hash);
        }
        
 #ifdef TWISTER_LONGTEST
-       uart_putstr_P(PSTR("\r\n\r\n=== TWISTER-384 test suit (long test) ==="));
+       cli_putstr_P(PSTR("\r\n\r\n=== TWISTER-384 test suit (long test) ==="));
        char* ltest= "abcdefghbcdefghicdefghijdefghijk"
                            "efghijklfghijklmghijklmnhijklmno"; 
        twister384_ctx_t ctx;
        twister384_init(&ctx);  
-       uart_putstr_P(PSTR("\r\n TWISTER-384 ( 16777216 x \""));
-       uart_putstr(ltest);     
-       uart_putstr_P(PSTR("\") = \r\n\t"));
+       cli_putstr_P(PSTR("\r\n TWISTER-384 ( 16777216 x \""));
+       cli_putstr(ltest);      
+       cli_putstr_P(PSTR("\") = \r\n\t"));
        for(i=0; i<16777216; ++i){
                twister384_nextBlock(&ctx, ltest);
        }
@@ -146,34 +146,34 @@ void testrun_performance_twister384(void){
        startTimer(1);
        twister_big_init(&ctx, 384);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        twister_big_nextBlock(&ctx, data);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tone-block time: "));
+       cli_putstr_P(PSTR("\r\n\tone-block time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        twister_big_lastBlock(&ctx, data, 0);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tlast block time: "));
+       cli_putstr_P(PSTR("\r\n\tlast block time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        startTimer(1);
        twister_big_ctx2hash(data, &ctx, 384);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx2hash time: "));
+       cli_putstr_P(PSTR("\r\n\tctx2hash time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
 
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 
@@ -197,13 +197,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 149abef17de2b2905ac1fab0613a0ae68e08a30a..8e54bac5965b5c0ce893852ac0554bd2eeabac96 100644 (file)
@@ -75,9 +75,9 @@ void testrun_nessie_twister512(void){
  ******************************************************************************/
 
 void print_hash(void* hash){
-       uart_hexdump(hash, 256/8);
-       uart_putstr_P(PSTR("\r\n\t"));
-       uart_hexdump((uint8_t*)hash+256/8, 256/8);
+       cli_hexdump(hash, 256/8);
+       cli_putstr_P(PSTR("\r\n\t"));
+       cli_hexdump((uint8_t*)hash+256/8, 256/8);
        
 }
 
@@ -93,36 +93,36 @@ void testrun_twister512(void){
                "12345678901234567890123456789012345678901234567890123456789012345678901234567890"};
        uint32_t i;
        
-       uart_putstr_P(PSTR("\r\n=== TWISTER-512 test suit (MD5 test values) ==="));
+       cli_putstr_P(PSTR("\r\n=== TWISTER-512 test suit (MD5 test values) ==="));
        for(i=0; i<7; ++i){
-               uart_putstr_P(PSTR("\r\n TWISTER-512 (\""));
-               uart_putstr(testv[i]);
-               uart_putstr_P(PSTR("\") = \r\n\t"));
+               cli_putstr_P(PSTR("\r\n TWISTER-512 (\""));
+               cli_putstr(testv[i]);
+               cli_putstr_P(PSTR("\") = \r\n\t"));
                twister512(&hash, testv[i], strlen(testv[i])*8);
                print_hash(hash);
        //      return;
        }
        
-       uart_putstr_P(PSTR("\r\n\r\n=== TWISTER-512 test suit (short test values) ==="));
+       cli_putstr_P(PSTR("\r\n\r\n=== TWISTER-512 test suit (short test values) ==="));
        uint8_t stestv[]= {0x00, 0x00, 0xC0, 0xC0, 0x80, 0x48, 0x50};
        uint8_t stestl[]= {   0,    1,    2,    3,    4,    5,    6};   
        for(i=0; i<7; ++i){
-               uart_putstr_P(PSTR("\r\n TWISTER-512 (\""));
-               uart_hexdump(&(stestv[i]), 1);
-               uart_putstr_P(PSTR("\") = \r\n\t"));
+               cli_putstr_P(PSTR("\r\n TWISTER-512 (\""));
+               cli_hexdump(&(stestv[i]), 1);
+               cli_putstr_P(PSTR("\") = \r\n\t"));
                twister512(hash, &(stestv[i]), stestl[i]);
                print_hash(hash);
        }
        
 #ifdef TWISTER_LONGTEST
-       uart_putstr_P(PSTR("\r\n\r\n=== TWISTER-512 test suit (long test) ==="));
+       cli_putstr_P(PSTR("\r\n\r\n=== TWISTER-512 test suit (long test) ==="));
        char* ltest= "abcdefghbcdefghicdefghijdefghijk"
                            "efghijklfghijklmghijklmnhijklmno"; 
        twister512_ctx_t ctx;
        twister512_init(&ctx);  
-       uart_putstr_P(PSTR("\r\n TWISTER-512 ( 16777216 x \""));
-       uart_putstr(ltest);     
-       uart_putstr_P(PSTR("\") = \r\n\t"));
+       cli_putstr_P(PSTR("\r\n TWISTER-512 ( 16777216 x \""));
+       cli_putstr(ltest);      
+       cli_putstr_P(PSTR("\") = \r\n\t"));
        for(i=0; i<16777216; ++i){
                twister512_nextBlock(&ctx, ltest);
        }
@@ -146,34 +146,34 @@ void testrun_performance_twister512(void){
        startTimer(1);
        twister_big_init(&ctx, 512);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx-gen time: "));
+       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        twister_big_nextBlock(&ctx, data);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tone-block time: "));
+       cli_putstr_P(PSTR("\r\n\tone-block time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        
        startTimer(1);
        twister_big_lastBlock(&ctx, data, 0);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tlast block time: "));
+       cli_putstr_P(PSTR("\r\n\tlast block time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
        
        startTimer(1);
        twister_big_ctx2hash(data, &ctx, 512);
        t = stopTimer();
-       uart_putstr_P(PSTR("\r\n\tctx2hash time: "));
+       cli_putstr_P(PSTR("\r\n\tctx2hash time: "));
        ultoa((unsigned long)t, str, 10);
-       uart_putstr(str);
+       cli_putstr(str);
 
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 
@@ -197,13 +197,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index a1dfd029bf37caf0c542f7588b5499df0d724100..f450a9f1dc57ad0ed5dfe55e738fe41686f42df7 100644 (file)
@@ -80,7 +80,7 @@ void testrun_performance_xtea(void){
        t = stopTimer();
        print_time_P(PSTR("\tdecrypt time: "), t);
        
-       uart_putstr_P(PSTR("\r\n"));
+       cli_putstr_P(PSTR("\r\n"));
 }
 
 /*****************************************************************************
@@ -102,13 +102,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
 
 int main (void){
        DEBUG_INIT();
-       uart_putstr("\r\n");
+       
        cli_rx = uart_getc;
        cli_tx = uart_putc;             
        for(;;){
-               uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
-               uart_putstr(algo_name);
-               uart_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
                cmd_interface(cmdlist);
        }
 }
index 90e33de553d9ffcb14e3c2c551ee7d2485ef3f39..d3005428ccbc49f5e9fd64653d0e7711d9cd9f87 100644 (file)
@@ -27,6 +27,7 @@
  * */
 #include <stdint.h>
 #include <string.h>
+#include <stdlib.h>
 #include "nessie_mac_test.h"
 #include "nessie_common.h"
 #include "uart.h"
@@ -164,18 +165,29 @@ void one_in512_mac(uint16_t pos, uint8_t* key){
 }
 
 static
-void tv4_mac(uint8_t* key){
+void tv4_mac(void){
        uint8_t ctx[nessie_mac_ctx.ctx_size_B];
        uint8_t mac[MACSIZE_B];
-       uint8_t block[256/8];
-       uint16_t n=256;
+       uint8_t block[MACSIZE_B];
+       uint8_t core_key[] = {
+               0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
+               0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
+        0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF
+       };      
+       uint8_t key[KEYSIZE_B];
+       uint16_t n=MACSIZE_B*8;
        uint32_t i;
+       char str[6];
        
        NESSIE_PUTSTR_P(PSTR("\r\n                       message="));
-       NESSIE_PUTSTR(PSTR("256 zero bits"));
-       memset(block, 0, 256/8);
-       
-       nessie_mac_ctx.mac_init(key, nessie_mac_ctx.keysize_b, ctx);;
+       utoa(MACSIZE_B*8, str, 10);
+       NESSIE_PUTSTR(str);
+       NESSIE_PUTSTR_P(PSTR(" zero bits"));
+       memset(block, 0, MACSIZE_B);
+       for(i=0; i<KEYSIZE_B; ++i)
+               key[i] = core_key[i%(3*8)];
+       nessie_print_item("key", key, KEYSIZE_B);
+       nessie_mac_ctx.mac_init(key, nessie_mac_ctx.keysize_b, ctx);
        while(n>nessie_mac_ctx.blocksize_B*8){
                nessie_mac_ctx.mac_next(block, ctx);
                n    -= nessie_mac_ctx.blocksize_B*8;
@@ -265,8 +277,10 @@ void nessie_mac_run(void){
        nessie_print_setheader(set);
        /* we use the same key as above */
        nessie_print_set_vector(set, 0);
-       tv4_mac(key);
+       tv4_mac();
        /* test set 5 */
+       set=5;
+       nessie_print_setheader(set);
        for(i=0; i<nessie_mac_ctx.keysize_b; ++i){
                nessie_print_set_vector(set, i);
                memset(key, 0, KEYSIZE_B);
index 0c9943c914340aa8b715c4daf274443b88a67703..56b22dd7fd29c65009bb36a923115767cc3588c9 100644 (file)
@@ -81,6 +81,9 @@
 
 
 #ifdef UART_XON_XOFF
+#define XON  0x11
+#define XOFF 0x13
+
  #ifdef UART_INTERRUPT
   void uart_insertc(char c);
  #else
index a8de8a8ff7526571cb109f69b0d71e745a8bf7a4..dc8f0e91aa7a2612b158dad1d849c842a1a28dd6 100644 (file)
@@ -12488,7 +12488,8 @@ Set 3, vector#511:
 Test vectors -- set 4\r
 =====================\r
 \r
-Iterated message digest computation (100000 times): Set 4, vector#  0:\r
+Iterated message digest computation (100000 times):
+Set 4, vector#  0:\r
                        message=160 zero bits\r
                            key=00112233445566778899AABBCCDDEEFF\r
                                0123456789ABCDEF0011223344556677\r
index 07814cb9872550044cbe409474ede18504f61479..2bb3a365a5220e0d3d515dfbe93cd2c15d981433 100644 (file)
@@ -14046,7 +14046,8 @@ Set 3, vector#511:
 Test vectors -- set 4\r
 =====================\r
 \r
-Iterated message digest computation (100000 times): Set 4, vector#  0:\r
+Iterated message digest computation (100000 times):
+Set 4, vector#  0:\r
                        message=256 zero bits\r
                            key=00112233445566778899AABBCCDDEEFF\r
                                0123456789ABCDEF0011223344556677\r