/* nessie_stream_test.c */
/*
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
/**
*
* author: Daniel Otte
* email: daniel.otte@rub.de
* license: GPLv3
*
* a suit for running the nessie-tests for streamciphers
*
* */
#include
#include
#include "nessie_stream_test.h"
#include "nessie_common.h"
nessie_stream_ctx_t nessie_stream_ctx;
#define BLOCKSIZE_B 64
static
void memxor(void* dest, void* src, uint8_t length){
while(length--){
*((uint8_t*)dest) ^= *((uint8_t*)src);
dest = (uint8_t*)dest +1;
src = (uint8_t*)src +1;
}
}
static
void nessie_gen_block(void* ctx, uint8_t* block){
uint16_t i;
for(i=0; i>(i%8);
nessie_stream_enc(key);
}
/* test set 2 */
set=2;
nessie_print_setheader(set);
for(i=0; i<256; ++i){
nessie_print_set_vector(set, i);
memset(key, i, (nessie_stream_ctx.keysize_b+7)/8);
nessie_stream_enc(key);
}
/* test set 3 */
set=3;
nessie_print_setheader(set);
for(i=0; i<256; ++i){
uint8_t j;
nessie_print_set_vector(set, i);
for(j=0; j<(nessie_stream_ctx.keysize_b+7)/8; ++j){
key[j]=(i+j)&0xff;
}
nessie_stream_enc(key);
}
/* test set 4 */
set=4;
nessie_print_setheader(set);
for(i=0; i<4; ++i){
uint8_t j;
nessie_print_set_vector(set, i);
for(j=0; j<(nessie_stream_ctx.keysize_b+7)/8; ++j){
key[j]=(i*5+j*0x53)&0xff;
}
nessie_stream_enc_large(key);
}
nessie_print_footer();
}