X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=scal%2Fscal-nessie.c;h=4df9357468bd7768ed03d6135282c6be9a808095;hb=ac564028e573ea773530e01f1e5a3fe58fcd40a0;hp=26105c0a9a56bafba3821cab0b1b63bfeb5985bd;hpb=66c915087d1f7b8eb7280be43c16e9588faf2e55;p=avr-crypto-lib.git diff --git a/scal/scal-nessie.c b/scal/scal-nessie.c index 26105c0..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, @@ -118,6 +132,9 @@ void long_block(scgen_ctx_t *ctx){ hook_str_ptr = (uint8_t*)hook_str_ptr + 2; nessie_print_item(str, block, 64); } + if(i%64==0){ + NESSIE_SEND_ALIVE; + } } strcpy_P(str, (PGM_VOID_P)pgm_read_word(hook_str_ptr)); nessie_print_item(str, xor_block, 64); @@ -138,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); @@ -152,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); @@ -165,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){ @@ -202,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); @@ -230,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){ @@ -249,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(); }