From 41e9e95f07e04170b8732426b2c5d73400b4a2bd Mon Sep 17 00:00:00 2001 From: bg Date: Thu, 27 Jan 2011 09:09:01 +0000 Subject: [PATCH] =?utf8?q?updated=20Gr=C3=B8stl=20for=20round=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- groestl/groestl_large.c | 54 ++++++++++++---- groestl/groestl_small.c | 62 ++++++++++++++++--- mkfiles/grain.mk | 2 +- mkfiles/mickey128.mk | 2 +- mkfiles/trivium.mk | 2 +- scal/scal-basic.c | 4 -- scal/scal-nessie.c | 32 ++++++++++ .../ExtremelyLongMsgKAT_224.txt | 0 .../ExtremelyLongMsgKAT_256.txt | 0 .../ExtremelyLongMsgKAT_384.txt | 0 .../ExtremelyLongMsgKAT_512.txt | 0 .../IntermediateValues_1BlockMsg_224.txt | 0 .../IntermediateValues_1BlockMsg_256.txt | 0 .../IntermediateValues_1BlockMsg_384.txt | 0 .../IntermediateValues_1BlockMsg_512.txt | 0 .../IntermediateValues_2BlockMsg_224.txt | 0 .../IntermediateValues_2BlockMsg_256.txt | 0 .../IntermediateValues_2BlockMsg_384.txt | 0 .../IntermediateValues_2BlockMsg_512.txt | 0 .../{Groestl => Groestl-0}/LongMsgKAT_224.txt | 0 .../{Groestl => Groestl-0}/LongMsgKAT_256.txt | 0 .../{Groestl => Groestl-0}/LongMsgKAT_384.txt | 0 .../{Groestl => Groestl-0}/LongMsgKAT_512.txt | 0 .../{Groestl => Groestl-0}/MonteCarlo_224.txt | 0 .../{Groestl => Groestl-0}/MonteCarlo_256.txt | 0 .../{Groestl => Groestl-0}/MonteCarlo_384.txt | 0 .../{Groestl => Groestl-0}/MonteCarlo_512.txt | 0 .../ShortMsgKAT_224.txt | 0 .../ShortMsgKAT_256.txt | 0 .../ShortMsgKAT_384.txt | 0 .../ShortMsgKAT_512.txt | 0 31 files changed, 128 insertions(+), 30 deletions(-) rename testvectors/shavs/{Groestl => Groestl-0}/ExtremelyLongMsgKAT_224.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/ExtremelyLongMsgKAT_256.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/ExtremelyLongMsgKAT_384.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/ExtremelyLongMsgKAT_512.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/IntermediateValues_1BlockMsg_224.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/IntermediateValues_1BlockMsg_256.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/IntermediateValues_1BlockMsg_384.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/IntermediateValues_1BlockMsg_512.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/IntermediateValues_2BlockMsg_224.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/IntermediateValues_2BlockMsg_256.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/IntermediateValues_2BlockMsg_384.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/IntermediateValues_2BlockMsg_512.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/LongMsgKAT_224.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/LongMsgKAT_256.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/LongMsgKAT_384.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/LongMsgKAT_512.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/MonteCarlo_224.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/MonteCarlo_256.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/MonteCarlo_384.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/MonteCarlo_512.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/ShortMsgKAT_224.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/ShortMsgKAT_256.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/ShortMsgKAT_384.txt (100%) rename testvectors/shavs/{Groestl => Groestl-0}/ShortMsgKAT_512.txt (100%) diff --git a/groestl/groestl_large.c b/groestl/groestl_large.c index bcfd8e5..0812683 100644 --- a/groestl/groestl_large.c +++ b/groestl/groestl_large.c @@ -65,14 +65,49 @@ static uint8_t matrix[] PROGMEM = { 2, 3, 4, 5, 3, 5, 7, 2 }; +static +void shift_columns(uint8_t *a, PGM_VOID_P shifts){ + uint8_t s; + uint8_t tmp[16]; + uint8_t i,j; + for(i=0; i<8; ++i){ + s = pgm_read_byte(shifts); + shifts = (uint8_t*)shifts + 1; + if(s==0){ + continue; + } + for(j=0;j<16;++j){ + tmp[j] = a[i+j*8]; + } + for(j=0; j<16; ++j){ + a[i+((j-s+16)%16)*8] = tmp[j]; + } + } +} + +static const uint8_t p_shifts[] PROGMEM = { + 0, 1, 2, 3, 4, 5, 6, 11 +}; + +static const uint8_t q_shifts[] PROGMEM = { + 1, 3, 5, 11, 0, 2, 4, 6 +}; + void groestl_large_rounds(uint8_t *m, uint8_t q){ uint8_t r,i,j; uint8_t tmp[16]; for(r=0; rctx))&(0xff<<(8-blocksize_b)))>>fill; fill += blocksize_b; }while(fill<8); -// cli_putstr_P(PSTR("\r\nDBG: ")); -// cli_hexdump_byte(r); return r; }else{ uint8_t r; diff --git a/scal/scal-nessie.c b/scal/scal-nessie.c index b4cddf4..4df9357 100644 --- a/scal/scal-nessie.c +++ b/scal/scal-nessie.c @@ -25,6 +25,11 @@ #include "memxor.h" #include +#ifndef NESSIE_ESTREAM +#define NESSIE_ESTREAM 0 +#endif + + static const uint8_t normal_hooks[] PROGMEM = { 0, 192/64, 256/64, 448/64 }; @@ -37,7 +42,12 @@ static const char stream0_n[] PROGMEM = "stream[0..63]"; static const char stream1_n[] PROGMEM = "stream[192..255]"; static const char stream2_n[] PROGMEM = "stream[256..319]"; static const char stream3_n[] PROGMEM = "stream[448..511]"; + +#if NESSIE_ESTREAM +static const char streamX_n[] PROGMEM = "xor-digest"; +#else static const char streamX_n[] PROGMEM = "stream[0..511]xored"; +#endif static const char* stream_n_str[] PROGMEM = { stream0_n, @@ -50,7 +60,11 @@ static const char* stream_n_str[] PROGMEM = { static const char stream1_l[] PROGMEM = "stream[65472..65535]"; static const char stream2_l[] PROGMEM = "stream[65536..65599]"; static const char stream3_l[] PROGMEM = "stream[131008..131071]"; +#if NESSIE_ESTREAM +static const char streamX_l[] PROGMEM = "xor-digest"; +#else static const char streamX_l[] PROGMEM = "stream[0..131071]xored"; +#endif static const char* stream_l_str[] PROGMEM = { stream0_n, @@ -141,7 +155,11 @@ void scal_nessie_stream_run(const scdesc_t *desc, uint16_t keysize_b, uint16_t i memset(key, 0, (keysize_b+7)/8); /*** Test SET 1 ***/ nessie_print_setheader(1); +#if NESSIE_ESTREAM + for(v=0;v>(v&7); nessie_print_item("key", key, (keysize_b+7)/8); @@ -155,7 +173,11 @@ void scal_nessie_stream_run(const scdesc_t *desc, uint16_t keysize_b, uint16_t i } /*** Test SET 2 ***/ nessie_print_setheader(2); +#if NESSIE_ESTREAM + for(v=0;v<256; v+=9){ +#else for(v=0;v<256; ++v){ +#endif nessie_print_set_vector(2,v); memset(key, v&0xff, (keysize_b+7)/8); nessie_print_item("key", key, (keysize_b+7)/8); @@ -168,7 +190,11 @@ void scal_nessie_stream_run(const scdesc_t *desc, uint16_t keysize_b, uint16_t i } /*** Test SET 3 ***/ nessie_print_setheader(3); +#if NESSIE_ESTREAM + for(v=0;v<256; v+=9){ +#else for(v=0;v<256; ++v){ +#endif uint8_t i; nessie_print_set_vector(3,v); for(i=0; i<((keysize_b+7)/8); ++i){ @@ -205,7 +231,11 @@ void scal_nessie_stream_run(const scdesc_t *desc, uint16_t keysize_b, uint16_t i /*** Test SET 5 ***/ nessie_print_setheader(5); memset(key, 0, (keysize_b+7)/8); +#if NESSIE_ESTREAM + for(v=0;v>(v&7); nessie_print_item("key", key, (keysize_b+7)/8); @@ -233,6 +263,7 @@ void scal_nessie_stream_run(const scdesc_t *desc, uint16_t keysize_b, uint16_t i scal_cipher_free(&ctx); } /*** Test SET 7 ***/ +#if !NESSIE_ESTREAM nessie_print_setheader(7); uint8_t u; for(v=0;v<3; ++v){ @@ -252,6 +283,7 @@ void scal_nessie_stream_run(const scdesc_t *desc, uint16_t keysize_b, uint16_t i long_block(&ctx); scal_cipher_free(&ctx); } +#endif nessie_print_footer(); } diff --git a/testvectors/shavs/Groestl/ExtremelyLongMsgKAT_224.txt b/testvectors/shavs/Groestl-0/ExtremelyLongMsgKAT_224.txt similarity index 100% rename from testvectors/shavs/Groestl/ExtremelyLongMsgKAT_224.txt rename to testvectors/shavs/Groestl-0/ExtremelyLongMsgKAT_224.txt diff --git a/testvectors/shavs/Groestl/ExtremelyLongMsgKAT_256.txt b/testvectors/shavs/Groestl-0/ExtremelyLongMsgKAT_256.txt similarity index 100% rename from testvectors/shavs/Groestl/ExtremelyLongMsgKAT_256.txt rename to testvectors/shavs/Groestl-0/ExtremelyLongMsgKAT_256.txt diff --git a/testvectors/shavs/Groestl/ExtremelyLongMsgKAT_384.txt b/testvectors/shavs/Groestl-0/ExtremelyLongMsgKAT_384.txt similarity index 100% rename from testvectors/shavs/Groestl/ExtremelyLongMsgKAT_384.txt rename to testvectors/shavs/Groestl-0/ExtremelyLongMsgKAT_384.txt diff --git a/testvectors/shavs/Groestl/ExtremelyLongMsgKAT_512.txt b/testvectors/shavs/Groestl-0/ExtremelyLongMsgKAT_512.txt similarity index 100% rename from testvectors/shavs/Groestl/ExtremelyLongMsgKAT_512.txt rename to testvectors/shavs/Groestl-0/ExtremelyLongMsgKAT_512.txt diff --git a/testvectors/shavs/Groestl/IntermediateValues_1BlockMsg_224.txt b/testvectors/shavs/Groestl-0/IntermediateValues_1BlockMsg_224.txt similarity index 100% rename from testvectors/shavs/Groestl/IntermediateValues_1BlockMsg_224.txt rename to testvectors/shavs/Groestl-0/IntermediateValues_1BlockMsg_224.txt diff --git a/testvectors/shavs/Groestl/IntermediateValues_1BlockMsg_256.txt b/testvectors/shavs/Groestl-0/IntermediateValues_1BlockMsg_256.txt similarity index 100% rename from testvectors/shavs/Groestl/IntermediateValues_1BlockMsg_256.txt rename to testvectors/shavs/Groestl-0/IntermediateValues_1BlockMsg_256.txt diff --git a/testvectors/shavs/Groestl/IntermediateValues_1BlockMsg_384.txt b/testvectors/shavs/Groestl-0/IntermediateValues_1BlockMsg_384.txt similarity index 100% rename from testvectors/shavs/Groestl/IntermediateValues_1BlockMsg_384.txt rename to testvectors/shavs/Groestl-0/IntermediateValues_1BlockMsg_384.txt diff --git a/testvectors/shavs/Groestl/IntermediateValues_1BlockMsg_512.txt b/testvectors/shavs/Groestl-0/IntermediateValues_1BlockMsg_512.txt similarity index 100% rename from testvectors/shavs/Groestl/IntermediateValues_1BlockMsg_512.txt rename to testvectors/shavs/Groestl-0/IntermediateValues_1BlockMsg_512.txt diff --git a/testvectors/shavs/Groestl/IntermediateValues_2BlockMsg_224.txt b/testvectors/shavs/Groestl-0/IntermediateValues_2BlockMsg_224.txt similarity index 100% rename from testvectors/shavs/Groestl/IntermediateValues_2BlockMsg_224.txt rename to testvectors/shavs/Groestl-0/IntermediateValues_2BlockMsg_224.txt diff --git a/testvectors/shavs/Groestl/IntermediateValues_2BlockMsg_256.txt b/testvectors/shavs/Groestl-0/IntermediateValues_2BlockMsg_256.txt similarity index 100% rename from testvectors/shavs/Groestl/IntermediateValues_2BlockMsg_256.txt rename to testvectors/shavs/Groestl-0/IntermediateValues_2BlockMsg_256.txt diff --git a/testvectors/shavs/Groestl/IntermediateValues_2BlockMsg_384.txt b/testvectors/shavs/Groestl-0/IntermediateValues_2BlockMsg_384.txt similarity index 100% rename from testvectors/shavs/Groestl/IntermediateValues_2BlockMsg_384.txt rename to testvectors/shavs/Groestl-0/IntermediateValues_2BlockMsg_384.txt diff --git a/testvectors/shavs/Groestl/IntermediateValues_2BlockMsg_512.txt b/testvectors/shavs/Groestl-0/IntermediateValues_2BlockMsg_512.txt similarity index 100% rename from testvectors/shavs/Groestl/IntermediateValues_2BlockMsg_512.txt rename to testvectors/shavs/Groestl-0/IntermediateValues_2BlockMsg_512.txt diff --git a/testvectors/shavs/Groestl/LongMsgKAT_224.txt b/testvectors/shavs/Groestl-0/LongMsgKAT_224.txt similarity index 100% rename from testvectors/shavs/Groestl/LongMsgKAT_224.txt rename to testvectors/shavs/Groestl-0/LongMsgKAT_224.txt diff --git a/testvectors/shavs/Groestl/LongMsgKAT_256.txt b/testvectors/shavs/Groestl-0/LongMsgKAT_256.txt similarity index 100% rename from testvectors/shavs/Groestl/LongMsgKAT_256.txt rename to testvectors/shavs/Groestl-0/LongMsgKAT_256.txt diff --git a/testvectors/shavs/Groestl/LongMsgKAT_384.txt b/testvectors/shavs/Groestl-0/LongMsgKAT_384.txt similarity index 100% rename from testvectors/shavs/Groestl/LongMsgKAT_384.txt rename to testvectors/shavs/Groestl-0/LongMsgKAT_384.txt diff --git a/testvectors/shavs/Groestl/LongMsgKAT_512.txt b/testvectors/shavs/Groestl-0/LongMsgKAT_512.txt similarity index 100% rename from testvectors/shavs/Groestl/LongMsgKAT_512.txt rename to testvectors/shavs/Groestl-0/LongMsgKAT_512.txt diff --git a/testvectors/shavs/Groestl/MonteCarlo_224.txt b/testvectors/shavs/Groestl-0/MonteCarlo_224.txt similarity index 100% rename from testvectors/shavs/Groestl/MonteCarlo_224.txt rename to testvectors/shavs/Groestl-0/MonteCarlo_224.txt diff --git a/testvectors/shavs/Groestl/MonteCarlo_256.txt b/testvectors/shavs/Groestl-0/MonteCarlo_256.txt similarity index 100% rename from testvectors/shavs/Groestl/MonteCarlo_256.txt rename to testvectors/shavs/Groestl-0/MonteCarlo_256.txt diff --git a/testvectors/shavs/Groestl/MonteCarlo_384.txt b/testvectors/shavs/Groestl-0/MonteCarlo_384.txt similarity index 100% rename from testvectors/shavs/Groestl/MonteCarlo_384.txt rename to testvectors/shavs/Groestl-0/MonteCarlo_384.txt diff --git a/testvectors/shavs/Groestl/MonteCarlo_512.txt b/testvectors/shavs/Groestl-0/MonteCarlo_512.txt similarity index 100% rename from testvectors/shavs/Groestl/MonteCarlo_512.txt rename to testvectors/shavs/Groestl-0/MonteCarlo_512.txt diff --git a/testvectors/shavs/Groestl/ShortMsgKAT_224.txt b/testvectors/shavs/Groestl-0/ShortMsgKAT_224.txt similarity index 100% rename from testvectors/shavs/Groestl/ShortMsgKAT_224.txt rename to testvectors/shavs/Groestl-0/ShortMsgKAT_224.txt diff --git a/testvectors/shavs/Groestl/ShortMsgKAT_256.txt b/testvectors/shavs/Groestl-0/ShortMsgKAT_256.txt similarity index 100% rename from testvectors/shavs/Groestl/ShortMsgKAT_256.txt rename to testvectors/shavs/Groestl-0/ShortMsgKAT_256.txt diff --git a/testvectors/shavs/Groestl/ShortMsgKAT_384.txt b/testvectors/shavs/Groestl-0/ShortMsgKAT_384.txt similarity index 100% rename from testvectors/shavs/Groestl/ShortMsgKAT_384.txt rename to testvectors/shavs/Groestl-0/ShortMsgKAT_384.txt diff --git a/testvectors/shavs/Groestl/ShortMsgKAT_512.txt b/testvectors/shavs/Groestl-0/ShortMsgKAT_512.txt similarity index 100% rename from testvectors/shavs/Groestl/ShortMsgKAT_512.txt rename to testvectors/shavs/Groestl-0/ShortMsgKAT_512.txt -- 2.39.2