From aa060d30f8600acb9cc5bcf9fa3d97a2fbe5ccda Mon Sep 17 00:00:00 2001 From: bg Date: Sat, 28 Nov 2009 18:52:23 +0000 Subject: [PATCH] fixing some warnings (AES); simplifyning AES headers (now simply include "aes.h"); some renaming in the debug module --- aes/aes.h | 37 +++----- aes/aes128_dec.h | 10 +- aes/aes128_enc.h | 10 +- aes/aes192_dec.h | 10 +- aes/aes192_enc.h | 10 +- aes/aes256_dec.h | 10 +- aes/aes256_enc.h | 10 +- aes/aes_dec.h | 6 +- aes/aes_enc.h | 6 +- aes/aes_keyschedule.c | 33 ++++--- aes/aes_keyschedule.h | 22 ++--- test_src/serial-tools.h => aes/aes_types.h | 43 +++++++-- bmw/bmw_small.c | 13 +-- bmw/f0-opt-table.txt | 2 + config.h | 8 +- debug.h | 2 +- groestl/groestl_small.c | 22 ++--- hfal-performance.c | 17 ++-- host/shavs_test2.rb | 36 ++++++- test_src/config.h | 8 +- test_src/debug.c | 14 +-- test_src/main-aes-test.c | 103 ++++++++++----------- test_src/main-aes128-test.c | 40 ++++---- test_src/main-aes192-test.c | 33 +++---- test_src/main-aes256-test.c | 39 ++++---- test_src/main-groestl-test.c | 27 ++++-- test_src/performance_test.c | 2 +- testport.conf | 55 +---------- 28 files changed, 311 insertions(+), 317 deletions(-) rename test_src/serial-tools.h => aes/aes_types.h (55%) diff --git a/aes/aes.h b/aes/aes.h index 9d5b770..8e651f4 100644 --- a/aes/aes.h +++ b/aes/aes.h @@ -19,38 +19,25 @@ /** * \file aes.h * \email daniel.otte@rub.de - * \author Daniel Otte + * \author Daniel Otte * \date 2008-12-30 * \license GPLv3 or later - * + * */ #ifndef AES_H_ #define AES_H_ #include -typedef struct{ - uint8_t ks[16]; -} aes_roundkey_t; - -typedef struct{ - aes_roundkey_t key[10+1]; -} aes128_ctx_t; - -typedef struct{ - aes_roundkey_t key[12+1]; -} aes192_ctx_t; - -typedef struct{ - aes_roundkey_t key[14+1]; -} aes256_ctx_t; - -typedef struct{ - aes_roundkey_t key[1]; /* just to avoid the warning */ -} aes_genctx_t; - -typedef struct{ - uint8_t s[16]; -} aes_cipher_state_t; +#include "aes_types.h" +#include "aes128_enc.h" +#include "aes192_enc.h" +#include "aes256_enc.h" +#include "aes128_dec.h" +#include "aes192_dec.h" +#include "aes256_dec.h" +#include "aes_enc.h" +#include "aes_dec.h" +#include "aes_keyschedule.h" #endif diff --git a/aes/aes128_dec.h b/aes/aes128_dec.h index f6015d8..b5df9df 100644 --- a/aes/aes128_dec.h +++ b/aes/aes128_dec.h @@ -19,7 +19,7 @@ /** * \file aes128_dec.h * \email daniel.otte@rub.de - * \author Daniel Otte + * \author Daniel Otte * \date 2008-12-30 * \license GPLv3 or later * \ingroup AES @@ -28,16 +28,16 @@ #ifndef AES128_DEC_H_ #define AES128_DEC_H_ -#include "aes.h" +#include "aes_types.h" #include "aes_dec.h" -/** \fn void aes128_dec(void* buffer, aes128_ctx_t* ctx) +/** * \brief decrypt with 128 bit key. - * + * * This function decrypts one block with the AES algorithm under control of * a keyschedule produced from a 128 bit key. * \param buffer pointer to the block to decrypt - * \param ctx pointer to the key schedule + * \param ctx pointer to the key schedule */ void aes128_dec(void* buffer, aes128_ctx_t* ctx); diff --git a/aes/aes128_enc.h b/aes/aes128_enc.h index 5cb4953..98a8cc2 100644 --- a/aes/aes128_enc.h +++ b/aes/aes128_enc.h @@ -19,7 +19,7 @@ /** * \file aes128_enc.h * \email daniel.otte@rub.de - * \author Daniel Otte + * \author Daniel Otte * \date 2008-12-30 * \license GPLv3 or later * \ingroup AES @@ -28,17 +28,17 @@ #ifndef AES128_ENC_H_ #define AES128_ENC_H_ -#include "aes.h" +#include "aes_types.h" #include "aes_enc.h" -/** \fn void aes128_enc(void* buffer, aes128_ctx_t* ctx) +/** * \brief encrypt with 128 bit key. - * + * * This function encrypts one block with the AES algorithm under control of * a keyschedule produced from a 128 bit key. * \param buffer pointer to the block to encrypt - * \param ctx pointer to the key schedule + * \param ctx pointer to the key schedule */ void aes128_enc(void* buffer, aes128_ctx_t* ctx); diff --git a/aes/aes192_dec.h b/aes/aes192_dec.h index 299edf9..577ab44 100644 --- a/aes/aes192_dec.h +++ b/aes/aes192_dec.h @@ -19,7 +19,7 @@ /** * \file aes192_dec.h * \email daniel.otte@rub.de - * \author Daniel Otte + * \author Daniel Otte * \date 2008-12-31 * \license GPLv3 or later * \ingroup AES @@ -28,16 +28,16 @@ #ifndef AES192_DEC_H_ #define AES192_DEC_H_ -#include "aes.h" +#include "aes_types.h" #include "aes_dec.h" -/** \fn void aes192_dec(void* buffer, aes192_ctx_t* ctx) +/** * \brief decrypt with 192 bit key. - * + * * This function decrypts one block with the AES algorithm under control of * a keyschedule produced from a 192 bit key. * \param buffer pointer to the block to decrypt - * \param ctx pointer to the key schedule + * \param ctx pointer to the key schedule */ void aes192_dec(void* buffer, aes192_ctx_t* ctx); diff --git a/aes/aes192_enc.h b/aes/aes192_enc.h index 30b79ec..1c39aa0 100644 --- a/aes/aes192_enc.h +++ b/aes/aes192_enc.h @@ -19,7 +19,7 @@ /** * \file aes192_enc.h * \email daniel.otte@rub.de - * \author Daniel Otte + * \author Daniel Otte * \date 2008-12-31 * \license GPLv3 or later * \ingroup AES @@ -28,17 +28,17 @@ #ifndef AES192_ENC_H_ #define AES192_ENC_H_ -#include "aes.h" +#include "aes_types.h" #include "aes_enc.h" -/** \fn void aes192_enc(void* buffer, aes192_ctx_t* ctx) +/** * \brief encrypt with 192 bit key. - * + * * This function encrypts one block with the AES algorithm under control of * a keyschedule produced from a 192 bit key. * \param buffer pointer to the block to encrypt - * \param ctx pointer to the key schedule + * \param ctx pointer to the key schedule */ void aes192_enc(void* buffer, aes192_ctx_t* ctx); diff --git a/aes/aes256_dec.h b/aes/aes256_dec.h index 3c77c7b..14b8a0a 100644 --- a/aes/aes256_dec.h +++ b/aes/aes256_dec.h @@ -19,7 +19,7 @@ /** * \file aes256_dec.h * \email daniel.otte@rub.de - * \author Daniel Otte + * \author Daniel Otte * \date 2008-12-31 * \license GPLv3 or later * \ingroup AES @@ -28,16 +28,16 @@ #ifndef AES256_DEC_H_ #define AES256_DEC_H_ -#include "aes.h" +#include "aes_types.h" #include "aes_dec.h" -/** \fn void aes256_dec(void* buffer, aes256_ctx_t* ctx) +/** * \brief decrypt with 256 bit key. - * + * * This function decrypts one block with the AES algorithm under control of * a keyschedule produced from a 256 bit key. * \param buffer pointer to the block to decrypt - * \param ctx pointer to the key schedule + * \param ctx pointer to the key schedule */ void aes256_dec(void* buffer, aes256_ctx_t* ctx); diff --git a/aes/aes256_enc.h b/aes/aes256_enc.h index b42b0f3..a890cd3 100644 --- a/aes/aes256_enc.h +++ b/aes/aes256_enc.h @@ -19,7 +19,7 @@ /** * \file aes256_enc.h * \email daniel.otte@rub.de - * \author Daniel Otte + * \author Daniel Otte * \date 2008-12-31 * \license GPLv3 or later * \ingroup AES @@ -28,17 +28,17 @@ #ifndef AES256_ENC_H_ #define AES256_ENC_H_ -#include "aes.h" +#include "aes_types.h" #include "aes_enc.h" -/** \fn void aes256_enc(void* buffer, aes256_ctx_t* ctx) +/** * \brief encrypt with 256 bit key. - * + * * This function encrypts one block with the AES algorithm under control of * a keyschedule produced from a 256 bit key. * \param buffer pointer to the block to encrypt - * \param ctx pointer to the key schedule + * \param ctx pointer to the key schedule */ void aes256_enc(void* buffer, aes256_ctx_t* ctx); diff --git a/aes/aes_dec.h b/aes/aes_dec.h index 631d953..0517bd9 100644 --- a/aes/aes_dec.h +++ b/aes/aes_dec.h @@ -19,14 +19,14 @@ /** * \file aes_dec.h * \email daniel.otte@rub.de - * \author Daniel Otte + * \author Daniel Otte * \date 2008-12-30 * \license GPLv3 or later - * + * */ #ifndef AES_DEC_H_ #define AES_DEC_H_ -#include "aes.h" +#include "aes_types.h" #include diff --git a/aes/aes_enc.h b/aes/aes_enc.h index f3c4dfa..fb25764 100644 --- a/aes/aes_enc.h +++ b/aes/aes_enc.h @@ -19,14 +19,14 @@ /** * \file aes_enc.h * \email daniel.otte@rub.de - * \author Daniel Otte + * \author Daniel Otte * \date 2008-12-30 * \license GPLv3 or later - * + * */ #ifndef AES_ENC_H_ #define AES_ENC_H_ -#include "aes.h" +#include "aes_types.h" #include diff --git a/aes/aes_keyschedule.c b/aes/aes_keyschedule.c index 9e58eb5..9225323 100644 --- a/aes/aes_keyschedule.c +++ b/aes/aes_keyschedule.c @@ -19,10 +19,10 @@ /** * \file aes_keyschedule.c * \email daniel.otte@rub.de - * \author Daniel Otte + * \author Daniel Otte * \date 2008-12-30 * \license GPLv3 or later - * + * */ #include @@ -49,32 +49,35 @@ uint8_t rc_tab[] PROGMEM = { 0x01, 0x02, 0x04, 0x08, void aes_init(const void* key, uint16_t keysize_b, aes_genctx_t* ctx){ uint8_t hi,i,nk, next_nk; uint8_t rc=0; - uint8_t tmp[4]; + union { + uint32_t v32; + uint8_t v8[4]; + } tmp; nk=keysize_b>>5; /* 4, 6, 8 */ hi=4*(nk+6+1); memcpy(ctx, key, keysize_b/8); next_nk = nk; for(i=nk;ikey[0].ks))[i-1]; + tmp.v32 = ((uint32_t*)(ctx->key[0].ks))[i-1]; if(i!=next_nk){ if(nk==8 && i%8==4){ - tmp[0] = pgm_read_byte(aes_sbox+tmp[0]); - tmp[1] = pgm_read_byte(aes_sbox+tmp[1]); - tmp[2] = pgm_read_byte(aes_sbox+tmp[2]); - tmp[3] = pgm_read_byte(aes_sbox+tmp[3]); + tmp.v8[0] = pgm_read_byte(aes_sbox+tmp.v8[0]); + tmp.v8[1] = pgm_read_byte(aes_sbox+tmp.v8[1]); + tmp.v8[2] = pgm_read_byte(aes_sbox+tmp.v8[2]); + tmp.v8[3] = pgm_read_byte(aes_sbox+tmp.v8[3]); } } else { next_nk += nk; - aes_rotword(tmp); - tmp[0] = pgm_read_byte(aes_sbox+tmp[0]); - tmp[1] = pgm_read_byte(aes_sbox+tmp[1]); - tmp[2] = pgm_read_byte(aes_sbox+tmp[2]); - tmp[3] = pgm_read_byte(aes_sbox+tmp[3]); - tmp[0] ^= pgm_read_byte(rc_tab+rc); + aes_rotword(&(tmp.v32)); + tmp.v8[0] = pgm_read_byte(aes_sbox+tmp.v8[0]); + tmp.v8[1] = pgm_read_byte(aes_sbox+tmp.v8[1]); + tmp.v8[2] = pgm_read_byte(aes_sbox+tmp.v8[2]); + tmp.v8[3] = pgm_read_byte(aes_sbox+tmp.v8[3]); + tmp.v8[0] ^= pgm_read_byte(rc_tab+rc); rc++; } ((uint32_t*)(ctx->key[0].ks))[i] = ((uint32_t*)(ctx->key[0].ks))[i-nk] - ^ *((uint32_t*)tmp); + ^ tmp.v32; } } diff --git a/aes/aes_keyschedule.h b/aes/aes_keyschedule.h index b013971..ab5786a 100644 --- a/aes/aes_keyschedule.h +++ b/aes/aes_keyschedule.h @@ -19,7 +19,7 @@ /** * \file aes_keyschedule.h * \email daniel.otte@rub.de - * \author Daniel Otte + * \author Daniel Otte * \date 2008-12-30 * \license GPLv3 or later * \ingroup AES @@ -29,10 +29,10 @@ #ifndef AES_KEYSCHEDULE_H_ #define AES_KEYSCHEDULE_H_ -#include "aes.h" -/** \fn void aes_init(const void* key, uint16_t keysize_b, aes_genctx_t* ctx) +#include "aes_types.h" +/** * \brief initialize the keyschedule - * + * * This function computes the keyschedule from a given key with a given length * and stores it in the context variable * \param key pointer to the key material @@ -41,9 +41,9 @@ */ void aes_init(const void* key, uint16_t keysize_b, aes_genctx_t* ctx); -/** \fn void aes128_init(const void* key, aes128_ctx_t* ctx) +/** * \brief initialize the keyschedule for 128 bit key - * + * * This function computes the keyschedule from a given 128 bit key * and stores it in the context variable * \param key pointer to the key material @@ -51,9 +51,9 @@ void aes_init(const void* key, uint16_t keysize_b, aes_genctx_t* ctx); */ void aes128_init(const void* key, aes128_ctx_t* ctx); -/** \fn void aes192_init(const void* key, aes192_ctx_t* ctx) +/** * \brief initialize the keyschedule for 192 bit key - * + * * This function computes the keyschedule from a given 192 bit key * and stores it in the context variable * \param key pointer to the key material @@ -61,9 +61,9 @@ void aes128_init(const void* key, aes128_ctx_t* ctx); */ void aes192_init(const void* key, aes192_ctx_t* ctx); -/** \fn void aes256_init(const void* key, aes256_ctx_t* ctx) +/** * \brief initialize the keyschedule for 256 bit key - * + * * This function computes the keyschedule from a given 256 bit key * and stores it in the context variable * \param key pointer to the key material @@ -72,4 +72,4 @@ void aes192_init(const void* key, aes192_ctx_t* ctx); void aes256_init(const void* key, aes256_ctx_t* ctx); #endif /* AES_KEYSCHEDULE_H_ */ - + diff --git a/test_src/serial-tools.h b/aes/aes_types.h similarity index 55% rename from test_src/serial-tools.h rename to aes/aes_types.h index 9dcf028..d69dd9f 100644 --- a/test_src/serial-tools.h +++ b/aes/aes_types.h @@ -1,4 +1,4 @@ -/* serial-tools.h */ +/* aes.h */ /* This file is part of the AVR-Crypto-Lib. Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de) @@ -16,12 +16,41 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef SERIALTOOLS_H_ -#define SERIALTOOLS_H_ +/** + * \file aes_types.h + * \email daniel.otte@rub.de + * \author Daniel Otte + * \date 2008-12-30 + * \license GPLv3 or later + * + */ +#ifndef AES_TYPES_H_ +#define AES_TYPES_H_ +#include -int getnextwordn(char *s, int n); /* words are seperated by spaces */ -void readhex2buffer(void* buffer, int n); -void uart_putptr(void* p); +typedef struct{ + uint8_t ks[16]; +} aes_roundkey_t; -#endif /*SERIALTOOLS_H_*/ +typedef struct{ + aes_roundkey_t key[10+1]; +} aes128_ctx_t; + +typedef struct{ + aes_roundkey_t key[12+1]; +} aes192_ctx_t; + +typedef struct{ + aes_roundkey_t key[14+1]; +} aes256_ctx_t; + +typedef struct{ + aes_roundkey_t key[1]; /* just to avoid the warning */ +} aes_genctx_t; + +typedef struct{ + uint8_t s[16]; +} aes_cipher_state_t; + +#endif diff --git a/bmw/bmw_small.c b/bmw/bmw_small.c index c9a011c..9f93935 100644 --- a/bmw/bmw_small.c +++ b/bmw/bmw_small.c @@ -213,24 +213,25 @@ uint32_t k_lut[] PROGMEM = { static uint32_t bmw_small_expand1(uint8_t j, const uint32_t* q, const void* m, const void* h){ uint32_t(*s[])(uint32_t) = {bmw_small_s1, bmw_small_s2, bmw_small_s3, bmw_small_s0}; - uint32_t r=0; + uint32_t r; uint8_t i; /* r = 0x05555555*(j+16); */ - for(i=0; i<16; ++i){ - r += s[i%4](q[j+i]); - } + #if TWEAK - r += ( ROTL32(((uint32_t*)m)[j&0xf], ((j+0)&0xf)+1 ) + r = ( ROTL32(((uint32_t*)m)[j&0xf], ((j+0)&0xf)+1 ) + ROTL32(((uint32_t*)m)[(j+3)&0xf], ((j+3)&0xf)+1 ) - ROTL32(((uint32_t*)m)[(j+10)&0xf], ((j+10)&0xf)+1 ) + pgm_read_dword(k_lut+j) ) ^ ((uint32_t*)h)[(j+7)&0xf]; #else - r += pgm_read_dword(k_lut+j); + r = pgm_read_dword(k_lut+j); r += ((uint32_t*)m)[j&0xf]; r += ((uint32_t*)m)[(j+3)&0xf]; r -= ((uint32_t*)m)[(j+10)&0xf]; #endif + for(i=0; i<16; ++i){ + r += s[i%4](q[j+i]); + } return r; } diff --git a/bmw/f0-opt-table.txt b/bmw/f0-opt-table.txt index a975644..a35e6ad 100644 --- a/bmw/f0-opt-table.txt +++ b/bmw/f0-opt-table.txt @@ -1,3 +1,5 @@ + + q[ 0] = (+ h[ 5] - h[ 7] + h[10] + h[13] + h[14]); q[ 1] = (+ h[ 6] - h[ 8] + h[11] + h[14] - h[15]); q[ 2] = (+ h[ 7] + h[ 9] - h[12] + h[15] + h[ 0]); diff --git a/config.h b/config.h index 76debe5..04c8cd2 100644 --- a/config.h +++ b/config.h @@ -20,16 +20,14 @@ #define __CONFIG_H__ #include // #define F_CPU 20000000 - #define F_CPU 16000000 /* Oszillator-Frequenz in Hz */ +// #define F_CPU 16000000 /* oscillator-frequency in Hz */ // #define F_CPU 14745600 +#define F_CPU 20000000 /* this is out of spec but lets try it */ +#define DEBUG_METHOD uart #include "uart_defs.h" -#define DEBUG uart - -#undef UART_LEDS - #define UART0_I 1 #define UART0_BAUD_RATE 38400 #define UART0_PARATY UART_PARATY_NONE diff --git a/debug.h b/debug.h index acc0a09..76ef0ce 100644 --- a/debug.h +++ b/debug.h @@ -19,7 +19,7 @@ #ifndef DEBUG_H_ #define DEBUG_H_ -#ifdef DEBUG +#ifdef DEBUG_METHOD #define DEBUG_INIT() debug_init() #define DEBUG_C(_c) debug_char(_c) #define DEBUG_S(_s) debug_str(_s) diff --git a/groestl/groestl_small.c b/groestl/groestl_small.c index e5a3d94..44ab7ee 100644 --- a/groestl/groestl_small.c +++ b/groestl/groestl_small.c @@ -22,7 +22,7 @@ * \email daniel.otte@rub.de * \date 2009-05-19 * \license GPLv3 or later - * + * */ #include "groestl_small.h" @@ -74,7 +74,7 @@ void groestl_small_rounds(uint8_t *m, uint8_t q){ }else{ m[0] ^= r; } -#if DEBUG +#if DEBUG if(r<2){ cli_putstr_P(PSTR("\r\npost add-const")); dump_m(m); @@ -90,12 +90,12 @@ void groestl_small_rounds(uint8_t *m, uint8_t q){ m[i+((j-i+8)%8)*8] = tmp[j]; } } -#if DEBUG +#if DEBUG if(r<2){ cli_putstr_P(PSTR("\r\npost shift-bytes")); dump_m(m); } -#endif +#endif for(i=0; i<8; ++i){ memcpy(tmp, m+8*i, 8); for(j=0; j<8; ++j){ @@ -114,20 +114,20 @@ void groestl_small_rounds(uint8_t *m, uint8_t q){ cli_putstr_P(PSTR("\r\npost mix-bytes")); dump_m(m); } -#endif +#endif } } void groestl224_init(groestl224_ctx_t* ctx){ memset(ctx->h, 0, 8*8); ctx->h[8*8-1] = 224; - ctx->counter = 0; + ctx->counter = 1; } void groestl256_init(groestl256_ctx_t* ctx){ memset(ctx->h, 0, 8*8); ctx->h[8*8-2] = 1; - ctx->counter = 0; + ctx->counter = 1; } void groestl_small_nextBlock(groestl_small_ctx_t* ctx, const void* block){ @@ -137,7 +137,7 @@ void groestl_small_nextBlock(groestl_small_ctx_t* ctx, const void* block){ tmp1[j*8+i] = ((uint8_t*)block)[i*8+j]; } } -*/ +*/ memcpy(tmp1, block, 64); memcpy(tmp2, tmp1, 64); memxor(tmp1, ctx->h, 64); @@ -157,12 +157,12 @@ void groestl_small_lastBlock(groestl_small_ctx_t* ctx, const void* block, uint16 } memset(buffer, 0, 64); memcpy(buffer, block, (length_b+7)/8); - buffer[length_b/8] |= 0x80>>(length_b%8); + buffer[length_b/8] |= 0x80>>(length_b&0x7); if(length_b>512-65){ groestl_small_nextBlock(ctx, buffer); memset(buffer, 0, 64-4); } - ctx->counter++; +// ctx->counter++; buffer[64-1] = (uint8_t)(ctx->counter); buffer[64-2] = (uint8_t)((ctx->counter)>>8); buffer[64-3] = (uint8_t)((ctx->counter)>>16); @@ -178,7 +178,7 @@ void groestl_small_ctx2hash(void* dest, const groestl_small_ctx_t* ctx, uint16_t #if DEBUG cli_putstr_P(PSTR("\r\npost finalisation")); dump_m(tmp); -#endif +#endif memcpy(dest, tmp+64-outlength_b/8, outlength_b/8); } diff --git a/hfal-performance.c b/hfal-performance.c index e9ec770..70f2ef1 100644 --- a/hfal-performance.c +++ b/hfal-performance.c @@ -22,7 +22,7 @@ * \email daniel.otte@rub.de * \date 2009-05-10 * \license GPLv3 or later - * + * */ #include "hfal-performance.h" @@ -53,23 +53,24 @@ void hfal_performance(const hfdesc_t* hd){ uint8_t data[(hf.blocksize_b+7)/8]; uint8_t digest[(hf.hashsize_b+7)/8]; uint64_t t; - + if(hf.type!=HFDESC_TYPE_HASHFUNCTION) return; calibrateTimer(); + print_overhead(); cli_putstr_P(PSTR("\r\n\r\n === ")); cli_putstr_P(hf.name); cli_putstr_P(PSTR(" performance === " "\r\n type: hashfunction" "\r\n hashsize (bits): ")); printvalue(hf.hashsize_b); - + cli_putstr_P(PSTR("\r\n ctxsize (bytes): ")); printvalue(hf.ctxsize_B); - + cli_putstr_P(PSTR("\r\n blocksize (bits): ")); printvalue(hf.blocksize_b); - + startTimer(0); START_TIMER; hf.init(&ctx); @@ -77,7 +78,7 @@ void hfal_performance(const hfdesc_t* hd){ t = stopTimer(); cli_putstr_P(PSTR("\r\n init (cycles): ")); printvalue(t); - + startTimer(0); START_TIMER; hf.nextBlock(&ctx, data); @@ -85,7 +86,7 @@ void hfal_performance(const hfdesc_t* hd){ t = stopTimer(); cli_putstr_P(PSTR("\r\n nextBlock (cycles): ")); printvalue(t); - + startTimer(0); START_TIMER; hf.lastBlock(&ctx, data, 0); @@ -93,7 +94,7 @@ void hfal_performance(const hfdesc_t* hd){ t = stopTimer(); cli_putstr_P(PSTR("\r\n lastBlock (cycles): ")); printvalue(t); - + startTimer(0); START_TIMER; hf.ctx2hash(digest, &ctx); diff --git a/host/shavs_test2.rb b/host/shavs_test2.rb index ad242f4..863fb84 100644 --- a/host/shavs_test2.rb +++ b/host/shavs_test2.rb @@ -25,8 +25,12 @@ require 'serialport' require 'getopt/std' $buffer_size = 0 +$conffile_check = Hash.new +$conffile_check.default = 0 def readconfigfile(fname, conf) + return conf if $conffile_check[fname]==1 + $conffile_check[fname]=1 section = "default" if not File.exists?(fname) return conf @@ -42,7 +46,11 @@ def readconfigfile(fname, conf) end next if not /=/.match(line) m=/[\s]*([^\s]*)[\s]*=[\s]*([^\s]*)/.match(line) - conf[section][m[1]] = m[2] + if m[1]=="include" + Dir.glob(m[2]){ |fn| conf = readconfigfile(fn, conf) } + else + conf[section][m[1]] = m[2] + end end file.close() return conf @@ -96,6 +104,7 @@ def send_md(md_string) for i in 0..md_string.length-1 $sp.print(md_string[i].chr) # print("DBG s: "+ md_string[i].chr) if $debug + sleep(0.01) if((i%($buffer_size*2)==0)&&(i!=0)) begin line=$sp.gets() @@ -148,7 +157,8 @@ def run_test(filename, skip=0) putc('*') else putc('!') - printf("<%d>",len) + # printf("<%d>",len) + printf("\nError @%05d: %s \n != %s - ",len, a, b) nerrors += 1 end pos += 1 @@ -156,10 +166,14 @@ def run_test(filename, skip=0) return nerrors.to_i end +opts = Getopt::Std.getopts("s:f:i:hdca") + conf = Hash.new conf = readconfigfile("/etc/testport.conf", conf) conf = readconfigfile("~/.testport.conf", conf) conf = readconfigfile("testport.conf", conf) +conf = readconfigfile(opts["f"], conf) if opts["f"] + #puts conf.inspect puts("serial port interface version: " + SerialPort::VERSION); @@ -190,7 +204,19 @@ reset_system() algos=scan_system() #puts algos.inspect -algos.sort.each do |algoa| +if opts["s"] + algos_rev = algos.invert + algo_tasks = Array.new + opts["s"].each_byte{ |x| + if algos_rev[x.chr] + algo_tasks << [algos_rev[x.chr],x.chr] + end + } +else + algo_tasks=algos.sort +end + +algo_tasks.each do |algoa| algo = algoa[0] if conf[algo]==nil puts("No test-set defined for #{algo} \r\n") @@ -202,7 +228,9 @@ algos.sort.each do |algoa| puts("Testing #{algo} with #{conf[algo]["file_#{i}"]}") reset_system() init_system(algoa[1]) - nerrors=run_test(conf[algo]["file_#{i}"], 0) + skip=0 + skip=opts["i"].to_i if opts["i"] + nerrors=run_test(conf[algo]["file_#{i}"], skip) if nerrors == 0 puts("\n[ok]") logfile.puts("[ok] "+conf[algo]["file_#{i}"]+ " ("+Time.now.to_s()+")") diff --git a/test_src/config.h b/test_src/config.h index 76debe5..04c8cd2 100644 --- a/test_src/config.h +++ b/test_src/config.h @@ -20,16 +20,14 @@ #define __CONFIG_H__ #include // #define F_CPU 20000000 - #define F_CPU 16000000 /* Oszillator-Frequenz in Hz */ +// #define F_CPU 16000000 /* oscillator-frequency in Hz */ // #define F_CPU 14745600 +#define F_CPU 20000000 /* this is out of spec but lets try it */ +#define DEBUG_METHOD uart #include "uart_defs.h" -#define DEBUG uart - -#undef UART_LEDS - #define UART0_I 1 #define UART0_BAUD_RATE 38400 #define UART0_PARATY UART_PARATY_NONE diff --git a/test_src/debug.c b/test_src/debug.c index 128b4bc..6526479 100644 --- a/test_src/debug.c +++ b/test_src/debug.c @@ -23,35 +23,35 @@ ****************************/ #include "config.h" -#if DEBUG == uart +#if DEBUG_METHOD == uart #include "uart_i.h" #else #error "Your DEBUG methode is not suported!" #endif -#ifdef DEBUG +#ifdef DEBUG_METHOD void debug_init(void){ - #if DBUG==uart + #if DEBUG_METHOD==uart uart0_init(); #else #error "Your DEBUG methode is not suported!" #endif } - + void debug_char(char c){ static char initialised = 0; if (!initialised){ uart0_init(); initialised=1; - } + } uart0_putc(c); } - + void debug_str(char* s){ while (*s) debug_char(*s++); } - + void debug_byte(char b){ diff --git a/test_src/main-aes-test.c b/test_src/main-aes-test.c index e2d3685..71b6600 100644 --- a/test_src/main-aes-test.c +++ b/test_src/main-aes-test.c @@ -18,7 +18,7 @@ */ /* * AES test-suit - * + * */ #include "config.h" @@ -27,13 +27,6 @@ #include "debug.h" #include "aes/aes.h" -#include "aes/aes128_enc.h" -#include "aes/aes128_dec.h" -#include "aes/aes192_enc.h" -#include "aes/aes192_dec.h" -#include "aes/aes256_enc.h" -#include "aes/aes256_dec.h" -#include "aes/aes_keyschedule.h" #include "nessie_bc_test.h" #include "cli.h" @@ -59,28 +52,28 @@ void testrun_nessie_aes(void){ nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)aes128_dec; nessie_bc_ctx.cipher_genctx = (nessie_bc_gen_fpt)aes_init; nessie_bc_run(); - + nessie_bc_ctx.keysize_b = 192; nessie_bc_ctx.ctx_size_B = sizeof(aes192_ctx_t); nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)aes192_enc; nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)aes192_dec; nessie_bc_run(); - + nessie_bc_ctx.keysize_b = 256; nessie_bc_ctx.ctx_size_B = sizeof(aes256_ctx_t); nessie_bc_ctx.cipher_enc = (nessie_bc_enc_fpt)aes256_enc; nessie_bc_ctx.cipher_dec = (nessie_bc_dec_fpt)aes256_dec; - nessie_bc_run(); + nessie_bc_run(); } void testrun_test_aes(void){ - uint8_t key[16] = { 0x2b, 0x7e, 0x15, 0x16, + uint8_t key[16] = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c }; uint8_t data[16] = { 0x32, 0x43, 0xf6, 0xa8, - 0x88, 0x5a, 0x30, 0x8d, - 0x31, 0x31, 0x98, 0xa2, + 0x88, 0x5a, 0x30, 0x8d, + 0x31, 0x31, 0x98, 0xa2, 0xe0, 0x37, 0x07, 0x34 }; aes128_ctx_t ctx; aes128_init(key, &ctx); @@ -94,12 +87,12 @@ void testrun_test_aes(void){ aes128_dec(data, &ctx); cli_putstr_P(PSTR("\r\n plaintext: ")); cli_hexdump(data, 16); - - + + } void testrun_testkey_aes128(void){ - uint8_t key[16] = { 0x2b, 0x7e, 0x15, 0x16, + uint8_t key[16] = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}; @@ -118,11 +111,11 @@ void testrun_testkey_aes128(void){ } void testrun_testkey_aes192(void){ - uint8_t key[24] = { 0x8e, 0x73, 0xb0, 0xf7, + uint8_t key[24] = { 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, - 0xc8, 0x10, 0xf3, 0x2b, - 0x80, 0x90, 0x79, 0xe5, - 0x62, 0xf8, 0xea, 0xd2, + 0xc8, 0x10, 0xf3, 0x2b, + 0x80, 0x90, 0x79, 0xe5, + 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b}; aes192_ctx_t ctx; uint8_t i; @@ -141,13 +134,13 @@ void testrun_testkey_aes192(void){ void testrun_testkey_aes256(void){ - uint8_t key[32] = { 0x60, 0x3d, 0xeb, 0x10, - 0x15, 0xca, 0x71, 0xbe, - 0x2b, 0x73, 0xae, 0xf0, - 0x85, 0x7d, 0x77, 0x81, - 0x1f, 0x35, 0x2c, 0x07, - 0x3b, 0x61, 0x08, 0xd7, - 0x2d, 0x98, 0x10, 0xa3, + uint8_t key[32] = { 0x60, 0x3d, 0xeb, 0x10, + 0x15, 0xca, 0x71, 0xbe, + 0x2b, 0x73, 0xae, 0xf0, + 0x85, 0x7d, 0x77, 0x81, + 0x1f, 0x35, 0x2c, 0x07, + 0x3b, 0x61, 0x08, 0xd7, + 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4}; aes256_ctx_t ctx; uint8_t i; @@ -176,36 +169,36 @@ void testrun_performance_aes128(void){ char str[16]; uint8_t key[32], data[16]; aes128_ctx_t ctx; - + calibrateTimer(); print_overhead(); - + memset(key, 0, 32); memset(data, 0, 16); - + startTimer(1); aes128_init(key, &ctx); t = stopTimer(); cli_putstr_P(PSTR("\r\n\tctx-gen time: ")); ultoa((unsigned long)t, str, 10); cli_putstr(str); - - + + startTimer(1); aes128_enc(data, &ctx); t = stopTimer(); cli_putstr_P(PSTR("\r\n\tencrypt time: ")); ultoa((unsigned long)t, str, 10); cli_putstr(str); - - + + startTimer(1); aes128_dec(data, &ctx); t = stopTimer(); cli_putstr_P(PSTR("\r\n\tdecrypt time: ")); ultoa((unsigned long)t, str, 10); cli_putstr(str); - + cli_putstr_P(PSTR("\r\n")); } @@ -215,36 +208,36 @@ void testrun_performance_aes192(void){ char str[16]; uint8_t key[32], data[16]; aes192_ctx_t ctx; - + calibrateTimer(); print_overhead(); - + memset(key, 0, 32); memset(data, 0, 16); - + startTimer(1); aes192_init(key, &ctx); t = stopTimer(); cli_putstr_P(PSTR("\r\n\tctx-gen time: ")); ultoa((unsigned long)t, str, 10); cli_putstr(str); - - + + startTimer(1); aes192_enc(data, &ctx); t = stopTimer(); cli_putstr_P(PSTR("\r\n\tencrypt time: ")); ultoa((unsigned long)t, str, 10); cli_putstr(str); - - + + startTimer(1); aes192_dec(data, &ctx); t = stopTimer(); cli_putstr_P(PSTR("\r\n\tdecrypt time: ")); ultoa((unsigned long)t, str, 10); cli_putstr(str); - + cli_putstr_P(PSTR("\r\n")); } @@ -254,36 +247,36 @@ void testrun_performance_aes256(void){ char str[16]; uint8_t key[32], data[16]; aes256_ctx_t ctx; - + calibrateTimer(); print_overhead(); - + memset(key, 0, 32); memset(data, 0, 16); - + startTimer(1); aes256_init(key, &ctx); t = stopTimer(); cli_putstr_P(PSTR("\r\n\tctx-gen time: ")); ultoa((unsigned long)t, str, 10); cli_putstr(str); - - + + startTimer(1); aes256_enc(data, &ctx); t = stopTimer(); cli_putstr_P(PSTR("\r\n\tencrypt time: ")); ultoa((unsigned long)t, str, 10); cli_putstr(str); - - + + startTimer(1); aes256_dec(data, &ctx); t = stopTimer(); cli_putstr_P(PSTR("\r\n\tdecrypt time: ")); ultoa((unsigned long)t, str, 10); cli_putstr(str); - + cli_putstr_P(PSTR("\r\n")); } @@ -314,13 +307,13 @@ cmdlist_entry_t cmdlist[] PROGMEM = { { echo_str, (void*)1, (void_fpt)echo_ctrl}, { NULL, NULL, NULL} }; - + int main (void){ DEBUG_INIT(); - + cli_rx = (cli_rx_fpt)uart0_getc; - cli_tx = (cli_tx_fpt)uart0_putc; + cli_tx = (cli_tx_fpt)uart0_putc; for(;;){ cli_putstr_P(PSTR("\r\n\r\nCrypto-VS (")); cli_putstr(algo_name); diff --git a/test_src/main-aes128-test.c b/test_src/main-aes128-test.c index ce9468f..01cf583 100644 --- a/test_src/main-aes128-test.c +++ b/test_src/main-aes128-test.c @@ -18,7 +18,7 @@ */ /* * AES-128 test-suit - * + * */ #include "config.h" @@ -27,10 +27,6 @@ #include "debug.h" #include "aes/aes.h" -#include "aes/aes128_enc.h" -#include "aes/aes128_dec.h" -#include "aes/aes_keyschedule.h" - #include "nessie_bc_test.h" #include "cli.h" #include "performance_test.h" @@ -57,13 +53,13 @@ void testrun_nessie_aes(void){ } void testrun_test_aes(void){ - uint8_t key[16] = { 0x2b, 0x7e, 0x15, 0x16, + uint8_t key[16] = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c }; uint8_t data[16] = { 0x32, 0x43, 0xf6, 0xa8, - 0x88, 0x5a, 0x30, 0x8d, - 0x31, 0x31, 0x98, 0xa2, + 0x88, 0x5a, 0x30, 0x8d, + 0x31, 0x31, 0x98, 0xa2, 0xe0, 0x37, 0x07, 0x34 }; aes128_ctx_t ctx; aes128_init(key, &ctx); @@ -77,12 +73,12 @@ void testrun_test_aes(void){ aes128_dec(data, &ctx); cli_putstr_P(PSTR("\r\n plaintext: ")); cli_hexdump(data, 16); - - + + } void testrun_testkey_aes128(void){ - uint8_t key[16] = { 0x2b, 0x7e, 0x15, 0x16, + uint8_t key[16] = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}; @@ -110,36 +106,36 @@ void testrun_performance_aes128(void){ char str[16]; uint8_t key[32], data[16]; aes128_ctx_t ctx; - + calibrateTimer(); print_overhead(); - + memset(key, 0, 32); memset(data, 0, 16); - + startTimer(1); aes128_init(key, &ctx); t = stopTimer(); cli_putstr_P(PSTR("\r\n\tctx-gen time: ")); ultoa((unsigned long)t, str, 10); cli_putstr(str); - - + + startTimer(1); aes128_enc(data, &ctx); t = stopTimer(); cli_putstr_P(PSTR("\r\n\tencrypt time: ")); ultoa((unsigned long)t, str, 10); cli_putstr(str); - - + + startTimer(1); aes128_dec(data, &ctx); t = stopTimer(); cli_putstr_P(PSTR("\r\n\tdecrypt time: ")); ultoa((unsigned long)t, str, 10); cli_putstr(str); - + cli_putstr_P(PSTR("\r\n")); } @@ -166,12 +162,12 @@ cmdlist_entry_t cmdlist[] PROGMEM = { { echo_str, (void*)1, (void_fpt)echo_ctrl}, { NULL, NULL, NULL} }; - + int main (void){ DEBUG_INIT(); - + cli_rx = (cli_rx_fpt)uart0_getc; - cli_tx = (cli_tx_fpt)uart0_putc; + cli_tx = (cli_tx_fpt)uart0_putc; for(;;){ cli_putstr_P(PSTR("\r\n\r\nCrypto-VS (")); cli_putstr(algo_name); diff --git a/test_src/main-aes192-test.c b/test_src/main-aes192-test.c index 850d773..2324705 100644 --- a/test_src/main-aes192-test.c +++ b/test_src/main-aes192-test.c @@ -18,7 +18,7 @@ */ /* * AES-192 test-suit - * + * */ #include "config.h" @@ -27,9 +27,6 @@ #include "debug.h" #include "aes/aes.h" -#include "aes/aes192_enc.h" -#include "aes/aes192_dec.h" -#include "aes/aes_keyschedule.h" #include "nessie_bc_test.h" #include "cli.h" @@ -57,11 +54,11 @@ void testrun_nessie_aes(void){ } void testrun_testkey_aes192(void){ - uint8_t key[24] = { 0x8e, 0x73, 0xb0, 0xf7, + uint8_t key[24] = { 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, - 0xc8, 0x10, 0xf3, 0x2b, - 0x80, 0x90, 0x79, 0xe5, - 0x62, 0xf8, 0xea, 0xd2, + 0xc8, 0x10, 0xf3, 0x2b, + 0x80, 0x90, 0x79, 0xe5, + 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b}; aes192_ctx_t ctx; uint8_t i; @@ -88,36 +85,36 @@ void testrun_performance_aes192(void){ char str[16]; uint8_t key[32], data[16]; aes192_ctx_t ctx; - + calibrateTimer(); print_overhead(); - + memset(key, 0, 32); memset(data, 0, 16); - + startTimer(1); aes192_init(key, &ctx); t = stopTimer(); cli_putstr_P(PSTR("\r\n\tctx-gen time: ")); ultoa((unsigned long)t, str, 10); cli_putstr(str); - - + + startTimer(1); aes192_enc(data, &ctx); t = stopTimer(); cli_putstr_P(PSTR("\r\n\tencrypt time: ")); ultoa((unsigned long)t, str, 10); cli_putstr(str); - - + + startTimer(1); aes192_dec(data, &ctx); t = stopTimer(); cli_putstr_P(PSTR("\r\n\tdecrypt time: ")); ultoa((unsigned long)t, str, 10); cli_putstr(str); - + cli_putstr_P(PSTR("\r\n")); } @@ -148,9 +145,9 @@ cmdlist_entry_t cmdlist[] PROGMEM = { int main (void){ DEBUG_INIT(); - + cli_rx = (cli_rx_fpt)uart0_getc; - cli_tx = (cli_tx_fpt)uart0_putc; + cli_tx = (cli_tx_fpt)uart0_putc; for(;;){ cli_putstr_P(PSTR("\r\n\r\nCrypto-VS (")); cli_putstr(algo_name); diff --git a/test_src/main-aes256-test.c b/test_src/main-aes256-test.c index 53c4fe6..d75fc52 100644 --- a/test_src/main-aes256-test.c +++ b/test_src/main-aes256-test.c @@ -18,7 +18,7 @@ */ /* * AES-256 test-suit - * + * */ #include "config.h" @@ -27,9 +27,6 @@ #include "debug.h" #include "aes/aes.h" -#include "aes/aes256_enc.h" -#include "aes/aes256_dec.h" -#include "aes/aes_keyschedule.h" #include "nessie_bc_test.h" #include "cli.h" @@ -57,13 +54,13 @@ void testrun_nessie_aes(void){ } void testrun_testkey_aes256(void){ - uint8_t key[32] = { 0x60, 0x3d, 0xeb, 0x10, - 0x15, 0xca, 0x71, 0xbe, - 0x2b, 0x73, 0xae, 0xf0, - 0x85, 0x7d, 0x77, 0x81, - 0x1f, 0x35, 0x2c, 0x07, - 0x3b, 0x61, 0x08, 0xd7, - 0x2d, 0x98, 0x10, 0xa3, + uint8_t key[32] = { 0x60, 0x3d, 0xeb, 0x10, + 0x15, 0xca, 0x71, 0xbe, + 0x2b, 0x73, 0xae, 0xf0, + 0x85, 0x7d, 0x77, 0x81, + 0x1f, 0x35, 0x2c, 0x07, + 0x3b, 0x61, 0x08, 0xd7, + 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4}; aes256_ctx_t ctx; uint8_t i; @@ -90,36 +87,36 @@ void testrun_performance_aes256(void){ char str[16]; uint8_t key[32], data[16]; aes256_ctx_t ctx; - + calibrateTimer(); print_overhead(); - + memset(key, 0, 32); memset(data, 0, 16); - + startTimer(1); aes256_init(key, &ctx); t = stopTimer(); cli_putstr_P(PSTR("\r\n\tctx-gen time: ")); ultoa((unsigned long)t, str, 10); cli_putstr(str); - - + + startTimer(1); aes256_enc(data, &ctx); t = stopTimer(); cli_putstr_P(PSTR("\r\n\tencrypt time: ")); ultoa((unsigned long)t, str, 10); cli_putstr(str); - - + + startTimer(1); aes256_dec(data, &ctx); t = stopTimer(); cli_putstr_P(PSTR("\r\n\tdecrypt time: ")); ultoa((unsigned long)t, str, 10); cli_putstr(str); - + cli_putstr_P(PSTR("\r\n")); } @@ -150,9 +147,9 @@ cmdlist_entry_t cmdlist[] PROGMEM = { int main (void){ DEBUG_INIT(); - + cli_rx = (cli_rx_fpt)uart0_getc; - cli_tx = (cli_tx_fpt)uart0_putc; + cli_tx = (cli_tx_fpt)uart0_putc; for(;;){ cli_putstr_P(PSTR("\r\n\r\nCrypto-VS (")); cli_putstr(algo_name); diff --git a/test_src/main-groestl-test.c b/test_src/main-groestl-test.c index a2e9714..5b46497 100644 --- a/test_src/main-groestl-test.c +++ b/test_src/main-groestl-test.c @@ -18,7 +18,7 @@ */ /* * groestl test-suit - * + * */ #include "config.h" @@ -78,7 +78,7 @@ void groestl512_test(void* msg, uint32_t length_b){ void testrun_stdtest_groestl(void){ - uint8_t msg1[144]; + uint8_t msg1[144]; memset(msg1, 0, 144); groestl224_test("", 8); groestl224_test(msg1, 576); @@ -98,6 +98,19 @@ void testlshort(void){ groestl512_test("abc", 24); } +void test505(void){ + uint8_t data[] = { + 0x84, 0x73, 0xDC, 0x53, 0x82, 0xDE, 0x32, 0x95, + 0x7E, 0x3A, 0x15, 0xCA, 0x3D, 0x79, 0x1C, 0x67, + 0xD2, 0x0C, 0xF9, 0xEF, 0xBE, 0x3E, 0x46, 0x40, + 0x7D, 0xCA, 0x5D, 0x02, 0x63, 0x5A, 0xC8, 0x6D, + 0x2E, 0x0B, 0x22, 0xC7, 0x6D, 0x7D, 0x08, 0x0D, + 0x36, 0x2E, 0x82, 0x75, 0x89, 0x14, 0xCC, 0x0A, + 0xE2, 0xB8, 0x9B, 0xD3, 0x5F, 0x71, 0xD8, 0x44, + 0x92, 0xD9, 0x43, 0x07, 0x42, 0x78, 0x9C, 0x80 }; + groestl224_test(data, 505); +} + void performance_groestl(void){ hfal_performance_multiple(algolist); @@ -112,6 +125,7 @@ const char nessie_str[] PROGMEM = "nessie"; const char test_str[] PROGMEM = "test"; const char testshort_str[] PROGMEM = "short"; const char testlshort_str[] PROGMEM = "lshort"; +const char test505_str[] PROGMEM = "test505"; const char performance_str[] PROGMEM = "performance"; const char echo_str[] PROGMEM = "echo"; const char shavs_list_str[] PROGMEM = "shavs_list"; @@ -123,6 +137,7 @@ cmdlist_entry_t cmdlist[] PROGMEM = { { test_str, NULL, testrun_stdtest_groestl}, { testshort_str, NULL, testshort}, { testlshort_str, NULL, testlshort}, + { test505_str, NULL, test505}, { performance_str, NULL, performance_groestl}, { shavs_list_str, NULL, shavs_listalgos}, { shavs_set_str, (void*)1, (void_fpt)shavs_setalgo}, @@ -133,9 +148,9 @@ cmdlist_entry_t cmdlist[] PROGMEM = { int main (void){ DEBUG_INIT(); - + cli_rx = (cli_rx_fpt)uart0_getc; - cli_tx = (cli_tx_fpt)uart0_putc; + cli_tx = (cli_tx_fpt)uart0_putc; shavs_algolist=(hfdesc_t**)algolist; shavs_algo=(hfdesc_t*)&groestl256_desc; for(;;){ @@ -146,7 +161,7 @@ int main (void){ cli_putstr_P(PSTR(" ")); cli_putstr(__TIME__); cli_putstr_P(PSTR(")\r\nloaded and running\r\n")); - + cmd_interface(cmdlist); } -} +} diff --git a/test_src/performance_test.c b/test_src/performance_test.c index ad745fc..6ba5645 100644 --- a/test_src/performance_test.c +++ b/test_src/performance_test.c @@ -51,7 +51,7 @@ ISR(TIMER1_OVF_vect){ } void calibrateTimer(void){ - volatile uint8_t i; + volatile uint8_t i=0; startTimer(1); stopTimer(); const_overhead = TCNT1; diff --git a/testport.conf b/testport.conf index 213533d..92c450e 100644 --- a/testport.conf +++ b/testport.conf @@ -6,60 +6,9 @@ baud = 38400 databits = 8 stopbits = 1 paraty = none -testlogbase = testlog_ +testlogbase = testlog/testlog_ -############################################################################### - -[BlueMidnightWish-224] -algo=a -file_0=testvectors/shavs/BlueMidnightWish/ShortMsgKAT_224.txt -file_1=testvectors/shavs/BlueMidnightWish/LongMsgKAT_224.txt - -[BlueMidnightWish-256] -algo=b -file_0=testvectors/shavs/BlueMidnightWish/ShortMsgKAT_256.txt -file_1=testvectors/shavs/BlueMidnightWish/LongMsgKAT_256.txt - -[BlueMidnightWish-384] -algo=c -file_0=testvectors/shavs/BlueMidnightWish/ShortMsgKAT_384.txt -file_1=testvectors/shavs/BlueMidnightWish/LongMsgKAT_384.txt - -[BlueMidnightWish-512] -algo=d -file_0=testvectors/shavs/BlueMidnightWish/ShortMsgKAT_512.txt -file_1=testvectors/shavs/BlueMidnightWish/LongMsgKAT_512.txt - -[BlueMidnightWish] -meta=1 -test_0=BlueMidnightWish-256 -test_1=BlueMidnightWish-512 -test_2=BlueMidnightWish-224 -test_3=BlueMidnightWish-384 - -############################################################################### - -[Blake-28] -algo=a -file_0=testvectors/shavs/Blake/ShortMsgKAT_224.txt -file_1=testvectors/shavs/Blake/LongMsgKAT_224.txt - -[Blake-32] -algo=b -file_0=testvectors/shavs/Blake/ShortMsgKAT_256.txt -file_1=testvectors/shavs/Blake/LongMsgKAT_256.txt - -[Blake-48] -algo=c -file_0=testvectors/shavs/Blake/ShortMsgKAT_384.txt -file_1=testvectors/shavs/Blake/LongMsgKAT_384.txt - -[Blake-64] -algo=d -file_0=testvectors/shavs/Blake/ShortMsgKAT_512.txt -file_1=testvectors/shavs/Blake/LongMsgKAT_512.txt - -############################################################################### +include=testconf/*.conf # END OF CONFIGFILE -- 2.39.5