fixed bug in shabea

This commit is contained in:
bg 2008-07-21 02:40:18 +00:00
parent 619fb76528
commit a06c8ef821
4 changed files with 19 additions and 10 deletions

8
memxor.c Normal file
View File

@ -0,0 +1,8 @@
#include <stdint.h>
void memxor(void * dest, const void * src, uint16_t n){
while(n--){
((uint8_t*)dest)[n] ^= ((uint8_t*)src)[n];
}
}

7
memxor.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef MEMXOR_H_
#define MEMXOR_H_
#include <stdint.h>
void memxor(void * dest, const void * src, uint16_t n);
#endif

View File

@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := shabea.o sha256-asm.o
$(ALGO_NAME)_TEST_BIN := main-shabea-test.o debug.o uart.o serial-tools.o \
shabea.o sha256-asm.o nessie_bc_test.o \
nessie_common.o cli.o performance_test.o
nessie_common.o cli.o performance_test.o memxor.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"

View File

@ -35,14 +35,8 @@
#include "config.h"
#include "uart.h"
#include "debug.h"
/*
*
*/
void memxor(uint8_t * dest, uint8_t * src, uint8_t length){
while(length--){
*dest++ ^= *src++;
}
}
#include "memxor.h"
/*
* SHABEA256-n
@ -77,7 +71,7 @@ void shabea256(void * block, void * key, uint16_t keysize_b, uint8_t enc, uint8_
memcpy(R, hash, HALFSIZEB);
} else {
/* no swap */
memxor(L, hash, HALFSIZE);
memxor(L, hash, HALFSIZEB);
}
}
}