moving from uart to cli

This commit is contained in:
bg 2009-02-25 20:22:32 +00:00
parent fa7a41a129
commit 83d0614d8b
42 changed files with 604 additions and 578 deletions

View File

@ -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)

View File

@ -32,11 +32,11 @@
#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];

View 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)
@ -22,14 +22,14 @@
#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_*/

View File

@ -20,10 +20,10 @@
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);

View 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+")")

View 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

View 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);
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);

View File

@ -81,6 +81,9 @@
#ifdef UART_XON_XOFF
#define XON 0x11
#define XOFF 0x13
#ifdef UART_INTERRUPT
void uart_insertc(char c);
#else

View File

@ -12488,7 +12488,8 @@ Set 3, vector#511:
Test vectors -- set 4
=====================
Iterated message digest computation (100000 times): Set 4, vector# 0:
Iterated message digest computation (100000 times):
Set 4, vector# 0:
message=160 zero bits
key=00112233445566778899AABBCCDDEEFF
0123456789ABCDEF0011223344556677

View File

@ -14046,7 +14046,8 @@ Set 3, vector#511:
Test vectors -- set 4
=====================
Iterated message digest computation (100000 times): Set 4, vector# 0:
Iterated message digest computation (100000 times):
Set 4, vector# 0:
message=256 zero bits
key=00112233445566778899AABBCCDDEEFF
0123456789ABCDEF0011223344556677