X-Git-Url: https://git.cryptolib.org/?p=arm-crypto-lib.git;a=blobdiff_plain;f=test_src%2Fnessie_stream_test.c;fp=test_src%2Fnessie_stream_test.c;h=7545a3becbc7c1de0681d8ed6833582c262e3f89;hp=0000000000000000000000000000000000000000;hb=2a4779378a7bf4322a0e6b2024284092135e8a3d;hpb=e69f1207a9fbd9c0f45bfdbb2d8ebe9852d95969 diff --git a/test_src/nessie_stream_test.c b/test_src/nessie_stream_test.c new file mode 100644 index 0000000..7545a3b --- /dev/null +++ b/test_src/nessie_stream_test.c @@ -0,0 +1,185 @@ +/* nessie_stream_test.c */ +/* + This file is part of the ARM-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" +#include "memxor.h" + +nessie_stream_ctx_t nessie_stream_ctx; + + +#define BLOCKSIZE_B 64 + + +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(); +}