/* 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
/**
*
* 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);
}
static
-void nessie_stream_enc(uint8_t* key){
+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];
static
-void nessie_stream_enc_large(uint8_t* key){
+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];
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);
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);