make process changed and modularised

This commit is contained in:
bg 2008-04-05 17:57:46 +00:00
parent 1578e34f55
commit bfac0f0eef
23 changed files with 265 additions and 68 deletions

105
Makefile
View File

@ -1,55 +1,82 @@
# Makefile for the micro-crypt project
# author: Daniel Otte
BLOCK_CIPHERS =
STREAM_CIPHERS =
HASHES =
include avr-makefile.inc
include *.mk
ALGORITHMS = $(BLOCK_CIPHERS) $(STREAM_CIPHERS) $(HASHES)
ALGORITHMS_OBJ = $(patsubst %,%_OBJ, $(ALGORITHMS))
ALGORITHMS_OBJ_IMM = $(foreach a, $(ALGORITHMS_OBJ), $($(a)))
ALGORITHMS_TEST_BIN = $(patsubst %,%_TEST_BIN, $(ALGORITHMS))
ALGORITHMS_TEST_BIN_MAIN = $(foreach a, $(ALGORITHMS_TEST_BIN), $(firstword $($(a))))
ALGORITHMS_TEST_BIN_MAIN_ELF = $(patsubst %.o, %.elf, $(ALGORITHMS_TEST_BIN_MAIN))
ALGORITHMS_TEST_BIN_MAIN_HEX = $(patsubst %.o, %.hex, $(ALGORITHMS_TEST_BIN_MAIN))
ALGORITHMS_TEST_BIN_IMM = $(foreach a, $(ALGORITHMS_TEST_BIN), $($(a)))
ALGORITHMS_NESSIE_TEST = $(patsubst %,%_NESSIE_TEST, $(ALGORITHMS))
ALGORITHMS_PERFORMANCE_TEST = $(patsubst %,%_PERORMANCE_TEST, $(ALGORITHMS))
PRG = serpent-test
#PRG = tdes-test
# camellia
# cryptotest
SERPENT_OBJ = main-serpent-test.o debug.o uart.o serial-tools.o serpent.o nessie_bc_test.o
CAMELLIA_OBJ = main-camellia-test.o debug.o uart.o serial-tools.o camellia.o camellia-asm.o
SKIPJACK_OBJ = main-skipjack-test.o debug.o uart.o serial-tools.o skipjack.o
SHA1_OBJ = main-sha1-test.o debug.o uart.o serial-tools.o sha1-asm.o
MD5_OBJ = main-md5-test.o debug.o uart.o serial-tools.o md5.o
CAST5_OBJ = main-cast5-test.o debug.o uart.o serial-tools.o cast5.o
RC6_OBJ = main-rc6-test.o debug.o uart.o serial-tools.o rc6.o
Multi_OBJ = main.o debug.o uart.o serial-tools.o sha256-asm.o xtea-asm.o arcfour-asm.o prng.o cast5.o
DES_OBJ = main-des-test.o debug.o uart.o serial-tools.o des.o
TDES_OBJ = main-tdes-test.o debug.o uart.o serial-tools.o des.o
SEED_OBJ = main-seed-test.o debug.o uart.o serial-tools.o seed.o seed-asm.o
SHABEA_OBJ = main-shabea-test.o debug.o uart.o serial-tools.o shabea.o sha256-asm.o
OBJ = $(SERPENT_OBJ)
MCU_TARGET = atmega32
OPTIMIZE = -Os
#SHA1_OBJ = main-sha1-test.o debug.o uart.o serial-tools.o sha1-asm.o
#MD5_OBJ = main-md5-test.o debug.o uart.o serial-tools.o md5.o
FLASHCMD = avrdude -p $(MCU_TARGET) -P /dev/ttyUSB0 -c avr911 -U flash:w:$(PRG).hex
# -U eeprom:w:$(PRG)_eeprom.hex
#uisp -dprog=bsd -dlpt=/dev/parport1 --upload if=$(PRG).hex
ERASECMD =
#Multi_OBJ = main.o debug.o uart.o serial-tools.o sha256-asm.o xtea-asm.o arcfour-asm.o prng.o cast5.o
#OBJ = $(SERPENT_OBJ)
DEFS =
LIBS =
# You should not have to change anything below here.
define BLA_TEMPLATE2
$(2): $(3)
echo $$@
echo $$^
$(CC) $(CFLAGS) $(LDFLAGS)$(patsubst %.elf,%.map,$(2)) -o \
$(2) \
$(3) \
$(LIBS)
endef
CC = avr-gcc
$(foreach algo, $(ALGORITHMS), $(eval $(call BLA_TEMPLATE2, $(algo), $(patsubst %.o,%.elf,$(firstword $($(algo)_TEST_BIN))), $($(algo)_TEST_BIN) )))
# Override is only needed by avr-lib build system.
.PHONY: info
info:
echo $(ALGORITHMS_TEST_BIN_MAIN)
echo $(ALGORITHMS)
echo $(firstword $(XTEA_TEST_BIN))
echo $(patsubst %.o,%.elf,$(firstword $(XTEA_TEST_BIN)))
# echo $(ALGORITHMS_OBJ)
# echo $(ALGORITHMS_OBJ_IMM)
# echo $(ALGORITHMS_TEST_BIN)
# echo $(ALGORITHMS_NESSIE_TEST)
# echo $(ALGORITHMS_PERFORMANCE_TEST)
override CFLAGS = -pedantic -std=c99 -Wall -Wstrict-prototypes $(OPTIMIZE) -mmcu=$(MCU_TARGET)
$(DEFS)
override LDFLAGS = -Wl,-Map,$(PRG).map
override ASFLAGS = -mmcu=$(MCU_TARGET)
bc: $(ALGORITHMS_OBJ)
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
tests: $(ALGORITHMS_TEST_BIN) \
$(ALGORITHMS_TEST_BIN_MAIN_ELF) \
$(ALGORITHMS_TEST_BIN_MAIN_HEX)
$(ALGORITHMS_OBJ): $(ALGORITHMS_OBJ_IMM)
$(ALGORITHMS_TEST_BIN): $(ALGORITHMS_TEST_BIN_IMM)
$(ALGORITHMS):
.PHONY: all
all: $(PRG).elf lst text eeprom
$(PRG).elf: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
#rc6-test:
.PHONY: clean
clean:
rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak
rm -rf *.o *.elf *.eps *.png *.pdf *.bak
rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
flash:
@ -95,6 +122,11 @@ esrec: $(PRG)_eeprom.srec
%_eeprom.bin: %.elf
$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@
%_size.txt: %.o
$(SIZE) $< > $@
# Every thing below here is used by avr-libc's build system and can be ignored
# by the casual user.
@ -107,6 +139,7 @@ eps: $(PRG).eps
png: $(PRG).png
pdf: $(PRG).pdf
%.eps: %.fig
$(FIG2DEV) -L eps $< $@

12
arcfour.mk Normal file
View File

@ -0,0 +1,12 @@
# Makefile for ARCFOUR (RC4 compatible)
ALGO_NAME := ARCFOUR
# comment out the following line for removement of ARCFOUR from the build process
BLOCK_CIPHERS := $(BLOCK_CIPHERS) $(ALGO_NAME)
$(ALGO_NAME)_OBJ := arcfour-asm.o
$(ALGO_NAME)_TEST_BIN := main.o debug.o uart.o serial-tools.o sha256-asm.o \
xtea-asm.o arcfour-asm.o prng.o cast5.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"

20
avr-makefile.inc Normal file
View File

@ -0,0 +1,20 @@
OBJ = $(SERPENT_OBJ)
MCU_TARGET = atmega32
OPTIMIZE = -Os
FLASHCMD = avrdude -p $(MCU_TARGET) -P /dev/ttyUSB0 -c avr911 -U flash:w:$(PRG).hex
# -U eeprom:w:$(PRG)_eeprom.hex
#uisp -dprog=bsd -dlpt=/dev/parport1 --upload if=$(PRG).hex
ERASECMD =
CC = avr-gcc
override CFLAGS = -pedantic -std=c99 -Wall -Wstrict-prototypes $(OPTIMIZE) -mmcu=$(MCU_TARGET)
$(DEFS)
override LDFLAGS = -Wl,-Map,
override ASFLAGS = -mmcu=$(MCU_TARGET)
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
SIZE = avr-size

View File

@ -21,8 +21,8 @@ uint64_t camellia_fl(uint64_t x, uint64_t k);
uint64_t camellia_fl_inv(uint64_t y, uint64_t k);
/*****************************************************************************/
void change_endian(void* data, uint8_t length);
uint64_t PROGMEM camellia_sigma[6]={ /* 64 byte table */
/*
uint64_t PROGMEM camellia_sigma[6]={ / * 64 byte table * /
0xA09E667F3BCC908BLL,
0xB67AE8584CAA73B2LL,
0xC6EF372FE94F82BELL,
@ -30,10 +30,23 @@ uint64_t PROGMEM camellia_sigma[6]={ /* 64 byte table */
0x10E527FADE682D1DLL,
0xB05688C2B3E6C1FDLL
};
*/
uint32_t PROGMEM camellia_sigma[12]={ /* 64 byte table */
0x3BCC908BL, 0xA09E667FL,
0x4CAA73B2L, 0xB67AE858L,
0xE94F82BEL, 0xC6EF372FL,
0xF1D36F1CL, 0x54FF53A5L,
0xDE682D1DL, 0x10E527FAL,
0xB3E6C1FDL, 0xB05688C2L
};
/* an ugly macro to load an entry form the table above */
#define SIGMA(p) (( ((uint64_t)(pgm_read_dword((prog_uint32_t*)camellia_sigma+2*(p)+1)))<<32) + \
((uint64_t)(pgm_read_dword((prog_uint32_t*)camellia_sigma+2*(p)+0) )) )
/*
#define SIGMA(p) (( ((uint64_t)(pgm_read_dword((prog_uint32_t*)camellia_sigma+2*(p)+1)))<<32) | \
((uint64_t)(pgm_read_dword((prog_uint32_t*)camellia_sigma+2*(p)+0))) )
*/
#define SIGMA(p) (( ((uint64_t)(pgm_read_dword(((prog_uint32_t*)camellia_sigma)[2*(p)+1])))<<32) | \
((uint64_t)(pgm_read_dword(((prog_uint32_t*)camellia_sigma)[2*(p)+0]))) )

13
camellia.mk Normal file
View File

@ -0,0 +1,13 @@
# Makefile for camellia
ALGO_NAME := CAMELLIA
# comment out the following line for removement of serpent from the build process
BLOCK_CIPHERS := $(BLOCK_CIPHERS) $(ALGO_NAME)
# main-camellia-test.o debug.o uart.o serial-tools.o camellia.o camellia-asm.o
$(ALGO_NAME)_OBJ := camellia.o camellia-asm.o
$(ALGO_NAME)_TEST_BIN := main-camellia-test.o debug.o uart.o serial-tools.o \
camellia.o camellia-asm.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"

11
cast5.mk Normal file
View File

@ -0,0 +1,11 @@
# Makefile for CAST5
ALGO_NAME := CAST5
# comment out the following line for removement of CAST5 from the build process
BLOCK_CIPHERS := $(BLOCK_CIPHERS) $(ALGO_NAME)
$(ALGO_NAME)_OBJ := cast5.o
$(ALGO_NAME)_TEST_BIN := main-cast5-test.o debug.o uart.o serial-tools.o cast5.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"

11
des.mk Normal file
View File

@ -0,0 +1,11 @@
# Makefile for DES
ALGO_NAME := DES
# comment out the following line for removement of DES from the build process
BLOCK_CIPHERS := $(BLOCK_CIPHERS) $(ALGO_NAME)
$(ALGO_NAME)_OBJ := des.o
$(ALGO_NAME)_TEST_BIN := main-des-test.o debug.o uart.o serial-tools.o des.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"

View File

@ -111,7 +111,7 @@ prog_uint8_t ntt_test_values_out[16] = {
0x67, 0x67, 0x31, 0x38, 0x54, 0x96, 0x69, 0x73,
0x08, 0x57, 0x06, 0x56, 0x48, 0xea, 0xbe, 0x43
};
/* memcmp_P() is now implemented in avr-libc
int memcmp_P(const void *s1, PGM_P s2, size_t n){
uint8_t b;
while(n--){
@ -122,7 +122,7 @@ int memcmp_P(const void *s1, PGM_P s2, size_t n){
}
return 0;
}
*/
void testrun_camellia(void){
/* we run the NESSIE test for Camellia here see
* https://www.cosic.esat.kuleuven.be/nessie/testvectors/bc/camellia/Camellia-128-128.verified.test-vectors

View File

@ -77,8 +77,8 @@ void test_decrypt(uint8_t *block, uint8_t *key, uint8_t keylength, bool print){
void testrun_cast5(void){
uint8_t block[8];
uint8_t key[16];
uint8_t *tda = "\x01\x23\x45\x67\x89\xAB\xCD\xEF",
*tka = "\x01\x23\x45\x67\x12\x34\x56\x78\x23\x45\x67\x89\x34\x56\x78\x9A";
uint8_t *tda = (uint8_t*)"\x01\x23\x45\x67\x89\xAB\xCD\xEF",
*tka = (uint8_t*)"\x01\x23\x45\x67\x12\x34\x56\x78\x23\x45\x67\x89\x34\x56\x78\x9A";
memcpy(block, tda, 8);
memcpy(key, tka, 16);
test_encrypt(block, key, 128, true);

View File

@ -89,7 +89,6 @@ Set 8, vector# 0:
encrypted=0011223344556677
*/
void nessie_testdec(uint8_t* data, uint8_t* key){
uint16_t i;
uart_putstr("\r\n\t key = \t"); uart_hexdump(key, 8);
uart_putstr("\r\n\t cipher = \t"); uart_hexdump(data, 8);
des_decrypt(data,data,key);

View File

@ -28,9 +28,9 @@ void testrun_serpent(void){
nessie_ctx.keysize = 128;
nessie_ctx.name = cipher_name;
nessie_ctx.ctx_size_B = sizeof(serpent_ctx_t);
nessie_ctx.cipher_enc = serpent_enc;
nessie_ctx.cipher_dec = serpent_dec;
nessie_ctx.cipher_genctx = serpent_genctx_dummy;
nessie_ctx.cipher_enc = (nessie_enc_fpt)serpent_enc;
nessie_ctx.cipher_dec = (nessie_dec_fpt)serpent_dec;
nessie_ctx.cipher_genctx = (nessie_gen_fpt)serpent_genctx_dummy;
nessie_run();

View File

@ -30,11 +30,11 @@ void testencrypt(uint8_t* block, uint8_t* key){
uart_putstr("\r\n==testy-encrypt==\r\n key: ");
uart_hexdump(key,16);
uart_putstr("\r\n plain: ");
uart_hexdump(block,16);
uart_hexdump(block,32);
_delay_ms(50);
shabea128(block,key,128,1,16);
shabea256(block,key,128,1,16);
uart_putstr("\r\n crypt: ");
uart_hexdump(block,16);
uart_hexdump(block,32);
}
void testdecrypt(uint8_t* block, uint8_t* key){
@ -42,11 +42,11 @@ void testdecrypt(uint8_t* block, uint8_t* key){
uart_putstr("\r\n==testy-decrypt==\r\n key: ");
uart_hexdump(key,16);
uart_putstr("\r\n crypt: ");
uart_hexdump(block,16);
uart_hexdump(block,32);
_delay_ms(50);
shabea128(block,key,128,0,16);
shabea256(block,key,128,0,16);
uart_putstr("\r\n plain: ");
uart_hexdump(block,16);
uart_hexdump(block,32);
}
void testrun_shabea(void){
@ -60,14 +60,22 @@ void testrun_shabea(void){
{ 0x28, 0xDB, 0xC3, 0xBC, 0x49, 0xFF, 0xD8, 0x7D,
0xCF, 0xA5, 0x09, 0xB1, 0x1D, 0x42, 0x2B, 0xE7,}
};
uint8_t datas[4][16]=
uint8_t datas[4][32]=
{ { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x83, 0xA2, 0xF8, 0xA2, 0x88, 0x64, 0x1F, 0xB9,
0xA4, 0xE9, 0xA5, 0xCC, 0x2F, 0x13, 0x1C, 0x7D,
0x83, 0xA2, 0xF8, 0xA2, 0x88, 0x64, 0x1F, 0xB9,
0xA4, 0xE9, 0xA5, 0xCC, 0x2F, 0x13, 0x1C, 0x7D },
{ 0xB4, 0x1E, 0x6B, 0xE2, 0xEB, 0xA8, 0x4A, 0x14,
0x8E, 0x2E, 0xED, 0x84, 0x59, 0x3C, 0x5E, 0xC7,
0xB4, 0x1E, 0x6B, 0xE2, 0xEB, 0xA8, 0x4A, 0x14,
0x8E, 0x2E, 0xED, 0x84, 0x59, 0x3C, 0x5E, 0xC7 }
};
uint8_t i=0;

10
main.c
View File

@ -148,28 +148,28 @@ void testrun_arcfour(void){
* RC4( "Secret", "Attack at dawn" ) == "45a01f64 5fc35b38 3552544b 9bf5"
**/
uart_putstr("\r\narcfour(\"Plaintext\", \"Key\")=");
arcfour_init(&s, "Key", 3);
arcfour_init(&s, (uint8_t*)"Key", 3);
b="Plaintext";
while (*b)
*b++ ^= arcfour_gen(&s);
uart_hexdump(b-9, 9);
uart_putstr("\r\narcfour(\"pedia\", \"Wiki\")=");
arcfour_init(&s, "Wiki", 4);
arcfour_init(&s, (uint8_t*)"Wiki", 4);
b="pedia";
while (*b)
*b++ ^= arcfour_gen(&s);
uart_hexdump(b-5, 5);
uart_putstr("\r\narcfour(\"Attack at dawn\", \"Secret\")=");
arcfour_init(&s, "Secret", 6);
arcfour_init(&s, (uint8_t*)"Secret", 6);
b="Attack at dawn";
while (*b)
*b++ ^= arcfour_gen(&s);
uart_hexdump(b-14, 14);
uart_putstr("\r\narcfour(00.00.00.00.00.00.00.00, 01.23.45.67.89.AB.CD.EF)=");
arcfour_init(&s, "\x01\x23\x45\x67\x89\xAB\xCD\xEF", 8);
arcfour_init(&s, (uint8_t*)"\x01\x23\x45\x67\x89\xAB\xCD\xEF", 8);
int i=0;
uint8_t a[8];
memset(a, 0 , 8);
@ -193,7 +193,7 @@ void testrun_cast5(void){
cast5_ctx_t s;
uint8_t i;
uart_putstr("\r\nCAST5:\r\nkey: 01 23 45 67 34 56 78 23 45 67 89 34 56 78 9A");
cast5_init(&s, "\x01\x23\x45\x67\x12\x34\x56\x78\x23\x45\x67\x89\x34\x56\x78\x9A", 128);
cast5_init(&s, (uint8_t*)"\x01\x23\x45\x67\x12\x34\x56\x78\x23\x45\x67\x89\x34\x56\x78\x9A", 128);
uint8_t block[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
uart_putstr("\r\nplaintext: ");
uart_hexdump(block, 8);

View File

@ -3,6 +3,11 @@
#include <stdint.h>
typedef void (*nessie_gen_fpt)(uint8_t*, uint16_t, void*);
typedef void (*nessie_enc_fpt)(void*, void*);
typedef void (*nessie_dec_fpt)(void*, void*);
typedef struct nessie_ctx_st{
uint16_t keysize;
uint16_t blocksize_B;

View File

@ -87,4 +87,4 @@ bigendian_sub32:

8
seed.c
View File

@ -49,9 +49,9 @@ uint32_t bigendian_sum32(uint32_t a, uint32_t b);/*{
changeendian32(&a);
return a;
}
*/
/******************************************************************************/
static
/* static */
uint32_t bigendian_sub32(uint32_t a, uint32_t b);/*{
changeendian32(&a);
changeendian32(&b);
@ -59,7 +59,7 @@ uint32_t bigendian_sub32(uint32_t a, uint32_t b);/*{
changeendian32(&a);
return a;
}
*/
/******************************************************************************/
static inline
uint64_t bigendian_rotl8_64(uint64_t a){
@ -144,6 +144,7 @@ keypair_t getnextkeys(uint32_t *keystate, uint8_t curround){
keypair_t ret;
if (curround>15){
/* ERROR */
ret.k0 = ret.k1 = 0;
} else {
/* ret.k0 = g_function(keystate[0] + keystate[2] - pgm_read_dword(&(seed_kc[curround])));
ret.k1 = g_function(keystate[1] - keystate[3] + pgm_read_dword(&(seed_kc[curround]))); */
@ -172,6 +173,7 @@ keypair_t getprevkeys(uint32_t *keystate, uint8_t curround){
keypair_t ret;
if (curround>15){
/* ERROR */
ret.k0 = ret.k1 = 0;
} else {
if (curround & 1){
/* odd round (1,3,5, ..., 15) */

12
seed.mk Normal file
View File

@ -0,0 +1,12 @@
# Makefile for SEED
ALGO_NAME := SEED
# comment out the following line for removement of SEED from the build process
BLOCK_CIPHERS := $(BLOCK_CIPHERS) $(ALGO_NAME)
$(ALGO_NAME)_OBJ := seed.o seed-asm.o
$(ALGO_NAME)_TEST_BIN := main-seed-test.o debug.o uart.o serial-tools.o \
seed.o seed-asm.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"

13
serpent.mk Normal file
View File

@ -0,0 +1,13 @@
# Makefile for serpent
ALGO_NAME := SERPENT
# comment out the following line for removement of serpent from the build process
BLOCK_CIPHERS := $(BLOCK_CIPHERS) $(ALGO_NAME)
$(ALGO_NAME)_OBJ := serpent.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o serial-tools.o \
serpent.o nessie_bc_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"

View File

@ -39,13 +39,12 @@ void memxor(uint8_t * dest, uint8_t * src, uint8_t length){
#define R ((uint8_t*)block+16)
void shabea256(void * block, void * key, uint16_t keysize, uint8_t enc, uint8_t rounds){
int8_t r; /**/
uint8_t *tb; /**/
uint8_t tb[HALFSIZEB+2+(keysize+7)/8]; /**/
uint16_t kbs; /* bytes used for the key / temporary block */
sha256_hash_t hash;
r = (enc?0:(rounds-1));
kbs = (keysize+7)/8;
tb = malloc(HALFSIZEB+2+kbs);
memcpy(tb+HALFSIZEB+2, key, kbs); /* copy key to temporary block */
tb[HALFSIZEB+0] = 0; /* set round counter high value to zero */
@ -63,7 +62,6 @@ void shabea256(void * block, void * key, uint16_t keysize, uint8_t enc, uint8_t
memxor(L, hash, HALFSIZE);
}
}
free(tb);
}

12
shabea.mk Normal file
View File

@ -0,0 +1,12 @@
# Makefile for SHABEA
ALGO_NAME := SHABEA
# comment out the following line for removement of SHABEA from the build process
BLOCK_CIPHERS := $(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
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"

12
skipjack.mk Normal file
View File

@ -0,0 +1,12 @@
# Makefile for SKIPJACK
ALGO_NAME := SKIPJACK
# comment out the following line for removement of skipjack from the build process
BLOCK_CIPHERS := $(BLOCK_CIPHERS) $(ALGO_NAME)
$(ALGO_NAME)_OBJ := skipjack.o
$(ALGO_NAME)_TEST_BIN := main-skipjack-test.o debug.o uart.o serial-tools.o \
skipjack.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"

11
tdes.mk Normal file
View File

@ -0,0 +1,11 @@
# Makefile for triple-DES
ALGO_NAME := TDES
# comment out the following line for removement of triple-DES from the build process
BLOCK_CIPHERS := $(BLOCK_CIPHERS) $(ALGO_NAME)
$(ALGO_NAME)_OBJ := des.o
$(ALGO_NAME)_TEST_BIN := main-tdes-test.o debug.o uart.o serial-tools.o des.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"

12
xtea.mk Normal file
View File

@ -0,0 +1,12 @@
# Makefile for XTEA
ALGO_NAME := XTEA
# comment out the following line for removement of XTEA from the build process
BLOCK_CIPHERS := $(BLOCK_CIPHERS) $(ALGO_NAME)
$(ALGO_NAME)_OBJ := xtea-asm.o
$(ALGO_NAME)_TEST_BIN := main.o debug.o uart.o serial-tools.o sha256-asm.o \
xtea-asm.o arcfour-asm.o prng.o cast5.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"