X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=test_src%2Fnessie_stream_test.c;fp=test_src%2Fnessie_stream_test.c;h=3866b218ed3b11508756d7b38231242be3dbd234;hb=2159c273c9d3361571a6ff1ab63d9bc76582fbab;hp=0000000000000000000000000000000000000000;hpb=4d76909e4282baf1420ee309e270384246b241b8;p=avr-crypto-lib.git
diff --git a/test_src/nessie_stream_test.c b/test_src/nessie_stream_test.c
new file mode 100644
index 0000000..3866b21
--- /dev/null
+++ b/test_src/nessie_stream_test.c
@@ -0,0 +1,192 @@
+/* nessie_stream_test.c */
+/*
+ This file is part of the Crypto-avr-lib/microcrypt-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 "uart.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();
+}