]> git.cryptolib.org Git - avr-crypto-lib.git/commitdiff
+threefish +ubi
authorbg <bg@b1d182e4-1ff8-0310-901f-bddb46175740>
Thu, 12 Mar 2009 16:28:45 +0000 (16:28 +0000)
committerbg <bg@b1d182e4-1ff8-0310-901f-bddb46175740>
Thu, 12 Mar 2009 16:28:45 +0000 (16:28 +0000)
67 files changed:
avr-makefile.inc
mkfiles/a5_1.mk
mkfiles/aes.mk
mkfiles/aes_asm_faster.mk
mkfiles/aes_c.mk
mkfiles/arcfour.mk
mkfiles/arcfour_c.mk
mkfiles/base64.mk
mkfiles/camellia.mk
mkfiles/cast5.mk
mkfiles/des.mk
mkfiles/entropium.mk
mkfiles/grain.mk
mkfiles/hmac-md5.mk
mkfiles/hmac-sha1.mk
mkfiles/hmac-sha256.mk
mkfiles/md5.mk
mkfiles/md5_asm.mk
mkfiles/mugi.mk
mkfiles/noekeon.mk
mkfiles/noekeon_c.mk
mkfiles/omac_noekeon.mk
mkfiles/omac_noekeon_c.mk
mkfiles/present.mk
mkfiles/rc5.mk
mkfiles/rc6.mk
mkfiles/seed.mk
mkfiles/seed_C.mk
mkfiles/serpent-bitslice.mk
mkfiles/serpent_asm_bitslice.mk
mkfiles/serpent_asm_fast.mk
mkfiles/serpent_asm_small.mk
mkfiles/serpent_c.mk
mkfiles/sha1.mk
mkfiles/sha1_c.mk
mkfiles/sha256.mk
mkfiles/sha256_c.mk
mkfiles/shabea.mk
mkfiles/shacal1enc.mk
mkfiles/shacal2enc.mk
mkfiles/skipjack.mk
mkfiles/tdes.mk
mkfiles/threefish.mk [new file with mode: 0644]
mkfiles/trivium.mk
mkfiles/twister224.mk
mkfiles/twister224_c.mk
mkfiles/twister256.mk
mkfiles/twister256_c.mk
mkfiles/twister384.mk
mkfiles/twister384_c.mk
mkfiles/twister512.mk
mkfiles/twister512_c.mk
mkfiles/ubi.mk [new file with mode: 0644]
mkfiles/xtea.mk
mkfiles/xtea_c.mk
omac_noekeon.h
test_src/dbz_strings.h
test_src/main-threefish-test.c [new file with mode: 0644]
test_src/main-ubi-test.c [new file with mode: 0644]
threefish.h [new file with mode: 0644]
threefish1024_enc.c [new file with mode: 0644]
threefish256_enc.c [new file with mode: 0644]
threefish512_enc.c [new file with mode: 0644]
ubi.h [new file with mode: 0644]
ubi1024.c [new file with mode: 0644]
ubi256.c [new file with mode: 0644]
ubi512.c [new file with mode: 0644]

index 77cae4daaa5f44df15af6cc786a9bd6bd5b3a5b0..95e0228985e37fd8f31c53bd01199fef3eff50d3 100644 (file)
@@ -20,7 +20,7 @@ STAT_DIR       = stats/
 CC            = avr-gcc
 CSTD           = c99
 
-override CFLAGS        = -MMD -MF$(DEP_DIR)$(patsubst %.c,%.d,$(patsubst $(TESTSRC_DIR)%,%,$<)) -I. -gdwarf-2 -pedantic -std=$(CSTD) -Wall -Wstrict-prototypes  $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
+override CFLAGS        = -MMD -MF$(DEP_DIR)$(patsubst %.c,%.d,$(patsubst $(TESTSRC_DIR)%,%,$<)) -I. -Itest_src -gdwarf-2 -pedantic -std=$(CSTD) -Wall -Wstrict-prototypes  $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
 
 override LDFLAGS       = -gdwarf-2 -Wl,-Map,
 override ASFLAGS          = -mmcu=$(MCU_TARGET) -Wa,--gdwarf-2
index 078d982c54da3ec773dd52d19c5d110b9698a1e9..63f59ec6f90994076bff03c9a224d9f0bc46183f 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := A51
 STREAM_CIPHERS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := A5_1.o
-$(ALGO_NAME)_TEST_BIN := main-a5_1-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-a5_1-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_stream_test.o dbz_strings.o nessie_common.o cli.o string-extras.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index 71ab1d73626760a1ab08109869c65449b1e52972..871434b18ee8fd19b5e03f0da9d02b0042d00964 100644 (file)
@@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := aes_enc-asm.o aes_dec-asm.o aes_sbox-asm.o aes_invsbox-asm.o  \
                          aes_keyschedule-asm.o  
-$(ALGO_NAME)_TEST_BIN := main-aes-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-aes-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
index 71f1de7ea125ebd8b21a2f62e0d9cba74799cd91..ad5acb5b8048bfe366897cebc1b361f4073676ee 100644 (file)
@@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := aes_enc-asm.o aes_dec-asm_faster.o aes_sbox-asm.o aes_invsbox-asm.o  \
                          aes_keyschedule-asm.o  
-$(ALGO_NAME)_TEST_BIN := main-aes-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-aes-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
index 8bec1337f8b002d99da29b1d0c7adc1c7443969b..dcc6c6204226c3eb45bcda89bb5f58650c01102f 100644 (file)
@@ -9,7 +9,7 @@ $(ALGO_NAME)_OBJ      := aes_enc.o aes_dec.o aes_sbox.o aes_invsbox.o \
                          aes_keyschedule.o gf256mul.o \
                          aes128_enc.o aes128_dec.o aes192_enc.o aes192_dec.o \
                          aes256_enc.o aes256_dec.o
-$(ALGO_NAME)_TEST_BIN := main-aes-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-aes-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
index 6a6e24bb073807e45ce616169571f8debff636f5..7cc4c8eaa6eb51a4d05674a047beb94a9d560fba 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := ARCFOUR
 STREAM_CIPHERS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := arcfour-asm.o
-$(ALGO_NAME)_TEST_BIN := main-arcfour-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-arcfour-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_stream_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \
                          performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
index d6770615e86c04a9274a80034250cf489029307a..23a413572f23f7b60cbd9aabaf09fba581311ed9 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := ARCFOUR_C
 STREAM_CIPHERS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := arcfour.o
-$(ALGO_NAME)_TEST_BIN := main-arcfour-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-arcfour-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_stream_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \
                          performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
index 339238b4259e3ef36106c33badd11fedf179afe6..ef652aad7c70a0a52a7db4db708d0c3216deab71 100644 (file)
@@ -6,7 +6,7 @@ ENCODINGS += $(ALGO_NAME)
 
 
 $(ALGO_NAME)_OBJ      := base64_enc.o base64_dec.o
-$(ALGO_NAME)_TEST_BIN := main-base64-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-base64-test.o debug.o uart.o hexdigit_tab.o  \
                          cli.o string-extras.o performance_test.o noekeon_asm.o noekeon_prng.o \
                         memxor.o
                         
index 9b27fe61a0c3bf51884772581894113a262b88f8..2cd0581ca6f76483b6fbc0d0f51416a4bdd28420 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := CAMELLIA
 BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := camellia128-stub.o camellia-asm.o
-$(ALGO_NAME)_TEST_BIN := main-camellia-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-camellia-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o \
                         dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
index e2472a9d38754f03775df4e65f1efdfaa59a149a..df2fd137bcb4093c165543a2df5b49e2b29d8dd0 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := CAST5
 BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := cast5.o
-$(ALGO_NAME)_TEST_BIN := main-cast5-test.o debug.o uart.o hexdigit_tab.o serial-tools.o cli.o string-extras.o\
+$(ALGO_NAME)_TEST_BIN := main-cast5-test.o debug.o uart.o hexdigit_tab.o  cli.o string-extras.o\
                          nessie_bc_test.o dbz_strings.o nessie_common.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index f7862106dd0c4d986057655be35a96bf4f7084bb..17c5709369d3fbd8d03e726726d3d50ec956f0ba 100644 (file)
@@ -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 hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-des-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index 14cc8bdd233674c45937d4109a5f9bb71c98d2a4..f6c16f6d706705f2e11fa8101a552d9b66cb5287 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := ENTROPIUM
 PRNGS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := entropium.o sha256-asm.o
-$(ALGO_NAME)_TEST_BIN := main-entropium-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-entropium-test.o debug.o uart.o hexdigit_tab.o  \
                          cli.o string-extras.o performance_test.o
                          
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
index a8373c297c06d5a1c4f1c9ad3e20af4ec17c21ca..a79076d0b476da033fdb92a3634de6bea272e0d7 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := GRAIN
 STREAM_CIPHERS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := grain.o
-$(ALGO_NAME)_TEST_BIN := main-grain-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-grain-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_stream_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \
                                     performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
index a79e9bb9a696a51395b9be1028513f4bd533b38b..a816ed3c35b50487b4e77be9ce210ffb4b520b95 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := HMAC-MD5
 MACS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := hmac-md5.o md5-asm.o
-$(ALGO_NAME)_TEST_BIN := main-hmac-md5-test.o debug.o uart.o hexdigit_tab.o serial-tools.o cli.o string-extras.o \
+$(ALGO_NAME)_TEST_BIN := main-hmac-md5-test.o debug.o uart.o hexdigit_tab.o  cli.o string-extras.o \
                          nessie_mac_test.o dbz_strings.o nessie_common.o base64_enc.o base64_dec.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index 7998afaa888d0357a60eb4964af5ddb2dff8d84b..3c75921b469dadbaa82c5ea5e786a7505e3de244 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := HMAC-SHA1
 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 hexdigit_tab.o serial-tools.o cli.o string-extras.o \
+$(ALGO_NAME)_TEST_BIN := main-hmac-sha1-test.o debug.o uart.o hexdigit_tab.o  cli.o string-extras.o \
                          nessie_mac_test.o dbz_strings.o nessie_common.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index 871444087c40b23e1ec25e7782a07543558b017f..2dd2973254598f5c7230202e945010714d7b4694 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := HMAC-SHA256
 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 hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-hmac-sha256-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_mac_test.o dbz_strings.o nessie_common.o cli.o string-extras.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index 1fee35755be26ba73ffa530c52e52c15db2d2bf1..1f7375558ec6331e8ea8aaa94e25e18e203b6547 100644 (file)
@@ -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 hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-md5-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index ed2905fcc83fc62e4464b37b70f148f1696152b5..179d2e6c5c40201db49fcad71b4c4a12baa722e5 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := MD5_ASM
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := md5-asm.o
-$(ALGO_NAME)_TEST_BIN := main-md5-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-md5-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index c5f64f38d09eb5190c4256ebebcc8d41f83b939d..0e1e61fb2829763556f8ff8bc95f780b8a2e291e 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := MUGI_C
 STREAM_CIPHERS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := mugi.o gf256mul.o aes_sbox.o
-$(ALGO_NAME)_TEST_BIN := main-mugi-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-mugi-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_stream_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \
                          performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
index 52cb73011eeeeaa95b756b68f46e561c05de819f..9c70942a635b7d1d09f60b92c559d0bae81f2578 100644 (file)
@@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 
 $(ALGO_NAME)_OBJ      := noekeon_asm.o
-$(ALGO_NAME)_TEST_BIN := main-noekeon-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-noekeon-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
index 504a2665b0cee7c80523f1e1f9b818d0eb626c74..700e8c247932327975339a6686b0a6bd782afd7c 100644 (file)
@@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 
 $(ALGO_NAME)_OBJ      := noekeon.o
-$(ALGO_NAME)_TEST_BIN := main-noekeon-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-noekeon-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
index 365e05672620de639735edf5db08a9eec26c11f6..3429a4afb49ed8822dc1b0d8beedb831c743d30d 100644 (file)
@@ -6,7 +6,7 @@ MACS += $(ALGO_NAME)
 
 
 $(ALGO_NAME)_OBJ      := noekeon_asm.o omac_noekeon.o memxor.o
-$(ALGO_NAME)_TEST_BIN := main-omac-noekeon-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-omac-noekeon-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_mac_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
index 290fc7de277871ca7cf20b17fd92f1484fc0d9b2..e704b1e79c47fc519f72378bc1efa215fb1d9084 100644 (file)
@@ -6,7 +6,7 @@ MACS += $(ALGO_NAME)
 
 
 $(ALGO_NAME)_OBJ      := noekeon_asm.o omac_noekeon_C.o memxor.o
-$(ALGO_NAME)_TEST_BIN := main-omac-noekeon-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-omac-noekeon-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_mac_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
index 1dd39b0e7e42ec085396d0653e0b89b04018e8fc..2c8e9d1e3543b8115ccaaedd17ba672b4e1342ed 100644 (file)
@@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 
 $(ALGO_NAME)_OBJ      := present.o
-$(ALGO_NAME)_TEST_BIN := main-present-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-present-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index 0b1befed26a745a0b17c4955b75612999cd443f1..f948b622e4612fcdfac34b85570d8afa9e8f2419 100644 (file)
@@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 
 $(ALGO_NAME)_OBJ      := rc5.o
-$(ALGO_NAME)_TEST_BIN := main-rc5-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-rc5-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o \
                          dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
index a02f17c77e8021fcf922a05c1835e06c74328ace..f6729e36b245a4d0b7e8825fc82f2dffeb8e9317 100644 (file)
@@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 
 $(ALGO_NAME)_OBJ      := rc6.o
-$(ALGO_NAME)_TEST_BIN := main-rc6-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-rc6-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
index 12d8d59552d550d9f48475a030cb4f0704d73a80..28b437a66e4ecc5f5549e509a52669293b1d6c91 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := SEED
 BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := seed-asm.o
-$(ALGO_NAME)_TEST_BIN := main-seed-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-seed-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o \
                          cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
index 0cc6ea3f360ab4eff5fe65eab2dea5fdb14aabdb..7ec687fd2936559d5d228df424c2bdbbcfd4f21a 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := SEED_C
 BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := seed_C.o
-$(ALGO_NAME)_TEST_BIN := main-seed-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-seed-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o \
                          cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
index dbea67e64ab0d5ea498bfdb57f0e4b916af07b62..d1e5a9a8d57c23a7a7fa47c847e43430ffb15f66 100644 (file)
@@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 
 $(ALGO_NAME)_OBJ      := serpent-asm.o serpent-sboxes-bitslice-asm.o memxor.o
-$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index e731cff8b29d69dd6636236dfe55a2acf0b3d40c..f8cb7b7affeb79df7e8951b409326693dc84be2f 100644 (file)
@@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 
 $(ALGO_NAME)_OBJ      := serpent-sboxes-bitslice-asm.o serpent-asm.o memxor.o
-$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index 71f2a99506cbbabcac78a7ba56b924ce88e9ea25..d9c3760d121b9b4db4f2e2fa4a318474d8341656 100644 (file)
@@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 
 $(ALGO_NAME)_OBJ      := serpent-asm.o serpent-sboxes-fast.o memxor.o
-$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index 7d5a1c3875416b0d0c3f1f79718e5f7bf20d57dc..52cfda2612caa5727c4d6220722abc82f01eb6a8 100644 (file)
@@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 
 $(ALGO_NAME)_OBJ      := serpent-asm.o serpent-sboxes-small.o memxor.o
-$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index 63b498d636a4b685d72e75bfe3434d3e3875b59b..e8c7be4c26b4d305ae3e80e9bd0324b07d9ff71a 100644 (file)
@@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 
 $(ALGO_NAME)_OBJ      := serpent.o serpent-sboxes_c.o memxor.o
-$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index 818a91b9ad7c672fcf87a900b4e44fee9c59804e..f8400bed9044f614c482e3432f9141547c7fc680 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := SHA1
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := sha1-asm.o
-$(ALGO_NAME)_TEST_BIN := main-sha1-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-sha1-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \
                                                 performance_test.o hfal-basic.o hfal_sha1.o shavs.o dump.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
index 6674a3e52630cf41211b0ea968c43dbcceff195d..3b8776c75661507fdb6b828e666697f76b226d6c 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := SHA1_C
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := sha1.o
-$(ALGO_NAME)_TEST_BIN := main-sha1-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-sha1-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \
                         performance_test.o hfal-basic.o hfal_sha1.o shavs.o dump.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
index fee84e0db8ee3c2a83b6017de3967ef54837a837..60925ed2660c9b2b56eecd1fcb13ba0e350e5378 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := SHA256
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := sha256-asm.o
-$(ALGO_NAME)_TEST_BIN := main-sha256-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-sha256-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o \
                         hfal-basic.o hfal_sha256.o shavs.o dump.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
index 6952ca7e4221d9c72b9a4f7361e4ec9a0c3a4394..fa9ca75f048c56626ecddf9cc7a38c24b1e82e30 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := SHA256_C
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := sha256.o
-$(ALGO_NAME)_TEST_BIN := main-sha256-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-sha256-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o \
                         hfal-basic.o hfal_sha256.o shavs.o dump.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
index 7747998f6909b2bf8014d81c5d9bc6325f51d847..fb65dd4828f18097111dd79c4ea7cb1a5a72be34 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := SHABEA
 BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := shabea.o sha256-asm.o memxor.o
-$(ALGO_NAME)_TEST_BIN := main-shabea-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-shabea-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index 4a579709e04ed11039ad82d6df2891e7ac241053..728116eafff06b74fdaba0898a696dd33dd2cf41 100644 (file)
@@ -6,7 +6,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 hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-shacal1_enc-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o 
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index 99dae3389c280f63f8d5d695edc3eefcde09c46c..fe24abaae06b27f7570c402ca54944bf72315784 100644 (file)
@@ -6,7 +6,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 hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-shacal2_enc-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o 
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index 9f4eb35b75cfaadae284c378d8025fad855df130..a325577988600165b84b7b79f559ebbec6f0d652 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := SKIPJACK
 BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := skipjack.o
-$(ALGO_NAME)_TEST_BIN := main-skipjack-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-skipjack-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \
                         performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
index 96ccabaa07ed0df9f3a0c3bb26a111f07d43f24d..34740e9a60000e43931a4ec750c8ed8490c72d4e 100644 (file)
@@ -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 hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-tdes-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/threefish.mk b/mkfiles/threefish.mk
new file mode 100644 (file)
index 0000000..71a4da4
--- /dev/null
@@ -0,0 +1,13 @@
+# Makefile for noekeon
+ALGO_NAME := THREEFISH_C
+
+# comment out the following line for removement of threefish from the build process
+BLOCK_CIPHERS += $(ALGO_NAME)
+
+
+$(ALGO_NAME)_OBJ      := threefish256_enc.o threefish512_enc.o threefish1024_enc.o
+$(ALGO_NAME)_TEST_BIN := main-threefish-test.o debug.o uart.o hexdigit_tab.o  \
+                         nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
+$(ALGO_NAME)_NESSIE_TEST      := test nessie
+$(ALGO_NAME)_PERFORMANCE_TEST := performance
+
index 7b8dd3f750b15b08e4e6c12bcc3bc581275c8497..1478cb66fce3d5863f6d1b701540391beb25da54 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := TRIVIUM
 STREAM_CIPHERS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := trivium.o
-$(ALGO_NAME)_TEST_BIN := main-trivium-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-trivium-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_stream_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \
                          performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
index e33e28ab7d1cc60a96e948781f11fc5e5ebe35ec..93567ffe9da145b333209e1d4649d709678d2ff2 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := TWISTER224
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := twister-small-asm.o twister-asm.o twister224.o 
-$(ALGO_NAME)_TEST_BIN := main-twister224-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-twister224-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index be880e0a7f2335652d6d248fc05093a7cad17c05..948a11398db04e8831787deaf0a27344d888e0cf 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := TWISTER224_C
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := twister.o twister-small.o memxor.o gf256mul.o
-$(ALGO_NAME)_TEST_BIN := main-twister224-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-twister224-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index feb8ac52d2e7cb054994f39f7892cd4c18f71645..dcbf7a6188aa808f103ea0fbf57fd7614f0538fe 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := TWISTER256
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := twister-asm.o twister-small-asm.o twister256.o  
-$(ALGO_NAME)_TEST_BIN := main-twister256-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-twister256-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index 8b1717ed7ec99d765f7f040abfc1507dd1a7c834..bfa070d78c80a1c711896c91f67bb53b73018902 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := TWISTER256_C
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := twister.o twister-small.o memxor.o gf256mul.o
-$(ALGO_NAME)_TEST_BIN := main-twister256-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-twister256-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index c4f2f954cf41e28feba400a96d0ce978977be7b6..aa07161f486a34a5797d3a34c8ae1076fd1b5fca 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := TWISTER384
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := twister-asm.o twister-big-asm.o twister384.o
-$(ALGO_NAME)_TEST_BIN := main-twister384-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-twister384-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index 56511de167d74b68a3d97acd3fc51e505cc02667..f3ac76c11597cfda3c40e720b358df5dd38df6aa 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := TWISTER384_C
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := twister.o twister-big.o memxor.o gf256mul.o
-$(ALGO_NAME)_TEST_BIN := main-twister384-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-twister384-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index 484cc56ea498b667e073d2f648a2f8850b5c4a78..23168f7870583fbcfc8ee3f0f5b23dafbc16284c 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := TWISTER512
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := twister-asm.o twister-big-asm.o twister512.o
-$(ALGO_NAME)_TEST_BIN := main-twister512-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-twister512-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index 1dc2ec0ccadc4be3488456fc21647b4780ca8dea..3f405bb5c3a36b4f630ba6a4990c96913e9900cb 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := TWISTER512_C
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := twister.o twister-big.o memxor.o gf256mul.o
-$(ALGO_NAME)_TEST_BIN := main-twister512-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-twister512-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_hash_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/ubi.mk b/mkfiles/ubi.mk
new file mode 100644 (file)
index 0000000..06ca291
--- /dev/null
@@ -0,0 +1,14 @@
+# Makefile for noekeon
+ALGO_NAME := UBI_C
+
+# comment out the following line for removement of threefish from the build process
+BLOCK_CIPHERS += $(ALGO_NAME)
+
+
+$(ALGO_NAME)_OBJ      := threefish256_enc.o threefish512_enc.o threefish1024_enc.o \
+                         ubi256.o ubi512.o ubi1024.o memxor.o
+$(ALGO_NAME)_TEST_BIN := main-ubi-test.o debug.o uart.o hexdigit_tab.o  \
+                         dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
+$(ALGO_NAME)_NESSIE_TEST      := test nessie
+$(ALGO_NAME)_PERFORMANCE_TEST := performance
+
index 67abbe6e4bbdbd457fe6ede4155bbec5c712d864..a26ec2201e04a1729e0810bd368d4b386a8a7f8b 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := XTEA
 BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := xtea-asm.o
-$(ALGO_NAME)_TEST_BIN := main-xtea-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-xtea-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index 711db8390c1bb8bae4f22724a1f105691b9bcf86..9779affaf10c4fe689d3cffa66dc6e78db1e112c 100644 (file)
@@ -5,7 +5,7 @@ ALGO_NAME := XTEA_C
 BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(ALGO_NAME)_OBJ      := xtea.o
-$(ALGO_NAME)_TEST_BIN := main-xtea-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
+$(ALGO_NAME)_TEST_BIN := main-xtea-test.o debug.o uart.o hexdigit_tab.o  \
                          nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
index c56b3a04952358f23716943d5246eb04daeac617..a4db052f6b33ab188de3b7d3a4c2f0313af56900 100644 (file)
@@ -1,3 +1,29 @@
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2008, 2009  Daniel Otte (daniel.otte@rub.de)
+
+    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
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+/*
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \license GPLv3 or later
+ * 
+ * 
+ * 
+ */
+
 #ifndef NOEKEON_OMAC_H_
 #define NOEKEON_OMAC_H_
 
index 7fc09e97017778b9f4f05d0fb273853676bf0ec9..76c8b75f8597a99aff29f901eda1be12ee98474a 100644 (file)
@@ -37,7 +37,7 @@
 /** \fn uint8_t dbz_strcount(const char* str)
  * \brief count stings in dbz-terminated string
  * 
- * Count the single zero terminated string in a 
+ * Count the single zero terminated strings in a 
  * double terminated string
  * \param str pointer to the double-zero-terminated string
  */
diff --git a/test_src/main-threefish-test.c b/test_src/main-threefish-test.c
new file mode 100644 (file)
index 0000000..6197e63
--- /dev/null
@@ -0,0 +1,248 @@
+/* main-threefish-test.c */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2008  Daniel Otte (daniel.otte@rub.de)
+
+    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
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+/*
+ * threefish test-suit
+ * 
+*/
+
+#include "config.h"
+#include "serial-tools.h"
+#include "uart.h"
+#include "debug.h"
+
+#include "threefish.h"
+#include "nessie_bc_test.h"
+#include "cli.h"
+#include "performance_test.h"
+
+#include <stdint.h>
+#include <string.h>
+#include <stdlib.h>
+
+char* algo_name = "Threefish";
+
+/*****************************************************************************
+ *  additional validation-functions                                                                                     *
+ *****************************************************************************/
+void testrun_stdtest_threefish256(void){
+       uint8_t key[32], data[32];
+       uint8_t tweak[16];
+       uint8_t i;
+       threefish256_ctx_t ctx;
+       
+       cli_putstr_P(PSTR("\r\n\r\nTest vectors for block cipher Threefish (256 bits):"));
+       memset(key,  0, 32);
+       memset(data, 0, 32);
+       memset(tweak, 0, 16);
+       
+       cli_putstr_P(PSTR("\r\nkey:    "));
+       cli_hexdump(key, 32);
+       cli_putstr_P(PSTR("\r\ntweak:  "));
+       cli_hexdump(tweak, 16);
+       cli_putstr_P(PSTR("\r\nplain:  "));
+       cli_hexdump(data, 32);
+       threefish256_init(key, tweak, &ctx);
+       threefish256_enc(data, &ctx);
+       cli_putstr_P(PSTR("\r\ncipher: "));
+       cli_hexdump(data, 32);
+       
+       for(i=0; i<32; ++i){
+               key[i] = 0x10+i;
+               data[i] = 0xFF-i;
+       }
+       for(i=0; i<16; ++i){
+               tweak[i] = i;
+       }
+       cli_putstr_P(PSTR("\r\n\r\nkey:    "));
+       cli_hexdump(key, 32);
+       cli_putstr_P(PSTR("\r\ntweak:  "));
+       cli_hexdump(tweak, 16);
+       cli_putstr_P(PSTR("\r\nplain:  "));
+       cli_hexdump(data, 32);
+       threefish256_init(key, tweak, &ctx);
+       threefish256_enc(data, &ctx);
+       cli_putstr_P(PSTR("\r\ncipher: "));
+       cli_hexdump(data, 32);
+}
+
+void testrun_stdtest_threefish512(void){
+       uint8_t key[64], data[64];
+       uint8_t tweak[16];
+       uint8_t i;
+       threefish512_ctx_t ctx;
+       
+       cli_putstr_P(PSTR("\r\n\r\nTest vectors for block cipher Threefish (512 bits) :"));
+       memset(key,  0, 64);
+       memset(data, 0, 64);
+       memset(tweak, 0, 16);
+       
+       cli_putstr_P(PSTR("\r\nkey:    "));
+       cli_hexdump(key, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(key+32, 32);
+       cli_putstr_P(PSTR("\r\ntweak:  "));
+       cli_hexdump(tweak, 16);
+       cli_putstr_P(PSTR("\r\nplain:  "));
+       cli_hexdump(data, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(data+32, 32);
+       threefish512_init(key, tweak, &ctx);
+       threefish512_enc(data, &ctx);
+       cli_putstr_P(PSTR("\r\ncipher: "));
+       cli_hexdump(data, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(data+32, 32);
+       
+       for(i=0; i<64; ++i){
+               key[i] = 0x10+i;
+               data[i] = 0xFF-i;
+       }
+       for(i=0; i<16; ++i){
+               tweak[i] = i;
+       }
+       cli_putstr_P(PSTR("\r\n\r\nkey:    "));
+       cli_hexdump(key, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(key+32, 32);
+       cli_putstr_P(PSTR("\r\ntweak:  "));
+       cli_hexdump(tweak, 16);
+       cli_putstr_P(PSTR("\r\nplain:  "));
+       cli_hexdump(data, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(data+32, 32);
+       threefish512_init(key, tweak, &ctx);
+       threefish512_enc(data, &ctx);
+       cli_putstr_P(PSTR("\r\ncipher: "));
+       cli_hexdump(data, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(data+32, 32);
+}
+
+void testrun_stdtest_threefish1024(void){
+       uint8_t key[128], data[128];
+       uint8_t tweak[16];
+       uint8_t i;
+       threefish1024_ctx_t ctx;
+       
+       cli_putstr_P(PSTR("\r\n\r\nTest vectors for block cipher Threefish (1024 bits) :"));
+       memset(key,  0, 128);
+       memset(data, 0, 128);
+       memset(tweak, 0, 16);
+       
+       cli_putstr_P(PSTR("\r\nkey:    "));
+       cli_hexdump(key, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(key+32, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(key+64, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(key+96, 32);
+       cli_putstr_P(PSTR("\r\ntweak:  "));
+       cli_hexdump(tweak, 16);
+       cli_putstr_P(PSTR("\r\nplain:  "));
+       cli_hexdump(data, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(data+32, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(data+64, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(data+96, 32);
+       threefish1024_init(key, tweak, &ctx);
+       threefish1024_enc(data, &ctx);
+       cli_putstr_P(PSTR("\r\ncipher: "));
+       cli_hexdump(data, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(data+32, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(data+64, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(data+96, 32);
+       
+       for(i=0; i<128; ++i){
+               key[i] = 0x10+i;
+               data[i] = 0xFF-i;
+       }
+       for(i=0; i<16; ++i){
+               tweak[i] = i;
+       }
+       cli_putstr_P(PSTR("\r\n\r\nkey:    "));
+       cli_hexdump(key, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(key+32, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(key+64, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(key+96, 32);
+       cli_putstr_P(PSTR("\r\ntweak:  "));
+       cli_hexdump(tweak, 16);
+       cli_putstr_P(PSTR("\r\nplain:  "));
+       cli_hexdump(data, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(data+32, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(data+64, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(data+96, 32);
+       threefish1024_init(key, tweak, &ctx);
+       threefish1024_enc(data, &ctx);
+       cli_putstr_P(PSTR("\r\ncipher: "));
+       cli_hexdump(data, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(data+32, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(data+64, 32);
+       cli_putstr_P(PSTR("\r\n        "));
+       cli_hexdump(data+96, 32);
+       }
+
+
+void testrun_stdtest_threefish(void){
+       testrun_stdtest_threefish256();
+       testrun_stdtest_threefish512();
+       testrun_stdtest_threefish1024();
+}
+/*****************************************************************************
+ *  main                                                                                                                                        *
+ *****************************************************************************/
+
+const char nessie_str[]      PROGMEM = "nessie";
+const char test_str[]        PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[]        PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+//     { nessie_str,      NULL, testrun_nessie_noekeon},
+       { test_str,        NULL, testrun_stdtest_threefish},
+//     { performance_str, NULL, testrun_performance_noekeon},
+       { echo_str,    (void*)1, (void_fpt)echo_ctrl},
+       { NULL,            NULL, NULL}
+};
+
+int main (void){
+       DEBUG_INIT();
+       
+       cli_rx = uart_getc;
+       cli_tx = uart_putc;             
+       for(;;){
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cmd_interface(cmdlist);
+       }
+}
diff --git a/test_src/main-ubi-test.c b/test_src/main-ubi-test.c
new file mode 100644 (file)
index 0000000..140362d
--- /dev/null
@@ -0,0 +1,207 @@
+/* main-threefish-test.c */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2008  Daniel Otte (daniel.otte@rub.de)
+
+    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
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+/*
+ * threefish test-suit
+ * 
+*/
+
+#include "config.h"
+#include "serial-tools.h"
+#include "uart.h"
+#include "debug.h"
+
+#include "ubi.h"
+#include "cli.h"
+#include "performance_test.h"
+
+#include <stdint.h>
+#include <string.h>
+#include <stdlib.h>
+
+char* algo_name = "UBI-Threefish";
+
+/*****************************************************************************
+ *  additional validation-functions                                                                                     *
+ *****************************************************************************/
+void testrun_stdtest_ubi256(uint16_t outsize){
+       ubi256_ctx_t ctx;
+       skein_config_t conf;
+       uint64_t iv[4];
+       
+       cli_putstr_P(PSTR("\r\n\r\nTest vectors for UBI (256 bits):"));
+       memset(&conf, 0, sizeof(skein_config_t));
+
+       ubi256_init(&ctx, &conf, UBI_TYPE_CFG);
+       conf.schema[0] = 'S';
+       conf.schema[1] = 'H';
+       conf.schema[2] = 'A';
+       conf.schema[3] = '3';
+       conf.version = 1;
+       conf.out_length = outsize;
+       ubi256_lastBlock(&ctx, &conf, 256);
+       ubi256_ctx2hash(iv, &ctx);
+               
+       cli_putstr_P(PSTR("\r\nIV: "));
+       cli_hexdump_rev(&(iv[0]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[1]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[2]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[3]), 8);
+}
+
+void testrun_stdtest_ubi512(uint16_t outsize){
+       ubi512_ctx_t ctx;
+       skein_config_t conf;
+       uint64_t iv[8];
+       uint8_t null[UBI512_BLOCKSIZE_B];
+       
+       cli_putstr_P(PSTR("\r\n\r\nTest vectors for UBI (512 bits):"));
+       memset(&conf, 0, sizeof(skein_config_t));
+       memset(null, 0, UBI512_BLOCKSIZE_B);
+       ubi512_init(&ctx, null, UBI_TYPE_CFG);
+       conf.schema[0] = 'S';
+       conf.schema[1] = 'H';
+       conf.schema[2] = 'A';
+       conf.schema[3] = '3';
+       conf.version = 1;
+       conf.out_length = outsize;
+       ubi512_lastBlock(&ctx, &conf, 256);
+       ubi512_ctx2hash(iv, &ctx);
+               
+       cli_putstr_P(PSTR("\r\nIV: "));
+       cli_hexdump_rev(&(iv[0]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[1]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[2]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[3]), 8);
+       cli_putstr_P(PSTR("\r\n    "));
+       cli_hexdump_rev(&(iv[4]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[5]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[6]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[7]), 8);
+}
+
+void testrun_stdtest_ubi1024(uint16_t outsize){
+       ubi1024_ctx_t ctx;
+       skein_config_t conf;
+       uint64_t iv[16];
+       uint8_t null[UBI1024_BLOCKSIZE_B];
+       
+       cli_putstr_P(PSTR("\r\n\r\nTest vectors for UBI (1024 bits):"));
+       memset(&conf, 0, sizeof(skein_config_t));
+
+       memset(null, 0, UBI1024_BLOCKSIZE_B);
+       ubi1024_init(&ctx, null, UBI_TYPE_CFG);
+       conf.schema[0] = 'S';
+       conf.schema[1] = 'H';
+       conf.schema[2] = 'A';
+       conf.schema[3] = '3';
+       conf.version = 1;
+       conf.out_length = outsize;
+       ubi1024_lastBlock(&ctx, &conf, 256);
+       ubi1024_ctx2hash(iv, &ctx);
+               
+       cli_putstr_P(PSTR("\r\nIV: "));
+       cli_hexdump_rev(&(iv[0]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[1]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[2]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[3]), 8);
+       cli_putstr_P(PSTR("\r\n    "));
+       cli_hexdump_rev(&(iv[4]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[5]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[6]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[7]), 8);
+       cli_putstr_P(PSTR("\r\n    "));
+       cli_hexdump_rev(&(iv[8]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[9]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[10]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[11]), 8);
+       cli_putstr_P(PSTR("\r\n    "));
+       cli_hexdump_rev(&(iv[12]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[13]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[14]), 8);
+       cli_putstr_P(PSTR("    "));
+       cli_hexdump_rev(&(iv[15]), 8);
+}
+
+void testrun_stdtest_ubi(void){
+       testrun_stdtest_ubi256(128);
+       testrun_stdtest_ubi256(160);
+       testrun_stdtest_ubi256(224);
+       testrun_stdtest_ubi256(256);
+       
+       testrun_stdtest_ubi512(128);
+       testrun_stdtest_ubi512(160);
+       testrun_stdtest_ubi512(224);
+       testrun_stdtest_ubi512(256);
+       testrun_stdtest_ubi512(384);
+       testrun_stdtest_ubi512(512);
+       
+       testrun_stdtest_ubi1024(384);
+       testrun_stdtest_ubi1024(512);
+       testrun_stdtest_ubi1024(1024);
+}
+
+/*****************************************************************************
+ *  main                                                                                                                                        *
+ *****************************************************************************/
+
+const char nessie_str[]      PROGMEM = "nessie";
+const char test_str[]        PROGMEM = "test";
+const char performance_str[] PROGMEM = "performance";
+const char echo_str[]        PROGMEM = "echo";
+
+cmdlist_entry_t cmdlist[] PROGMEM = {
+//     { nessie_str,      NULL, testrun_nessie_noekeon},
+       { test_str,        NULL, testrun_stdtest_ubi},
+//     { performance_str, NULL, testrun_performance_noekeon},
+       { echo_str,    (void*)1, (void_fpt)echo_ctrl},
+       { NULL,            NULL, NULL}
+};
+
+int main (void){
+       DEBUG_INIT();
+       
+       cli_rx = uart_getc;
+       cli_tx = uart_putc;             
+       for(;;){
+               cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
+               cli_putstr(algo_name);
+               cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
+               cmd_interface(cmdlist);
+       }
+}
diff --git a/threefish.h b/threefish.h
new file mode 100644 (file)
index 0000000..73871a4
--- /dev/null
@@ -0,0 +1,58 @@
+/* threefish.c */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2009  Daniel Otte (daniel.otte@rub.de)
+
+    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
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+/*
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2009-03-12
+ * \license GPLv3 or later
+ */
+
+#ifndef THREEFISH_H_
+#define THREEFISH_H_
+
+#include <stdint.h>
+
+typedef struct{
+       uint64_t k[5];
+       uint64_t t[3];
+} threefish256_ctx_t;
+
+
+typedef struct{
+       uint64_t k[9];
+       uint64_t t[3];
+} threefish512_ctx_t;
+
+
+typedef struct{
+       uint64_t k[17];
+       uint64_t t[3];
+} threefish1024_ctx_t;
+
+
+
+void threefish256_init(void* key, void* tweak, threefish256_ctx_t* ctx);
+void threefish512_init(void* key, void* tweak, threefish512_ctx_t* ctx);
+void threefish1024_init(void* key, void* tweak, threefish1024_ctx_t* ctx);
+
+void threefish256_enc(void* data, threefish256_ctx_t* ctx);
+void threefish512_enc(void* data, threefish512_ctx_t* ctx);
+void threefish1024_enc(void* data, threefish1024_ctx_t* ctx);
+
+#endif /* THREEFISH_H_ */
diff --git a/threefish1024_enc.c b/threefish1024_enc.c
new file mode 100644 (file)
index 0000000..2fa1957
--- /dev/null
@@ -0,0 +1,123 @@
+/* threefish1024_enc.c */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2009  Daniel Otte (daniel.otte@rub.de)
+
+    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
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+/*
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2009-03-12
+ * \license GPLv3 or later
+ * 
+ * 
+ * 
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include "threefish.h"
+
+#define X0 (((uint64_t*)data)[0])
+#define X1 (((uint64_t*)data)[1])
+static
+void mix(void* data, uint8_t rot){
+       uint64_t x;
+       x = X1;
+       X0 += x;
+       X1 = ((x<<rot)|(x>>(64-rot))) ^ X0;
+}
+
+#define X(a) (((uint64_t*)data)[(a)])
+
+static
+void permute_16(void* data){
+       uint64_t t;
+       t = X(1);
+       X(1) = X(9);
+       X(9) = X(7);
+       X(7) = X(15);
+       X(15) = t;
+       t = X(3);
+       X(3) = X(13);
+       X(13) = X(5);
+       X(5) = X(11);
+       X(11) = t;
+       t = X(4);
+       X(4) = X(6);
+       X(6) = t;
+       t = X(8);
+       X(8) = X(10);
+       X(10) = X(12);
+       X(12) = X(14);
+       X(14) = t;
+}
+
+#define THREEFISH_KEY_CONST 0x5555555555555555LL /* 2**64/3 */
+
+#define K(s) (((uint64_t*)key)[(s)])
+#define T(s) (((uint64_t*)tweak)[(s)])
+
+void threefish1024_init(void* key, void* tweak, threefish1024_ctx_t* ctx){
+       memcpy(ctx->k, key, 16*8);
+       memcpy(ctx->t, tweak, 2*8);
+       uint8_t i;
+       ctx->k[16] = THREEFISH_KEY_CONST;
+       for(i=0; i<16; ++i){
+               ctx->k[16] ^= K(i);
+       }
+       ctx->t[2] = T(0) ^ T(1);
+}
+
+static
+void add_key_16(void* data, threefish1024_ctx_t* ctx, uint8_t s){
+       uint8_t i;
+       for(i=0; i<13; ++i){
+               X(i) += ctx->k[(s+i)%17];
+       }
+       X(13) += ctx->k[(s+13)%17] + ctx->t[s%3];
+       X(14) += ctx->k[(s+14)%17] + ctx->t[(s+1)%3];
+       X(15) += ctx->k[(s+15)%17] + s;
+}
+
+void threefish1024_enc(void* data, threefish1024_ctx_t* ctx){
+       uint8_t i=0,s=0;
+       uint8_t r0[8] = {55, 25, 33, 34, 28, 17, 58, 47};
+       uint8_t r1[8] = {43, 25,  8, 43,  7,  6,  7, 49};
+       uint8_t r2[8] = {37, 46, 18, 25, 47, 18, 32, 27};
+       uint8_t r3[8] = {40, 13, 57, 60, 48, 25, 45, 58};
+       uint8_t r4[8] = {16, 14, 21, 44, 51, 43, 19, 37};
+       uint8_t r5[8] = {22, 13, 12,  9,  9, 42, 18, 48};
+       uint8_t r6[8] = {38, 52, 32, 59, 35, 40,  2, 53};
+       uint8_t r7[8] = {12, 57, 54, 34, 41, 15, 56, 56};
+       
+       do{
+               if(i%4==0){
+                       add_key_16(data, ctx, s);
+                       ++s;
+               }
+               mix((uint8_t*)data +  0, r0[i%8]);
+               mix((uint8_t*)data + 16, r1[i%8]);
+               mix((uint8_t*)data + 32, r2[i%8]);
+               mix((uint8_t*)data + 48, r3[i%8]);
+               mix((uint8_t*)data + 64, r4[i%8]);
+               mix((uint8_t*)data + 80, r5[i%8]);
+               mix((uint8_t*)data + 96, r6[i%8]);
+               mix((uint8_t*)data +112, r7[i%8]);
+               permute_16(data);
+               ++i;
+       }while(i!=80);
+       add_key_16(data, ctx, s);
+}
diff --git a/threefish256_enc.c b/threefish256_enc.c
new file mode 100644 (file)
index 0000000..be0d5db
--- /dev/null
@@ -0,0 +1,92 @@
+/* threefish256_enc.c */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2009  Daniel Otte (daniel.otte@rub.de)
+
+    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
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+/*
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2009-03-12
+ * \license GPLv3 or later
+ * 
+ * 
+ * 
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include "threefish.h"
+
+#define X0 (((uint64_t*)data)[0])
+#define X1 (((uint64_t*)data)[1])
+static
+void mix(void* data, uint8_t rot){
+       uint64_t x;
+       x = X1;
+       X0 += x;
+       X1 = ((x<<rot)|(x>>(64-rot))) ^ X0;
+}
+
+#define X(a) (((uint64_t*)data)[(a)])
+static
+void permute_4(void* data){
+       uint64_t t;
+       t = X(1);
+       X(1) = X(3);
+       X(3) = t;
+}
+
+#define THREEFISH_KEY_CONST 0x5555555555555555LL /* 2**64/3 */
+
+#define K(s) (((uint64_t*)key)[(s)])
+#define T(s) (((uint64_t*)tweak)[(s)])
+
+void threefish256_init(void* key, void* tweak, threefish256_ctx_t* ctx){
+       memcpy(ctx->k, key, 4*8);
+       memcpy(ctx->t, tweak, 2*8);
+       uint8_t i;
+       ctx->k[4] = THREEFISH_KEY_CONST;
+       for(i=0; i<4; ++i){
+               ctx->k[4] ^= K(i);
+       }
+       ctx->t[2] = T(0) ^ T(1);
+}
+
+static
+void add_key_4(void* data, threefish256_ctx_t* ctx, uint8_t s){
+       X(0) += ctx->k[(s+0)%5];
+       X(1) += ctx->k[(s+1)%5] + ctx->t[s%3];
+       X(2) += ctx->k[(s+2)%5] + ctx->t[(s+1)%3];
+       X(3) += ctx->k[(s+3)%5] + s;
+}
+
+void threefish256_enc(void* data, threefish256_ctx_t* ctx){
+       uint8_t i=0,s=0;
+       uint8_t r0[8] = { 5, 36, 13, 58, 26, 53, 11, 59}; 
+       uint8_t r1[8] = {56, 28, 46, 44, 20, 35, 42, 50};
+       do{
+               if(i%4==0){
+                       add_key_4(data, ctx, s);
+                       ++s;
+               }
+               mix(data, r0[i%8]);
+               mix((uint8_t*)data + 16, r1[i%8]);
+               permute_4(data);
+               ++i;
+       }while(i!=72);
+       add_key_4(data, ctx, s);
+}
+
diff --git a/threefish512_enc.c b/threefish512_enc.c
new file mode 100644 (file)
index 0000000..abd1afc
--- /dev/null
@@ -0,0 +1,119 @@
+/* threefish512_enc.c */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2009  Daniel Otte (daniel.otte@rub.de)
+
+    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
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+/*
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2009-03-12
+ * \license GPLv3 or later
+ * 
+ * 
+ * 
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include "threefish.h"
+
+#define X0 (((uint64_t*)data)[0])
+#define X1 (((uint64_t*)data)[1])
+static
+void mix(void* data, uint8_t rot){
+       uint64_t x;
+       x = X1;
+       X0 += x;
+       X1 = ((x<<rot)|(x>>(64-rot))) ^ X0;
+}
+
+#define X(a) (((uint64_t*)data)[(a)])
+
+static
+void permute_8(void* data){
+       uint64_t t;
+       t = X(0);
+       X(0) = X(2);
+       X(2) = X(4);
+       X(4) = X(6);
+       X(6) = t;
+       t = X(3);
+       X(3) = X(7);
+       X(7) = t;
+}
+/*
+static
+void permute_inv8(void* data){
+       uint64_t t;
+       t = X(6);
+       X(6) = X(4);
+       X(4) = X(2);
+       X(2) = X(0);
+       X(0) = t;
+       t = X(7);
+       X(7) = X(3);
+       X(3) = t;
+}
+*/
+
+#define THREEFISH_KEY_CONST 0x5555555555555555LL /* 2**64/3 */
+
+#define K(s) (((uint64_t*)key)[(s)])
+#define T(s) (((uint64_t*)tweak)[(s)])
+
+void threefish512_init(void* key, void* tweak, threefish512_ctx_t* ctx){
+       memcpy(ctx->k, key, 8*8);
+       memcpy(ctx->t, tweak, 2*8);
+       uint8_t i;
+       ctx->k[8] = THREEFISH_KEY_CONST;
+       for(i=0; i<8; ++i){
+               ctx->k[8] ^= K(i);
+       }
+       ctx->t[2] = T(0) ^ T(1);
+}
+
+static
+void add_key_8(void* data, threefish512_ctx_t* ctx, uint8_t s){
+       uint8_t i;
+       for(i=0; i<5; ++i){
+               X(i) += ctx->k[(s+i)%9];
+       }
+       X(5) += ctx->k[(s+5)%9] + ctx->t[s%3];
+       X(6) += ctx->k[(s+6)%9] + ctx->t[(s+1)%3];
+       X(7) += ctx->k[(s+7)%9] + s;
+}
+
+void threefish512_enc(void* data, threefish512_ctx_t* ctx){
+       uint8_t i=0,s=0;
+       uint8_t r0[8] = {38, 48, 34, 26, 33, 39, 29, 33}; 
+       uint8_t r1[8] = {30, 20, 14, 12, 49, 27, 26, 51};
+       uint8_t r2[8] = {50, 43, 15, 58,  8, 41, 11, 39};
+       uint8_t r3[8] = {53, 31, 27,  7, 42, 14,  9, 35};
+       do{
+               if(i%4==0){
+                       add_key_8(data, ctx, s);
+                       ++s;
+               }
+               mix((uint8_t*)data +  0, r0[i%8]);
+               mix((uint8_t*)data + 16, r1[i%8]);
+               mix((uint8_t*)data + 32, r2[i%8]);
+               mix((uint8_t*)data + 48, r3[i%8]);
+               permute_8(data);
+               ++i;
+       }while(i!=72);
+       add_key_8(data, ctx, s);
+}
+
diff --git a/ubi.h b/ubi.h
new file mode 100644 (file)
index 0000000..582a54e
--- /dev/null
+++ b/ubi.h
@@ -0,0 +1,93 @@
+/* ubi.h */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2009  Daniel Otte (daniel.otte@rub.de)
+
+    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
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+/*
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2009-03-12
+ * \license GPLv3 or later
+ * 
+ */
+
+#ifndef UBI_H_
+#define UBI_H_
+
+#include <stdint.h>
+
+#define UBI_TYPE_KEY  0
+#define UBI_TYPE_CFG  4
+#define UBI_TYPE_PRS  8
+#define UBI_TYPE_PK  12
+#define UBI_TYPE_KDF 16
+#define UBI_TYPE_NON 20
+#define UBI_TYPE_MSG 48
+#define UBI_TYPE_OUT 63
+
+#define UBI256_BLOCKSIZE 256
+#define UBI256_BLOCKSIZE_B ((UBI256_BLOCKSIZE+7)/8)
+
+#define UBI512_BLOCKSIZE 512
+#define UBI512_BLOCKSIZE_B ((UBI512_BLOCKSIZE+7)/8)
+
+#define UBI1024_BLOCKSIZE 1024
+#define UBI1024_BLOCKSIZE_B ((UBI1024_BLOCKSIZE+7)/8)
+
+
+typedef struct{
+       uint8_t tweak[16];
+       uint8_t g[32];
+}ubi256_ctx_t;
+
+typedef struct{
+       uint8_t tweak[16];
+       uint8_t g[64];
+}ubi512_ctx_t;
+
+typedef struct{
+       uint8_t tweak[16];
+       uint8_t g[128];
+}ubi1024_ctx_t;
+
+void ubi256_init(ubi256_ctx_t* ctx, void* g, uint8_t type);
+void ubi256_nextBlock(ubi256_ctx_t* ctx, void* block);
+void ubi256_lastBlock(ubi256_ctx_t* ctx, void* block, uint16_t length_b);
+void ubi256_ctx2hash(void* dest, ubi256_ctx_t* ctx);
+
+void ubi512_init(ubi512_ctx_t* ctx, void* g, uint8_t type);
+void ubi512_nextBlock(ubi512_ctx_t* ctx, void* block);
+void ubi512_lastBlock(ubi512_ctx_t* ctx, void* block, uint16_t length_b);
+void ubi512_ctx2hash(void* dest, ubi512_ctx_t* ctx);
+
+void ubi1024_init(ubi1024_ctx_t* ctx, void* g, uint8_t type);
+void ubi1024_nextBlock(ubi1024_ctx_t* ctx, void* block);
+void ubi1024_lastBlock(ubi1024_ctx_t* ctx, void* block, uint16_t length_b);
+void ubi1024_ctx2hash(void* dest, ubi1024_ctx_t* ctx);
+
+typedef struct{
+       char     schema[4];
+       uint16_t version;
+       uint16_t reserved1;
+       uint64_t out_length;
+       uint8_t  tree_leaf_size;
+       uint8_t  tree_fan_out;
+       uint8_t  tree_max_height;
+       uint8_t  reserved2[13];
+}skein_config_t;
+
+
+#endif /* UBI_H_ */
diff --git a/ubi1024.c b/ubi1024.c
new file mode 100644 (file)
index 0000000..6287e68
--- /dev/null
+++ b/ubi1024.c
@@ -0,0 +1,73 @@
+/* ubi1024.c */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2009  Daniel Otte (daniel.otte@rub.de)
+
+    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
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+/*
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2009-03-12
+ * \license GPLv3 or later
+ * 
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include "threefish.h"
+#include "memxor.h"
+#include "ubi.h"
+
+void ubi1024_init(ubi1024_ctx_t* ctx, void* g, uint8_t type){
+       memset(ctx->tweak, 0, 15);
+       ctx->tweak[15] = 0x40+type;
+       memcpy(ctx->g, g, UBI1024_BLOCKSIZE_B);
+}
+
+void ubi1024_nextBlock(ubi1024_ctx_t* ctx, void* block){
+       threefish1024_ctx_t tfctx;
+       ((uint64_t*)(ctx->tweak))[0] += UBI1024_BLOCKSIZE_B;
+       threefish1024_init(ctx->g, ctx->tweak, &tfctx);
+       memcpy(ctx->g, block, UBI1024_BLOCKSIZE_B);
+       threefish1024_enc(ctx->g, &tfctx);
+       memxor(ctx->g, block, UBI1024_BLOCKSIZE_B);
+       ctx->tweak[15] &= (uint8_t)~0x40;
+} 
+
+
+void ubi1024_lastBlock(ubi1024_ctx_t* ctx, void* block, uint16_t length_b){
+       threefish1024_ctx_t tfctx;
+       while(length_b>UBI1024_BLOCKSIZE){
+               ubi1024_nextBlock(ctx, block);
+               block = (uint8_t*)block + UBI1024_BLOCKSIZE_B;
+               length_b -= UBI1024_BLOCKSIZE;
+       }
+       ctx->tweak[15] |= 0x80;
+       ((uint64_t*)(ctx->tweak))[0] += (length_b+7)/8;
+       if(length_b & 0x07)
+               ctx->tweak[14] |= 0x80;
+       threefish1024_init(ctx->g, ctx->tweak, &tfctx);
+       memset(ctx->g, 0, UBI1024_BLOCKSIZE_B);
+       memcpy(ctx->g, block, (length_b+7)/8);
+       if(length_b & 0x07)
+               ctx->g[(length_b+7)/8-1] |= 0x80>>(length_b&7);
+       threefish1024_enc(ctx->g, &tfctx);
+       memxor(ctx->g, block, (length_b+7)/8);
+} 
+
+void ubi1024_ctx2hash(void* dest, ubi1024_ctx_t* ctx){
+       memcpy(dest, ctx->g, UBI1024_BLOCKSIZE_B);
+}
+
diff --git a/ubi256.c b/ubi256.c
new file mode 100644 (file)
index 0000000..8adfda8
--- /dev/null
+++ b/ubi256.c
@@ -0,0 +1,73 @@
+/* ubi256.c */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2009  Daniel Otte (daniel.otte@rub.de)
+
+    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
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+/*
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2009-03-12
+ * \license GPLv3 or later
+ * 
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include "threefish.h"
+#include "memxor.h"
+#include "ubi.h"
+
+void ubi256_init(ubi256_ctx_t* ctx, void* g, uint8_t type){
+       memset(ctx->tweak, 0, 15);
+       ctx->tweak[15] = 0x40+type;
+       memcpy(ctx->g, g, 32);
+}
+
+void ubi256_nextBlock(ubi256_ctx_t* ctx, void* block){
+       threefish256_ctx_t tfctx;
+       ((uint64_t*)(ctx->tweak))[0] += UBI256_BLOCKSIZE_B;
+       threefish256_init(ctx->g, ctx->tweak, &tfctx);
+       memcpy(ctx->g, block, UBI256_BLOCKSIZE_B);
+       threefish256_enc(ctx->g, &tfctx);
+       memxor(ctx->g, block, UBI256_BLOCKSIZE_B);
+       ctx->tweak[15] &= (uint8_t)~0x40;
+} 
+
+
+void ubi256_lastBlock(ubi256_ctx_t* ctx, void* block, uint16_t length_b){
+       threefish256_ctx_t tfctx;
+       while(length_b>UBI256_BLOCKSIZE){
+               ubi256_nextBlock(ctx, block);
+               block = (uint8_t*)block + UBI256_BLOCKSIZE_B;
+               length_b -= UBI256_BLOCKSIZE;
+       }
+       ctx->tweak[15] |= 0x80;
+       ((uint64_t*)(ctx->tweak))[0] += (length_b+7)/8;
+       if(length_b & 0x07)
+               ctx->tweak[14] |= 0x80;
+       threefish256_init(ctx->g, ctx->tweak, &tfctx);
+       memset(ctx->g, 0, UBI256_BLOCKSIZE_B);
+       memcpy(ctx->g, block, (length_b+7)/8);
+       if(length_b & 0x07)
+               ctx->g[(length_b+7)/8-1] |= 0x80>>(length_b&7);
+       threefish256_enc(ctx->g, &tfctx);
+       memxor(ctx->g, block, (length_b+7)/8);
+} 
+
+void ubi256_ctx2hash(void* dest, ubi256_ctx_t* ctx){
+       memcpy(dest, ctx->g, UBI256_BLOCKSIZE_B);
+}
+
diff --git a/ubi512.c b/ubi512.c
new file mode 100644 (file)
index 0000000..c5e6f51
--- /dev/null
+++ b/ubi512.c
@@ -0,0 +1,73 @@
+/* ubi512.c */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2009  Daniel Otte (daniel.otte@rub.de)
+
+    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
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+/*
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2009-03-12
+ * \license GPLv3 or later
+ * 
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include "threefish.h"
+#include "memxor.h"
+#include "ubi.h"
+
+void ubi512_init(ubi512_ctx_t* ctx, void* g, uint8_t type){
+       memset(ctx->tweak, 0, 15);
+       ctx->tweak[15] = 0x40+type;
+       memcpy(ctx->g, g, UBI512_BLOCKSIZE_B);
+}
+
+void ubi512_nextBlock(ubi512_ctx_t* ctx, void* block){
+       threefish512_ctx_t tfctx;
+       ((uint64_t*)(ctx->tweak))[0] += UBI512_BLOCKSIZE_B;
+       threefish512_init(ctx->g, ctx->tweak, &tfctx);
+       memcpy(ctx->g, block, UBI512_BLOCKSIZE_B);
+       threefish512_enc(ctx->g, &tfctx);
+       memxor(ctx->g, block, UBI512_BLOCKSIZE_B);
+       ctx->tweak[15] &= (uint8_t)~0x40;
+} 
+
+
+void ubi512_lastBlock(ubi512_ctx_t* ctx, void* block, uint16_t length_b){
+       threefish512_ctx_t tfctx;
+       while(length_b>UBI512_BLOCKSIZE){
+               ubi512_nextBlock(ctx, block);
+               block = (uint8_t*)block + UBI512_BLOCKSIZE_B;
+               length_b -= UBI512_BLOCKSIZE;
+       }
+       ctx->tweak[15] |= 0x80;
+       ((uint64_t*)(ctx->tweak))[0] += (length_b+7)/8;
+       if(length_b & 0x07)
+               ctx->tweak[14] |= 0x80;
+       threefish512_init(ctx->g, ctx->tweak, &tfctx);
+       memset(ctx->g, 0, UBI512_BLOCKSIZE_B);
+       memcpy(ctx->g, block, (length_b+7)/8);
+       if(length_b & 0x07)
+               ctx->g[(length_b+7)/8-1] |= 0x80>>(length_b&7);
+       threefish512_enc(ctx->g, &tfctx);
+       memxor(ctx->g, block, (length_b+7)/8);
+} 
+
+void ubi512_ctx2hash(void* dest, ubi512_ctx_t* ctx){
+       memcpy(dest, ctx->g, UBI512_BLOCKSIZE_B);
+}
+