modification to the build system
This commit is contained in:
parent
4d76909e42
commit
2159c273c9
32
Makefile
32
Makefile
|
@ -19,10 +19,7 @@ $(1) = $(2)
|
|||
endef
|
||||
$(foreach a, $(ALGORITHMS_OBJ), $(eval $(call OBJinBINDIR_TEMPLATE, $(a), $(patsubst %.o,$(BIN_DIR)%.o,$($(a))))))
|
||||
ALGORITHMS_TEST_BIN = $(patsubst %,%_TEST_BIN, $(ALGORITHMS))
|
||||
$(foreach a, $(ALGORITHMS_TEST_BIN), $(eval $(call OBJinBINDIR_TEMPLATE, $(a), $(patsubst %.o,$(BIN_DIR)%.o,$($(a))))))
|
||||
#ALGORITHMS_TEST_BIN_MAIN = $(foreach a, $(ALGORITHMS_TEST_BIN), $(firstword $($(a))))
|
||||
#ALGORITHMS_TEST_BIN_MAIN_ELF = $(patsubst $(BIN_DIR)%.o, $(TESTBIN_DIR)%.elf, $(ALGORITHMS_TEST_BIN_MAIN))
|
||||
#ALGORITHMS_TEST_BIN_MAIN_HEX = $(patsubst $(BIN_DIR)%.o, $(TESTBIN_DIR)%.hex, $(ALGORITHMS_TEST_BIN_MAIN))
|
||||
$(foreach a, $(ALGORITHMS_TEST_BIN), $(eval $(call OBJinBINDIR_TEMPLATE, $(a), $(patsubst %.o,$(TESTBIN_DIR)%.o,$($(a))))))
|
||||
|
||||
|
||||
ALGORITHMS_TEST_BIN_IMM = $(foreach a, $(ALGORITHMS_TEST_BIN), $($(a)))
|
||||
|
@ -41,18 +38,24 @@ all: $(foreach algo, $(ALGORITHMS), $(algo)_OBJ)
|
|||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
define BLA_TEMPLATE2
|
||||
$(2): $(3)
|
||||
define MAIN_OBJ_TEMPLATE
|
||||
$(2): $(3) $(4)
|
||||
@echo "[gcc]: $$@"
|
||||
# echo $$^
|
||||
@$(CC) $(CFLAGS) $(LDFLAGS)$(patsubst %.elf,%.map,$(2)) -o \
|
||||
$(2) \
|
||||
$(3) \
|
||||
$(3) $(4) \
|
||||
$(LIBS)
|
||||
endef
|
||||
|
||||
#$(foreach algo, $(ALGORITHMS), $(eval $(call BLA_TEMPLATE2, $(algo), $(patsubst $(BIN_DIR)%.o,$(TESTBIN_DIR)%.elf,$(firstword $($(algo)_TEST_BIN))), $(patsubst %.o,%.o,$($(algo)_TEST_BIN)) )))
|
||||
$(foreach algo, $(ALGORITHMS), $(eval $(call BLA_TEMPLATE2, $(algo), $(TESTBIN_DIR)main-$(call lc,$(algo))-test.elf, $(patsubst %.o,%.o,$($(algo)_TEST_BIN)) )))
|
||||
$(foreach algo, $(ALGORITHMS), $(eval $(call MAIN_OBJ_TEMPLATE, \
|
||||
$(algo), \
|
||||
$(TESTBIN_DIR)main-$(call lc,$(algo))-test.elf, \
|
||||
$(patsubst %.o,%.o,$($(algo)_TEST_BIN)), \
|
||||
$(patsubst %.o,%.o,$($(algo)_OBJ)) )))
|
||||
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
.PHONY: help
|
||||
|
@ -70,6 +73,8 @@ info:
|
|||
@echo " $(MACS)"
|
||||
@echo " PRNG functions:"
|
||||
@echo " $(PRNGS)"
|
||||
@echo " ALGORITHMS_TEST_BIN"
|
||||
@echo " $(ALGORITHMS_TEST_BIN)"
|
||||
@echo " ALGORITHMS_TEST_TARGET_ELF:"
|
||||
@echo " $(ALGORITHMS_TEST_TARGET_ELF)"
|
||||
|
||||
|
@ -82,6 +87,15 @@ $(BIN_DIR)%.o: %.S
|
|||
@echo "[as] : $@"
|
||||
@$(CC) $(ASFLAGS) -c -o $@ $<
|
||||
|
||||
$(TESTBIN_DIR)%.o: $(TESTSRC_DIR)%.c
|
||||
@echo "[gcc]: $@"
|
||||
@$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
$(TESTBIN_DIR)%.o: $(TESTSRC_DIR)%.S
|
||||
@echo "[as] : $@"
|
||||
@$(CC) $(ASFLAGS) -c -o $@ $<
|
||||
|
||||
|
||||
%.o: %.c
|
||||
@echo "[gcc]: $@"
|
||||
@$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
|
|
@ -7,6 +7,7 @@ FLASHCMD = avrdude -p $(MCU_TARGET) -P /dev/ttyUSB0 -c avr911 -U flash:w:#
|
|||
DEP_DIR = deps/
|
||||
BIN_DIR = bin/
|
||||
TESTBIN_DIR = test_bin/
|
||||
TESTSRC_DIR = test_src/
|
||||
#uisp -dprog=bsd -dlpt=/dev/parport1 --upload if=$(PRG).hex
|
||||
ERASECMD =
|
||||
TESTPORT = /dev/ttyUSB1
|
||||
|
@ -15,7 +16,7 @@ TESTLOG_DIR = testlog/
|
|||
TESTPREFIX = nessie-
|
||||
CC = avr-gcc
|
||||
|
||||
override CFLAGS = -MMD -MF$(DEP_DIR)$(patsubst %.c,%.d,$<) -pedantic -std=c99 -Wall -Wstrict-prototypes $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
|
||||
override CFLAGS = -MMD -MF$(DEP_DIR)$(patsubst %.c,%.d,$<) -I. -pedantic -std=c99 -Wall -Wstrict-prototypes $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
|
||||
|
||||
override LDFLAGS = -Wl,-Map,
|
||||
override ASFLAGS = -mmcu=$(MCU_TARGET)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
.
|
|
@ -6,7 +6,7 @@ STREAM_CIPHERS += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := A5_1.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-a5_1-test.o debug.o uart.o serial-tools.o \
|
||||
nessie_stream_test.o nessie_common.o A5_1.o
|
||||
nessie_stream_test.o nessie_common.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ STREAM_CIPHERS += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := arcfour-asm.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-arcfour-test.o debug.o uart.o serial-tools.o \
|
||||
nessie_stream_test.o nessie_common.o arcfour-asm.o
|
||||
nessie_stream_test.o nessie_common.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ STREAM_CIPHERS += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := arcfour.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-arcfour-test.o debug.o uart.o serial-tools.o \
|
||||
nessie_stream_test.o nessie_common.o arcfour.o
|
||||
nessie_stream_test.o nessie_common.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
# Makefile for camellia
|
||||
ALGO_NAME := CAMELLIA
|
||||
|
||||
# comment out the following line for removement of serpent from the build process
|
||||
# comment out the following line for removement of Camellia from the build process
|
||||
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 nessie_bc_test.o \
|
||||
nessie_bc_test.o \
|
||||
nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
|
|
@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := cast5.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-cast5-test.o debug.o uart.o serial-tools.o cli.o\
|
||||
cast5.o nessie_bc_test.o nessie_common.o performance_test.o
|
||||
nessie_bc_test.o nessie_common.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ ALGO_NAME := DES
|
|||
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)_TEST_BIN := main-des-test.o debug.o uart.o serial-tools.o \
|
||||
nessie_bc_test.o nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
|
|
@ -6,7 +6,7 @@ PRNGS += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := entropium.o sha256-asm.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-entropium-test.o debug.o uart.o serial-tools.o \
|
||||
sha256-asm.o entropium.o cli.o performance_test.o
|
||||
cli.o performance_test.o
|
||||
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
|
|
@ -6,8 +6,8 @@ STREAM_CIPHERS += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := grain.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-grain-test.o debug.o uart.o serial-tools.o \
|
||||
nessie_stream_test.o nessie_common.o grain.o cli.o \
|
||||
performance_test.o
|
||||
nessie_stream_test.o nessie_common.o cli.o \
|
||||
performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ MACS += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := hmac-sha1.o sha1-asm.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-hmac-sha1-test.o debug.o uart.o serial-tools.o cli.o \
|
||||
hmac-sha1.o sha1-asm.o nessie_mac_test.o nessie_common.o
|
||||
nessie_mac_test.o nessie_common.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ MACS += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := hmac-sha256.o sha256-asm.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-hmac-sha256-test.o debug.o uart.o serial-tools.o \
|
||||
hmac-sha256.o sha256-asm.o nessie_mac_test.o nessie_common.o
|
||||
nessie_mac_test.o nessie_common.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ ALGO_NAME := MD5
|
|||
HASHES += $(ALGO_NAME)
|
||||
|
||||
$(ALGO_NAME)_OBJ := md5.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-md5-test.o debug.o uart.o serial-tools.o md5.o \
|
||||
$(ALGO_NAME)_TEST_BIN := main-md5-test.o debug.o uart.o serial-tools.o \
|
||||
nessie_hash_test.o nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
|
|
@ -7,8 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := noekeon_asm.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-noekeon-test.o debug.o uart.o serial-tools.o \
|
||||
noekeon_asm.o nessie_bc_test.o \
|
||||
nessie_common.o cli.o performance_test.o
|
||||
nessie_bc_test.o nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := test nessie
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := performance
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := noekeon.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-noekeon-test.o debug.o uart.o serial-tools.o \
|
||||
noekeon.o nessie_bc_test.o \
|
||||
nessie_common.o cli.o performance_test.o
|
||||
nessie_bc_test.o nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := test nessie
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := performance
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := present.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-present-test.o debug.o uart.o serial-tools.o \
|
||||
present.o nessie_bc_test.o nessie_common.o cli.o \
|
||||
performance_test.o
|
||||
nessie_bc_test.o nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := rc5.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-rc5-test.o debug.o uart.o serial-tools.o \
|
||||
rc5.o nessie_bc_test.o \
|
||||
nessie_bc_test.o \
|
||||
nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := test nessie
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := performance
|
||||
|
|
|
@ -7,8 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := rc6.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-rc6-test.o debug.o uart.o serial-tools.o \
|
||||
rc6.o nessie_bc_test.o \
|
||||
nessie_common.o cli.o performance_test.o
|
||||
nessie_bc_test.o nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := test nessie
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := performance
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ 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 nessie_bc_test.o nessie_common.o \
|
||||
nessie_bc_test.o nessie_common.o \
|
||||
cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
|
|
@ -5,10 +5,9 @@ ALGO_NAME := SERPENT_BITSLICE
|
|||
BLOCK_CIPHERS += $(ALGO_NAME)
|
||||
|
||||
|
||||
$(ALGO_NAME)_OBJ := serpent.o serpent-sboxes-bitslice.o
|
||||
$(ALGO_NAME)_OBJ := serpent.o serpent-sboxes-bitslice.o memxor.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o serial-tools.o \
|
||||
serpent.o serpent-sboxes-bitslice.o nessie_bc_test.o \
|
||||
nessie_common.o cli.o performance_test.o
|
||||
nessie_bc_test.o nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
|
@ -5,10 +5,9 @@ ALGO_NAME := SERPENT
|
|||
BLOCK_CIPHERS += $(ALGO_NAME)
|
||||
|
||||
|
||||
$(ALGO_NAME)_OBJ := serpent.o serpent-sboxes.o
|
||||
$(ALGO_NAME)_OBJ := serpent.o serpent-sboxes.o memxor.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o serial-tools.o \
|
||||
serpent.o serpent-sboxes.o nessie_bc_test.o \
|
||||
nessie_common.o cli.o performance_test.o
|
||||
nessie_bc_test.o nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@ HASHES += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := sha1-asm.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-sha1-test.o debug.o uart.o serial-tools.o \
|
||||
sha1-asm.o nessie_hash_test.o nessie_common.o cli.o \
|
||||
performance_test.o
|
||||
nessie_hash_test.o nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := sha1.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-sha1-test.o debug.o uart.o serial-tools.o \
|
||||
sha1.o nessie_hash_test.o nessie_common.o cli.o \
|
||||
nessie_hash_test.o nessie_common.o cli.o \
|
||||
performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
|
|
@ -6,8 +6,7 @@ HASHES += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := sha256-asm.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-sha256-test.o debug.o uart.o serial-tools.o \
|
||||
sha256-asm.o nessie_hash_test.o nessie_common.o cli.o \
|
||||
performance_test.o
|
||||
nessie_hash_test.o nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@ HASHES += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := sha256.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-sha256-test.o debug.o uart.o serial-tools.o \
|
||||
sha256.o nessie_hash_test.o nessie_common.o cli.o \
|
||||
performance_test.o
|
||||
nessie_hash_test.o nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
|
@ -4,10 +4,9 @@ ALGO_NAME := SHABEA
|
|||
# comment out the following line for removement of SHABEA from the build process
|
||||
BLOCK_CIPHERS += $(ALGO_NAME)
|
||||
|
||||
$(ALGO_NAME)_OBJ := shabea.o sha256-asm.o
|
||||
$(ALGO_NAME)_OBJ := shabea.o sha256-asm.o memxor.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 memxor.o
|
||||
nessie_bc_test.o nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := shacal1_enc.o sha1-asm.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-shacal1_enc-test.o debug.o uart.o serial-tools.o \
|
||||
nessie_bc_test.o nessie_common.o cli.o \
|
||||
performance_test.o shacal1_enc.o sha1-asm.o
|
||||
nessie_bc_test.o nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := shacal2_enc.o sha256-asm.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-shacal2_enc-test.o debug.o uart.o serial-tools.o \
|
||||
nessie_bc_test.o nessie_common.o cli.o \
|
||||
performance_test.o shacal2_enc.o sha256-asm.o
|
||||
nessie_bc_test.o nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ 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 nessie_bc_test.o nessie_common.o cli.o \
|
||||
nessie_bc_test.o nessie_common.o cli.o \
|
||||
performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
|
|
@ -5,7 +5,7 @@ ALGO_NAME := TDES
|
|||
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)_TEST_BIN := main-tdes-test.o debug.o uart.o serial-tools.o \
|
||||
nessie_bc_test.o nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
|
|
@ -6,8 +6,8 @@ STREAM_CIPHERS += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := trivium.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-trivium-test.o debug.o uart.o serial-tools.o \
|
||||
nessie_stream_test.o nessie_common.o trivium.o cli.o \
|
||||
performance_test.o
|
||||
nessie_stream_test.o nessie_common.o cli.o \
|
||||
performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := xtea-asm.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-xtea-test.o debug.o uart.o serial-tools.o \
|
||||
xtea-asm.o nessie_bc_test.o nessie_common.o \
|
||||
cli.o performance_test.o
|
||||
nessie_bc_test.o nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
|
|||
|
||||
$(ALGO_NAME)_OBJ := xtea.o
|
||||
$(ALGO_NAME)_TEST_BIN := main-xtea-test.o debug.o uart.o serial-tools.o \
|
||||
xtea.o nessie_bc_test.o nessie_common.o \
|
||||
cli.o performance_test.o
|
||||
nessie_bc_test.o nessie_common.o cli.o performance_test.o
|
||||
$(ALGO_NAME)_NESSIE_TEST := "nessie"
|
||||
$(ALGO_NAME)_PEROFRMANCE_TEST := "performance"
|
||||
|
||||
|
|
19
serpent.c
19
serpent.c
|
@ -26,21 +26,12 @@
|
|||
#include <stdint.h>
|
||||
#include <string.h> /* memset() */
|
||||
#include <avr/pgmspace.h>
|
||||
#include "memxor.h"
|
||||
#include "serpent.h"
|
||||
#include "serpent-sboxes.h"
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
void memxor(void * dest, void * src, uint8_t size){
|
||||
while(size--){
|
||||
*((uint8_t*)dest) ^= *((uint8_t*)src);
|
||||
dest = (uint8_t*)dest +1;
|
||||
src = (uint8_t*)src +1;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
uint32_t rotl32(uint32_t a, uint8_t n){
|
||||
return ((a<<n) | (a>>(32-n)));
|
||||
}
|
||||
|
@ -92,10 +83,10 @@ static uint32_t gen_w(uint32_t * b, uint8_t i){
|
|||
}
|
||||
|
||||
/* key must be 256bit (32 byte) large! */
|
||||
void serpent_init(void * key, uint8_t keysize, serpent_ctx_t * ctx){
|
||||
void serpent_init(const void* key, uint16_t keysize, serpent_ctx_t* ctx){
|
||||
uint32_t buffer[8];
|
||||
uint8_t i,j;
|
||||
if(keysize){
|
||||
if(keysize<256){
|
||||
/* keysize is less than 256 bit, padding needed */
|
||||
memset(buffer, 0, 32);
|
||||
memcpy(buffer, key, (keysize+7)/8);
|
||||
|
@ -117,7 +108,7 @@ void serpent_init(void * key, uint8_t keysize, serpent_ctx_t * ctx){
|
|||
}
|
||||
|
||||
|
||||
void serpent_enc(void* buffer, serpent_ctx_t * ctx){
|
||||
void serpent_enc(void* buffer, const serpent_ctx_t* ctx){
|
||||
uint8_t i;
|
||||
for(i=0; i<31; ++i){
|
||||
memxor((uint8_t*)buffer, ctx->k[i], 16);
|
||||
|
@ -130,7 +121,7 @@ void serpent_enc(void* buffer, serpent_ctx_t * ctx){
|
|||
memxor((uint8_t*)buffer, ctx->k[i], 16);
|
||||
}
|
||||
|
||||
void serpent_dec(void* buffer, serpent_ctx_t * ctx){
|
||||
void serpent_dec(void* buffer, const serpent_ctx_t* ctx){
|
||||
int8_t i=32;
|
||||
|
||||
memxor((uint8_t*)buffer, ctx->k[i], 16);
|
||||
|
|
16
serpent.h
16
serpent.h
|
@ -16,10 +16,10 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* serpent.h
|
||||
* a bitsliced implementation of the serpent cipher for avr microcontrollers
|
||||
* author: Daniel Otte
|
||||
* license: GPLv3
|
||||
/** \file serpent.h
|
||||
* \author Daniel Otte
|
||||
* \license GPLv3
|
||||
* \brief a implementation of the serpent cipher for avr microcontrollers
|
||||
*/
|
||||
|
||||
#ifndef SERPENT_H_
|
||||
|
@ -35,13 +35,13 @@ typedef struct serpent_ctx_st {
|
|||
|
||||
#define SERPENT_KEY128 128
|
||||
#define SERPENT_KEY192 192
|
||||
#define SERPENT_KEY256 0
|
||||
#define SERPENT_KEY256 256
|
||||
|
||||
|
||||
/* key must be 256bit (32 byte) large! */
|
||||
void serpent_init(void * key, uint8_t keysize, serpent_ctx_t * ctx);
|
||||
void serpent_enc(void * buffer, serpent_ctx_t * ctx);
|
||||
void serpent_dec(void * buffer, serpent_ctx_t * ctx);
|
||||
void serpent_init(const void* key, uint16_t keysize, serpent_ctx_t* ctx);
|
||||
void serpent_enc(void* buffer, const serpent_ctx_t* ctx);
|
||||
void serpent_dec(void* buffer, const serpent_ctx_t* ctx);
|
||||
|
||||
|
||||
#endif /*SERPENT_H_*/
|
||||
|
|
Loading…
Reference in New Issue