]> git.cryptolib.org Git - avr-crypto-lib.git/blobdiff - test_src/nessie_stream_test.c
fixing E-Mail-Address & Copyright
[avr-crypto-lib.git] / test_src / nessie_stream_test.c
index 9aecdbee3ba97ca29e968ed7467c0acc9485c3bd..16001ae19a9735e916aacff620b07ec87d929d1e 100644 (file)
@@ -1,7 +1,7 @@
 /* nessie_stream_test.c */
 /*
-    This file is part of the This file is part of the AVR-Crypto-Lib.
-    Copyright (C) 2008  Daniel Otte (daniel.otte@rub.de)
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
 
     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
@@ -19,7 +19,7 @@
 /**
  * 
  * author: Daniel Otte
- * email:  daniel.otte@rub.de
+ * email:  bg@nerilex.org
  * license: GPLv3
  * 
  * a suit for running the nessie-tests for streamciphers
 #include <string.h>
 #include "nessie_stream_test.h"
 #include "nessie_common.h"
-#include "uart.h"
+#include "memxor.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){
+void nessie_gen_block(void *ctx, uint8_t *block){
        uint16_t i;
        for(i=0; i<BLOCKSIZE_B; ++i){
                block[i] = nessie_stream_ctx.cipher_enc(ctx);
@@ -55,7 +46,7 @@ void nessie_gen_block(void* ctx, uint8_t* block){
 }
 
 static
-void nessie_stream_enc(uint8_tkey){
+void nessie_stream_enc(uint8_t *key){
        uint8_t ctx[nessie_stream_ctx.ctx_size_B];
        uint8_t buffer[BLOCKSIZE_B];
        uint8_t xorbuffer[BLOCKSIZE_B];
@@ -99,7 +90,7 @@ void nessie_stream_enc(uint8_t* key){
 
 
 static
-void nessie_stream_enc_large(uint8_tkey){
+void nessie_stream_enc_large(uint8_t *key){
        uint8_t ctx[nessie_stream_ctx.ctx_size_B];
        uint8_t buffer[BLOCKSIZE_B];
        uint8_t xorbuffer[BLOCKSIZE_B];
@@ -118,6 +109,7 @@ void nessie_stream_enc_large(uint8_t* key){
        for(i=0; i<((65472-0)/BLOCKSIZE_B-1); ++i){
                nessie_gen_block(ctx, buffer);
                memxor(xorbuffer, buffer, BLOCKSIZE_B);
+               NESSIE_SEND_ALIVE_A(i);
        }
        
        nessie_gen_block(ctx, buffer);
@@ -131,6 +123,7 @@ void nessie_stream_enc_large(uint8_t* key){
        for(i=0; i<((131008-65536)/BLOCKSIZE_B-1); ++i){
                nessie_gen_block(ctx, buffer);
                memxor(xorbuffer, buffer, BLOCKSIZE_B);
+               NESSIE_SEND_ALIVE_A(i);
        }
        
        nessie_gen_block(ctx, buffer);