fixed bug in shabea
This commit is contained in:
parent
619fb76528
commit
a06c8ef821
|
@ -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];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#ifndef MEMXOR_H_
|
||||||
|
#define MEMXOR_H_
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
void memxor(void * dest, const void * src, uint16_t n);
|
||||||
|
|
||||||
|
#endif
|
|
@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
|
||||||
$(ALGO_NAME)_OBJ := shabea.o sha256-asm.o
|
$(ALGO_NAME)_OBJ := shabea.o sha256-asm.o
|
||||||
$(ALGO_NAME)_TEST_BIN := main-shabea-test.o debug.o uart.o serial-tools.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 \
|
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)_NESSIE_TEST := "nessie"
|
||||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||||
|
|
||||||
|
|
12
shabea.c
12
shabea.c
|
@ -35,14 +35,8 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "uart.h"
|
#include "uart.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
/*
|
#include "memxor.h"
|
||||||
*
|
|
||||||
*/
|
|
||||||
void memxor(uint8_t * dest, uint8_t * src, uint8_t length){
|
|
||||||
while(length--){
|
|
||||||
*dest++ ^= *src++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SHABEA256-n
|
* SHABEA256-n
|
||||||
|
@ -77,7 +71,7 @@ void shabea256(void * block, void * key, uint16_t keysize_b, uint8_t enc, uint8_
|
||||||
memcpy(R, hash, HALFSIZEB);
|
memcpy(R, hash, HALFSIZEB);
|
||||||
} else {
|
} else {
|
||||||
/* no swap */
|
/* no swap */
|
||||||
memxor(L, hash, HALFSIZE);
|
memxor(L, hash, HALFSIZEB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue