]> git.cryptolib.org Git - arm-crypto-lib.git/commitdiff
updated build system
authorbg <bg@cypex>
Sun, 26 Sep 2010 16:22:40 +0000 (18:22 +0200)
committerbg <bg@cypex>
Sun, 26 Sep 2010 16:22:40 +0000 (18:22 +0200)
245 files changed:
Makefile
aes/aes_dec.c
aes/aes_enc.c
aes/aes_keyschedule.c
aes/aes_sbox.h
aes/gf256mul.c [deleted file]
aes/gf256mul.h [deleted file]
aes/memxor.c [deleted file]
arm-makefile.inc
bcal-basic.c [deleted file]
bcal-basic.h [deleted file]
bcal-cbc.c [deleted file]
bcal-cbc.h [deleted file]
bcal-cfb_bit.c [deleted file]
bcal-cfb_bit.h [deleted file]
bcal-cfb_byte.c [deleted file]
bcal-cfb_byte.h [deleted file]
bcal-cmac.c [deleted file]
bcal-cmac.h [deleted file]
bcal-ctr.c [deleted file]
bcal-ctr.h [deleted file]
bcal-eax.c [deleted file]
bcal-eax.h [deleted file]
bcal-ofb.c [deleted file]
bcal-ofb.h [deleted file]
bcal-performance.c [deleted file]
bcal-performance.h [deleted file]
bcal/bcal-basic.c [new file with mode: 0644]
bcal/bcal-basic.h [new file with mode: 0644]
bcal/bcal-cbc.c [new file with mode: 0644]
bcal/bcal-cbc.h [new file with mode: 0644]
bcal/bcal-cfb_bit.c [new file with mode: 0644]
bcal/bcal-cfb_bit.h [new file with mode: 0644]
bcal/bcal-cfb_byte.c [new file with mode: 0644]
bcal/bcal-cfb_byte.h [new file with mode: 0644]
bcal/bcal-cmac.c [new file with mode: 0644]
bcal/bcal-cmac.h [new file with mode: 0644]
bcal/bcal-ctr.c [new file with mode: 0644]
bcal/bcal-ctr.h [new file with mode: 0644]
bcal/bcal-eax.c [new file with mode: 0644]
bcal/bcal-eax.h [new file with mode: 0644]
bcal/bcal-ofb.c [new file with mode: 0644]
bcal/bcal-ofb.h [new file with mode: 0644]
bcal/bcal-performance.c [new file with mode: 0644]
bcal/bcal-performance.h [new file with mode: 0644]
bcal/bcal_aes128.c [new file with mode: 0644]
bcal/bcal_aes128.h [new file with mode: 0644]
bcal/bcal_aes192.c [new file with mode: 0644]
bcal/bcal_aes192.h [new file with mode: 0644]
bcal/bcal_aes256.c [new file with mode: 0644]
bcal/bcal_aes256.h [new file with mode: 0644]
bcal/bcal_camellia128.c [new file with mode: 0644]
bcal/bcal_camellia128.h [new file with mode: 0644]
bcal/bcal_cast5.c [new file with mode: 0644]
bcal/bcal_cast5.h [new file with mode: 0644]
bcal/bcal_cast6.c [new file with mode: 0644]
bcal/bcal_cast6.h [new file with mode: 0644]
bcal/bcal_des.c [new file with mode: 0644]
bcal/bcal_des.h [new file with mode: 0644]
bcal/bcal_noekeon.c [new file with mode: 0644]
bcal/bcal_noekeon.h [new file with mode: 0644]
bcal/bcal_present.c [new file with mode: 0644]
bcal/bcal_present.h [new file with mode: 0644]
bcal/bcal_rc5.c [new file with mode: 0644]
bcal/bcal_rc5.h [new file with mode: 0644]
bcal/bcal_rc6.c [new file with mode: 0644]
bcal/bcal_rc6.h [new file with mode: 0644]
bcal/bcal_seed.c [new file with mode: 0644]
bcal/bcal_seed.h [new file with mode: 0644]
bcal/bcal_serpent.c [new file with mode: 0644]
bcal/bcal_serpent.h [new file with mode: 0644]
bcal/bcal_skipjack.c [new file with mode: 0644]
bcal/bcal_skipjack.h [new file with mode: 0644]
bcal/bcal_tdes.c [new file with mode: 0644]
bcal/bcal_tdes.h [new file with mode: 0644]
bcal/bcal_tdes2.c [new file with mode: 0644]
bcal/bcal_tdes2.h [new file with mode: 0644]
bcal/bcal_threefish1024.c [new file with mode: 0644]
bcal/bcal_threefish1024.h [new file with mode: 0644]
bcal/bcal_threefish256.c [new file with mode: 0644]
bcal/bcal_threefish256.h [new file with mode: 0644]
bcal/bcal_threefish512.c [new file with mode: 0644]
bcal/bcal_threefish512.h [new file with mode: 0644]
bcal/bcal_xtea.c [new file with mode: 0644]
bcal/bcal_xtea.h [new file with mode: 0644]
bcal/keysize_descriptor.c [new file with mode: 0644]
bcal/keysize_descriptor.h [new file with mode: 0644]
bcal_aes128.c [deleted file]
bcal_aes128.h [deleted file]
bcal_aes192.c [deleted file]
bcal_aes192.h [deleted file]
bcal_aes256.c [deleted file]
bcal_aes256.h [deleted file]
blake/blake_large.c
blake/blake_small.c
blake/memxor.c [deleted file]
blake/memxor.h [deleted file]
bmw/bmw_small.c
bmw/bmw_small_speed.c
bmw/memxor.c [deleted file]
bmw/memxor.h [deleted file]
cubehash/cubehash.c
cubehash/memxor.c [deleted file]
cubehash/memxor.h [deleted file]
echo/aes_enc_round.c
echo/aes_sbox.c [deleted file]
echo/aes_sbox.h [deleted file]
echo/echo.c
echo/gf256mul.c [deleted file]
echo/gf256mul.h [deleted file]
echo/memxor.c [deleted file]
echo/memxor.h [deleted file]
gf256mul/gf256mul.c [new file with mode: 0644]
gf256mul/gf256mul.h [new file with mode: 0644]
groestl/aes_sbox.c [deleted file]
groestl/aes_sbox.h [deleted file]
groestl/gf256mul.c [deleted file]
groestl/gf256mul.h [deleted file]
groestl/groestl_large.c
groestl/groestl_small.c
groestl/memxor.c [deleted file]
groestl/memxor.h [deleted file]
hfal-basic.c [deleted file]
hfal-basic.h [deleted file]
hfal/hfal-basic.c [new file with mode: 0644]
hfal/hfal-basic.h [new file with mode: 0644]
hfal/hfal-hmac.c [new file with mode: 0644]
hfal/hfal-hmac.h [new file with mode: 0644]
hfal/hfal-nessie.c [new file with mode: 0644]
hfal/hfal-nessie.h [new file with mode: 0644]
hfal/hfal-performance.c [new file with mode: 0644]
hfal/hfal-performance.h [new file with mode: 0644]
hfal/hfal-test.c [new file with mode: 0644]
hfal/hfal-test.h [new file with mode: 0644]
hfal/hfal_blake_large.c [new file with mode: 0644]
hfal/hfal_blake_large.h [new file with mode: 0644]
hfal/hfal_blake_small.c [new file with mode: 0644]
hfal/hfal_blake_small.h [new file with mode: 0644]
hfal/hfal_bmw_large.c [new file with mode: 0644]
hfal/hfal_bmw_large.h [new file with mode: 0644]
hfal/hfal_bmw_small.c [new file with mode: 0644]
hfal/hfal_bmw_small.h [new file with mode: 0644]
hfal/hfal_cubehash.c [new file with mode: 0644]
hfal/hfal_cubehash.h [new file with mode: 0644]
hfal/hfal_echo.c [new file with mode: 0644]
hfal/hfal_echo.h [new file with mode: 0644]
hfal/hfal_groestl_large.c [new file with mode: 0644]
hfal/hfal_groestl_large.h [new file with mode: 0644]
hfal/hfal_groestl_small.c [new file with mode: 0644]
hfal/hfal_groestl_small.h [new file with mode: 0644]
hfal/hfal_keccak.c [new file with mode: 0644]
hfal/hfal_keccak.h [new file with mode: 0644]
hfal/hfal_md5.c [new file with mode: 0644]
hfal/hfal_md5.h [new file with mode: 0644]
hfal/hfal_sha1.c [new file with mode: 0644]
hfal/hfal_sha1.h [new file with mode: 0644]
hfal/hfal_sha256.c [new file with mode: 0644]
hfal/hfal_sha256.h [new file with mode: 0644]
hfal/hfal_shabal.c [new file with mode: 0644]
hfal/hfal_shabal.h [new file with mode: 0644]
hfal/hfal_skein1024.c [new file with mode: 0644]
hfal/hfal_skein1024.h [new file with mode: 0644]
hfal/hfal_skein256.c [new file with mode: 0644]
hfal/hfal_skein256.h [new file with mode: 0644]
hfal/hfal_skein512.c [new file with mode: 0644]
hfal/hfal_skein512.h [new file with mode: 0644]
hfal_blake_large.c [deleted file]
hfal_blake_large.h [deleted file]
hfal_blake_small.c [deleted file]
hfal_blake_small.h [deleted file]
hfal_bmw_large.c [deleted file]
hfal_bmw_large.h [deleted file]
hfal_bmw_small.c [deleted file]
hfal_bmw_small.h [deleted file]
hfal_cubehash.c [deleted file]
hfal_cubehash.h [deleted file]
hfal_echo.c [deleted file]
hfal_echo.h [deleted file]
hfal_groestl_large.c [deleted file]
hfal_groestl_large.h [deleted file]
hfal_groestl_small.c [deleted file]
hfal_groestl_small.h [deleted file]
hfal_keccak.c [deleted file]
hfal_keccak.h [deleted file]
hfal_md5.c [deleted file]
hfal_md5.h [deleted file]
hfal_sha1.c [deleted file]
hfal_sha1.h [deleted file]
hfal_sha256.c [deleted file]
hfal_sha256.h [deleted file]
hfal_shabal.c [deleted file]
hfal_shabal.h [deleted file]
hfal_skein1024.c [deleted file]
hfal_skein1024.h [deleted file]
hfal_skein256.c [deleted file]
hfal_skein256.h [deleted file]
hfal_skein512.c [deleted file]
hfal_skein512.h [deleted file]
keccak/keccak.c
keccak/memxor.c [deleted file]
keccak/memxor.h [deleted file]
keysize_descriptor.c [deleted file]
keysize_descriptor.h [deleted file]
memxor/memxor.c [new file with mode: 0644]
memxor/memxor.h [new file with mode: 0644]
memxor/memxor_c.c [new file with mode: 0644]
mkfiles/aes_c.mk
mkfiles/blake_c.mk
mkfiles/bmw_c.mk
mkfiles/bmw_c_speed.mk
mkfiles/cubehash_c.mk
mkfiles/echo_c.mk
mkfiles/groestl_c.mk
mkfiles/keccak_c.mk
mkfiles/sha1_c.mk
mkfiles/sha256_c.mk
mkfiles/shabal_c.mk
mkfiles/skein_c.mk
noekeon/noekeon.c [new file with mode: 0644]
noekeon/noekeon.h [new file with mode: 0644]
noekeon/noekeon_cbc_enc.h [new file with mode: 0644]
noekeon/noekeon_ctr.h [new file with mode: 0644]
noekeon/noekeon_prng.c [new file with mode: 0644]
noekeon/noekeon_prng.h [new file with mode: 0644]
noekeon/omac_noekeon.h [new file with mode: 0644]
noekeon/omac_noekeon_C.c [new file with mode: 0644]
skein/memxor.c [deleted file]
skein/memxor.h [deleted file]
skein/ubi1024.c
skein/ubi256.c
skein/ubi512.c
test_src/cmacvs.c
test_src/main-aes-test.c
test_src/main-blake-test.c
test_src/main-bmw-test.c
test_src/main-cubehash-test.c
test_src/main-echo-test.c
test_src/main-groestl-test.c
test_src/main-keccak-test.c
test_src/main-md5-test.c
test_src/main-sha1-test.c
test_src/main-sha256-test.c
test_src/main-shabal-test.c
test_src/main-skein-test.c
test_src/shavs.c

index 7fd75c6ecadec696e1dc227306bfed6e2e3d466b..8ed3e1ade1e4b03fa0ba8f31d6af4d1112c4d15e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# Makefile for the AVR-Crypto-Lib project
+# Makefile for the ARM-Crypto-Lib project
 #
 #    This file is part of the AVR-Crypto-Lib.
 #    Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
@@ -28,10 +28,14 @@ SIGNATURE      :=
 PK_CIPHERS     :=
 AUX            :=
 
+
 # we use the gnu make standard library
 include gmsl
 include arm-makefile.inc
 
+
+GLOBAL_INCDIR := ./ $(TESTSRC_DIR)
+
 #-------------------------------------------------------------------------------
 # inclusion of make stubs
 include mkfiles/*.mk
@@ -59,29 +63,8 @@ $(foreach a, $(ALGORITHMS), $(eval $(call Assert_Template, \
 )))
 
 
-#$(foreach a, $(ALGORITHMS), \
-#    $(if $(def $(a)_DIR), \
-#    $(eval $(call Assert_Template, \
-#        $(a)_DIR, \
-#        . \
-#    ) \
-#    )) \
-#)
-#
-#$(foreach a, $(ALGORITHMS), \
-#    $(if $(call seq($(strip($($(a)_DIR))),)), \
-#    $(eval $(call Assert_Template, \
-#        $(a)_DIR, \
-#        . \
-#    ) \
-#    )) \
-#)
 
 #-------------------------------------------------------------------------------
-#
-###    ifeq 'blafoo' ''
-###        $(error no source ($(2)) for $(1) in TargetSource_Template)
-###    endif
 
 define TargetSource_Template
 $(1): $(2)
@@ -90,11 +73,26 @@ $(1): $(2)
        @$(CC) $(CFLAGS_A) -I./$(strip $(3)) -c -o $(1) $(2)
 endef
 
+# ----------------------------------------------------------------------------
+# Function:  find_source_file
+# Arguments: 1: name of the binary file (.o extension) to search
+#            2: list of directorys to search for file
+# Returns:   Returns paths to source file (mathing the pattern in 
+#            $(SOURCE_PATTERN)
+# ----------------------------------------------------------------------------
+SOURCE_PATTERN := %.S %.c 
+find_source_file = $(firstword $(foreach d, $(2), \
+                     $(filter $(SOURCE_PATTERN),  \
+                       $(wildcard $(d)$(notdir $(patsubst %.o,%,$1)).*) \
+                     ) \
+                   ) )
+              
+              
 $(foreach a, $(ALGORITHMS), \
   $(foreach b, $($(a)_OBJ), \
     $(eval $(call TargetSource_Template, \
       $(BIN_DIR)$(call lc, $(a))/$(b), \
-      $(filter %.S %.c, $(wildcard $($(a)_DIR)$(notdir $(patsubst %.o,%,$(b))).*)), \
+       $(call find_source_file, $(b), $($(a)_DIR) $($(a)_INCDIR) $(GLOBAL_INCDIR) ),\
       $($(a)_DIR) \
     )) \
   ) \
@@ -103,15 +101,13 @@ $(foreach a, $(ALGORITHMS), \
 $(foreach a, $(ALGORITHMS), \
   $(foreach b, $($(a)_TEST_BIN), \
     $(eval $(call TargetSource_Template, \
-         $(BIN_DIR)$(call lc, $(a))/$(TEST_DIR)$(b), \
-      $(if $(call sne,$(strip $(filter %.S %.c, $(wildcard $(TESTSRC_DIR)$(notdir $(patsubst %.o,%,$(b))).*))),), \
-          $(filter %.S %.c, $(wildcard $(TESTSRC_DIR)$(notdir $(patsubst %.o,%,$(b))).*)), \
-          $(filter %.S %.c, $(wildcard ./$(notdir $(patsubst %.o,%,$(b))).*))\
-         ), \
+      $(BIN_DIR)$(call lc, $(a))/$(TEST_DIR)$(b), \
+       $(call find_source_file, $(b), $($(a)_DIR) $($(a)_INCDIR) $(GLOBAL_INCDIR) ),\
       $($(a)_DIR) \
     )) \
   ) \
 )
+
 #-------------------------------------------------------------------------------
 
 define MainTestElf_Template
@@ -162,7 +158,7 @@ endef
 
 $(foreach algo, $(ALGORITHMS), $(eval $(call Flash_Template, \
     $(algo), \
-    $(BIN_DIR)$(call lc, $(algo))/$(TEST_DIR)main-$(call lc, $(algo))-test.elf \
+    $(BIN_DIR)$(call lc, $(algo))/$(TEST_DIR)main-$(call lc, $(algo))-test.hex \
 )))
 
 #-------------------------------------------------------------------------------
@@ -179,6 +175,8 @@ $(foreach algo, $(ALGORITHMS), $(eval $(call Speed_Template, \
 .PHONY: hash_speed
 hash_speed: $(foreach algo, $(HASHES), $(algo)_SPEED)
 
+.PHONY: blockcipher_speed
+blockcipher_speed: $(foreach algo, $(BLOCK_CIPHERS), $(algo)_SPEED)
 #-------------------------------------------------------------------------------
 
 
@@ -195,6 +193,9 @@ $(foreach algo, $(ALGORITHMS), $(eval $(call Size_Template, \
 .PHONY: hash_size
 hash_size: $(foreach algo, $(HASHES), $(algo)_SIZE)
 
+.PHONY: blockcipher_size
+blockcipher_size: $(foreach algo, $(BLOCK_CIPHERS), $(algo)_SIZE)
+
 #-------------------------------------------------------------------------------
 
 .PHONY: tests
@@ -277,27 +278,29 @@ info:
        @echo "  auxiliary functions:"
        @echo "    $(AUX)"
        @echo " targets:"
-       @echo "  all           - all algorithm cores"
-       @echo "  cores         - all algorithm cores"
-       @echo "  listings      - all algorithm core listings"
-       @echo "  tests         - all algorithm test programs"
-       @echo "  stats         - all algorithm size statistics"
-       @echo "  blockciphers  - all blockcipher cores"
-       @echo "  streamciphers - all streamcipher cores"
-       @echo "  hashes        - all hash cores"
-       @echo "  macs          - all MAC cores"
-       @echo "  prngs         - all PRNG cores"
-       @echo "  all_testrun   - testrun all algorithms"
-       @echo "  hash_size     - measure size of all hash functions"
-       @echo "  hash_speed    - measure performance of all hash functions"
-       @echo "  docu          - build doxygen documentation"
-       @echo "  clean         - remove a lot of builded files"
-       @echo "  depclean      - also remove dependency files"
-       @echo "  *_TEST_BIN    - build test program"
-       @echo "  *_TESTRUN     - run nessie test"
-       @echo "  *_OBJ         - build algorithm core"
-       @echo "  *_FLASH       - flash test program"
-       @echo "  *_LIST        - build assembler listing"
+       @echo "  all                - all algorithm cores"
+       @echo "  cores              - all algorithm cores"
+       @echo "  listings           - all algorithm core listings"
+       @echo "  tests              - all algorithm test programs"
+       @echo "  stats              - all algorithm size statistics"
+       @echo "  blockciphers       - all blockcipher cores"
+       @echo "  streamciphers      - all streamcipher cores"
+       @echo "  hashes             - all hash cores"
+       @echo "  macs               - all MAC cores"
+       @echo "  prngs              - all PRNG cores"
+       @echo "  all_testrun        - testrun all algorithms"
+       @echo "  hash_size          - measure size of all hash functions"
+       @echo "  hash_speed         - measure performance of all hash functions"
+       @echo "  blockcipher_size   - measure size of all blockciphers"
+       @echo "  blockcipher_speed  - measure performance of all blockciphers"
+       @echo "  docu               - build doxygen documentation"
+       @echo "  clean              - remove a lot of builded files"
+       @echo "  depclean           - also remove dependency files"
+       @echo "  *_TEST_BIN         - build test program"
+       @echo "  *_TESTRUN          - run nessie test"
+       @echo "  *_OBJ              - build algorithm core"
+       @echo "  *_FLASH            - flash test program"
+       @echo "  *_LIST             - build assembler listing"
 
 
 #-------------------------------------------------------------------------------
@@ -308,7 +311,7 @@ clean:
 
 .PHONY: depclean
 depclean: clean
-       rm $(DEP_DIR)*.d
+       rm -f $(DEP_DIR)*.d
 
 #-------------------------------------------------------------------------------
 # dependency inclusion
index 51af9c773170f589aac118d87f66d768942afc7b..64f87c298b5bff3fb1079f280a0720b07c0fb6b6 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <stdint.h>
 #include <string.h>
-#include "gf256mul.h"
+#include "gf256mul/gf256mul.h"
 #include "aes.h"
 #include "aes_invsbox.h"
 #include "aes_dec.h"
index 3d45af6d46db5f66cb74fa3170899689042eeb71..959667d8c0d3322e730eb519068acb64e96d65d6 100644 (file)
@@ -28,8 +28,8 @@
 #include <stdint.h>
 #include <string.h>
 #include "aes.h"
-#include "gf256mul.h"
-#include "aes_sbox.h"
+#include "gf256mul/gf256mul.h"
+#include "aes/aes_sbox.h"
 #include "aes_enc.h"
 
 void aes_shiftcol(void* data, uint8_t shift){
index 2c7953ac8975e73de969b0063f397110239afbec..32e4badf208f0b75d2ecaf27ef0263cc8ba12420 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdint.h>
 #include "aes.h"
 #include "aes_keyschedule.h"
-#include "aes_sbox.h"
+#include "aes/aes_sbox.h"
 #include <string.h>
 
 static
index 5bc03b77e18a6374d5c275e9979ac57614f102f4..421b57665f672e70f6f901893c653cdaeff9d1e0 100644 (file)
@@ -28,6 +28,6 @@
 #define AES_SBOX_H_
 #include <stdint.h>
 
-extern uint8_t aes_sbox[];
+extern const uint8_t aes_sbox[];
 
 #endif
diff --git a/aes/gf256mul.c b/aes/gf256mul.c
deleted file mode 100644 (file)
index a473646..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/* gf256mul.c */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-
-#include <stdint.h>
-
-uint8_t gf256mul(uint8_t a, uint8_t b, uint8_t reducer){
-       uint8_t r=0;
-       while(a&0xFE){
-               if(a&1){
-                       r ^= b;
-               }
-               a >>= 1;
-               if(b&0x80){
-                       b <<= 1;
-                       b ^= reducer;
-               }else{
-                       b <<= 1;
-               }
-       }
-       if(a&1){
-               r ^= b;
-       }
-       return r;
-}
diff --git a/aes/gf256mul.h b/aes/gf256mul.h
deleted file mode 100644 (file)
index 87f1cb3..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* gf256mul.h */
-/*
-    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/>.
-*/
-#ifndef GF256MUL_H_
-#define GF256MUL_H_
-
-/**
- * \author  Daniel Otte
- * \email   daniel.otte@rub.de
- * \date    2008-12-19
- * \license GPLv3
- * \brief
- * 
- * 
- */
-
-#include <stdint.h>
-
-uint8_t gf256mul(uint8_t a, uint8_t b, uint8_t reducer);
-
-#endif /* GF256MUL_H_ */
-
diff --git a/aes/memxor.c b/aes/memxor.c
deleted file mode 100644 (file)
index 7485b3e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdint.h>
-
-#include "memxor.h"
-
-void memxor(void* dest, const void* src, uint16_t n){
-  while(n--){
-    *((uint8_t*)dest) ^= *((uint8_t*)src);
-    dest = (uint8_t*)dest +1;
-    src  = (uint8_t*)src  +1;
-  }
-}
-
index 4987aec9f312e74f46db1cc613f5fe1b714e829c..98ac3beac5feb36ab8d09bf44d37b7bc70cd50c8 100644 (file)
@@ -6,7 +6,6 @@ FLASHCMD       = arm-elf-gdb -x gdb-flash  #
 DEP_DIR        = deps/
 TEST_DIR       = test/
 BIN_DIR        = bin/
-TESTBIN_DIR    = test_bin/
 TESTSRC_DIR    = test_src/
 ERASECMD       =
 TESTPORT       = /dev/ttyUSB1
diff --git a/bcal-basic.c b/bcal-basic.c
deleted file mode 100644 (file)
index 5cb5536..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/* bcal-basic.c */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include "blockcipher_descriptor.h"
-#include "keysize_descriptor.h"
-
-uint8_t bcal_cipher_init(const bcdesc_t* cipher_descriptor,
-                         const void* key, uint16_t keysize_b, bcgen_ctx_t* ctx){
-       if(!is_valid_keysize_P(cipher_descriptor->valid_keysize_desc, keysize_b)){
-               return 1;
-       }
-       uint8_t flags;
-       bc_init_fpt init_fpt;
-       ctx->desc_ptr = (bcdesc_t*)cipher_descriptor;
-       ctx->keysize  = keysize_b;
-       flags = cipher_descriptor->flags;
-       init_fpt.initvoid = (void_fpt)(cipher_descriptor->init.initvoid);
-       if(init_fpt.initvoid == NULL){
-               if(!(ctx->ctx = malloc((keysize_b+7)/8)))
-                       return 2;
-               memcpy(ctx->ctx, key, (keysize_b+7)/8);
-               return 0;
-       }
-       if(!(ctx->ctx = malloc(cipher_descriptor->ctxsize_B)))
-               return 3;
-       if((flags&BC_INIT_TYPE)==BC_INIT_TYPE_1){
-               init_fpt.init1((void*)key, (ctx->ctx));
-       }else{
-               init_fpt.init2((void*)key, keysize_b, (ctx->ctx));
-       }
-       return 0;
-}
-
-void bcal_cipher_free(bcgen_ctx_t* ctx){
-       if(!ctx)
-               return;
-       bc_free_fpt free_fpt;
-       free_fpt = (bc_free_fpt)(ctx->desc_ptr->free);
-       if(free_fpt)
-               free_fpt((ctx->ctx));
-       free(ctx->ctx);
-}
-
-void bcal_cipher_enc(void* block, const bcgen_ctx_t* ctx){
-       bc_enc_fpt enc_fpt;
-       enc_fpt.encvoid = (void_fpt)(ctx->desc_ptr->enc.encvoid);
-       if(!enc_fpt.encvoid){
-               /* very bad error, no enciphering function specified */
-               return;
-       }
-       enc_fpt.enc1(block, (ctx->ctx));
-       
-}
-
-void bcal_cipher_dec(void* block, const bcgen_ctx_t* ctx){
-       bc_dec_fpt dec_fpt;
-       dec_fpt.decvoid = (void_fpt)(ctx->desc_ptr->dec.decvoid);
-       if(!dec_fpt.decvoid){
-               /* very bad error, no deciphering function specified */
-               return;
-       }
-       dec_fpt.dec1(block, (ctx->ctx));
-}
-
-uint16_t bcal_cipher_getBlocksize_b(const bcdesc_t* desc){
-       return (desc->blocksize_b);
-}
-
-const void* bcal_cipher_getKeysizeDesc(const bcdesc_t* desc){
-       return (desc->valid_keysize_desc);
-}
-
-
diff --git a/bcal-basic.h b/bcal-basic.h
deleted file mode 100644 (file)
index 04165eb..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/* bcal-basic.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/>.
-*/
-
-#ifndef BCAL_BASIC_H_
-#define BCAL_BASIC_H_
-
-#include <stdlib.h>
-#include <stdint.h>
-#include "blockcipher_descriptor.h"
-#include "keysize_descriptor.h"
-
-uint8_t bcal_cipher_init(const bcdesc_t* cipher_descriptor,
-                         const void* key, uint16_t keysize_b, bcgen_ctx_t* ctx);
-void bcal_cipher_free(bcgen_ctx_t* ctx);
-void bcal_cipher_enc(void* block, const bcgen_ctx_t* ctx);
-void bcal_cipher_dec(void* block, const bcgen_ctx_t* ctx);
-uint16_t bcal_cipher_getBlocksize_b(const bcdesc_t* desc);
-const void* bcal_cipher_getKeysizeDesc(const bcdesc_t* desc);
-#endif /* BCAL_BASIC_H_ */
diff --git a/bcal-cbc.c b/bcal-cbc.c
deleted file mode 100644 (file)
index 16d27a1..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/* bcal-cbc.c */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-
-#include <stdint.h>
-#include <string.h>
-#include "bcal-cbc.h"
-#include "bcal-basic.h"
-#include "memxor.h"
-
-uint8_t bcal_cbc_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_cbc_ctx_t* ctx){
-       ctx->desc = (bcdesc_t*)desc;
-       ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
-       ctx->prev_block = malloc(ctx->blocksize_B);
-
-       if(ctx->prev_block==NULL){
-               return 0x11;
-       }
-       return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
-}
-
-void bcal_cbc_free(bcal_cbc_ctx_t* ctx){
-       bcal_cipher_free(&(ctx->cctx));
-       free(ctx->prev_block);
-}
-
-
-void bcal_cbc_loadIV(const void* iv, bcal_cbc_ctx_t* ctx){
-       if(iv){
-               memcpy(ctx->prev_block, iv, ctx->blocksize_B);
-       }
-}
-
-void bcal_cbc_encNext(void* block, bcal_cbc_ctx_t* ctx){
-       memxor(block, ctx->prev_block, ctx->blocksize_B);
-       bcal_cipher_enc(block, &(ctx->cctx));
-       memcpy(ctx->prev_block, block, ctx->blocksize_B);
-}
-
-void bcal_cbc_decNext(void* block, bcal_cbc_ctx_t* ctx){
-       uint8_t tmp[ctx->blocksize_B];
-       memcpy(tmp, block, ctx->blocksize_B);
-       bcal_cipher_dec(block, &(ctx->cctx));
-       memxor(block, ctx->prev_block, ctx->blocksize_B);
-       memcpy(ctx->prev_block, tmp, ctx->blocksize_B);
-}
-void bcal_cbc_decRand(void* block, const void* prev_block, bcal_cbc_ctx_t* ctx){
-       bcal_cipher_dec(block, &(ctx->cctx));
-       memxor(block, prev_block, ctx->blocksize_B);
-}
-
-void bcal_cbc_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ctx_t* ctx){
-       bcal_cbc_loadIV(iv, ctx);
-       while(msg_blocks--){
-               bcal_cbc_encNext(msg, ctx);
-               msg = (uint8_t*)msg + ctx->blocksize_B;
-       }
-}
-
-void bcal_cbc_decMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ctx_t* ctx){
-       msg=(uint8_t*)msg + (msg_blocks-1)*ctx->blocksize_B;
-       while(msg_blocks > 1){
-               bcal_cbc_decRand(msg, (uint8_t*)msg-ctx->blocksize_B, ctx);
-               msg_blocks -= 1;
-               msg=(uint8_t*)msg-ctx->blocksize_B;
-       }
-       bcal_cbc_decRand(msg, iv, ctx);
-}
-
diff --git a/bcal-cbc.h b/bcal-cbc.h
deleted file mode 100644 (file)
index ba20186..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/* bcal-cbc.h */
-/*
-    This file is part of the AVR-Crypto-Lib.
-    Copyright (C) 2010 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/>.
-*/
-
-#ifndef BCALCBC_H_
-#define BCALCBC_H_
-
-#include <stdint.h>
-#include "blockcipher_descriptor.h"
-#include "bcal-basic.h"
-
-typedef struct{
-       bcdesc_t*    desc;
-       bcgen_ctx_t  cctx;
-       uint8_t*     prev_block;
-       uint8_t      blocksize_B;
-} bcal_cbc_ctx_t;
-
-uint8_t bcal_cbc_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_cbc_ctx_t* ctx);
-void bcal_cbc_free(bcal_cbc_ctx_t* ctx);
-void bcal_cbc_loadIV(const void* iv, bcal_cbc_ctx_t* ctx);
-void bcal_cbc_encNext(void* block, bcal_cbc_ctx_t* ctx);
-void bcal_cbc_decNext(void* block, bcal_cbc_ctx_t* ctx);
-void bcal_cbc_decRand(void* block, const void* prev_block, bcal_cbc_ctx_t* ctx);
-void bcal_cbc_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ctx_t* ctx);
-void bcal_cbc_decMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ctx_t* ctx);
-
-
-#endif /* BCALCBC_H_ */
diff --git a/bcal-cfb_bit.c b/bcal-cfb_bit.c
deleted file mode 100644 (file)
index 6ddb57f..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/* bcal-cfb_bit.c */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-
-
-#include <stdint.h>
-#include <string.h>
-#include "bcal-cfb_bit.h"
-#include "bcal-basic.h"
-
-static uint8_t read_bit(void* block, uint32_t index){
-       uint8_t r;
-       r=((uint8_t*)block)[index/8];
-       r=(r&(0x80>>(index&7)))?0xff:0x00;
-       return r;
-}
-
-static void write_bit(void* block, uint32_t index, uint8_t value){
-       if(value){
-               /* set bit */
-               ((uint8_t*)block)[index/8] |= 0x80>>(index&7);
-       }else{
-               /* clear bit */
-               ((uint8_t*)block)[index/8] &= ~(0x80>>(index&7));
-       }
-}
-
-uint8_t bcal_cfb_b_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_b_ctx_t* ctx){
-       ctx->desc = (bcdesc_t*)desc;
-       ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
-       ctx->in_block=malloc(ctx->blocksize_B);
-       if(ctx->in_block==NULL){
-               return 0x11;
-       }
-       if(size_b>bcal_cipher_getBlocksize_b(desc)){
-               return 0x12;
-       }
-       ctx->size_b = size_b;
-       return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
-}
-
-void bcal_cfb_b_free(bcal_cfb_b_ctx_t* ctx){
-       free(ctx->in_block);
-       bcal_cipher_free(&(ctx->cctx));
-}
-
-void bcal_cfb_b_loadIV(const void* iv, bcal_cfb_b_ctx_t* ctx){
-       if(iv){
-               memcpy(ctx->in_block, iv, ctx->blocksize_B);
-       }
-}
-
-void bcal_cfb_b_encNext(void* block, uint8_t offset, bcal_cfb_b_ctx_t* ctx){
-       uint8_t tmp[ctx->blocksize_B];
-       offset &= 7;
-       memcpy(tmp, ctx->in_block, ctx->blocksize_B);
-       bcal_cipher_enc(tmp, &(ctx->cctx));
-       uint16_t i,j;
-       uint8_t a;
-       for(i=0; i<ctx->blocksize_B*8-ctx->size_b; ++i){
-               a = read_bit(ctx->in_block, i+ctx->size_b);
-               write_bit(ctx->in_block, i, a);
-       }
-       for(j=offset,i=0; i<ctx->size_b; ++i, ++j){
-               a = read_bit(tmp, i) ^ read_bit(block, j);
-               write_bit(ctx->in_block, ctx->blocksize_B*8-ctx->size_b+i, a);
-               write_bit(block, j, a);
-       }
-}
-
-void bcal_cfb_b_decNext(void* block, uint8_t offset, bcal_cfb_b_ctx_t* ctx){
-       uint8_t tmp[ctx->blocksize_B];
-       offset &= 7;
-       memcpy(tmp, ctx->in_block, ctx->blocksize_B);
-       bcal_cipher_enc(tmp, &(ctx->cctx));
-       uint16_t i,j;
-       uint8_t a,b;
-       for(i=0; i<ctx->blocksize_B*8-ctx->size_b; ++i){
-               a = read_bit(ctx->in_block, i+ctx->size_b);
-               write_bit(ctx->in_block, i, a);
-       }
-       for(j=offset,i=0; i<ctx->size_b; ++i, ++j){
-               a = read_bit(tmp, i);
-               b = read_bit(block, j);
-               a ^= b;
-               write_bit(ctx->in_block, ctx->blocksize_B*8-ctx->size_b+i, b);
-               write_bit(block, j, a);
-       }
-}
-
-void bcal_cfb_b_encMsg(const void* iv, void* msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t* ctx){
-       bcal_cfb_b_loadIV(iv, ctx);
-       uint64_t addr;
-       addr = ((uint32_t)msg)*8+offset;
-       while(msg_blocks--){
-               msg = (void*)((uint32_t)(addr/8));
-               offset = addr&7;
-               bcal_cfb_b_encNext(msg, offset, ctx);
-               addr += ctx->size_b;
-       }
-}
-
-void bcal_cfb_b_decMsg(const void* iv, void* msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t* ctx){
-       bcal_cfb_b_loadIV(iv, ctx);
-       uint64_t addr;
-       addr = ((uint32_t)msg)*8+offset;
-       while(msg_blocks--){
-               msg = (void*)((uint32_t)(addr/8));
-               offset = addr&7;
-               bcal_cfb_b_decNext(msg, offset, ctx);
-               addr += ctx->size_b;
-       }
-}
diff --git a/bcal-cfb_bit.h b/bcal-cfb_bit.h
deleted file mode 100644 (file)
index df62e17..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/* bcal-cfb_bit.h */
-/*
-    This file is part of the AVR-Crypto-Lib.
-    Copyright (C) 2010 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/>.
-*/
-
-
-#ifndef BCALCFB_BIT_H_
-#define BCALCFB_BIT_H_
-
-#include <stdint.h>
-#include "bcal-basic.h"
-#include "blockcipher_descriptor.h"
-
-
-typedef struct{
-       bcdesc_t*    desc;
-       bcgen_ctx_t  cctx;
-       uint8_t*     in_block;
-       uint8_t      blocksize_B;
-       uint16_t     size_b;
-} bcal_cfb_b_ctx_t;
-
-
-uint8_t bcal_cfb_b_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_b_ctx_t* ctx);
-void bcal_cfb_b_free(bcal_cfb_b_ctx_t* ctx);
-void bcal_cfb_b_loadIV(const void* iv, bcal_cfb_b_ctx_t* ctx);
-void bcal_cfb_b_encNext(void* block, uint8_t offset, bcal_cfb_b_ctx_t* ctx);
-void bcal_cfb_b_decNext(void* block, uint8_t offset, bcal_cfb_b_ctx_t* ctx);
-void bcal_cfb_b_encMsg(const void* iv, void* msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t* ctx);
-void bcal_cfb_b_decMsg(const void* iv, void* msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t* ctx);
-
-
-#endif /* BCALCFB_BIT_H_ */
diff --git a/bcal-cfb_byte.c b/bcal-cfb_byte.c
deleted file mode 100644 (file)
index 0f6f31d..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/* bcal-cfb_byte.c */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-
-
-#include <stdint.h>
-#include <string.h>
-#include "bcal-cfb_byte.h"
-#include "bcal-basic.h"
-#include "memxor.h"
-
-
-uint8_t bcal_cfb_B_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_B_ctx_t* ctx){
-       ctx->desc = (bcdesc_t*)desc;
-       ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
-       ctx->in_block=malloc(ctx->blocksize_B);
-       if(ctx->in_block==NULL){
-                       return 0x11;
-       }
-       if(size_b&7){
-               return 0x12;
-       }
-       ctx->size_B = size_b/8;
-       return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
-}
-
-void bcal_cfb_B_free(bcal_cfb_B_ctx_t* ctx){
-       free(ctx->in_block);
-       bcal_cipher_free(&(ctx->cctx));
-}
-
-void bcal_cfb_B_loadIV(const void* iv, bcal_cfb_B_ctx_t* ctx){
-       if(iv){
-               memcpy(ctx->in_block, iv, ctx->blocksize_B);
-       }
-}
-
-void bcal_cfb_B_encNext(void* block, bcal_cfb_B_ctx_t* ctx){
-       uint8_t tmp[ctx->blocksize_B];
-       memcpy(tmp, ctx->in_block, ctx->blocksize_B);
-       bcal_cipher_enc(tmp, &(ctx->cctx));
-       memxor(block, tmp, ctx->size_B);
-       memmove(ctx->in_block, ctx->in_block+ctx->size_B, ctx->blocksize_B - ctx->size_B);
-       memcpy(ctx->in_block+ctx->blocksize_B-ctx->size_B, block, ctx->size_B);
-}
-
-void bcal_cfb_B_decNext(void* block, bcal_cfb_B_ctx_t* ctx){
-       uint8_t tmp[ctx->blocksize_B];
-       uint8_t xblock[ctx->size_B];
-       memcpy(xblock, block, ctx->size_B);
-       memcpy(tmp, ctx->in_block, ctx->blocksize_B);
-       bcal_cipher_enc(tmp, &(ctx->cctx));
-       memxor(block, tmp, ctx->size_B);
-       memmove(ctx->in_block, ctx->in_block+ctx->size_B, ctx->blocksize_B - ctx->size_B);
-       memcpy(ctx->in_block+ctx->blocksize_B-ctx->size_B, xblock, ctx->size_B);
-}
-
-void bcal_cfb_B_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t* ctx){
-       bcal_cfb_B_loadIV(iv, ctx);
-       while(msg_blocks--){
-               bcal_cfb_B_encNext(msg, ctx);
-               msg = (uint8_t*)msg+ctx->size_B;
-       }
-}
-
-void bcal_cfb_B_decMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t* ctx){
-       bcal_cfb_B_loadIV(iv, ctx);
-               while(msg_blocks--){
-                       bcal_cfb_B_decNext(msg, ctx);
-                       msg = (uint8_t*)msg+ctx->size_B;
-               }
-}
-
diff --git a/bcal-cfb_byte.h b/bcal-cfb_byte.h
deleted file mode 100644 (file)
index 276a904..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/* bcal-cbc.h */
-/*
-    This file is part of the AVR-Crypto-Lib.
-    Copyright (C) 2010 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/>.
-*/
-
-#ifndef BCALCFB_BYTE_H_
-#define BCALCFB_BYTE_H_
-
-#include <stdint.h>
-#include "bcal-basic.h"
-#include "blockcipher_descriptor.h"
-
-
-typedef struct{
-       bcdesc_t*    desc;
-       bcgen_ctx_t  cctx;
-       uint8_t*     in_block;
-       uint8_t      blocksize_B;
-       uint8_t      size_B;
-} bcal_cfb_B_ctx_t;
-
-
-uint8_t bcal_cfb_B_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_B_ctx_t* ctx);
-void bcal_cfb_B_free(bcal_cfb_B_ctx_t* ctx);
-void bcal_cfb_B_loadIV(const void* iv, bcal_cfb_B_ctx_t* ctx);
-void bcal_cfb_B_encNext(void* block, bcal_cfb_B_ctx_t* ctx);
-void bcal_cfb_B_decNext(void* block, bcal_cfb_B_ctx_t* ctx);
-void bcal_cfb_B_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t* ctx);
-void bcal_cfb_B_decMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t* ctx);
-
-
-#endif /* BCALCFB_BYTE_H_ */
diff --git a/bcal-cmac.c b/bcal-cmac.c
deleted file mode 100644 (file)
index 32ddfeb..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-/* bcal-omac.c */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-
-
-#include <stdint.h>
-#include <string.h>
-#include "bcal-basic.h"
-#include "bcal-cmac.h"
-#include "memxor.h"
-
-
-static uint8_t left_shift_be_block(void* block, uint8_t blocksize_B){
-       uint8_t c1=0, c2;
-       do{
-               --blocksize_B;
-               c2 = (((uint8_t*)block)[blocksize_B])>>7;
-               (((uint8_t*)block)[blocksize_B]) <<= 1;
-               (((uint8_t*)block)[blocksize_B]) |= c1;
-               c1 = c2;
-       }while(blocksize_B);
-       return c1;
-}
-
-static const uint8_t const_128 = 0x87;
-static const uint8_t const_64  = 0x1b;
-
-uint8_t bcal_cmac_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_cmac_ctx_t* ctx){
-       uint8_t r;
-       ctx->desc = (bcdesc_t*)desc;
-       ctx->blocksize_B = bcal_cipher_getBlocksize_b(desc)/8;
-       if (ctx->blocksize_B!=128/8 && ctx->blocksize_B!=64/8){
-               return 0x13;
-       }
-       ctx->accu = malloc(ctx->blocksize_B);
-       if(ctx->accu==NULL){
-               return 0x14;
-       }
-       ctx->k1 = malloc(ctx->blocksize_B);
-       if(ctx->k1==NULL){
-               return 0x15;
-       }
-       ctx->k2 = malloc(ctx->blocksize_B);
-       if(ctx->k2==NULL){
-               return 0x16;
-       }
-       ctx->lastblock = malloc(ctx->blocksize_B);
-       if(ctx->lastblock==NULL){
-               return 0x17;
-       }
-       r = bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
-       if(r){
-               return r;
-       }
-       if(ctx->blocksize_B==128/8){
-               r = const_128;
-       }else{
-               r = const_64;
-       }
-       /* subkey computation */
-       memset(ctx->accu, 0x00, ctx->blocksize_B);
-       memset(ctx->k1, 0x00, ctx->blocksize_B);
-       bcal_cipher_enc(ctx->k1, &(ctx->cctx));
-       if(left_shift_be_block(ctx->k1, ctx->blocksize_B)){
-               ctx->k1[ctx->blocksize_B-1] ^= r;
-       }
-       memcpy(ctx->k2, ctx->k1, ctx->blocksize_B);
-       if(left_shift_be_block(ctx->k2, ctx->blocksize_B)){
-               ctx->k2[ctx->blocksize_B-1] ^= r;
-       }
-       ctx->last_set=0;
-       return 0;
-}
-
-void bcal_cmac_free(bcal_cmac_ctx_t* ctx){
-       free(ctx->accu);
-       free(ctx->k1);
-       free(ctx->k2);
-       bcal_cipher_free(&(ctx->cctx));
-}
-
-void bcal_cmac_nextBlock (bcal_cmac_ctx_t* ctx, const void* block){
-       if(ctx->last_set){
-               memxor(ctx->accu, ctx->lastblock, ctx->blocksize_B);
-               bcal_cipher_enc(ctx->accu, &(ctx->cctx));
-       }
-       memcpy(ctx->lastblock, block, ctx->blocksize_B);
-       ctx->last_set=1;
-}
-
-
-void bcal_cmac_lastBlock(bcal_cmac_ctx_t* ctx, const void* block, uint16_t length_b){
-       uint16_t blocksize_b;
-       blocksize_b = ctx->blocksize_B*8;
-       while(length_b>=blocksize_b){
-               bcal_cmac_nextBlock(ctx, block);
-               block = (uint8_t*)block + ctx->blocksize_B;
-               length_b -= blocksize_b;
-       }
-       if(ctx->last_set==0){
-               memxor(ctx->accu, block, (length_b+7)/8);
-               memxor(ctx->accu, ctx->k2, ctx->blocksize_B);
-               ctx->accu[length_b/8] ^= 0x80>>(length_b&7);
-       }else{
-               if(length_b==0){
-                       memxor(ctx->accu, ctx->lastblock, ctx->blocksize_B);
-                       memxor(ctx->accu, ctx->k1, ctx->blocksize_B);
-               }else{
-                       memxor(ctx->accu, ctx->lastblock, ctx->blocksize_B);
-                       bcal_cipher_enc(ctx->accu, &(ctx->cctx));
-                       memxor(ctx->accu, block, (length_b+7)/8);
-                       memxor(ctx->accu, ctx->k2, ctx->blocksize_B);
-                       ctx->accu[length_b/8] ^= 0x80>>(length_b&7);
-               }
-       }
-       bcal_cipher_enc(ctx->accu, &(ctx->cctx));
-}
-
-void bcal_cmac_ctx2mac(void* dest, uint16_t length_b, const bcal_cmac_ctx_t* ctx){
-       memcpy(dest, ctx->accu, length_b/8);
-       if(length_b&7){
-               ((uint8_t*)dest)[length_b/8] &= 0xff>>(length_b&7);
-               ((uint8_t*)dest)[length_b/8] |= (0xff00>>(length_b&7))&(ctx->accu[length_b/8]);
-       }
-}
-
-void bcal_cmac(void* dest, uint16_t out_length_b, const void* block, uint32_t length_b, bcal_cmac_ctx_t* ctx){
-       uint16_t blocksize_b;
-       blocksize_b = ctx->blocksize_B*8;
-       while(length_b>blocksize_b){
-               bcal_cmac_nextBlock(ctx, block);
-               block = (uint8_t*)block + ctx->blocksize_B;
-               length_b -= blocksize_b;
-       }
-       bcal_cmac_lastBlock(ctx, block, length_b);
-       bcal_cmac_ctx2mac(dest, out_length_b, ctx);
-}
diff --git a/bcal-cmac.h b/bcal-cmac.h
deleted file mode 100644 (file)
index be699b6..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/* bcal-cmac.h */
-/*
-    This file is part of the AVR-Crypto-Lib.
-    Copyright (C) 2010 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/>.
-*/
-
-#ifndef BCALCMAC_H_
-#define BCALCMAC_H_
-
-#include <stdint.h>
-#include "bcal-basic.h"
-#include "blockcipher_descriptor.h"
-
-typedef struct{
-       bcdesc_t*    desc;
-       bcgen_ctx_t  cctx;
-       uint8_t*     accu;
-       uint8_t*     k1;
-       uint8_t*     k2;
-       uint8_t*     lastblock;
-       uint8_t      last_set;
-       uint8_t      blocksize_B;
-} bcal_cmac_ctx_t;
-
-uint8_t bcal_cmac_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_cmac_ctx_t* ctx);
-void bcal_cmac_free(bcal_cmac_ctx_t* ctx);
-void bcal_cmac_nextBlock(bcal_cmac_ctx_t* ctx, const void* block);
-void bcal_cmac_lastBlock(bcal_cmac_ctx_t* ctx, const void* block, uint16_t length_b);
-void bcal_cmac_ctx2mac(void* dest, uint16_t length_b, const bcal_cmac_ctx_t* ctx);
-void bcal_cmac(void* dest, uint16_t out_length_b, const void* block, uint32_t length_b, bcal_cmac_ctx_t* ctx);
-
-#endif /* BCALCMAC_H_ */
diff --git a/bcal-ctr.c b/bcal-ctr.c
deleted file mode 100644 (file)
index ec1b1d4..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/* bcal-ctr.c */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-
-
-#include <stdint.h>
-#include <string.h>
-#include "bcal-basic.h"
-#include "bcal-ctr.h"
-#include "memxor.h"
-
-static void increment_be(void* block, uint8_t size_B){
-       uint16_t c=1;
-       do{
-               --size_B;
-               c += ((uint8_t*)block)[size_B];
-               ((uint8_t*)block)[size_B] = (uint8_t)c;
-               c>>=8;
-       }while(size_B);
-}
-
-uint8_t bcal_ctr_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, inc_fp_t inc_func, bcal_ctr_ctx_t* ctx){
-       ctx->desc = (bcdesc_t*)desc;
-       if(inc_func){
-               ctx->inc_func = inc_func;
-       }else{
-               ctx->inc_func = increment_be;
-       }
-       ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
-       ctx->in_block=malloc(ctx->blocksize_B);
-       if(ctx->in_block==NULL){
-                       return 0x11;
-       }
-       return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
-}
-
-void bcal_ctr_free(bcal_ctr_ctx_t* ctx){
-       free(ctx->in_block);
-       bcal_cipher_free(&(ctx->cctx));
-}
-
-void bcal_ctr_loadIV(const void* iv, bcal_ctr_ctx_t* ctx){
-       if(iv){
-               memcpy(ctx->in_block, iv, ctx->blocksize_B);
-       }
-}
-
-void bcal_ctr_encNext(void* block, bcal_ctr_ctx_t* ctx){
-       uint8_t tmp[ctx->blocksize_B];
-       memcpy(tmp, ctx->in_block, ctx->blocksize_B);
-       bcal_cipher_enc(tmp, &(ctx->cctx));
-       memxor(block, tmp, ctx->blocksize_B);
-       ctx->inc_func(ctx->in_block, ctx->blocksize_B);
-}
-
-void bcal_ctr_decNext(void* block, bcal_ctr_ctx_t* ctx){
-       bcal_ctr_encNext(block, ctx);
-}
-
-void bcal_ctr_encMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ctr_ctx_t* ctx){
-       bcal_ctr_loadIV(iv, ctx);
-       uint16_t blocksize_b;
-       blocksize_b = ctx->blocksize_B*8;
-       while(msg_len_b>blocksize_b){
-               bcal_ctr_encNext(msg, ctx);
-               msg_len_b -= blocksize_b;
-               msg = (uint8_t*)msg + ctx->blocksize_B;
-       }
-       uint8_t tmp[ctx->blocksize_B];
-       memcpy(tmp, ctx->in_block, ctx->blocksize_B);
-       bcal_cipher_enc(tmp, &(ctx->cctx));
-       ctx->inc_func(ctx->in_block, ctx->blocksize_B);
-       tmp[msg_len_b/8] = 0xff00>>(msg_len_b&7);
-       memxor(msg, tmp, (msg_len_b+7)/8);
-}
-
-void bcal_ctr_decMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ctr_ctx_t* ctx){
-       bcal_ctr_encMsg(iv, msg, msg_len_b, ctx);
-}
-
diff --git a/bcal-ctr.h b/bcal-ctr.h
deleted file mode 100644 (file)
index 55de485..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/* bcal-ctr.h */
-/*
-    This file is part of the AVR-Crypto-Lib.
-    Copyright (C) 2010 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/>.
-*/
-
-#ifndef BCALCTR_H_
-#define BCALCTR_H_
-
-#include <stdint.h>
-#include "bcal-basic.h"
-#include "blockcipher_descriptor.h"
-
-typedef void(*inc_fp_t)(void* block, uint8_t size_B);
-
-typedef struct{
-       bcdesc_t*    desc;
-       bcgen_ctx_t  cctx;
-       uint8_t*     in_block;
-       inc_fp_t     inc_func;
-       uint8_t      blocksize_B;
-} bcal_ctr_ctx_t;
-
-uint8_t bcal_ctr_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, inc_fp_t inc_func, bcal_ctr_ctx_t* ctx);
-void bcal_ctr_free(bcal_ctr_ctx_t* ctx);
-void bcal_ctr_loadIV(const void* iv, bcal_ctr_ctx_t* ctx);
-void bcal_ctr_encNext(void* block, bcal_ctr_ctx_t* ctx);
-void bcal_ctr_decNext(void* block, bcal_ctr_ctx_t* ctx);
-void bcal_ctr_encMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ctr_ctx_t* ctx);
-void bcal_ctr_decMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ctr_ctx_t* ctx);
-
-#endif /* BCALCTR_H_ */
diff --git a/bcal-eax.c b/bcal-eax.c
deleted file mode 100644 (file)
index 72d68bd..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/* bca-eax.c */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-
-
-#include <stdint.h>
-#include "bcal-basic.h"
-#include "blockcipher_descriptor.h"
-#include "bcal-cmac.h"
-#include "bcal-ctr.h"
-#include "bcal-eax.h"
-#include "memxor.h"
-
-uint8_t bcal_eax_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_eax_ctx_t* ctx){
-       uint8_t r;
-       ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
-       ctx->nonce = malloc(ctx->blocksize_B);
-       if(ctx->nonce==NULL){
-               return 0x81;
-       }
-       r = bcal_cmac_init(desc, key, keysize_b, &(ctx->ctag));
-       if(r){
-               return r;
-       }
-       r = bcal_cmac_init(desc, key, keysize_b, &(ctx->htag));
-       if(r){
-               return (r|0x10);
-       }
-       r = bcal_cmac_init(desc, key, keysize_b, &(ctx->ntag));
-       if(r){
-               return (r|0x20);
-       }
-       r = bcal_ctr_init(desc, key, keysize_b, NULL, &(ctx->cipher));
-       if(r){
-               return (r|0x30);
-       }
-       ctx->header_set=0;
-       uint8_t tmp[ctx->blocksize_B];
-       memset(tmp, 0, ctx->blocksize_B);
-       bcal_cmac_nextBlock(&(ctx->ntag), tmp);
-       tmp[ctx->blocksize_B-1]=1;
-       bcal_cmac_nextBlock(&(ctx->htag), tmp);
-       tmp[ctx->blocksize_B-1]=2;
-       bcal_cmac_nextBlock(&(ctx->ctag), tmp);
-       return 0;
-}
-
-void bcal_eax_free(bcal_eax_ctx_t* ctx){
-       bcal_ctr_free(&(ctx->cipher));
-       bcal_cmac_free(&(ctx->ctag));
-       bcal_cmac_free(&(ctx->htag));
-       bcal_cmac_free(&(ctx->ntag));
-       free(ctx->nonce);
-}
-
-void bcal_eax_loadNonce(const void* nonce, uint16_t length_b, bcal_eax_ctx_t* ctx){
-       bcal_cmac_lastBlock(&(ctx->ntag), nonce, length_b);
-       bcal_cmac_ctx2mac(ctx->nonce, ctx->blocksize_B*8, &(ctx->ntag));
-       bcal_ctr_loadIV(ctx->nonce, &(ctx->cipher));
-}
-
-void bcal_eax_addNextHeader(const void* header, bcal_eax_ctx_t* ctx){
-       bcal_cmac_nextBlock(&(ctx->htag), header);
-}
-
-void bcal_eax_addLastHeader(const void* header, uint16_t length_b, bcal_eax_ctx_t* ctx){
-       bcal_cmac_lastBlock(&(ctx->htag), header, length_b);
-       ctx->header_set = 1;
-}
-
-void bcal_eax_encNextBlock(void* block, bcal_eax_ctx_t* ctx){
-       bcal_ctr_encNext(block, &(ctx->cipher));
-       bcal_cmac_nextBlock(&(ctx->ctag), block);
-}
-
-void bcal_eax_encLastBlock(void* block, uint16_t length_b, bcal_eax_ctx_t* ctx){
-       bcal_ctr_encMsg(NULL, block, length_b, &(ctx->cipher));
-       bcal_cmac_lastBlock(&(ctx->ctag), block, length_b);
-}
-
-void bcal_eax_decNextBlock(void* block, bcal_eax_ctx_t* ctx){
-       bcal_cmac_nextBlock(&(ctx->ctag), block);
-       bcal_ctr_decNext(block, &(ctx->cipher));
-}
-
-void bcal_eax_decLastBlock(void* block, uint16_t length_b, bcal_eax_ctx_t* ctx){
-       bcal_cmac_lastBlock(&(ctx->ctag), block, length_b);
-       bcal_ctr_decMsg(NULL, block, length_b, &(ctx->cipher));
-}
-
-void bcal_eax_ctx2tag(void* dest, uint16_t length_b, bcal_eax_ctx_t* ctx){
-       uint8_t tmp[ctx->blocksize_B];
-       if(ctx->header_set==0){
-               bcal_cmac_lastBlock(&(ctx->htag), NULL, 0);
-       }
-
-       bcal_cmac_ctx2mac(tmp, ctx->blocksize_B*8, &(ctx->htag));
-       memxor(ctx->nonce, tmp, ctx->blocksize_B);
-
-       bcal_cmac_ctx2mac(tmp, ctx->blocksize_B*8, &(ctx->ctag));
-       memxor(ctx->nonce, tmp, ctx->blocksize_B);
-       memcpy(dest, ctx->nonce, (length_b+7)/8);
-}
-
diff --git a/bcal-eax.h b/bcal-eax.h
deleted file mode 100644 (file)
index 190eee9..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* bcal-eax.h */
-/*
-    This file is part of the AVR-Crypto-Lib.
-    Copyright (C) 2010 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/>.
-*/
-
-#ifndef BCALEAX_H_
-#define BCALEAX_H_
-
-#include <stdint.h>
-#include <string.h>
-#include "bcal-basic.h"
-#include "blockcipher_descriptor.h"
-#include "bcal-cmac.h"
-#include "bcal-ctr.h"
-
-typedef struct{
-       uint8_t*        nonce;
-       bcal_cmac_ctx_t ntag;
-       bcal_cmac_ctx_t ctag;
-       bcal_cmac_ctx_t htag;
-       bcal_ctr_ctx_t  cipher;
-       uint8_t         blocksize_B;
-       uint8_t         header_set;
-} bcal_eax_ctx_t;
-
-uint8_t bcal_eax_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_eax_ctx_t* ctx);
-void bcal_eax_free(bcal_eax_ctx_t* ctx);
-void bcal_eax_loadNonce(const void* nonce, uint16_t length_b, bcal_eax_ctx_t* ctx);
-void bcal_eax_addNextHeader(const void* header, bcal_eax_ctx_t* ctx);
-void bcal_eax_addLastHeader(const void* header, uint16_t length_b, bcal_eax_ctx_t* ctx);
-void bcal_eax_encNextBlock(void* block, bcal_eax_ctx_t* ctx);
-void bcal_eax_encLastBlock(void* block, uint16_t length_b, bcal_eax_ctx_t* ctx);
-void bcal_eax_decNextBlock(void* block, bcal_eax_ctx_t* ctx);
-void bcal_eax_decLastBlock(void* block, uint16_t length_b, bcal_eax_ctx_t* ctx);
-void bcal_eax_ctx2tag(void* dest, uint16_t length_b, bcal_eax_ctx_t* ctx);
-//void bcal_eax(void* dest, uint16_t out_length_b, const void* block, uint32_t length_b, bcal_eax_ctx_t* ctx);
-
-#endif /* BCALEAX_H_ */
-
diff --git a/bcal-ofb.c b/bcal-ofb.c
deleted file mode 100644 (file)
index 6494fb8..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/* bcal-ofb.c */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-
-#include <stdint.h>
-#include <string.h>
-#include "bcal-ofb.h"
-#include "bcal-basic.h"
-#include "memxor.h"
-
-
-uint8_t bcal_ofb_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_ofb_ctx_t* ctx){
-       ctx->desc = (bcdesc_t*)desc;
-       ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
-       ctx->in_block=malloc(ctx->blocksize_B);
-       if(ctx->in_block==NULL){
-                       return 0x11;
-       }
-       return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
-}
-
-void bcal_ofb_free(bcal_ofb_ctx_t* ctx){
-       free(ctx->in_block);
-       bcal_cipher_free(&(ctx->cctx));
-}
-
-void bcal_ofb_loadIV(const void* iv, bcal_ofb_ctx_t* ctx){
-       if(iv){
-               memcpy(ctx->in_block, iv, ctx->blocksize_B);
-       }
-}
-
-void bcal_ofb_encNext(void* block, bcal_ofb_ctx_t* ctx){
-       bcal_cipher_enc(ctx->in_block , &(ctx->cctx));
-       memxor(block, ctx->in_block, ctx->blocksize_B);
-}
-
-void bcal_ofb_decNext(void* block, bcal_ofb_ctx_t* ctx){
-       bcal_cipher_enc(ctx->in_block , &(ctx->cctx));
-       memxor(block, ctx->in_block, ctx->blocksize_B);
-}
-
-
-void bcal_ofb_encMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ofb_ctx_t* ctx){
-       uint16_t block_len_b;
-       block_len_b = ctx->blocksize_B*8;
-       bcal_ofb_loadIV(iv, ctx);
-       while(msg_len_b>block_len_b){
-               bcal_ofb_encNext(msg, ctx);
-               msg_len_b -= block_len_b;
-               msg = (uint8_t*)msg + ctx->blocksize_B;
-       }
-       bcal_cipher_enc(ctx->in_block, &(ctx->cctx));
-       ctx->in_block[msg_len_b/8] = 0xff00>>(msg_len_b&7);
-       memxor(msg, ctx->in_block, (msg_len_b+7)/8);
-}
-
-void bcal_ofb_decMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ofb_ctx_t* ctx){
-       bcal_ofb_encMsg(iv, msg, msg_len_b, ctx);
-}
-
diff --git a/bcal-ofb.h b/bcal-ofb.h
deleted file mode 100644 (file)
index aa69c05..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/* bcal-ofb.h */
-/*
-    This file is part of the AVR-Crypto-Lib.
-    Copyright (C) 2010 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/>.
-*/
-
-
-#ifndef BCALOFB_H_
-#define BCALOFB_H_
-
-#include <stdint.h>
-#include "bcal-basic.h"
-#include "blockcipher_descriptor.h"
-
-
-typedef struct{
-       bcdesc_t*    desc;
-       bcgen_ctx_t  cctx;
-       uint8_t*     in_block;
-       uint8_t      blocksize_B;
-} bcal_ofb_ctx_t;
-
-
-uint8_t bcal_ofb_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_ofb_ctx_t* ctx);
-void bcal_ofb_free(bcal_ofb_ctx_t* ctx);
-void bcal_ofb_loadIV(const void* iv, bcal_ofb_ctx_t* ctx);
-void bcal_ofb_encNext(void* block, bcal_ofb_ctx_t* ctx);
-void bcal_ofb_decNext(void* block, bcal_ofb_ctx_t* ctx);
-void bcal_ofb_encMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ofb_ctx_t* ctx);
-void bcal_ofb_decMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ofb_ctx_t* ctx);
-
-
-#endif /* BCALOFB_H_ */
diff --git a/bcal-performance.c b/bcal-performance.c
deleted file mode 100644 (file)
index 9ad15a9..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/* bcal-performance.c */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-
-/*
- * \file    bcal-performance.c
- * \author  Daniel Otte
- * \email   daniel.otte@rub.de
- * \date    2010-02-16
- * \license GPLv3 or later
- *
- */
-
-#include "bcal-performance.h"
-#include "keysize_descriptor.h"
-#include "blockcipher_descriptor.h"
-#include "performance_test.h"
-#include "cli.h"
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-static
-void printvalue(unsigned long v){
-       char str[20];
-       int i;
-       ultoa(v, str, 10);
-       for(i=0; i<10-strlen(str); ++i){
-               cli_putc(' ');
-       }
-       cli_putstr(str);
-}
-
-void bcal_performance(const bcdesc_t* bcd){
-       bcdesc_t bc;
-       memcpy(&bc, bcd, sizeof(bcdesc_t));
-       uint8_t ctx[bc.ctxsize_B];
-       uint8_t data[(bc.blocksize_b+7)/8];
-       uint16_t keysize = get_keysize(bc.valid_keysize_desc);
-       uint8_t key[(keysize+7)/8];
-       uint64_t t;
-       uint8_t i;
-
-       if(bc.type!=BCDESC_TYPE_BLOCKCIPHER)
-               return;
-       calibrateTimer();
-       print_overhead();
-       cli_putstr("\r\n\r\n === ");
-       cli_putstr(bc.name);
-       cli_putstr(" performance === "
-                  "\r\n    type:             blockcipher"
-                  "\r\n    keysize (bits):     ");
-       printvalue(keysize);
-
-       cli_putstr("\r\n    ctxsize (bytes):    ");
-       printvalue(bc.ctxsize_B);
-
-       cli_putstr("\r\n    blocksize (bits):   ");
-       printvalue(bc.blocksize_b);
-
-       t=0;
-       if(bc.init.init1){
-               if((bc.flags&BC_INIT_TYPE)==BC_INIT_TYPE_1){
-                       for(i=0; i<32; ++i){
-                               startTimer(0);
-                               START_TIMER;
-                               (bc.init.init1)(key, &ctx);
-                               STOP_TIMER;
-                               t += stopTimer();
-                               if(i!=31 && bc.free){
-                                       bc.free(&ctx);
-                               }
-                       }
-               } else {
-                       for(i=0; i<32; ++i){
-                               startTimer(0);
-                               START_TIMER;
-                               (bc.init.init2)(key, keysize, &ctx);
-                               STOP_TIMER;
-                               t += stopTimer();
-                               if(i!=31 && bc.free){
-                                       bc.free(&ctx);
-                               }
-                       }
-               }
-               t>>=5;
-               cli_putstr("\r\n    init (cycles):      ");
-               printvalue(t);
-       }
-
-       t=0;
-       for(i=0; i<32; ++i){
-               startTimer(0);
-               START_TIMER;
-               bc.enc.enc1(data, &ctx);
-               STOP_TIMER;
-               t += stopTimer();
-       }
-       t>>=5;
-       cli_putstr("\r\n    encrypt (cycles):   ");
-       printvalue(t);
-
-       t=0;
-       for(i=0; i<32; ++i){
-               startTimer(0);
-               START_TIMER;
-               bc.dec.dec1(data, &ctx);
-               STOP_TIMER;
-               t += stopTimer();
-       }
-       t>>=5;
-       cli_putstr("\r\n    decrypt (cycles):   ");
-       printvalue(t);
-
-       if(bc.free){
-               bc.free(&ctx);
-       }
-
-}
-
-
-void bcal_performance_multiple(const bcdesc_t** bcd_list){
-       const bcdesc_t* bcd;
-       for(;;){
-               bcd = *bcd_list;
-               if(!bcd){
-                       cli_putstr("\r\n\r\n End of performance figures\r\n");
-                       return;
-               }
-               bcal_performance(bcd++);
-               bcd_list++;
-       }
-}
diff --git a/bcal-performance.h b/bcal-performance.h
deleted file mode 100644 (file)
index b8c5666..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/* bcal-performance.h */
-/*
-    This file is part of the AVR-Crypto-Lib.
-    Copyright (C) 2010 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/>.
-*/
-
-/*
- * \file    bcal-performance.h
- * \author  Daniel Otte
- * \email   daniel.otte@rub.de
- * \date    2010-02-16
- * \license GPLv3 or later
- *
- */
-
-#ifndef BCAL_PERFORMANCE_H_
-#define BCAL_PERFORMANCE_H_
-
-#include "blockcipher_descriptor.h"
-
-void bcal_performance(const bcdesc_t* hd);
-void bcal_performance_multiple(const bcdesc_t** hd_list);
-
-
-#endif /* BCAL_PERFORMANCE_H_ */
diff --git a/bcal/bcal-basic.c b/bcal/bcal-basic.c
new file mode 100644 (file)
index 0000000..5cb5536
--- /dev/null
@@ -0,0 +1,92 @@
+/* bcal-basic.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include "blockcipher_descriptor.h"
+#include "keysize_descriptor.h"
+
+uint8_t bcal_cipher_init(const bcdesc_t* cipher_descriptor,
+                         const void* key, uint16_t keysize_b, bcgen_ctx_t* ctx){
+       if(!is_valid_keysize_P(cipher_descriptor->valid_keysize_desc, keysize_b)){
+               return 1;
+       }
+       uint8_t flags;
+       bc_init_fpt init_fpt;
+       ctx->desc_ptr = (bcdesc_t*)cipher_descriptor;
+       ctx->keysize  = keysize_b;
+       flags = cipher_descriptor->flags;
+       init_fpt.initvoid = (void_fpt)(cipher_descriptor->init.initvoid);
+       if(init_fpt.initvoid == NULL){
+               if(!(ctx->ctx = malloc((keysize_b+7)/8)))
+                       return 2;
+               memcpy(ctx->ctx, key, (keysize_b+7)/8);
+               return 0;
+       }
+       if(!(ctx->ctx = malloc(cipher_descriptor->ctxsize_B)))
+               return 3;
+       if((flags&BC_INIT_TYPE)==BC_INIT_TYPE_1){
+               init_fpt.init1((void*)key, (ctx->ctx));
+       }else{
+               init_fpt.init2((void*)key, keysize_b, (ctx->ctx));
+       }
+       return 0;
+}
+
+void bcal_cipher_free(bcgen_ctx_t* ctx){
+       if(!ctx)
+               return;
+       bc_free_fpt free_fpt;
+       free_fpt = (bc_free_fpt)(ctx->desc_ptr->free);
+       if(free_fpt)
+               free_fpt((ctx->ctx));
+       free(ctx->ctx);
+}
+
+void bcal_cipher_enc(void* block, const bcgen_ctx_t* ctx){
+       bc_enc_fpt enc_fpt;
+       enc_fpt.encvoid = (void_fpt)(ctx->desc_ptr->enc.encvoid);
+       if(!enc_fpt.encvoid){
+               /* very bad error, no enciphering function specified */
+               return;
+       }
+       enc_fpt.enc1(block, (ctx->ctx));
+       
+}
+
+void bcal_cipher_dec(void* block, const bcgen_ctx_t* ctx){
+       bc_dec_fpt dec_fpt;
+       dec_fpt.decvoid = (void_fpt)(ctx->desc_ptr->dec.decvoid);
+       if(!dec_fpt.decvoid){
+               /* very bad error, no deciphering function specified */
+               return;
+       }
+       dec_fpt.dec1(block, (ctx->ctx));
+}
+
+uint16_t bcal_cipher_getBlocksize_b(const bcdesc_t* desc){
+       return (desc->blocksize_b);
+}
+
+const void* bcal_cipher_getKeysizeDesc(const bcdesc_t* desc){
+       return (desc->valid_keysize_desc);
+}
+
+
diff --git a/bcal/bcal-basic.h b/bcal/bcal-basic.h
new file mode 100644 (file)
index 0000000..04165eb
--- /dev/null
@@ -0,0 +1,35 @@
+/* bcal-basic.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/>.
+*/
+
+#ifndef BCAL_BASIC_H_
+#define BCAL_BASIC_H_
+
+#include <stdlib.h>
+#include <stdint.h>
+#include "blockcipher_descriptor.h"
+#include "keysize_descriptor.h"
+
+uint8_t bcal_cipher_init(const bcdesc_t* cipher_descriptor,
+                         const void* key, uint16_t keysize_b, bcgen_ctx_t* ctx);
+void bcal_cipher_free(bcgen_ctx_t* ctx);
+void bcal_cipher_enc(void* block, const bcgen_ctx_t* ctx);
+void bcal_cipher_dec(void* block, const bcgen_ctx_t* ctx);
+uint16_t bcal_cipher_getBlocksize_b(const bcdesc_t* desc);
+const void* bcal_cipher_getKeysizeDesc(const bcdesc_t* desc);
+#endif /* BCAL_BASIC_H_ */
diff --git a/bcal/bcal-cbc.c b/bcal/bcal-cbc.c
new file mode 100644 (file)
index 0000000..a5181d4
--- /dev/null
@@ -0,0 +1,84 @@
+/* bcal-cbc.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+
+#include <stdint.h>
+#include <string.h>
+#include "bcal-cbc.h"
+#include "bcal-basic.h"
+#include "memxor/memxor.h"
+
+uint8_t bcal_cbc_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_cbc_ctx_t* ctx){
+       ctx->desc = (bcdesc_t*)desc;
+       ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
+       ctx->prev_block = malloc(ctx->blocksize_B);
+
+       if(ctx->prev_block==NULL){
+               return 0x11;
+       }
+       return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
+}
+
+void bcal_cbc_free(bcal_cbc_ctx_t* ctx){
+       bcal_cipher_free(&(ctx->cctx));
+       free(ctx->prev_block);
+}
+
+
+void bcal_cbc_loadIV(const void* iv, bcal_cbc_ctx_t* ctx){
+       if(iv){
+               memcpy(ctx->prev_block, iv, ctx->blocksize_B);
+       }
+}
+
+void bcal_cbc_encNext(void* block, bcal_cbc_ctx_t* ctx){
+       memxor(block, ctx->prev_block, ctx->blocksize_B);
+       bcal_cipher_enc(block, &(ctx->cctx));
+       memcpy(ctx->prev_block, block, ctx->blocksize_B);
+}
+
+void bcal_cbc_decNext(void* block, bcal_cbc_ctx_t* ctx){
+       uint8_t tmp[ctx->blocksize_B];
+       memcpy(tmp, block, ctx->blocksize_B);
+       bcal_cipher_dec(block, &(ctx->cctx));
+       memxor(block, ctx->prev_block, ctx->blocksize_B);
+       memcpy(ctx->prev_block, tmp, ctx->blocksize_B);
+}
+void bcal_cbc_decRand(void* block, const void* prev_block, bcal_cbc_ctx_t* ctx){
+       bcal_cipher_dec(block, &(ctx->cctx));
+       memxor(block, prev_block, ctx->blocksize_B);
+}
+
+void bcal_cbc_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ctx_t* ctx){
+       bcal_cbc_loadIV(iv, ctx);
+       while(msg_blocks--){
+               bcal_cbc_encNext(msg, ctx);
+               msg = (uint8_t*)msg + ctx->blocksize_B;
+       }
+}
+
+void bcal_cbc_decMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ctx_t* ctx){
+       msg=(uint8_t*)msg + (msg_blocks-1)*ctx->blocksize_B;
+       while(msg_blocks > 1){
+               bcal_cbc_decRand(msg, (uint8_t*)msg-ctx->blocksize_B, ctx);
+               msg_blocks -= 1;
+               msg=(uint8_t*)msg-ctx->blocksize_B;
+       }
+       bcal_cbc_decRand(msg, iv, ctx);
+}
+
diff --git a/bcal/bcal-cbc.h b/bcal/bcal-cbc.h
new file mode 100644 (file)
index 0000000..ba20186
--- /dev/null
@@ -0,0 +1,44 @@
+/* bcal-cbc.h */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2010 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/>.
+*/
+
+#ifndef BCALCBC_H_
+#define BCALCBC_H_
+
+#include <stdint.h>
+#include "blockcipher_descriptor.h"
+#include "bcal-basic.h"
+
+typedef struct{
+       bcdesc_t*    desc;
+       bcgen_ctx_t  cctx;
+       uint8_t*     prev_block;
+       uint8_t      blocksize_B;
+} bcal_cbc_ctx_t;
+
+uint8_t bcal_cbc_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_cbc_ctx_t* ctx);
+void bcal_cbc_free(bcal_cbc_ctx_t* ctx);
+void bcal_cbc_loadIV(const void* iv, bcal_cbc_ctx_t* ctx);
+void bcal_cbc_encNext(void* block, bcal_cbc_ctx_t* ctx);
+void bcal_cbc_decNext(void* block, bcal_cbc_ctx_t* ctx);
+void bcal_cbc_decRand(void* block, const void* prev_block, bcal_cbc_ctx_t* ctx);
+void bcal_cbc_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ctx_t* ctx);
+void bcal_cbc_decMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ctx_t* ctx);
+
+
+#endif /* BCALCBC_H_ */
diff --git a/bcal/bcal-cfb_bit.c b/bcal/bcal-cfb_bit.c
new file mode 100644 (file)
index 0000000..6ddb57f
--- /dev/null
@@ -0,0 +1,128 @@
+/* bcal-cfb_bit.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+
+
+#include <stdint.h>
+#include <string.h>
+#include "bcal-cfb_bit.h"
+#include "bcal-basic.h"
+
+static uint8_t read_bit(void* block, uint32_t index){
+       uint8_t r;
+       r=((uint8_t*)block)[index/8];
+       r=(r&(0x80>>(index&7)))?0xff:0x00;
+       return r;
+}
+
+static void write_bit(void* block, uint32_t index, uint8_t value){
+       if(value){
+               /* set bit */
+               ((uint8_t*)block)[index/8] |= 0x80>>(index&7);
+       }else{
+               /* clear bit */
+               ((uint8_t*)block)[index/8] &= ~(0x80>>(index&7));
+       }
+}
+
+uint8_t bcal_cfb_b_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_b_ctx_t* ctx){
+       ctx->desc = (bcdesc_t*)desc;
+       ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
+       ctx->in_block=malloc(ctx->blocksize_B);
+       if(ctx->in_block==NULL){
+               return 0x11;
+       }
+       if(size_b>bcal_cipher_getBlocksize_b(desc)){
+               return 0x12;
+       }
+       ctx->size_b = size_b;
+       return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
+}
+
+void bcal_cfb_b_free(bcal_cfb_b_ctx_t* ctx){
+       free(ctx->in_block);
+       bcal_cipher_free(&(ctx->cctx));
+}
+
+void bcal_cfb_b_loadIV(const void* iv, bcal_cfb_b_ctx_t* ctx){
+       if(iv){
+               memcpy(ctx->in_block, iv, ctx->blocksize_B);
+       }
+}
+
+void bcal_cfb_b_encNext(void* block, uint8_t offset, bcal_cfb_b_ctx_t* ctx){
+       uint8_t tmp[ctx->blocksize_B];
+       offset &= 7;
+       memcpy(tmp, ctx->in_block, ctx->blocksize_B);
+       bcal_cipher_enc(tmp, &(ctx->cctx));
+       uint16_t i,j;
+       uint8_t a;
+       for(i=0; i<ctx->blocksize_B*8-ctx->size_b; ++i){
+               a = read_bit(ctx->in_block, i+ctx->size_b);
+               write_bit(ctx->in_block, i, a);
+       }
+       for(j=offset,i=0; i<ctx->size_b; ++i, ++j){
+               a = read_bit(tmp, i) ^ read_bit(block, j);
+               write_bit(ctx->in_block, ctx->blocksize_B*8-ctx->size_b+i, a);
+               write_bit(block, j, a);
+       }
+}
+
+void bcal_cfb_b_decNext(void* block, uint8_t offset, bcal_cfb_b_ctx_t* ctx){
+       uint8_t tmp[ctx->blocksize_B];
+       offset &= 7;
+       memcpy(tmp, ctx->in_block, ctx->blocksize_B);
+       bcal_cipher_enc(tmp, &(ctx->cctx));
+       uint16_t i,j;
+       uint8_t a,b;
+       for(i=0; i<ctx->blocksize_B*8-ctx->size_b; ++i){
+               a = read_bit(ctx->in_block, i+ctx->size_b);
+               write_bit(ctx->in_block, i, a);
+       }
+       for(j=offset,i=0; i<ctx->size_b; ++i, ++j){
+               a = read_bit(tmp, i);
+               b = read_bit(block, j);
+               a ^= b;
+               write_bit(ctx->in_block, ctx->blocksize_B*8-ctx->size_b+i, b);
+               write_bit(block, j, a);
+       }
+}
+
+void bcal_cfb_b_encMsg(const void* iv, void* msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t* ctx){
+       bcal_cfb_b_loadIV(iv, ctx);
+       uint64_t addr;
+       addr = ((uint32_t)msg)*8+offset;
+       while(msg_blocks--){
+               msg = (void*)((uint32_t)(addr/8));
+               offset = addr&7;
+               bcal_cfb_b_encNext(msg, offset, ctx);
+               addr += ctx->size_b;
+       }
+}
+
+void bcal_cfb_b_decMsg(const void* iv, void* msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t* ctx){
+       bcal_cfb_b_loadIV(iv, ctx);
+       uint64_t addr;
+       addr = ((uint32_t)msg)*8+offset;
+       while(msg_blocks--){
+               msg = (void*)((uint32_t)(addr/8));
+               offset = addr&7;
+               bcal_cfb_b_decNext(msg, offset, ctx);
+               addr += ctx->size_b;
+       }
+}
diff --git a/bcal/bcal-cfb_bit.h b/bcal/bcal-cfb_bit.h
new file mode 100644 (file)
index 0000000..df62e17
--- /dev/null
@@ -0,0 +1,47 @@
+/* bcal-cfb_bit.h */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2010 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/>.
+*/
+
+
+#ifndef BCALCFB_BIT_H_
+#define BCALCFB_BIT_H_
+
+#include <stdint.h>
+#include "bcal-basic.h"
+#include "blockcipher_descriptor.h"
+
+
+typedef struct{
+       bcdesc_t*    desc;
+       bcgen_ctx_t  cctx;
+       uint8_t*     in_block;
+       uint8_t      blocksize_B;
+       uint16_t     size_b;
+} bcal_cfb_b_ctx_t;
+
+
+uint8_t bcal_cfb_b_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_b_ctx_t* ctx);
+void bcal_cfb_b_free(bcal_cfb_b_ctx_t* ctx);
+void bcal_cfb_b_loadIV(const void* iv, bcal_cfb_b_ctx_t* ctx);
+void bcal_cfb_b_encNext(void* block, uint8_t offset, bcal_cfb_b_ctx_t* ctx);
+void bcal_cfb_b_decNext(void* block, uint8_t offset, bcal_cfb_b_ctx_t* ctx);
+void bcal_cfb_b_encMsg(const void* iv, void* msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t* ctx);
+void bcal_cfb_b_decMsg(const void* iv, void* msg, uint8_t offset, uint32_t msg_blocks, bcal_cfb_b_ctx_t* ctx);
+
+
+#endif /* BCALCFB_BIT_H_ */
diff --git a/bcal/bcal-cfb_byte.c b/bcal/bcal-cfb_byte.c
new file mode 100644 (file)
index 0000000..36e2ecc
--- /dev/null
@@ -0,0 +1,88 @@
+/* bcal-cfb_byte.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+
+
+#include <stdint.h>
+#include <string.h>
+#include "bcal-cfb_byte.h"
+#include "bcal-basic.h"
+#include "memxor/memxor.h"
+
+
+uint8_t bcal_cfb_B_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_B_ctx_t* ctx){
+       ctx->desc = (bcdesc_t*)desc;
+       ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
+       ctx->in_block=malloc(ctx->blocksize_B);
+       if(ctx->in_block==NULL){
+                       return 0x11;
+       }
+       if(size_b&7){
+               return 0x12;
+       }
+       ctx->size_B = size_b/8;
+       return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
+}
+
+void bcal_cfb_B_free(bcal_cfb_B_ctx_t* ctx){
+       free(ctx->in_block);
+       bcal_cipher_free(&(ctx->cctx));
+}
+
+void bcal_cfb_B_loadIV(const void* iv, bcal_cfb_B_ctx_t* ctx){
+       if(iv){
+               memcpy(ctx->in_block, iv, ctx->blocksize_B);
+       }
+}
+
+void bcal_cfb_B_encNext(void* block, bcal_cfb_B_ctx_t* ctx){
+       uint8_t tmp[ctx->blocksize_B];
+       memcpy(tmp, ctx->in_block, ctx->blocksize_B);
+       bcal_cipher_enc(tmp, &(ctx->cctx));
+       memxor(block, tmp, ctx->size_B);
+       memmove(ctx->in_block, ctx->in_block+ctx->size_B, ctx->blocksize_B - ctx->size_B);
+       memcpy(ctx->in_block+ctx->blocksize_B-ctx->size_B, block, ctx->size_B);
+}
+
+void bcal_cfb_B_decNext(void* block, bcal_cfb_B_ctx_t* ctx){
+       uint8_t tmp[ctx->blocksize_B];
+       uint8_t xblock[ctx->size_B];
+       memcpy(xblock, block, ctx->size_B);
+       memcpy(tmp, ctx->in_block, ctx->blocksize_B);
+       bcal_cipher_enc(tmp, &(ctx->cctx));
+       memxor(block, tmp, ctx->size_B);
+       memmove(ctx->in_block, ctx->in_block+ctx->size_B, ctx->blocksize_B - ctx->size_B);
+       memcpy(ctx->in_block+ctx->blocksize_B-ctx->size_B, xblock, ctx->size_B);
+}
+
+void bcal_cfb_B_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t* ctx){
+       bcal_cfb_B_loadIV(iv, ctx);
+       while(msg_blocks--){
+               bcal_cfb_B_encNext(msg, ctx);
+               msg = (uint8_t*)msg+ctx->size_B;
+       }
+}
+
+void bcal_cfb_B_decMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t* ctx){
+       bcal_cfb_B_loadIV(iv, ctx);
+               while(msg_blocks--){
+                       bcal_cfb_B_decNext(msg, ctx);
+                       msg = (uint8_t*)msg+ctx->size_B;
+               }
+}
+
diff --git a/bcal/bcal-cfb_byte.h b/bcal/bcal-cfb_byte.h
new file mode 100644 (file)
index 0000000..276a904
--- /dev/null
@@ -0,0 +1,46 @@
+/* bcal-cbc.h */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2010 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/>.
+*/
+
+#ifndef BCALCFB_BYTE_H_
+#define BCALCFB_BYTE_H_
+
+#include <stdint.h>
+#include "bcal-basic.h"
+#include "blockcipher_descriptor.h"
+
+
+typedef struct{
+       bcdesc_t*    desc;
+       bcgen_ctx_t  cctx;
+       uint8_t*     in_block;
+       uint8_t      blocksize_B;
+       uint8_t      size_B;
+} bcal_cfb_B_ctx_t;
+
+
+uint8_t bcal_cfb_B_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, uint16_t size_b, bcal_cfb_B_ctx_t* ctx);
+void bcal_cfb_B_free(bcal_cfb_B_ctx_t* ctx);
+void bcal_cfb_B_loadIV(const void* iv, bcal_cfb_B_ctx_t* ctx);
+void bcal_cfb_B_encNext(void* block, bcal_cfb_B_ctx_t* ctx);
+void bcal_cfb_B_decNext(void* block, bcal_cfb_B_ctx_t* ctx);
+void bcal_cfb_B_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t* ctx);
+void bcal_cfb_B_decMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cfb_B_ctx_t* ctx);
+
+
+#endif /* BCALCFB_BYTE_H_ */
diff --git a/bcal/bcal-cmac.c b/bcal/bcal-cmac.c
new file mode 100644 (file)
index 0000000..f9aa086
--- /dev/null
@@ -0,0 +1,152 @@
+/* bcal-omac.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+
+
+#include <stdint.h>
+#include <string.h>
+#include "bcal-basic.h"
+#include "bcal-cmac.h"
+#include "memxor/memxor.h"
+
+
+static uint8_t left_shift_be_block(void* block, uint8_t blocksize_B){
+       uint8_t c1=0, c2;
+       do{
+               --blocksize_B;
+               c2 = (((uint8_t*)block)[blocksize_B])>>7;
+               (((uint8_t*)block)[blocksize_B]) <<= 1;
+               (((uint8_t*)block)[blocksize_B]) |= c1;
+               c1 = c2;
+       }while(blocksize_B);
+       return c1;
+}
+
+static const uint8_t const_128 = 0x87;
+static const uint8_t const_64  = 0x1b;
+
+uint8_t bcal_cmac_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_cmac_ctx_t* ctx){
+       uint8_t r;
+       ctx->desc = (bcdesc_t*)desc;
+       ctx->blocksize_B = bcal_cipher_getBlocksize_b(desc)/8;
+       if (ctx->blocksize_B!=128/8 && ctx->blocksize_B!=64/8){
+               return 0x13;
+       }
+       ctx->accu = malloc(ctx->blocksize_B);
+       if(ctx->accu==NULL){
+               return 0x14;
+       }
+       ctx->k1 = malloc(ctx->blocksize_B);
+       if(ctx->k1==NULL){
+               return 0x15;
+       }
+       ctx->k2 = malloc(ctx->blocksize_B);
+       if(ctx->k2==NULL){
+               return 0x16;
+       }
+       ctx->lastblock = malloc(ctx->blocksize_B);
+       if(ctx->lastblock==NULL){
+               return 0x17;
+       }
+       r = bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
+       if(r){
+               return r;
+       }
+       if(ctx->blocksize_B==128/8){
+               r = const_128;
+       }else{
+               r = const_64;
+       }
+       /* subkey computation */
+       memset(ctx->accu, 0x00, ctx->blocksize_B);
+       memset(ctx->k1, 0x00, ctx->blocksize_B);
+       bcal_cipher_enc(ctx->k1, &(ctx->cctx));
+       if(left_shift_be_block(ctx->k1, ctx->blocksize_B)){
+               ctx->k1[ctx->blocksize_B-1] ^= r;
+       }
+       memcpy(ctx->k2, ctx->k1, ctx->blocksize_B);
+       if(left_shift_be_block(ctx->k2, ctx->blocksize_B)){
+               ctx->k2[ctx->blocksize_B-1] ^= r;
+       }
+       ctx->last_set=0;
+       return 0;
+}
+
+void bcal_cmac_free(bcal_cmac_ctx_t* ctx){
+       free(ctx->accu);
+       free(ctx->k1);
+       free(ctx->k2);
+       bcal_cipher_free(&(ctx->cctx));
+}
+
+void bcal_cmac_nextBlock (bcal_cmac_ctx_t* ctx, const void* block){
+       if(ctx->last_set){
+               memxor(ctx->accu, ctx->lastblock, ctx->blocksize_B);
+               bcal_cipher_enc(ctx->accu, &(ctx->cctx));
+       }
+       memcpy(ctx->lastblock, block, ctx->blocksize_B);
+       ctx->last_set=1;
+}
+
+
+void bcal_cmac_lastBlock(bcal_cmac_ctx_t* ctx, const void* block, uint16_t length_b){
+       uint16_t blocksize_b;
+       blocksize_b = ctx->blocksize_B*8;
+       while(length_b>=blocksize_b){
+               bcal_cmac_nextBlock(ctx, block);
+               block = (uint8_t*)block + ctx->blocksize_B;
+               length_b -= blocksize_b;
+       }
+       if(ctx->last_set==0){
+               memxor(ctx->accu, block, (length_b+7)/8);
+               memxor(ctx->accu, ctx->k2, ctx->blocksize_B);
+               ctx->accu[length_b/8] ^= 0x80>>(length_b&7);
+       }else{
+               if(length_b==0){
+                       memxor(ctx->accu, ctx->lastblock, ctx->blocksize_B);
+                       memxor(ctx->accu, ctx->k1, ctx->blocksize_B);
+               }else{
+                       memxor(ctx->accu, ctx->lastblock, ctx->blocksize_B);
+                       bcal_cipher_enc(ctx->accu, &(ctx->cctx));
+                       memxor(ctx->accu, block, (length_b+7)/8);
+                       memxor(ctx->accu, ctx->k2, ctx->blocksize_B);
+                       ctx->accu[length_b/8] ^= 0x80>>(length_b&7);
+               }
+       }
+       bcal_cipher_enc(ctx->accu, &(ctx->cctx));
+}
+
+void bcal_cmac_ctx2mac(void* dest, uint16_t length_b, const bcal_cmac_ctx_t* ctx){
+       memcpy(dest, ctx->accu, length_b/8);
+       if(length_b&7){
+               ((uint8_t*)dest)[length_b/8] &= 0xff>>(length_b&7);
+               ((uint8_t*)dest)[length_b/8] |= (0xff00>>(length_b&7))&(ctx->accu[length_b/8]);
+       }
+}
+
+void bcal_cmac(void* dest, uint16_t out_length_b, const void* block, uint32_t length_b, bcal_cmac_ctx_t* ctx){
+       uint16_t blocksize_b;
+       blocksize_b = ctx->blocksize_B*8;
+       while(length_b>blocksize_b){
+               bcal_cmac_nextBlock(ctx, block);
+               block = (uint8_t*)block + ctx->blocksize_B;
+               length_b -= blocksize_b;
+       }
+       bcal_cmac_lastBlock(ctx, block, length_b);
+       bcal_cmac_ctx2mac(dest, out_length_b, ctx);
+}
diff --git a/bcal/bcal-cmac.h b/bcal/bcal-cmac.h
new file mode 100644 (file)
index 0000000..be699b6
--- /dev/null
@@ -0,0 +1,45 @@
+/* bcal-cmac.h */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2010 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/>.
+*/
+
+#ifndef BCALCMAC_H_
+#define BCALCMAC_H_
+
+#include <stdint.h>
+#include "bcal-basic.h"
+#include "blockcipher_descriptor.h"
+
+typedef struct{
+       bcdesc_t*    desc;
+       bcgen_ctx_t  cctx;
+       uint8_t*     accu;
+       uint8_t*     k1;
+       uint8_t*     k2;
+       uint8_t*     lastblock;
+       uint8_t      last_set;
+       uint8_t      blocksize_B;
+} bcal_cmac_ctx_t;
+
+uint8_t bcal_cmac_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_cmac_ctx_t* ctx);
+void bcal_cmac_free(bcal_cmac_ctx_t* ctx);
+void bcal_cmac_nextBlock(bcal_cmac_ctx_t* ctx, const void* block);
+void bcal_cmac_lastBlock(bcal_cmac_ctx_t* ctx, const void* block, uint16_t length_b);
+void bcal_cmac_ctx2mac(void* dest, uint16_t length_b, const bcal_cmac_ctx_t* ctx);
+void bcal_cmac(void* dest, uint16_t out_length_b, const void* block, uint32_t length_b, bcal_cmac_ctx_t* ctx);
+
+#endif /* BCALCMAC_H_ */
diff --git a/bcal/bcal-ctr.c b/bcal/bcal-ctr.c
new file mode 100644 (file)
index 0000000..7b73594
--- /dev/null
@@ -0,0 +1,95 @@
+/* bcal-ctr.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+
+
+#include <stdint.h>
+#include <string.h>
+#include "bcal-basic.h"
+#include "bcal-ctr.h"
+#include "memxor/memxor.h"
+
+static void increment_be(void* block, uint8_t size_B){
+       uint16_t c=1;
+       do{
+               --size_B;
+               c += ((uint8_t*)block)[size_B];
+               ((uint8_t*)block)[size_B] = (uint8_t)c;
+               c>>=8;
+       }while(size_B);
+}
+
+uint8_t bcal_ctr_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, inc_fp_t inc_func, bcal_ctr_ctx_t* ctx){
+       ctx->desc = (bcdesc_t*)desc;
+       if(inc_func){
+               ctx->inc_func = inc_func;
+       }else{
+               ctx->inc_func = increment_be;
+       }
+       ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
+       ctx->in_block=malloc(ctx->blocksize_B);
+       if(ctx->in_block==NULL){
+                       return 0x11;
+       }
+       return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
+}
+
+void bcal_ctr_free(bcal_ctr_ctx_t* ctx){
+       free(ctx->in_block);
+       bcal_cipher_free(&(ctx->cctx));
+}
+
+void bcal_ctr_loadIV(const void* iv, bcal_ctr_ctx_t* ctx){
+       if(iv){
+               memcpy(ctx->in_block, iv, ctx->blocksize_B);
+       }
+}
+
+void bcal_ctr_encNext(void* block, bcal_ctr_ctx_t* ctx){
+       uint8_t tmp[ctx->blocksize_B];
+       memcpy(tmp, ctx->in_block, ctx->blocksize_B);
+       bcal_cipher_enc(tmp, &(ctx->cctx));
+       memxor(block, tmp, ctx->blocksize_B);
+       ctx->inc_func(ctx->in_block, ctx->blocksize_B);
+}
+
+void bcal_ctr_decNext(void* block, bcal_ctr_ctx_t* ctx){
+       bcal_ctr_encNext(block, ctx);
+}
+
+void bcal_ctr_encMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ctr_ctx_t* ctx){
+       bcal_ctr_loadIV(iv, ctx);
+       uint16_t blocksize_b;
+       blocksize_b = ctx->blocksize_B*8;
+       while(msg_len_b>blocksize_b){
+               bcal_ctr_encNext(msg, ctx);
+               msg_len_b -= blocksize_b;
+               msg = (uint8_t*)msg + ctx->blocksize_B;
+       }
+       uint8_t tmp[ctx->blocksize_B];
+       memcpy(tmp, ctx->in_block, ctx->blocksize_B);
+       bcal_cipher_enc(tmp, &(ctx->cctx));
+       ctx->inc_func(ctx->in_block, ctx->blocksize_B);
+       tmp[msg_len_b/8] = 0xff00>>(msg_len_b&7);
+       memxor(msg, tmp, (msg_len_b+7)/8);
+}
+
+void bcal_ctr_decMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ctr_ctx_t* ctx){
+       bcal_ctr_encMsg(iv, msg, msg_len_b, ctx);
+}
+
diff --git a/bcal/bcal-ctr.h b/bcal/bcal-ctr.h
new file mode 100644 (file)
index 0000000..55de485
--- /dev/null
@@ -0,0 +1,45 @@
+/* bcal-ctr.h */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2010 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/>.
+*/
+
+#ifndef BCALCTR_H_
+#define BCALCTR_H_
+
+#include <stdint.h>
+#include "bcal-basic.h"
+#include "blockcipher_descriptor.h"
+
+typedef void(*inc_fp_t)(void* block, uint8_t size_B);
+
+typedef struct{
+       bcdesc_t*    desc;
+       bcgen_ctx_t  cctx;
+       uint8_t*     in_block;
+       inc_fp_t     inc_func;
+       uint8_t      blocksize_B;
+} bcal_ctr_ctx_t;
+
+uint8_t bcal_ctr_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, inc_fp_t inc_func, bcal_ctr_ctx_t* ctx);
+void bcal_ctr_free(bcal_ctr_ctx_t* ctx);
+void bcal_ctr_loadIV(const void* iv, bcal_ctr_ctx_t* ctx);
+void bcal_ctr_encNext(void* block, bcal_ctr_ctx_t* ctx);
+void bcal_ctr_decNext(void* block, bcal_ctr_ctx_t* ctx);
+void bcal_ctr_encMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ctr_ctx_t* ctx);
+void bcal_ctr_decMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ctr_ctx_t* ctx);
+
+#endif /* BCALCTR_H_ */
diff --git a/bcal/bcal-eax.c b/bcal/bcal-eax.c
new file mode 100644 (file)
index 0000000..e7b61f7
--- /dev/null
@@ -0,0 +1,119 @@
+/* bca-eax.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+
+
+#include <stdint.h>
+#include "bcal-basic.h"
+#include "blockcipher_descriptor.h"
+#include "bcal-cmac.h"
+#include "bcal-ctr.h"
+#include "bcal-eax.h"
+#include "memxor/memxor.h"
+
+uint8_t bcal_eax_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_eax_ctx_t* ctx){
+       uint8_t r;
+       ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
+       ctx->nonce = malloc(ctx->blocksize_B);
+       if(ctx->nonce==NULL){
+               return 0x81;
+       }
+       r = bcal_cmac_init(desc, key, keysize_b, &(ctx->ctag));
+       if(r){
+               return r;
+       }
+       r = bcal_cmac_init(desc, key, keysize_b, &(ctx->htag));
+       if(r){
+               return (r|0x10);
+       }
+       r = bcal_cmac_init(desc, key, keysize_b, &(ctx->ntag));
+       if(r){
+               return (r|0x20);
+       }
+       r = bcal_ctr_init(desc, key, keysize_b, NULL, &(ctx->cipher));
+       if(r){
+               return (r|0x30);
+       }
+       ctx->header_set=0;
+       uint8_t tmp[ctx->blocksize_B];
+       memset(tmp, 0, ctx->blocksize_B);
+       bcal_cmac_nextBlock(&(ctx->ntag), tmp);
+       tmp[ctx->blocksize_B-1]=1;
+       bcal_cmac_nextBlock(&(ctx->htag), tmp);
+       tmp[ctx->blocksize_B-1]=2;
+       bcal_cmac_nextBlock(&(ctx->ctag), tmp);
+       return 0;
+}
+
+void bcal_eax_free(bcal_eax_ctx_t* ctx){
+       bcal_ctr_free(&(ctx->cipher));
+       bcal_cmac_free(&(ctx->ctag));
+       bcal_cmac_free(&(ctx->htag));
+       bcal_cmac_free(&(ctx->ntag));
+       free(ctx->nonce);
+}
+
+void bcal_eax_loadNonce(const void* nonce, uint16_t length_b, bcal_eax_ctx_t* ctx){
+       bcal_cmac_lastBlock(&(ctx->ntag), nonce, length_b);
+       bcal_cmac_ctx2mac(ctx->nonce, ctx->blocksize_B*8, &(ctx->ntag));
+       bcal_ctr_loadIV(ctx->nonce, &(ctx->cipher));
+}
+
+void bcal_eax_addNextHeader(const void* header, bcal_eax_ctx_t* ctx){
+       bcal_cmac_nextBlock(&(ctx->htag), header);
+}
+
+void bcal_eax_addLastHeader(const void* header, uint16_t length_b, bcal_eax_ctx_t* ctx){
+       bcal_cmac_lastBlock(&(ctx->htag), header, length_b);
+       ctx->header_set = 1;
+}
+
+void bcal_eax_encNextBlock(void* block, bcal_eax_ctx_t* ctx){
+       bcal_ctr_encNext(block, &(ctx->cipher));
+       bcal_cmac_nextBlock(&(ctx->ctag), block);
+}
+
+void bcal_eax_encLastBlock(void* block, uint16_t length_b, bcal_eax_ctx_t* ctx){
+       bcal_ctr_encMsg(NULL, block, length_b, &(ctx->cipher));
+       bcal_cmac_lastBlock(&(ctx->ctag), block, length_b);
+}
+
+void bcal_eax_decNextBlock(void* block, bcal_eax_ctx_t* ctx){
+       bcal_cmac_nextBlock(&(ctx->ctag), block);
+       bcal_ctr_decNext(block, &(ctx->cipher));
+}
+
+void bcal_eax_decLastBlock(void* block, uint16_t length_b, bcal_eax_ctx_t* ctx){
+       bcal_cmac_lastBlock(&(ctx->ctag), block, length_b);
+       bcal_ctr_decMsg(NULL, block, length_b, &(ctx->cipher));
+}
+
+void bcal_eax_ctx2tag(void* dest, uint16_t length_b, bcal_eax_ctx_t* ctx){
+       uint8_t tmp[ctx->blocksize_B];
+       if(ctx->header_set==0){
+               bcal_cmac_lastBlock(&(ctx->htag), NULL, 0);
+       }
+
+       bcal_cmac_ctx2mac(tmp, ctx->blocksize_B*8, &(ctx->htag));
+       memxor(ctx->nonce, tmp, ctx->blocksize_B);
+
+       bcal_cmac_ctx2mac(tmp, ctx->blocksize_B*8, &(ctx->ctag));
+       memxor(ctx->nonce, tmp, ctx->blocksize_B);
+       memcpy(dest, ctx->nonce, (length_b+7)/8);
+}
+
diff --git a/bcal/bcal-eax.h b/bcal/bcal-eax.h
new file mode 100644 (file)
index 0000000..190eee9
--- /dev/null
@@ -0,0 +1,53 @@
+/* bcal-eax.h */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2010 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/>.
+*/
+
+#ifndef BCALEAX_H_
+#define BCALEAX_H_
+
+#include <stdint.h>
+#include <string.h>
+#include "bcal-basic.h"
+#include "blockcipher_descriptor.h"
+#include "bcal-cmac.h"
+#include "bcal-ctr.h"
+
+typedef struct{
+       uint8_t*        nonce;
+       bcal_cmac_ctx_t ntag;
+       bcal_cmac_ctx_t ctag;
+       bcal_cmac_ctx_t htag;
+       bcal_ctr_ctx_t  cipher;
+       uint8_t         blocksize_B;
+       uint8_t         header_set;
+} bcal_eax_ctx_t;
+
+uint8_t bcal_eax_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_eax_ctx_t* ctx);
+void bcal_eax_free(bcal_eax_ctx_t* ctx);
+void bcal_eax_loadNonce(const void* nonce, uint16_t length_b, bcal_eax_ctx_t* ctx);
+void bcal_eax_addNextHeader(const void* header, bcal_eax_ctx_t* ctx);
+void bcal_eax_addLastHeader(const void* header, uint16_t length_b, bcal_eax_ctx_t* ctx);
+void bcal_eax_encNextBlock(void* block, bcal_eax_ctx_t* ctx);
+void bcal_eax_encLastBlock(void* block, uint16_t length_b, bcal_eax_ctx_t* ctx);
+void bcal_eax_decNextBlock(void* block, bcal_eax_ctx_t* ctx);
+void bcal_eax_decLastBlock(void* block, uint16_t length_b, bcal_eax_ctx_t* ctx);
+void bcal_eax_ctx2tag(void* dest, uint16_t length_b, bcal_eax_ctx_t* ctx);
+//void bcal_eax(void* dest, uint16_t out_length_b, const void* block, uint32_t length_b, bcal_eax_ctx_t* ctx);
+
+#endif /* BCALEAX_H_ */
+
diff --git a/bcal/bcal-ofb.c b/bcal/bcal-ofb.c
new file mode 100644 (file)
index 0000000..059515f
--- /dev/null
@@ -0,0 +1,76 @@
+/* bcal-ofb.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+
+#include <stdint.h>
+#include <string.h>
+#include "bcal-ofb.h"
+#include "bcal-basic.h"
+#include "memxor/memxor.h"
+
+
+uint8_t bcal_ofb_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_ofb_ctx_t* ctx){
+       ctx->desc = (bcdesc_t*)desc;
+       ctx->blocksize_B = (bcal_cipher_getBlocksize_b(desc)+7)/8;
+       ctx->in_block=malloc(ctx->blocksize_B);
+       if(ctx->in_block==NULL){
+                       return 0x11;
+       }
+       return bcal_cipher_init(desc, key, keysize_b, &(ctx->cctx));
+}
+
+void bcal_ofb_free(bcal_ofb_ctx_t* ctx){
+       free(ctx->in_block);
+       bcal_cipher_free(&(ctx->cctx));
+}
+
+void bcal_ofb_loadIV(const void* iv, bcal_ofb_ctx_t* ctx){
+       if(iv){
+               memcpy(ctx->in_block, iv, ctx->blocksize_B);
+       }
+}
+
+void bcal_ofb_encNext(void* block, bcal_ofb_ctx_t* ctx){
+       bcal_cipher_enc(ctx->in_block , &(ctx->cctx));
+       memxor(block, ctx->in_block, ctx->blocksize_B);
+}
+
+void bcal_ofb_decNext(void* block, bcal_ofb_ctx_t* ctx){
+       bcal_cipher_enc(ctx->in_block , &(ctx->cctx));
+       memxor(block, ctx->in_block, ctx->blocksize_B);
+}
+
+
+void bcal_ofb_encMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ofb_ctx_t* ctx){
+       uint16_t block_len_b;
+       block_len_b = ctx->blocksize_B*8;
+       bcal_ofb_loadIV(iv, ctx);
+       while(msg_len_b>block_len_b){
+               bcal_ofb_encNext(msg, ctx);
+               msg_len_b -= block_len_b;
+               msg = (uint8_t*)msg + ctx->blocksize_B;
+       }
+       bcal_cipher_enc(ctx->in_block, &(ctx->cctx));
+       ctx->in_block[msg_len_b/8] = 0xff00>>(msg_len_b&7);
+       memxor(msg, ctx->in_block, (msg_len_b+7)/8);
+}
+
+void bcal_ofb_decMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ofb_ctx_t* ctx){
+       bcal_ofb_encMsg(iv, msg, msg_len_b, ctx);
+}
+
diff --git a/bcal/bcal-ofb.h b/bcal/bcal-ofb.h
new file mode 100644 (file)
index 0000000..aa69c05
--- /dev/null
@@ -0,0 +1,46 @@
+/* bcal-ofb.h */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2010 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/>.
+*/
+
+
+#ifndef BCALOFB_H_
+#define BCALOFB_H_
+
+#include <stdint.h>
+#include "bcal-basic.h"
+#include "blockcipher_descriptor.h"
+
+
+typedef struct{
+       bcdesc_t*    desc;
+       bcgen_ctx_t  cctx;
+       uint8_t*     in_block;
+       uint8_t      blocksize_B;
+} bcal_ofb_ctx_t;
+
+
+uint8_t bcal_ofb_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_ofb_ctx_t* ctx);
+void bcal_ofb_free(bcal_ofb_ctx_t* ctx);
+void bcal_ofb_loadIV(const void* iv, bcal_ofb_ctx_t* ctx);
+void bcal_ofb_encNext(void* block, bcal_ofb_ctx_t* ctx);
+void bcal_ofb_decNext(void* block, bcal_ofb_ctx_t* ctx);
+void bcal_ofb_encMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ofb_ctx_t* ctx);
+void bcal_ofb_decMsg(const void* iv, void* msg, uint32_t msg_len_b, bcal_ofb_ctx_t* ctx);
+
+
+#endif /* BCALOFB_H_ */
diff --git a/bcal/bcal-performance.c b/bcal/bcal-performance.c
new file mode 100644 (file)
index 0000000..9ad15a9
--- /dev/null
@@ -0,0 +1,149 @@
+/* bcal-performance.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+
+/*
+ * \file    bcal-performance.c
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2010-02-16
+ * \license GPLv3 or later
+ *
+ */
+
+#include "bcal-performance.h"
+#include "keysize_descriptor.h"
+#include "blockcipher_descriptor.h"
+#include "performance_test.h"
+#include "cli.h"
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+static
+void printvalue(unsigned long v){
+       char str[20];
+       int i;
+       ultoa(v, str, 10);
+       for(i=0; i<10-strlen(str); ++i){
+               cli_putc(' ');
+       }
+       cli_putstr(str);
+}
+
+void bcal_performance(const bcdesc_t* bcd){
+       bcdesc_t bc;
+       memcpy(&bc, bcd, sizeof(bcdesc_t));
+       uint8_t ctx[bc.ctxsize_B];
+       uint8_t data[(bc.blocksize_b+7)/8];
+       uint16_t keysize = get_keysize(bc.valid_keysize_desc);
+       uint8_t key[(keysize+7)/8];
+       uint64_t t;
+       uint8_t i;
+
+       if(bc.type!=BCDESC_TYPE_BLOCKCIPHER)
+               return;
+       calibrateTimer();
+       print_overhead();
+       cli_putstr("\r\n\r\n === ");
+       cli_putstr(bc.name);
+       cli_putstr(" performance === "
+                  "\r\n    type:             blockcipher"
+                  "\r\n    keysize (bits):     ");
+       printvalue(keysize);
+
+       cli_putstr("\r\n    ctxsize (bytes):    ");
+       printvalue(bc.ctxsize_B);
+
+       cli_putstr("\r\n    blocksize (bits):   ");
+       printvalue(bc.blocksize_b);
+
+       t=0;
+       if(bc.init.init1){
+               if((bc.flags&BC_INIT_TYPE)==BC_INIT_TYPE_1){
+                       for(i=0; i<32; ++i){
+                               startTimer(0);
+                               START_TIMER;
+                               (bc.init.init1)(key, &ctx);
+                               STOP_TIMER;
+                               t += stopTimer();
+                               if(i!=31 && bc.free){
+                                       bc.free(&ctx);
+                               }
+                       }
+               } else {
+                       for(i=0; i<32; ++i){
+                               startTimer(0);
+                               START_TIMER;
+                               (bc.init.init2)(key, keysize, &ctx);
+                               STOP_TIMER;
+                               t += stopTimer();
+                               if(i!=31 && bc.free){
+                                       bc.free(&ctx);
+                               }
+                       }
+               }
+               t>>=5;
+               cli_putstr("\r\n    init (cycles):      ");
+               printvalue(t);
+       }
+
+       t=0;
+       for(i=0; i<32; ++i){
+               startTimer(0);
+               START_TIMER;
+               bc.enc.enc1(data, &ctx);
+               STOP_TIMER;
+               t += stopTimer();
+       }
+       t>>=5;
+       cli_putstr("\r\n    encrypt (cycles):   ");
+       printvalue(t);
+
+       t=0;
+       for(i=0; i<32; ++i){
+               startTimer(0);
+               START_TIMER;
+               bc.dec.dec1(data, &ctx);
+               STOP_TIMER;
+               t += stopTimer();
+       }
+       t>>=5;
+       cli_putstr("\r\n    decrypt (cycles):   ");
+       printvalue(t);
+
+       if(bc.free){
+               bc.free(&ctx);
+       }
+
+}
+
+
+void bcal_performance_multiple(const bcdesc_t** bcd_list){
+       const bcdesc_t* bcd;
+       for(;;){
+               bcd = *bcd_list;
+               if(!bcd){
+                       cli_putstr("\r\n\r\n End of performance figures\r\n");
+                       return;
+               }
+               bcal_performance(bcd++);
+               bcd_list++;
+       }
+}
diff --git a/bcal/bcal-performance.h b/bcal/bcal-performance.h
new file mode 100644 (file)
index 0000000..b8c5666
--- /dev/null
@@ -0,0 +1,38 @@
+/* bcal-performance.h */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2010 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/>.
+*/
+
+/*
+ * \file    bcal-performance.h
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2010-02-16
+ * \license GPLv3 or later
+ *
+ */
+
+#ifndef BCAL_PERFORMANCE_H_
+#define BCAL_PERFORMANCE_H_
+
+#include "blockcipher_descriptor.h"
+
+void bcal_performance(const bcdesc_t* hd);
+void bcal_performance_multiple(const bcdesc_t** hd_list);
+
+
+#endif /* BCAL_PERFORMANCE_H_ */
diff --git a/bcal/bcal_aes128.c b/bcal/bcal_aes128.c
new file mode 100644 (file)
index 0000000..5d4ae9c
--- /dev/null
@@ -0,0 +1,54 @@
+/* bcal_aes128.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_aes128.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-08
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "aes.h"
+#include "aes128_enc.h"
+#include "aes128_dec.h"
+#include "aes_keyschedule.h"
+#include "keysize_descriptor.h"
+
+const char aes128_str[]  = "AES-128";
+
+const uint8_t aes128_keysize_desc[]  = { KS_TYPE_LIST, 1, KS_INT(128),
+                                         KS_TYPE_TERMINATOR    };
+
+const bcdesc_t aes128_desc = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_1,
+       aes128_str,
+       sizeof(aes128_ctx_t),
+       128,
+       {(void_fpt)aes128_init},
+       {(void_fpt)aes128_enc},
+       {(void_fpt)aes128_dec},
+       (bc_free_fpt)NULL,
+       aes128_keysize_desc
+};
+
+
diff --git a/bcal/bcal_aes128.h b/bcal/bcal_aes128.h
new file mode 100644 (file)
index 0000000..4c603e0
--- /dev/null
@@ -0,0 +1,34 @@
+/* bcal_aes128.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_aes128.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-08
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include "blockcipher_descriptor.h"
+#include "aes.h"
+#include "aes128_enc.h"
+#include "aes128_dec.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t aes128_desc;
diff --git a/bcal/bcal_aes192.c b/bcal/bcal_aes192.c
new file mode 100644 (file)
index 0000000..fcbbcdc
--- /dev/null
@@ -0,0 +1,54 @@
+/* bcal_aes192.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_aes192.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-08
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "aes.h"
+#include "aes192_enc.h"
+#include "aes192_dec.h"
+#include "aes_keyschedule.h"
+#include "keysize_descriptor.h"
+
+const char aes192_str[]  = "AES-192";
+
+const uint8_t aes192_keysize_desc[] = { KS_TYPE_LIST, 1, KS_INT(192),
+                                        KS_TYPE_TERMINATOR    };
+
+const bcdesc_t aes192_desc = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_1,
+       aes192_str,
+       sizeof(aes192_ctx_t),
+       128,
+       {(void_fpt)aes192_init},
+       {(void_fpt)aes192_enc},
+       {(void_fpt)aes192_dec},
+       (bc_free_fpt)NULL,
+       aes192_keysize_desc
+};
+
+
diff --git a/bcal/bcal_aes192.h b/bcal/bcal_aes192.h
new file mode 100644 (file)
index 0000000..f8da795
--- /dev/null
@@ -0,0 +1,34 @@
+/* bcal_aes192.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_aes192.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-08
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include "blockcipher_descriptor.h"
+#include "aes.h"
+#include "aes192_enc.h"
+#include "aes192_dec.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t aes192_desc;
diff --git a/bcal/bcal_aes256.c b/bcal/bcal_aes256.c
new file mode 100644 (file)
index 0000000..3eb4914
--- /dev/null
@@ -0,0 +1,54 @@
+/* bcal_aes256.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_aes256.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-08
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "aes.h"
+#include "aes256_enc.h"
+#include "aes256_dec.h"
+#include "aes_keyschedule.h"
+#include "keysize_descriptor.h"
+
+const char aes256_str[]  = "AES-256";
+
+const uint8_t aes256_keysize_desc[] = { KS_TYPE_LIST, 1, KS_INT(256),
+                                        KS_TYPE_TERMINATOR    };
+
+const bcdesc_t aes256_desc = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_1,
+       aes256_str,
+       sizeof(aes256_ctx_t),
+       128,
+       {(void_fpt)aes256_init},
+       {(void_fpt)aes256_enc},
+       {(void_fpt)aes256_dec},
+       (bc_free_fpt)NULL,
+       aes256_keysize_desc
+};
+
+
diff --git a/bcal/bcal_aes256.h b/bcal/bcal_aes256.h
new file mode 100644 (file)
index 0000000..d241414
--- /dev/null
@@ -0,0 +1,34 @@
+/* bcal_aes256.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_aes256.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-08
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include "blockcipher_descriptor.h"
+#include "aes.h"
+#include "aes256_enc.h"
+#include "aes256_dec.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t aes256_desc;
diff --git a/bcal/bcal_camellia128.c b/bcal/bcal_camellia128.c
new file mode 100644 (file)
index 0000000..767c1b8
--- /dev/null
@@ -0,0 +1,52 @@
+/* bcal_camellia128.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_camellia128.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "camellia.h"
+#include "keysize_descriptor.h"
+
+const char camellia128_str[]   PROGMEM = "Camellia-128";
+
+const uint8_t camellia128_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128), 
+                                                KS_TYPE_TERMINATOR    };
+
+const bcdesc_t camellia128_desc PROGMEM = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_2,
+       camellia128_str,
+       sizeof(camellia128_ctx_t),
+       128,
+       {(void_fpt)camellia128_init},
+       {(void_fpt)camellia128_enc},
+       {(void_fpt)camellia128_dec},
+       (bc_free_fpt)NULL,
+       camellia128_keysize_desc
+};
+
+
diff --git a/bcal/bcal_camellia128.h b/bcal/bcal_camellia128.h
new file mode 100644 (file)
index 0000000..bbe0199
--- /dev/null
@@ -0,0 +1,33 @@
+/* bcal_camellia128.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_camellia128.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "camellia.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t camellia128_desc;
diff --git a/bcal/bcal_cast5.c b/bcal/bcal_cast5.c
new file mode 100644 (file)
index 0000000..1818e10
--- /dev/null
@@ -0,0 +1,52 @@
+/* bcal_cast5.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_cast5.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "cast5.h"
+#include "keysize_descriptor.h"
+
+const char cast5_str[]   PROGMEM = "CAST5";
+
+const uint8_t cast5_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(0), KS_INT(128), 
+                                                KS_TYPE_TERMINATOR    };
+
+const bcdesc_t cast5_desc PROGMEM = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_2,
+       cast5_str,
+       sizeof(cast5_ctx_t),
+       128,
+       {(void_fpt)cast5_init},
+       {(void_fpt)cast5_enc},
+       {(void_fpt)cast5_dec},
+       (bc_free_fpt)NULL,
+       cast5_keysize_desc
+};
+
+
diff --git a/bcal/bcal_cast5.h b/bcal/bcal_cast5.h
new file mode 100644 (file)
index 0000000..2b620ea
--- /dev/null
@@ -0,0 +1,33 @@
+/* bcal_cast5.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_cast5.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "cast5.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t cast5_desc;
diff --git a/bcal/bcal_cast6.c b/bcal/bcal_cast6.c
new file mode 100644 (file)
index 0000000..4a24ed5
--- /dev/null
@@ -0,0 +1,52 @@
+/* bcal_cast6.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_cast6.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-04-03
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "cast6.h"
+#include "keysize_descriptor.h"
+
+const char cast6_str[]   PROGMEM = "CAST-256";
+
+const uint8_t cast6_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(0), KS_INT(256), 
+                                                KS_TYPE_TERMINATOR    };
+
+const bcdesc_t cast6_desc PROGMEM = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_2,
+       cast6_str,
+       sizeof(cast6_ctx_t),
+       128,
+       {(void_fpt)cast6_init},
+       {(void_fpt)cast6_enc},
+       {(void_fpt)cast6_dec},
+       (bc_free_fpt)NULL,
+       cast6_keysize_desc
+};
+
+
diff --git a/bcal/bcal_cast6.h b/bcal/bcal_cast6.h
new file mode 100644 (file)
index 0000000..c327cf6
--- /dev/null
@@ -0,0 +1,33 @@
+/* bcal_cast6.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_cast6.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-04-03
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "cast6.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t cast6_desc;
diff --git a/bcal/bcal_des.c b/bcal/bcal_des.c
new file mode 100644 (file)
index 0000000..737e1d9
--- /dev/null
@@ -0,0 +1,61 @@
+/* bcal_des.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_des.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "des.h"
+#include "keysize_descriptor.h"
+
+const char des_str[]   PROGMEM = "DES";
+
+const uint8_t des_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(64), 
+                                                KS_TYPE_TERMINATOR    };
+static
+void des_dummy_enc(void* block, void* key){
+       des_enc(block, block, key);
+}
+
+static
+void des_dummy_dec(void* block, void* key){
+       des_dec(block, block, key);
+}
+
+const bcdesc_t des_desc PROGMEM = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_1,
+       des_str,
+       8,
+       128,
+       {(void_fpt)NULL},
+       {(void_fpt)des_dummy_enc},
+       {(void_fpt)des_dummy_dec},
+       (bc_free_fpt)NULL,
+       des_keysize_desc
+};
+
+
diff --git a/bcal/bcal_des.h b/bcal/bcal_des.h
new file mode 100644 (file)
index 0000000..84f76d2
--- /dev/null
@@ -0,0 +1,33 @@
+/* bcal_des.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_des.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "des.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t des_desc;
diff --git a/bcal/bcal_noekeon.c b/bcal/bcal_noekeon.c
new file mode 100644 (file)
index 0000000..47e1c59
--- /dev/null
@@ -0,0 +1,41 @@
+/* bcal_noekeon.c */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "noekeon/noekeon.h"
+#include "keysize_descriptor.h"
+
+const char noekeon_direct_str[]   PROGMEM = "Noekeon-Direct";
+const char noekeon_indirect_str[] PROGMEM = "Noekeon-Indirect"; 
+
+const uint8_t noekeon_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128), 
+                                                 KS_TYPE_TERMINATOR    };
+
+const bcdesc_t noekeon_direct_desc PROGMEM = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_ENC_TYPE_1,
+       noekeon_direct_str,
+       16,
+       128,
+       {(void_fpt)NULL},
+       {(void_fpt)noekeon_enc},
+       {(void_fpt)noekeon_dec},
+       (bc_free_fpt)NULL,
+       noekeon_keysize_desc
+};
+
+const bcdesc_t noekeon_indirect_desc PROGMEM = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_1 | BC_ENC_TYPE_1,
+       noekeon_indirect_str,
+       16,
+       128,
+       {(void_fpt)noekeon_init},
+       {(void_fpt)noekeon_enc},
+       {(void_fpt)noekeon_dec},
+       (bc_free_fpt)NULL,
+       noekeon_keysize_desc
+};
+
+
diff --git a/bcal/bcal_noekeon.h b/bcal/bcal_noekeon.h
new file mode 100644 (file)
index 0000000..16a8179
--- /dev/null
@@ -0,0 +1,10 @@
+/* bcal_noekeon.h */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "noekeon/noekeon.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t noekeon_direct_desc;
+extern const bcdesc_t noekeon_indirect_desc;
+
diff --git a/bcal/bcal_present.c b/bcal/bcal_present.c
new file mode 100644 (file)
index 0000000..6442c1e
--- /dev/null
@@ -0,0 +1,52 @@
+/* bcal_present.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_present.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "present.h"
+#include "keysize_descriptor.h"
+
+const char present_str[]   PROGMEM = "Present";
+
+const uint8_t present_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(80), 
+                                                KS_TYPE_TERMINATOR    };
+
+const bcdesc_t present_desc PROGMEM = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_1,
+       present_str,
+       sizeof(present_ctx_t),
+       64,
+       {(void_fpt)present_init},
+       {(void_fpt)present_enc},
+       {(void_fpt)present_dec},
+       (bc_free_fpt)NULL,
+       present_keysize_desc
+};
+
+
diff --git a/bcal/bcal_present.h b/bcal/bcal_present.h
new file mode 100644 (file)
index 0000000..1de8365
--- /dev/null
@@ -0,0 +1,33 @@
+/* bcal_present.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_present.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "present.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t present_desc;
diff --git a/bcal/bcal_rc5.c b/bcal/bcal_rc5.c
new file mode 100644 (file)
index 0000000..9634111
--- /dev/null
@@ -0,0 +1,59 @@
+/* bcal_rc5.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_rc5.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "rc5.h"
+#include "keysize_descriptor.h"
+
+#define RC5_ROUNDS 12
+
+const char rc5_str[]   PROGMEM = "RC5";
+
+const uint8_t rc5_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(1), KS_INT(2040), 
+                                                KS_TYPE_TERMINATOR    };
+
+static
+void rc5_dummy_init(void* key, uint16_t keysize_b, void* ctx){
+       rc5_init(key, keysize_b, RC5_ROUNDS, ctx);
+}
+
+const bcdesc_t rc5_desc PROGMEM = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_2,
+       rc5_str,
+       sizeof(rc5_ctx_t),
+       128,
+       {(void_fpt)rc5_dummy_init},
+       {(void_fpt)rc5_enc},
+       {(void_fpt)rc5_dec},
+       (bc_free_fpt)rc5_free,
+       rc5_keysize_desc
+};
+
+
diff --git a/bcal/bcal_rc5.h b/bcal/bcal_rc5.h
new file mode 100644 (file)
index 0000000..30d2100
--- /dev/null
@@ -0,0 +1,33 @@
+/* bcal_rc5.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_rc5.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "rc5.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t rc5_desc;
diff --git a/bcal/bcal_rc6.c b/bcal/bcal_rc6.c
new file mode 100644 (file)
index 0000000..5866b49
--- /dev/null
@@ -0,0 +1,52 @@
+/* bcal_rc6.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_rc6.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "rc6.h"
+#include "keysize_descriptor.h"
+
+const char rc6_str[]   PROGMEM = "RC6";
+
+const uint8_t rc6_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(1), KS_INT(2040), 
+                                                KS_TYPE_TERMINATOR    };
+
+const bcdesc_t rc6_desc PROGMEM = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_2,
+       rc6_str,
+       sizeof(rc6_ctx_t),
+       128,
+       {(void_fpt)rc6_init},
+       {(void_fpt)rc6_enc},
+       {(void_fpt)rc6_dec},
+       (bc_free_fpt)rc6_free,
+       rc6_keysize_desc
+};
+
+
diff --git a/bcal/bcal_rc6.h b/bcal/bcal_rc6.h
new file mode 100644 (file)
index 0000000..f6d0d1b
--- /dev/null
@@ -0,0 +1,33 @@
+/* bcal_rc6.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_rc6.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "rc6.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t rc6_desc;
diff --git a/bcal/bcal_seed.c b/bcal/bcal_seed.c
new file mode 100644 (file)
index 0000000..966f71d
--- /dev/null
@@ -0,0 +1,52 @@
+/* bcal_seed.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_seed.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "seed.h"
+#include "keysize_descriptor.h"
+
+const char seed_str[]   PROGMEM = "SEED";
+
+const uint8_t seed_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128), 
+                                              KS_TYPE_TERMINATOR    };
+
+const bcdesc_t seed_desc PROGMEM = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_1,
+       seed_str,
+       sizeof(seed_ctx_t),
+       128,
+       {(void_fpt)seed_init},
+       {(void_fpt)seed_enc},
+       {(void_fpt)seed_dec},
+       (bc_free_fpt)NULL,
+       seed_keysize_desc
+};
+
+
diff --git a/bcal/bcal_seed.h b/bcal/bcal_seed.h
new file mode 100644 (file)
index 0000000..a8bdf2c
--- /dev/null
@@ -0,0 +1,33 @@
+/* bcal_seed.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_seed.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "seed.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t seed_desc;
diff --git a/bcal/bcal_serpent.c b/bcal/bcal_serpent.c
new file mode 100644 (file)
index 0000000..50bb799
--- /dev/null
@@ -0,0 +1,52 @@
+/* bcal_serpent.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_serpent.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "serpent.h"
+#include "keysize_descriptor.h"
+
+const char serpent_str[]   PROGMEM = "serpent";
+
+const uint8_t serpent_keysize_desc[] PROGMEM = { KS_TYPE_RANGE, KS_INT(1), KS_INT(256), 
+                                                 KS_TYPE_TERMINATOR    };
+
+const bcdesc_t serpent_desc PROGMEM = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_2,
+       serpent_str,
+       sizeof(serpent_ctx_t),
+       128,
+       {(void_fpt)serpent_init},
+       {(void_fpt)serpent_enc},
+       {(void_fpt)serpent_dec},
+       (bc_free_fpt)NULL,
+       serpent_keysize_desc
+};
+
+
diff --git a/bcal/bcal_serpent.h b/bcal/bcal_serpent.h
new file mode 100644 (file)
index 0000000..60fc8cc
--- /dev/null
@@ -0,0 +1,33 @@
+/* bcal_serpent.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_serpent.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "serpent.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t serpent_desc;
diff --git a/bcal/bcal_skipjack.c b/bcal/bcal_skipjack.c
new file mode 100644 (file)
index 0000000..892c6b6
--- /dev/null
@@ -0,0 +1,52 @@
+/* bcal_skipjack.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_skipjack.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "skipjack.h"
+#include "keysize_descriptor.h"
+
+const char skipjack_str[]   PROGMEM = "Skipjack";
+
+const uint8_t skipjack_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(80), 
+                                                  KS_TYPE_TERMINATOR    };
+
+const bcdesc_t skipjack_desc PROGMEM = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_1,
+       skipjack_str,
+       10,
+       64,
+       {(void_fpt)NULL},
+       {(void_fpt)skipjack_enc},
+       {(void_fpt)skipjack_dec},
+       (bc_free_fpt)NULL,
+       skipjack_keysize_desc
+};
+
+
diff --git a/bcal/bcal_skipjack.h b/bcal/bcal_skipjack.h
new file mode 100644 (file)
index 0000000..e238141
--- /dev/null
@@ -0,0 +1,33 @@
+/* bcal_skipjack.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_skipjack.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "skipjack.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t skipjack_desc;
diff --git a/bcal/bcal_tdes.c b/bcal/bcal_tdes.c
new file mode 100644 (file)
index 0000000..914a1f0
--- /dev/null
@@ -0,0 +1,62 @@
+/* bcal_tdes.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_tdes.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "des.h"
+#include "keysize_descriptor.h"
+
+const char tdes_str[]   PROGMEM = "TDES";
+
+const uint8_t tdes_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(192), 
+                                                KS_TYPE_TERMINATOR    };
+
+static
+void tdes_dummy_enc(void* block, void* key){
+       tdes_enc(block, block, key);
+}
+
+static
+void tdes_dummy_dec(void* block, void* key){
+       tdes_dec(block, block, key);
+}
+
+const bcdesc_t tdes_desc PROGMEM = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_1,
+       tdes_str,
+       24,
+       64,
+       {(void_fpt)NULL},
+       {(void_fpt)tdes_dummy_enc},
+       {(void_fpt)tdes_dummy_dec},
+       (bc_free_fpt)NULL,
+       tdes_keysize_desc
+};
+
+
diff --git a/bcal/bcal_tdes.h b/bcal/bcal_tdes.h
new file mode 100644 (file)
index 0000000..e2f2b31
--- /dev/null
@@ -0,0 +1,33 @@
+/* bcal_tdes.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_tdes.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "des.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t tdes_desc;
diff --git a/bcal/bcal_tdes2.c b/bcal/bcal_tdes2.c
new file mode 100644 (file)
index 0000000..7c70cf0
--- /dev/null
@@ -0,0 +1,70 @@
+/* bcal_tdes2.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_tdes.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2010-02-02
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "des.h"
+#include "keysize_descriptor.h"
+
+const char tdes2_str[]   PROGMEM = "TDES-2";
+
+const uint8_t tdes2_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128),
+                                                KS_TYPE_TERMINATOR    };
+
+static
+void tdes_dummy_enc(void* block, void* key){
+       tdes_enc(block, block, key);
+}
+
+static
+void tdes_dummy_dec(void* block, void* key){
+       tdes_dec(block, block, key);
+}
+
+static
+void tdes2_init(void* key, void* ctx){
+       memcpy(ctx, key, 16);
+       memcpy((uint8_t*)ctx+16, key, 8);
+}
+
+
+
+const bcdesc_t tdes2_desc PROGMEM = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_1,
+       tdes2_str,
+       24,
+       64,
+       {(void_fpt)tdes2_init},
+       {(void_fpt)tdes_dummy_enc},
+       {(void_fpt)tdes_dummy_dec},
+       (bc_free_fpt)NULL,
+       tdes2_keysize_desc
+};
+
+
diff --git a/bcal/bcal_tdes2.h b/bcal/bcal_tdes2.h
new file mode 100644 (file)
index 0000000..4dac992
--- /dev/null
@@ -0,0 +1,38 @@
+/* bcal_tdes2.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_tdes.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#ifndef BCAL_TDES2_H_
+#define BCAL_TDES2_H_
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "des.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t tdes2_desc;
+
+#endif /* BCAL_TDES2_H_ */
diff --git a/bcal/bcal_threefish1024.c b/bcal/bcal_threefish1024.c
new file mode 100644 (file)
index 0000000..26de027
--- /dev/null
@@ -0,0 +1,56 @@
+/* bcal_threefish1024.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_threefish1024.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte
+ * \date     2010-02-20
+ * \license  GPLv3 or later
+ *
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "threefish.h"
+#include "keysize_descriptor.h"
+
+const char threefish1024_str[]   PROGMEM = "Threefish-1024";
+
+const uint8_t threefish1024_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(1024),
+                                                KS_TYPE_TERMINATOR    };
+
+static void threefish1024_dummy_init(void* key, void* ctx){
+       threefish1024_init(key, NULL, ctx);
+}
+
+const bcdesc_t threefish1024_desc PROGMEM = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_1,
+       threefish1024_str,
+       sizeof(threefish1024_ctx_t),
+       1024,
+       {(void_fpt)threefish1024_dummy_init},
+       {(void_fpt)threefish1024_enc},
+       {(void_fpt)threefish1024_dec},
+       (bc_free_fpt)NULL,
+       threefish1024_keysize_desc
+};
+
+
diff --git a/bcal/bcal_threefish1024.h b/bcal/bcal_threefish1024.h
new file mode 100644 (file)
index 0000000..67c9b3c
--- /dev/null
@@ -0,0 +1,33 @@
+/* bcal_threefis1024.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_threefish1024.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte
+ * \date     2010-02-20
+ * \license  GPLv3 or later
+ *
+ */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "threefish.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t threefish1024_desc;
diff --git a/bcal/bcal_threefish256.c b/bcal/bcal_threefish256.c
new file mode 100644 (file)
index 0000000..30f0ca3
--- /dev/null
@@ -0,0 +1,56 @@
+/* bcal_threefish256.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_threefish256.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte
+ * \date     2010-02-20
+ * \license  GPLv3 or later
+ *
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "threefish.h"
+#include "keysize_descriptor.h"
+
+const char threefish256_str[]   PROGMEM = "Threefish-256";
+
+const uint8_t threefish256_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(256),
+                                                KS_TYPE_TERMINATOR    };
+
+static void threefish256_dummy_init(void* key, void* ctx){
+       threefish256_init(key, NULL, ctx);
+}
+
+const bcdesc_t threefish256_desc PROGMEM = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_1,
+       threefish256_str,
+       sizeof(threefish256_ctx_t),
+       256,
+       {(void_fpt)threefish256_dummy_init},
+       {(void_fpt)threefish256_enc},
+       {(void_fpt)threefish256_dec},
+       (bc_free_fpt)NULL,
+       threefish256_keysize_desc
+};
+
+
diff --git a/bcal/bcal_threefish256.h b/bcal/bcal_threefish256.h
new file mode 100644 (file)
index 0000000..d2819bf
--- /dev/null
@@ -0,0 +1,33 @@
+/* bcal_threefis256.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_threefish256.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte
+ * \date     2010-02-20
+ * \license  GPLv3 or later
+ *
+ */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "threefish.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t threefish256_desc;
diff --git a/bcal/bcal_threefish512.c b/bcal/bcal_threefish512.c
new file mode 100644 (file)
index 0000000..7e8d8ba
--- /dev/null
@@ -0,0 +1,56 @@
+/* bcal_threefish512.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_threefish512.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte
+ * \date     2010-02-20
+ * \license  GPLv3 or later
+ *
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "threefish.h"
+#include "keysize_descriptor.h"
+
+const char threefish512_str[]   PROGMEM = "Threefish-512";
+
+const uint8_t threefish512_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(512),
+                                                KS_TYPE_TERMINATOR    };
+
+static void threefish512_dummy_init(void* key, void* ctx){
+       threefish512_init(key, NULL, ctx);
+}
+
+const bcdesc_t threefish512_desc PROGMEM = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_1,
+       threefish512_str,
+       sizeof(threefish512_ctx_t),
+       512,
+       {(void_fpt)threefish512_dummy_init},
+       {(void_fpt)threefish512_enc},
+       {(void_fpt)threefish512_dec},
+       (bc_free_fpt)NULL,
+       threefish512_keysize_desc
+};
+
+
diff --git a/bcal/bcal_threefish512.h b/bcal/bcal_threefish512.h
new file mode 100644 (file)
index 0000000..8f87d65
--- /dev/null
@@ -0,0 +1,33 @@
+/* bcal_threefis512.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_threefish512.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte
+ * \date     2010-02-20
+ * \license  GPLv3 or later
+ *
+ */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "threefish.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t threefish512_desc;
diff --git a/bcal/bcal_xtea.c b/bcal/bcal_xtea.c
new file mode 100644 (file)
index 0000000..2d37f68
--- /dev/null
@@ -0,0 +1,62 @@
+/* bcal_xtea.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file     bcal_xtea.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+#include "blockcipher_descriptor.h"
+#include "xtea.h"
+#include "keysize_descriptor.h"
+
+const char xtea_str[]   PROGMEM = "XTEA";
+
+const uint8_t xtea_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(128), 
+                                                KS_TYPE_TERMINATOR    };
+
+static
+void xtea_dummy_enc(void* block, void* key){
+       xtea_enc(block, block, key);
+}
+
+static
+void xtea_dummy_dec(void* block, void* key){
+       xtea_dec(block, block, key);
+}
+
+const bcdesc_t xtea_desc PROGMEM = {
+       BCDESC_TYPE_BLOCKCIPHER,
+       BC_INIT_TYPE_2,
+       xtea_str,
+       16,
+       64,
+       {(void_fpt)NULL},
+       {(void_fpt)xtea_dummy_enc},
+       {(void_fpt)xtea_dummy_dec},
+       (bc_free_fpt)NULL,
+       xtea_keysize_desc
+};
+
+
diff --git a/bcal/bcal_xtea.h b/bcal/bcal_xtea.h
new file mode 100644 (file)
index 0000000..66e6d26
--- /dev/null
@@ -0,0 +1,33 @@
+/* bcal_xtea.h */
+/*
+    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/>.
+*/
+/**
+ * \file     bcal_xtea.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-01-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <avr/pgmspace.h>
+#include "blockcipher_descriptor.h"
+#include "xtea.h"
+#include "keysize_descriptor.h"
+
+extern const bcdesc_t xtea_desc;
diff --git a/bcal/keysize_descriptor.c b/bcal/keysize_descriptor.c
new file mode 100644 (file)
index 0000000..8ffb06f
--- /dev/null
@@ -0,0 +1,87 @@
+/* keysize_descriptor.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/**
+ * \file    keysize_descriptor.c 
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2009-01-07
+ * \license GPLv3 or later
+ */
+
+#include <stdint.h>
+#include "keysize_descriptor.h"
+
+uint8_t is_valid_keysize_P(const void* ks_desc, uint16_t keysize){
+       uint8_t type;
+       type = *((uint8_t*)ks_desc);
+       ks_desc = (uint8_t*)ks_desc + 1;
+       if(type==KS_TYPE_TERMINATOR)
+               return 0;
+       if(type==KS_TYPE_LIST){
+               uint8_t items;
+               uint16_t item;
+               items = *((uint8_t*)ks_desc);
+               ks_desc = (uint8_t*)ks_desc + 1;
+               while(items--){
+                       item = *((uint16_t*)ks_desc);
+                       ks_desc = (uint8_t*)ks_desc + 2;
+                       if(item==keysize)
+                               return 1;
+               }
+               ks_desc = (uint8_t*)ks_desc - 2;
+       }
+       if(type==KS_TYPE_RANGE){
+               uint16_t max, min;
+               min = *((uint16_t*)ks_desc);
+               ks_desc = (uint8_t*)ks_desc + 2;
+               max = *((uint16_t*)ks_desc);
+               if(min<=keysize && keysize<=max)
+                       return 1;
+       }
+       if(type==KS_TYPE_ARG_RANGE){
+               uint16_t max, min, dist, offset;
+               min = *((uint16_t*)ks_desc);
+               ks_desc = (uint8_t*)ks_desc + 2;
+               max = *((uint16_t*)ks_desc);
+               ks_desc = (uint8_t*)ks_desc + 2;
+               dist = *((uint16_t*)ks_desc);
+               ks_desc = (uint8_t*)ks_desc + 2;
+               offset = *((uint16_t*)ks_desc);
+               if(min<=keysize && keysize<=max && (keysize%dist==offset))
+                       return 1;
+       }
+       if(type>KS_TYPE_ARG_RANGE){
+               /* bad error, you may insert a big warning message here */
+               return 0;
+       }
+       return is_valid_keysize_P((uint8_t*)ks_desc+1, keysize); /* search the next record */
+}
+
+uint16_t get_keysize(const void* ks_desc){
+       uint8_t type;
+       uint16_t keysize;
+       type = *((uint8_t*)ks_desc);
+       if(type==KS_TYPE_LIST)
+               ks_desc = (uint8_t*)ks_desc + 1;
+       ks_desc = (uint8_t*)ks_desc + 1;
+       keysize = *((uint16_t*)ks_desc);
+       return keysize;
+}
+
+
diff --git a/bcal/keysize_descriptor.h b/bcal/keysize_descriptor.h
new file mode 100644 (file)
index 0000000..5595888
--- /dev/null
@@ -0,0 +1,58 @@
+/* keysize_descriptor.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/>.
+*/
+/**
+ * \file    keysize_descriptor.h 
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2009-01-07
+ * \license GPLv3 or later
+ */
+
+#ifndef KEYSIZE_DESCRIPTOR_H_
+#define KEYSIZE_DESCRIPTOR_H_
+
+#include <stdint.h>
+
+#define KS_TYPE_TERMINATOR 0x00
+#define KS_TYPE_LIST       0x01
+#define KS_TYPE_RANGE      0x02
+#define KS_TYPE_ARG_RANGE  0x03
+
+#define KS_INT(a) ((a)&0xFF), ((a)>>8)
+
+typedef struct{ /* keysize is valid if listed in items */
+       uint8_t  n_items;  /* number of items (value 0 is reserved) */
+       uint16_t items[]; /* list of valid lengths */
+}keysize_desc_list_t;
+
+typedef struct{ /* keysize is valid if min<=keysize<=max */
+       uint16_t min;
+       uint16_t max;
+}keysize_desc_range_t;
+
+typedef struct{ /* keysize is valid if min<=keysize<=max and if keysize mod distance == offset */
+       uint16_t min;
+       uint16_t max;
+       uint16_t distance;
+       uint16_t offset;
+}keysize_desc_arg_range_t;
+
+uint8_t is_valid_keysize_P(const void* ks_desc, uint16_t keysize);
+uint16_t get_keysize(const void* ks_desc);
+#endif /* KEYSIZE_DESCRIPTOR_H_ */
diff --git a/bcal_aes128.c b/bcal_aes128.c
deleted file mode 100644 (file)
index 5d4ae9c..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/* bcal_aes128.c */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-/**
- * \file     bcal_aes128.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-01-08
- * \license  GPLv3 or later
- * 
- */
-
-#include <stdlib.h>
-#include "blockcipher_descriptor.h"
-#include "aes.h"
-#include "aes128_enc.h"
-#include "aes128_dec.h"
-#include "aes_keyschedule.h"
-#include "keysize_descriptor.h"
-
-const char aes128_str[]  = "AES-128";
-
-const uint8_t aes128_keysize_desc[]  = { KS_TYPE_LIST, 1, KS_INT(128),
-                                         KS_TYPE_TERMINATOR    };
-
-const bcdesc_t aes128_desc = {
-       BCDESC_TYPE_BLOCKCIPHER,
-       BC_INIT_TYPE_1,
-       aes128_str,
-       sizeof(aes128_ctx_t),
-       128,
-       {(void_fpt)aes128_init},
-       {(void_fpt)aes128_enc},
-       {(void_fpt)aes128_dec},
-       (bc_free_fpt)NULL,
-       aes128_keysize_desc
-};
-
-
diff --git a/bcal_aes128.h b/bcal_aes128.h
deleted file mode 100644 (file)
index 4c603e0..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* bcal_aes128.h */
-/*
-    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/>.
-*/
-/**
- * \file     bcal_aes128.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-01-08
- * \license  GPLv3 or later
- * 
- */
-
-#include "blockcipher_descriptor.h"
-#include "aes.h"
-#include "aes128_enc.h"
-#include "aes128_dec.h"
-#include "keysize_descriptor.h"
-
-extern const bcdesc_t aes128_desc;
diff --git a/bcal_aes192.c b/bcal_aes192.c
deleted file mode 100644 (file)
index fcbbcdc..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/* bcal_aes192.c */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-/**
- * \file     bcal_aes192.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-01-08
- * \license  GPLv3 or later
- * 
- */
-
-#include <stdlib.h>
-#include "blockcipher_descriptor.h"
-#include "aes.h"
-#include "aes192_enc.h"
-#include "aes192_dec.h"
-#include "aes_keyschedule.h"
-#include "keysize_descriptor.h"
-
-const char aes192_str[]  = "AES-192";
-
-const uint8_t aes192_keysize_desc[] = { KS_TYPE_LIST, 1, KS_INT(192),
-                                        KS_TYPE_TERMINATOR    };
-
-const bcdesc_t aes192_desc = {
-       BCDESC_TYPE_BLOCKCIPHER,
-       BC_INIT_TYPE_1,
-       aes192_str,
-       sizeof(aes192_ctx_t),
-       128,
-       {(void_fpt)aes192_init},
-       {(void_fpt)aes192_enc},
-       {(void_fpt)aes192_dec},
-       (bc_free_fpt)NULL,
-       aes192_keysize_desc
-};
-
-
diff --git a/bcal_aes192.h b/bcal_aes192.h
deleted file mode 100644 (file)
index f8da795..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* bcal_aes192.h */
-/*
-    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/>.
-*/
-/**
- * \file     bcal_aes192.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-01-08
- * \license  GPLv3 or later
- * 
- */
-
-#include "blockcipher_descriptor.h"
-#include "aes.h"
-#include "aes192_enc.h"
-#include "aes192_dec.h"
-#include "keysize_descriptor.h"
-
-extern const bcdesc_t aes192_desc;
diff --git a/bcal_aes256.c b/bcal_aes256.c
deleted file mode 100644 (file)
index 3eb4914..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/* bcal_aes256.c */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-/**
- * \file     bcal_aes256.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-01-08
- * \license  GPLv3 or later
- * 
- */
-
-#include <stdlib.h>
-#include "blockcipher_descriptor.h"
-#include "aes.h"
-#include "aes256_enc.h"
-#include "aes256_dec.h"
-#include "aes_keyschedule.h"
-#include "keysize_descriptor.h"
-
-const char aes256_str[]  = "AES-256";
-
-const uint8_t aes256_keysize_desc[] = { KS_TYPE_LIST, 1, KS_INT(256),
-                                        KS_TYPE_TERMINATOR    };
-
-const bcdesc_t aes256_desc = {
-       BCDESC_TYPE_BLOCKCIPHER,
-       BC_INIT_TYPE_1,
-       aes256_str,
-       sizeof(aes256_ctx_t),
-       128,
-       {(void_fpt)aes256_init},
-       {(void_fpt)aes256_enc},
-       {(void_fpt)aes256_dec},
-       (bc_free_fpt)NULL,
-       aes256_keysize_desc
-};
-
-
diff --git a/bcal_aes256.h b/bcal_aes256.h
deleted file mode 100644 (file)
index d241414..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* bcal_aes256.h */
-/*
-    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/>.
-*/
-/**
- * \file     bcal_aes256.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-01-08
- * \license  GPLv3 or later
- * 
- */
-
-#include "blockcipher_descriptor.h"
-#include "aes.h"
-#include "aes256_enc.h"
-#include "aes256_dec.h"
-#include "keysize_descriptor.h"
-
-extern const bcdesc_t aes256_desc;
index 15eb680d38ad2c24d2f7e790b636573ac98b5c1c..d00919f4289090398d60274487939a14ca714b2d 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <stdint.h>
 #include <string.h>
-#include "memxor.h"
+#include "memxor/memxor.h"
 #include "blake_large.h"
 #include "blake_common.h"
 
index bdf70cb9c82e7898447ed4e42f51870217cf6459..0b3fca281ad4e101912f6d2a614cf093c6c64dbb 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <stdint.h>
 #include <string.h>
-#include "memxor.h"
+#include "memxor/memxor.h"
 #include "blake_small.h"
 #include "blake_common.h"
 
diff --git a/blake/memxor.c b/blake/memxor.c
deleted file mode 100644 (file)
index 7485b3e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdint.h>
-
-#include "memxor.h"
-
-void memxor(void* dest, const void* src, uint16_t n){
-  while(n--){
-    *((uint8_t*)dest) ^= *((uint8_t*)src);
-    dest = (uint8_t*)dest +1;
-    src  = (uint8_t*)src  +1;
-  }
-}
-
diff --git a/blake/memxor.h b/blake/memxor.h
deleted file mode 100644 (file)
index a62a616..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef MEMXOR_H_
-#define MEMXOR_H_
-#include <stdint.h>
-
-void memxor(void* dest, const void* src, uint16_t n);
-
-#endif
index 74c6b9c238ad3edcd65281e441ad55d18501c610..6a531580f7c41226c8e57755ff183a7780b7f69c 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdint.h>
 #include <string.h>
 #include "bmw_small.h"
-#include "memxor.h"
+#include "memxor/memxor.h"
 
 #define SHL32(a,n) ((a)<<(n))
 #define SHR32(a,n) ((a)>>(n))
index d1d70e068a4f2a0eeb2bd8bdc0f6885698f01fe1..0a102c0375566339134906ee8e74be81078cbcca 100644 (file)
@@ -28,7 +28,6 @@
 #include <stdint.h>
 #include <string.h>
 #include "bmw_small.h"
-#include "memxor.h"
 
 #define SHL32(a,n) ((a)<<(n))
 #define SHR32(a,n) ((a)>>(n))
diff --git a/bmw/memxor.c b/bmw/memxor.c
deleted file mode 100644 (file)
index 7485b3e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdint.h>
-
-#include "memxor.h"
-
-void memxor(void* dest, const void* src, uint16_t n){
-  while(n--){
-    *((uint8_t*)dest) ^= *((uint8_t*)src);
-    dest = (uint8_t*)dest +1;
-    src  = (uint8_t*)src  +1;
-  }
-}
-
diff --git a/bmw/memxor.h b/bmw/memxor.h
deleted file mode 100644 (file)
index a62a616..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef MEMXOR_H_
-#define MEMXOR_H_
-#include <stdint.h>
-
-void memxor(void* dest, const void* src, uint16_t n);
-
-#endif
index 72c0d7521e4d4bdfb549b9e03f9691329fc8ac64..76040b0010d11d7026276f4a5be5d31dde1fcbae 100644 (file)
  */
 
 
-#include "memxor.h"
+#include "memxor/memxor.h"
 #include "cubehash.h"
 #include <string.h>
 #include <stdint.h>
 
+inline
 static uint32_t rol32(uint32_t a, uint8_t r){
        return (a<<r)|(a>>(32-r));
 }
 /*
-• Add    x_0jklm into    x_1jklm modulo 232 , for each (j, k, l, m).
+• Add    x_0jklm into    x_1jklm modulo 2**32 , for each (j, k, l, m).
 â€¢ Rotate x_0jklm upwards by 7 bits, for each (j, k, l, m).
 â€¢ Swap   x_00klm with    x_01klm , for each (k, l, m).
 â€¢ Xor    x_1jklm into    x_0jklm , for each (j, k, l, m).
 â€¢ Swap   x_1jk0m with    x_1jk1m , for each (j, k, m).
-• Add    x_0jklm into    x_1jklm modulo 232 , for each (j, k, l, m).
+• Add    x_0jklm into    x_1jklm modulo 2**32 , for each (j, k, l, m).
 â€¢ Rotate x_0jklm upwards by 11 bits, for each (j, k, l, m).
 â€¢ Swap   x_0j0lm with    x_0j1lm , for each (j, l, m).
 â€¢ Xor    x_1jklm into    x_0jklm , for each (j, k, l, m).
@@ -52,8 +53,6 @@ static void cubehash_round(cubehash_ctx_t* ctx){
        uint32_t t;
        for(i=0; i<16; ++i){
                ctx->a[i+16] += ctx->a[i];
-       }
-       for(i=0; i<16; ++i){
                ctx->a[i] = rol32(ctx->a[i], 7);
        }
        for(i=0; i<8; ++i){
@@ -74,8 +73,6 @@ static void cubehash_round(cubehash_ctx_t* ctx){
        }
        for(i=0; i<16; ++i){
                ctx->a[i+16] += ctx->a[i];
-       }
-       for(i=0; i<16; ++i){
                ctx->a[i] = rol32(ctx->a[i], 11);
        }
        for(i=0; i<4; ++i){
diff --git a/cubehash/memxor.c b/cubehash/memxor.c
deleted file mode 100644 (file)
index 7485b3e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdint.h>
-
-#include "memxor.h"
-
-void memxor(void* dest, const void* src, uint16_t n){
-  while(n--){
-    *((uint8_t*)dest) ^= *((uint8_t*)src);
-    dest = (uint8_t*)dest +1;
-    src  = (uint8_t*)src  +1;
-  }
-}
-
diff --git a/cubehash/memxor.h b/cubehash/memxor.h
deleted file mode 100644 (file)
index a62a616..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef MEMXOR_H_
-#define MEMXOR_H_
-#include <stdint.h>
-
-void memxor(void* dest, const void* src, uint16_t n);
-
-#endif
index 20ebd984da450a59866fb92729a13c047e6a2e03..d1d97a99f32780150bdc61b45dfee49386602d0e 100644 (file)
@@ -19,8 +19,8 @@
 
 #include <stdint.h>
 #include "aes_enc_round.h"
-#include "gf256mul.h"
-#include "aes_sbox.h"
+#include "gf256mul/gf256mul.h"
+#include "aes/aes_sbox.h"
 
 static
 void aes_shiftcol(void* data, uint8_t shift){
diff --git a/echo/aes_sbox.c b/echo/aes_sbox.c
deleted file mode 100644 (file)
index 73849dd..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/* aes sbox */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-
-#include <stdint.h>
-const uint8_t aes_sbox[256] = {
- 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
- 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
- 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
- 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
- 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
- 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
- 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
- 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
- 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
- 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
- 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
- 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
- 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
- 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
- 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
- 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
-};
-
diff --git a/echo/aes_sbox.h b/echo/aes_sbox.h
deleted file mode 100644 (file)
index 421b576..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/* aes_sbox.h */
-/*
-    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/>.
-*/
-/**
- * \file     aes_sbox.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2008-12-30
- * \license  GPLv3 or later
- * 
- */
-#ifndef AES_SBOX_H_
-#define AES_SBOX_H_
-#include <stdint.h>
-
-extern const uint8_t aes_sbox[];
-
-#endif
index 97ab73cdfca72a9fab64397249f1103876246795..b460f965bf84ae431b0034c85080b20fb9ada1a7 100644 (file)
@@ -19,8 +19,8 @@
 
 
 #include "echo.h"
-#include "gf256mul.h"
-#include "memxor.h"
+#include "gf256mul/gf256mul.h"
+#include "memxor/memxor.h"
 #include "aes_enc_round.h"
 #include <stdint.h>
 #include <string.h>
diff --git a/echo/gf256mul.c b/echo/gf256mul.c
deleted file mode 100644 (file)
index a473646..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/* gf256mul.c */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-
-#include <stdint.h>
-
-uint8_t gf256mul(uint8_t a, uint8_t b, uint8_t reducer){
-       uint8_t r=0;
-       while(a&0xFE){
-               if(a&1){
-                       r ^= b;
-               }
-               a >>= 1;
-               if(b&0x80){
-                       b <<= 1;
-                       b ^= reducer;
-               }else{
-                       b <<= 1;
-               }
-       }
-       if(a&1){
-               r ^= b;
-       }
-       return r;
-}
diff --git a/echo/gf256mul.h b/echo/gf256mul.h
deleted file mode 100644 (file)
index 87f1cb3..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* gf256mul.h */
-/*
-    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/>.
-*/
-#ifndef GF256MUL_H_
-#define GF256MUL_H_
-
-/**
- * \author  Daniel Otte
- * \email   daniel.otte@rub.de
- * \date    2008-12-19
- * \license GPLv3
- * \brief
- * 
- * 
- */
-
-#include <stdint.h>
-
-uint8_t gf256mul(uint8_t a, uint8_t b, uint8_t reducer);
-
-#endif /* GF256MUL_H_ */
-
diff --git a/echo/memxor.c b/echo/memxor.c
deleted file mode 100644 (file)
index 7485b3e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdint.h>
-
-#include "memxor.h"
-
-void memxor(void* dest, const void* src, uint16_t n){
-  while(n--){
-    *((uint8_t*)dest) ^= *((uint8_t*)src);
-    dest = (uint8_t*)dest +1;
-    src  = (uint8_t*)src  +1;
-  }
-}
-
diff --git a/echo/memxor.h b/echo/memxor.h
deleted file mode 100644 (file)
index a62a616..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef MEMXOR_H_
-#define MEMXOR_H_
-#include <stdint.h>
-
-void memxor(void* dest, const void* src, uint16_t n);
-
-#endif
diff --git a/gf256mul/gf256mul.c b/gf256mul/gf256mul.c
new file mode 100644 (file)
index 0000000..a473646
--- /dev/null
@@ -0,0 +1,40 @@
+/* gf256mul.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+
+#include <stdint.h>
+
+uint8_t gf256mul(uint8_t a, uint8_t b, uint8_t reducer){
+       uint8_t r=0;
+       while(a&0xFE){
+               if(a&1){
+                       r ^= b;
+               }
+               a >>= 1;
+               if(b&0x80){
+                       b <<= 1;
+                       b ^= reducer;
+               }else{
+                       b <<= 1;
+               }
+       }
+       if(a&1){
+               r ^= b;
+       }
+       return r;
+}
diff --git a/gf256mul/gf256mul.h b/gf256mul/gf256mul.h
new file mode 100644 (file)
index 0000000..87f1cb3
--- /dev/null
@@ -0,0 +1,37 @@
+/* gf256mul.h */
+/*
+    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/>.
+*/
+#ifndef GF256MUL_H_
+#define GF256MUL_H_
+
+/**
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2008-12-19
+ * \license GPLv3
+ * \brief
+ * 
+ * 
+ */
+
+#include <stdint.h>
+
+uint8_t gf256mul(uint8_t a, uint8_t b, uint8_t reducer);
+
+#endif /* GF256MUL_H_ */
+
diff --git a/groestl/aes_sbox.c b/groestl/aes_sbox.c
deleted file mode 100644 (file)
index 73849dd..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/* aes sbox */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-
-#include <stdint.h>
-const uint8_t aes_sbox[256] = {
- 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
- 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
- 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
- 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
- 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
- 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
- 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
- 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
- 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
- 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
- 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
- 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
- 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
- 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
- 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
- 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
-};
-
diff --git a/groestl/aes_sbox.h b/groestl/aes_sbox.h
deleted file mode 100644 (file)
index 5bc03b7..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/* aes_sbox.h */
-/*
-    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/>.
-*/
-/**
- * \file     aes_sbox.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2008-12-30
- * \license  GPLv3 or later
- * 
- */
-#ifndef AES_SBOX_H_
-#define AES_SBOX_H_
-#include <stdint.h>
-
-extern uint8_t aes_sbox[];
-
-#endif
diff --git a/groestl/gf256mul.c b/groestl/gf256mul.c
deleted file mode 100644 (file)
index a473646..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/* gf256mul.c */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-
-#include <stdint.h>
-
-uint8_t gf256mul(uint8_t a, uint8_t b, uint8_t reducer){
-       uint8_t r=0;
-       while(a&0xFE){
-               if(a&1){
-                       r ^= b;
-               }
-               a >>= 1;
-               if(b&0x80){
-                       b <<= 1;
-                       b ^= reducer;
-               }else{
-                       b <<= 1;
-               }
-       }
-       if(a&1){
-               r ^= b;
-       }
-       return r;
-}
diff --git a/groestl/gf256mul.h b/groestl/gf256mul.h
deleted file mode 100644 (file)
index 87f1cb3..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* gf256mul.h */
-/*
-    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/>.
-*/
-#ifndef GF256MUL_H_
-#define GF256MUL_H_
-
-/**
- * \author  Daniel Otte
- * \email   daniel.otte@rub.de
- * \date    2008-12-19
- * \license GPLv3
- * \brief
- * 
- * 
- */
-
-#include <stdint.h>
-
-uint8_t gf256mul(uint8_t a, uint8_t b, uint8_t reducer);
-
-#endif /* GF256MUL_H_ */
-
index 0650196cf289339000dbc2f6aa71ca932b752348..9381935441a5e11ed883558f81b4513c49ca6359 100644 (file)
@@ -26,9 +26,9 @@
  */
 
 #include "groestl_large.h"
-#include "aes_sbox.h"
-#include "gf256mul.h"
-#include "memxor.h"
+#include "aes/aes_sbox.h"
+#include "gf256mul/gf256mul.h"
+#include "memxor/memxor.h"
 #include <stdint.h>
 #include <string.h>
 
index 5996c10aeb6aaa1cba4fa5bbe6cc7225149f9c30..d23a4662ec217a81e80a337e4213f244bd2ea2aa 100644 (file)
@@ -26,9 +26,9 @@
  */
 
 #include "groestl_small.h"
-#include "aes_sbox.h"
-#include "gf256mul.h"
-#include "memxor.h"
+#include "aes/aes_sbox.h"
+#include "gf256mul/gf256mul.h"
+#include "memxor/memxor.h"
 #include <stdint.h>
 #include <string.h>
 
diff --git a/groestl/memxor.c b/groestl/memxor.c
deleted file mode 100644 (file)
index 7485b3e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdint.h>
-
-#include "memxor.h"
-
-void memxor(void* dest, const void* src, uint16_t n){
-  while(n--){
-    *((uint8_t*)dest) ^= *((uint8_t*)src);
-    dest = (uint8_t*)dest +1;
-    src  = (uint8_t*)src  +1;
-  }
-}
-
diff --git a/groestl/memxor.h b/groestl/memxor.h
deleted file mode 100644 (file)
index a62a616..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef MEMXOR_H_
-#define MEMXOR_H_
-#include <stdint.h>
-
-void memxor(void* dest, const void* src, uint16_t n);
-
-#endif
diff --git a/hfal-basic.c b/hfal-basic.c
deleted file mode 100644 (file)
index dbb1e7d..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/* hfal-basic.c */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-
-#include "hashfunction_descriptor.h"
-#include "hfal-basic.h"
-#include <stdlib.h>
-
-uint8_t hfal_hash_init(const hfdesc_t* hash_descriptor, hfgen_ctx_t* ctx){
-       ctx->desc_ptr = (hfdesc_t*)hash_descriptor;
-       if(!(ctx->ctx=malloc(hash_descriptor->ctxsize_B)))
-               return 3;
-       hash_descriptor->init(ctx->ctx);
-       return 0;
-}
-
-void hfal_hash_nextBlock(hfgen_ctx_t* ctx, const void* block){
-       ctx->desc_ptr->nextBlock(ctx->ctx, block);
-}
-
-void hfal_hash_lastBlock(hfgen_ctx_t* ctx, const void* block, uint16_t length_b){
-       ctx->desc_ptr->lastBlock(ctx->ctx, block, length_b);
-}
-
-void hfal_hash_ctx2hash(void* dest, hfgen_ctx_t* ctx){
-       ctx->desc_ptr->ctx2hash(dest, ctx->ctx);
-}
-
-void hfal_hash_free(hfgen_ctx_t* ctx){
-       hf_free_fpt f;
-       f = ctx->desc_ptr->free;
-       if(f)
-               f(ctx->ctx);
-       free(ctx->ctx);
-}
-
-void hfal_hash_mem(const hfdesc_t* hash_descriptor, void* dest, const void* msg, uint32_t length_b){
-       void_fpt f;
-       f = (void_fpt)(hash_descriptor->mem);
-       if(f){
-               ((hf_mem_fpt)f)(dest, msg, length_b);
-       }else{
-               uint16_t bs,bsb;
-               uint8_t ctx[hash_descriptor->ctxsize_B];
-               hash_descriptor->init(ctx);
-               bs = hash_descriptor->blocksize_b;
-               bsb=bs/8;
-               f=(void_fpt)(hash_descriptor->nextBlock);
-               while(length_b>bs){
-                       ((hf_nextBlock_fpt)f)(ctx, msg);
-                       length_b -= bs;
-                       msg = (uint8_t*)msg + bsb;
-               }
-               hash_descriptor->lastBlock(ctx, msg, length_b);
-               hash_descriptor->ctx2hash(dest, ctx);
-       }
-}
-
-uint16_t hfal_hash_getBlocksize(const hfdesc_t* hash_descriptor){
-       return hash_descriptor->blocksize_b;
-}
-
-uint16_t hfal_hash_getHashsize(const hfdesc_t* hash_descriptor){
-       return hash_descriptor->hashsize_b;
-}
diff --git a/hfal-basic.h b/hfal-basic.h
deleted file mode 100644 (file)
index e03bffe..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* hfal-basic.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/>.
-*/
-
-#ifndef HFAL_BASIC_H_
-#define HFAL_BASIC_H_
-
-#include "hashfunction_descriptor.h"
-
-uint8_t hfal_hash_init(const hfdesc_t* hash_descriptor, hfgen_ctx_t* ctx);
-void hfal_hash_nextBlock(hfgen_ctx_t* ctx, const void* block);
-void hfal_hash_lastBlock(hfgen_ctx_t* ctx, const void* block, uint16_t length_b);
-void hfal_hash_ctx2hash(void* dest, hfgen_ctx_t* ctx);
-void hfal_hash_free(hfgen_ctx_t* ctx);
-void hfal_hash_mem(const hfdesc_t* hash_descriptor, void* dest, const void* msg, uint32_t length_b);
-uint16_t hfal_hash_getBlocksize(const hfdesc_t* hash_descriptor);
-uint16_t hfal_hash_getHashsize(const hfdesc_t* hash_descriptor);
-
-#endif /* HFAL_BASIC_H_ */
diff --git a/hfal/hfal-basic.c b/hfal/hfal-basic.c
new file mode 100644 (file)
index 0000000..dbb1e7d
--- /dev/null
@@ -0,0 +1,80 @@
+/* hfal-basic.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+
+#include "hashfunction_descriptor.h"
+#include "hfal-basic.h"
+#include <stdlib.h>
+
+uint8_t hfal_hash_init(const hfdesc_t* hash_descriptor, hfgen_ctx_t* ctx){
+       ctx->desc_ptr = (hfdesc_t*)hash_descriptor;
+       if(!(ctx->ctx=malloc(hash_descriptor->ctxsize_B)))
+               return 3;
+       hash_descriptor->init(ctx->ctx);
+       return 0;
+}
+
+void hfal_hash_nextBlock(hfgen_ctx_t* ctx, const void* block){
+       ctx->desc_ptr->nextBlock(ctx->ctx, block);
+}
+
+void hfal_hash_lastBlock(hfgen_ctx_t* ctx, const void* block, uint16_t length_b){
+       ctx->desc_ptr->lastBlock(ctx->ctx, block, length_b);
+}
+
+void hfal_hash_ctx2hash(void* dest, hfgen_ctx_t* ctx){
+       ctx->desc_ptr->ctx2hash(dest, ctx->ctx);
+}
+
+void hfal_hash_free(hfgen_ctx_t* ctx){
+       hf_free_fpt f;
+       f = ctx->desc_ptr->free;
+       if(f)
+               f(ctx->ctx);
+       free(ctx->ctx);
+}
+
+void hfal_hash_mem(const hfdesc_t* hash_descriptor, void* dest, const void* msg, uint32_t length_b){
+       void_fpt f;
+       f = (void_fpt)(hash_descriptor->mem);
+       if(f){
+               ((hf_mem_fpt)f)(dest, msg, length_b);
+       }else{
+               uint16_t bs,bsb;
+               uint8_t ctx[hash_descriptor->ctxsize_B];
+               hash_descriptor->init(ctx);
+               bs = hash_descriptor->blocksize_b;
+               bsb=bs/8;
+               f=(void_fpt)(hash_descriptor->nextBlock);
+               while(length_b>bs){
+                       ((hf_nextBlock_fpt)f)(ctx, msg);
+                       length_b -= bs;
+                       msg = (uint8_t*)msg + bsb;
+               }
+               hash_descriptor->lastBlock(ctx, msg, length_b);
+               hash_descriptor->ctx2hash(dest, ctx);
+       }
+}
+
+uint16_t hfal_hash_getBlocksize(const hfdesc_t* hash_descriptor){
+       return hash_descriptor->blocksize_b;
+}
+
+uint16_t hfal_hash_getHashsize(const hfdesc_t* hash_descriptor){
+       return hash_descriptor->hashsize_b;
+}
diff --git a/hfal/hfal-basic.h b/hfal/hfal-basic.h
new file mode 100644 (file)
index 0000000..e03bffe
--- /dev/null
@@ -0,0 +1,34 @@
+/* hfal-basic.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/>.
+*/
+
+#ifndef HFAL_BASIC_H_
+#define HFAL_BASIC_H_
+
+#include "hashfunction_descriptor.h"
+
+uint8_t hfal_hash_init(const hfdesc_t* hash_descriptor, hfgen_ctx_t* ctx);
+void hfal_hash_nextBlock(hfgen_ctx_t* ctx, const void* block);
+void hfal_hash_lastBlock(hfgen_ctx_t* ctx, const void* block, uint16_t length_b);
+void hfal_hash_ctx2hash(void* dest, hfgen_ctx_t* ctx);
+void hfal_hash_free(hfgen_ctx_t* ctx);
+void hfal_hash_mem(const hfdesc_t* hash_descriptor, void* dest, const void* msg, uint32_t length_b);
+uint16_t hfal_hash_getBlocksize(const hfdesc_t* hash_descriptor);
+uint16_t hfal_hash_getHashsize(const hfdesc_t* hash_descriptor);
+
+#endif /* HFAL_BASIC_H_ */
diff --git a/hfal/hfal-hmac.c b/hfal/hfal-hmac.c
new file mode 100644 (file)
index 0000000..0232cca
--- /dev/null
@@ -0,0 +1,127 @@
+/* hfal-hmac.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+
+#include <avr/pgmspace.h>
+#include "hashfunction_descriptor.h"
+#include "hfal-basic.h"
+#include <stdlib.h>
+
+#define IPAD 0x36
+#define OPAD 0x5C
+
+uint8_t hfal_hmac_init(const hfdesc_t* hash_descriptor, 
+                       hfhmacgen_ctx_t* ctx, 
+                                          const void* key, uint16_t keylength_b){
+       uint16_t  bs = hfal_hash_getBlocksize();
+       uint8_t buffer[bs/8];
+       uint8_t i;
+       hf_init_fpt init;
+       hf_nextBlock_fpt nextBlock;
+       memset(buffer, 0, bs/8);
+       ctx->desc   = hash_descriptor;
+       ctx->ctx    = malloc(pgm_read_word(&(hash_descriptor->ctxsize_B)));
+       ctx->finctx = malloc(pgm_read_word(&(hash_descriptor->ctxsize_B)));
+       if(ctx->ctx==NULL && ctx->finctx==NULL)
+               return 3;
+       if(ctx->finctx==NULL){
+               free(ctx->ctx)
+               return 2;
+       }
+       if(ctx->ctx==NULL){
+               free(ctx->finctx)
+               return 1;
+       }               
+       if(keylength_b>bs){
+               hfal_hash_mem(hash_descriptor, buffer, key, keylength_b);
+       } else {
+               memcpy(buffer, key, (keylength_b+7)/8);
+       }
+       for(i=0; i<bs/8; ++i){
+               buffer[i] ^= IPAD;
+       }
+       init = pgm_read_word(&(hash_descriptor->init));
+       nextBlock = pgm_read_word(&(hash_descriptor->nextBlock));
+       init(ctx->ctx);
+       init(ctx->finctx);
+       nextBlock(ctx->ctx, buffer);
+       for(i=0; i<bs/8; ++i){
+               buffer[i] ^= IPAD^OPAD;
+       }
+       nextBlock(ctx->finctx, buffer);
+       memset(buffer, 0, bs/8);
+}
+                                          
+void hfal_hmac_nextBlock(hfhmacgen_ctx_t* ctx, const void* block){
+       hf_nextBlock_fpt nextBlock;
+       nextBlock = pgm_read_word(&(hash_descriptor->nextBlock));
+       nextBlock(ctx->ctx, block);
+}
+
+void hfal_hmac_lastBlock(hfhmacgen_ctx_t* ctx, const void* block, uint16_t length_b){
+       hf_lastBlock_fpt lastBlock;
+       hf_ctx2hash_fpt  ctx2hash;
+       uint16_t hs = pgm_read_word(&(hash_descriptor->hashsize_b));
+       uint8_t buffer[(hs+7)/8];
+       lastBlock = pgm_read_word(&(hash_descriptor->lastBlock));
+       ctx2hash = pgm_read_word(&(hash_descriptor->ctx2hash));
+       lastBlock(ctx->ctx, block, length_b);
+       ctx2hash(buffer, ctx->ctx);
+       lastBlock(ctx->finctx, buffer, hs);
+}
+
+void hfal_hmac_ctx2mac(void* dest, hfhmacgen_ctx_t* ctx){
+       hf_ctx2hash_fpt  ctx2hash;
+       ctx2hash = pgm_read_word(&(hash_descriptor->ctx2hash));
+       ctx2hash(dest, ctx->finctx);
+}
+
+void hfal_hmac_free(hfhmacgen_ctx_t* ctx){
+       hf_free_fpt free_fpt;
+       free_fpt = pgm_read_word(&(hash_descriptor->free));
+       if(free_fpt){
+               free_fpt(ctx->ctx);
+               free_fpt(ctx->finctx);
+       }
+       free(ctx->ctx)
+       free(ctx->finctx)
+}
+
+void hfal_hmac_mem(const hfdesc_t* hash_descriptor, const void* key, uint16_t keylength_b, void* dest, const void* msg, uint32_t length_b){
+       hfhmacgen_ctx_t ctx;
+       uint16_t  bs = hfal_hash_getBlocksize();
+       hfal_hmac_init(hash_descriptor, &ctx, key, keylength_b);
+       while(length_b>bs){
+               hfal_hmac_nextBlock(&ctx, msg);
+               msg = msg + bs/8;
+               length_b-=bs;
+       }
+       hfal_hmac_lastBlock(&ctx, msg, length_b);
+       hfal_hmac_ctx2mac(dest, &ctx);
+       hfal_free(&ctx);
+}
+
+uint16_t hfal_hmac_getBlocksize(const hfdesc_t* hash_descriptor){
+       return hfal_hash_getBlocksize(hash_descriptor);
+}
+
+uint16_t hfal_hmac_getMACsize(const hfdesc_t* hash_descriptor){
+       return hfal_hash_getHashsize(hash_descriptor);
+}
+
+
diff --git a/hfal/hfal-hmac.h b/hfal/hfal-hmac.h
new file mode 100644 (file)
index 0000000..8c9b899
--- /dev/null
@@ -0,0 +1,41 @@
+/* hfal-hmac.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/>.
+*/
+
+#ifndef HFAL_HMAC_H_
+#define HFAL_HMAC_H_
+
+#include <avr/pgmspace.h>
+#include "hashfunction_descriptor.h"
+
+typedef struct {
+       hfdesc_t* desc;
+       void*     ctx;
+       void*     finctx;
+} hfhmacgen_ctx_t;
+
+uint8_t hfal_hmac_init(const hfdesc_t* hash_descriptor, hfhmacgen_ctx_t* ctx, const void* key, uint16_t keylength_b);
+void hfal_hmac_nextBlock(hfhmacgen_ctx_t* ctx, const void* block);
+void hfal_hmac_lastBlock(hfhmacgen_ctx_t* ctx, const void* block, uint16_t length_b);
+void hfal_hmac_ctx2mac(void* dest, hfhmacgen_ctx_t* ctx);
+void hfal_hmac_free(hfhmacgen_ctx_t* ctx);
+void hfal_hmac_mem(const hfdesc_t* hash_descriptor, const void* key, uint16_t keylength_b, void* dest, const void* msg, uint32_t length_b);
+uint16_t hfal_hmac_getBlocksize(const hfdesc_t* hash_descriptor);
+uint16_t hfal_hmac_getMACsize(const hfdesc_t* hash_descriptor);
+
+#endif /* HFAL_HMAC_H_ */
diff --git a/hfal/hfal-nessie.c b/hfal/hfal-nessie.c
new file mode 100644 (file)
index 0000000..75f2ea8
--- /dev/null
@@ -0,0 +1,58 @@
+/* hfal-nessie.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/*
+ * \file    hfal-nessie.c
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2009-05-10
+ * \license GPLv3 or later
+ * 
+ */
+
+#include "nessie_hash_test.h"
+#include "hashfunction_descriptor.h"
+#include <stdint.h>
+
+void hfal_nessie(const hfdesc_t* hd){
+       if(hd->type!=HFDESC_TYPE_HASHFUNCTION)
+               return;
+       
+       nessie_hash_ctx.hashsize_b  = hd->hashsize_b;
+       nessie_hash_ctx.name = (char*)(hd->name); /* needs a nicer fix */
+       nessie_hash_ctx.blocksize_B = hd->blocksize_b/8;
+       nessie_hash_ctx.ctx_size_B  = hd->ctxsize_B;
+       nessie_hash_ctx.hash_init = (nessie_hash_init_fpt)(hd->init);
+       nessie_hash_ctx.hash_next = (nessie_hash_next_fpt)(hd->nextBlock);
+       nessie_hash_ctx.hash_last = (nessie_hash_last_fpt)(hd->lastBlock);
+       nessie_hash_ctx.hash_conv = (nessie_hash_conv_fpt)(hd->ctx2hash);
+       
+       nessie_hash_run();
+}
+
+void hfal_nessie_multiple(const hfdesc_t** hd_list){
+       const hfdesc_t* hd;
+       for(;;){
+               hd = *hd_list;
+               if(!hd)
+                       return;
+               hfal_nessie(hd);
+               hd_list += 1;
+       }
+}
+
diff --git a/hfal/hfal-nessie.h b/hfal/hfal-nessie.h
new file mode 100644 (file)
index 0000000..e9be131
--- /dev/null
@@ -0,0 +1,36 @@
+/* hfal-nessie.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/>.
+*/
+/*
+ * \file    hfal-nessie.h
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2009-05-10
+ * \license GPLv3 or later
+ * 
+ */
+
+#ifndef HFAL_NESSIE_H_
+#define HFAL_NESSIE_H_
+
+#include "hashfunction_descriptor.h"
+
+void hfal_nessie(const hfdesc_t* hd);
+void hfal_nessie_multiple(const hfdesc_t** hd_list);
+
+#endif /* HFAL_NESSIE_H_ */
diff --git a/hfal/hfal-performance.c b/hfal/hfal-performance.c
new file mode 100644 (file)
index 0000000..2679e48
--- /dev/null
@@ -0,0 +1,221 @@
+/* hfal-performance.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/*
+ * \file    hfal-performance.c
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2009-05-10
+ * \license GPLv3 or later
+ *
+ */
+
+#include "hfal-performance.h"
+#include "hashfunction_descriptor.h"
+/* #include "stack_measuring.h" */
+#include "cli.h"
+#include "performance_test.h"
+#include "string-extras.h"
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#define PATTERN_A 0xAA
+#define PATTERN_B 0x55
+
+static
+void printvalue(unsigned long v){
+       char str[20];
+       int i;
+       ultoa(v, str, 10);
+       for(i=0; i<10-strlen(str); ++i){
+               cli_putc(' ');
+       }
+       cli_putstr(str);
+}
+
+void hfal_performance(const hfdesc_t* hd){
+       hfdesc_t hf;
+       memcpy(&hf, hd, sizeof(hfdesc_t));
+       uint8_t ctx[hf.ctxsize_B];
+       uint8_t data[(hf.blocksize_b+7)/8];
+       uint8_t digest[(hf.hashsize_b+7)/8];
+       uint64_t t;
+       uint8_t i;
+
+       if(hf.type!=HFDESC_TYPE_HASHFUNCTION)
+               return;
+       calibrateTimer();
+       print_overhead();
+       cli_putstr("\r\n\r\n === ");
+       cli_putstr(hf.name);
+       cli_putstr(" performance === "
+                         "\r\n    type:             hashfunction"
+                         "\r\n    hashsize (bits):    ");
+       printvalue(hf.hashsize_b);
+
+       cli_putstr("\r\n    ctxsize (bytes):    ");
+       printvalue(hf.ctxsize_B);
+
+       cli_putstr("\r\n    blocksize (bits):   ");
+       printvalue(hf.blocksize_b);
+
+       t=0;
+       for(i=0; i<32; ++i){
+               startTimer(0);
+               START_TIMER;
+               hf.init(&ctx);
+               STOP_TIMER;
+               t += stopTimer();
+               if(i!=31 && hf.free){
+                       hf.free(&ctx);
+               }
+       }
+       t>>=5;
+       cli_putstr("\r\n    init (cycles):      ");
+       printvalue(t);
+
+       t=0;
+       for(i=0; i<32; ++i){
+               startTimer(0);
+               START_TIMER;
+               hf.nextBlock(&ctx, data);
+               STOP_TIMER;
+               t += stopTimer();
+       }
+       t>>=5;
+       cli_putstr("\r\n    nextBlock (cycles): ");
+       printvalue(t);
+
+       t=0;
+       for(i=0; i<32; ++i){
+               startTimer(0);
+               START_TIMER;
+               hf.lastBlock(&ctx, data, 0);
+               STOP_TIMER;
+               t += stopTimer();
+       }
+       t>>=5;
+       cli_putstr("\r\n    lastBlock (cycles): ");
+       printvalue(t);
+
+       t=0;
+       for(i=0; i<32; ++i){
+               startTimer(0);
+               START_TIMER;
+               hf.ctx2hash(digest, &ctx);
+               STOP_TIMER;
+               t += stopTimer();
+       }
+       t>>=5;
+       cli_putstr("\r\n    ctx2hash (cycles):  ");
+       printvalue(t);
+
+       if(hf.free){
+               hf.free(&ctx);
+       }
+}
+/*
+void hfal_stacksize(const hfdesc_t* hd){
+       hfdesc_t hf;
+       stack_measuring_ctx_t smctx;
+       memcpy(&hf, hd, sizeof(hfdesc_t));
+       uint8_t ctx[hf.ctxsize_B];
+       uint8_t data[(hf.blocksize_b+7)/8];
+       uint8_t digest[(hf.hashsize_b+7)/8];
+       uint16_t t1, t2;
+
+       if(hf.type!=HFDESC_TYPE_HASHFUNCTION)
+               return;
+       cli_putstr("\r\n\r\n === ");
+       cli_putstr_P(hf.name);
+       cli_putstr(" stack-usage === ");
+
+       cli();
+       stack_measure_init(&smctx, PATTERN_A);
+       hf.init(&ctx);
+       t1 = stack_measure_final(&smctx);
+       stack_measure_init(&smctx, PATTERN_B);
+       hf.init(&ctx);
+       t2 = stack_measure_final(&smctx);
+       sei();
+
+       t1 = (t1>t2)?t1:t2;
+       cli_putstr("\r\n    init (bytes):       ");
+       printvalue((unsigned long)t1);
+
+       cli();
+       stack_measure_init(&smctx, PATTERN_A);
+       hf.nextBlock(&ctx, data);
+       t1 = stack_measure_final(&smctx);
+       stack_measure_init(&smctx, PATTERN_B);
+       hf.nextBlock(&ctx, data);
+       t2 = stack_measure_final(&smctx);
+       sei();
+
+       t1 = (t1>t2)?t1:t2;
+       cli_putstr("\r\n    nextBlock (bytes):  ");
+       printvalue((unsigned long)t1);
+
+       cli();
+       stack_measure_init(&smctx, PATTERN_A);
+       hf.lastBlock(&ctx, data, 0);
+       t1 = stack_measure_final(&smctx);
+       stack_measure_init(&smctx, PATTERN_B);
+       hf.lastBlock(&ctx, data, 0);
+       t2 = stack_measure_final(&smctx);
+       sei();
+
+       t1 = (t1>t2)?t1:t2;
+       cli_putstr("\r\n    lastBlock (bytes):  ");
+       printvalue((unsigned long)t1);
+
+       cli();
+       stack_measure_init(&smctx, PATTERN_A);
+       hf.ctx2hash(digest, &ctx);
+       t1 = stack_measure_final(&smctx);
+       stack_measure_init(&smctx, PATTERN_B);
+       hf.ctx2hash(digest, &ctx);
+       t2 = stack_measure_final(&smctx);
+       sei();
+
+       t1 = (t1>t2)?t1:t2;
+       cli_putstr("\r\n    ctx2hash (bytes):   ");
+       printvalue((unsigned long)t1);
+
+       if(hf.free){
+               hf.free(&ctx);
+       }
+}
+*/
+
+void hfal_performance_multiple(const hfdesc_t** hd_list){
+       const hfdesc_t* hd;
+       for(;;){
+               hd = *hd_list;
+               if(!hd){
+                       cli_putstr("\r\n\r\n End of performance figures\r\n");
+                       return;
+               }
+               hfal_performance(hd);
+//             hfal_stacksize(hd);
+               hd_list += 1;
+       }
+}
+
diff --git a/hfal/hfal-performance.h b/hfal/hfal-performance.h
new file mode 100644 (file)
index 0000000..65b0473
--- /dev/null
@@ -0,0 +1,35 @@
+/* hfal-performance.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/>.
+*/
+/*
+ * \file    hfal-performance.h
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2009-05-10
+ * \license GPLv3 or later
+ * 
+ */
+
+#ifndef HFAL_PERFORMANCE_H_
+#define HFAL_PERFORMANCE_H_
+
+#include "hashfunction_descriptor.h"
+
+void hfal_performance(const hfdesc_t* hd);
+void hfal_performance_multiple(const hfdesc_t** hd_list);
+#endif /* HFAL_PERFORMANCE_H_ */
diff --git a/hfal/hfal-test.c b/hfal/hfal-test.c
new file mode 100644 (file)
index 0000000..f78375d
--- /dev/null
@@ -0,0 +1,48 @@
+/* hfal-test.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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/>.
+*/
+/*
+ * \file    hfal-test.c
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2009-05-10
+ * \license GPLv3 or later
+ * 
+ */
+
+#include "hfal-basic.h"
+#include "hashfunction_descriptor.h"
+#include "cli.h"
+#include <stdint.h>
+
+void hfal_test(const hfdesc_t* hd, const void* msg, uint32_t length_b){
+       if(hd->type!=HFDESC_TYPE_HASHFUNCTION)
+               return;
+       uint16_t dlen = (hd->hashsize_b+7)/8;
+       uint8_t digest[dlen];
+       cli_putstr("\r\n=== ");
+       cli_putstr(hd->name);
+       cli_putstr(" ===\r\n message:");
+       cli_hexdump_block(msg, (length_b+7)/8, 4, 16);
+       hfal_hash_mem(hd, digest, msg, length_b);
+       cli_putstr(" \r\n digest:");
+       cli_hexdump_block(digest, dlen, 4, 16);
+       cli_putstr("\r\n");
+}
+
+
diff --git a/hfal/hfal-test.h b/hfal/hfal-test.h
new file mode 100644 (file)
index 0000000..1d76a2c
--- /dev/null
@@ -0,0 +1,36 @@
+/* hfal-test.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/>.
+*/
+/*
+ * \file    hfal-test.h
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2009-05-10
+ * \license GPLv3 or later
+ * 
+ */
+
+#ifndef HFAL_TEST_H_
+#define HFAL_TEST_H_
+
+#include "hashfunction_descriptor.h"
+#include <stdint.h>
+
+void hfal_test(const hfdesc_t* hd,const void* msg, uint32_t length_b);
+
+#endif /* HFAL_TEST_H_ */
diff --git a/hfal/hfal_blake_large.c b/hfal/hfal_blake_large.c
new file mode 100644 (file)
index 0000000..8a432ff
--- /dev/null
@@ -0,0 +1,66 @@
+/* hfal_blake_large.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/>.
+*/
+/**
+ * \file     hfal_blake_large.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-05-08
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <stdlib.h>
+#include "hashfunction_descriptor.h"
+#include "blake_large.h"
+
+
+static const char blake48_str[]  = "Blake-48";
+static const char blake64_str[]  = "Blake-64";
+
+const hfdesc_t blake48_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       blake48_str,
+       sizeof(blake48_ctx_t),
+       BLAKE48_BLOCKSIZE,
+       384,
+       (hf_init_fpt)blake48_init,
+       (hf_nextBlock_fpt)blake_large_nextBlock,
+       (hf_lastBlock_fpt)blake_large_lastBlock,
+       (hf_ctx2hash_fpt)blake48_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)blake48
+};
+
+const hfdesc_t blake64_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       blake64_str,
+       sizeof(blake64_ctx_t),
+       BLAKE64_BLOCKSIZE,
+       512,
+       (hf_init_fpt)blake64_init,
+       (hf_nextBlock_fpt)blake_large_nextBlock,
+       (hf_lastBlock_fpt)blake_large_lastBlock,
+       (hf_ctx2hash_fpt)blake64_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)blake64
+};
+
+
diff --git a/hfal/hfal_blake_large.h b/hfal/hfal_blake_large.h
new file mode 100644 (file)
index 0000000..a6740b5
--- /dev/null
@@ -0,0 +1,36 @@
+/* hfal_blake_large.h */
+/*
+    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/>.
+*/
+/**
+ * \file     hfal_blake_large.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-05-08
+ * \license  GPLv3 or later
+ * 
+ */
+
+#ifndef HFAL_BLAKE_LARGE_H_
+#define HFAL_BLAKE_LARGE_H_
+
+#include "hashfunction_descriptor.h"
+
+extern const hfdesc_t blake48_desc;
+extern const hfdesc_t blake64_desc;
+
+#endif /* HFAL_BLAKE_LARGE_H_ */
diff --git a/hfal/hfal_blake_small.c b/hfal/hfal_blake_small.c
new file mode 100644 (file)
index 0000000..7273abb
--- /dev/null
@@ -0,0 +1,66 @@
+/* hfal_blake_small.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/>.
+*/
+/**
+ * \file     hfal_blake_small.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-05-05
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <stdlib.h>
+#include "hashfunction_descriptor.h"
+#include "blake_small.h"
+
+
+static const char blake28_str[] = "Blake-28";
+static const char blake32_str[] = "Blake-32";
+
+const hfdesc_t blake28_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       blake28_str,
+       sizeof(blake28_ctx_t),
+       BLAKE28_BLOCKSIZE,
+       224,
+       (hf_init_fpt)blake28_init,
+       (hf_nextBlock_fpt)blake_small_nextBlock,
+       (hf_lastBlock_fpt)blake_small_lastBlock,
+       (hf_ctx2hash_fpt)blake28_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)blake28
+};
+
+const hfdesc_t blake32_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       blake32_str,
+       sizeof(blake32_ctx_t),
+       BLAKE32_BLOCKSIZE,
+       256,
+       (hf_init_fpt)blake32_init,
+       (hf_nextBlock_fpt)blake_small_nextBlock,
+       (hf_lastBlock_fpt)blake_small_lastBlock,
+       (hf_ctx2hash_fpt)blake32_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)blake32
+};
+
+
diff --git a/hfal/hfal_blake_small.h b/hfal/hfal_blake_small.h
new file mode 100644 (file)
index 0000000..925d72d
--- /dev/null
@@ -0,0 +1,36 @@
+/* hfal_blake_small.h */
+/*
+    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/>.
+*/
+/**
+ * \file     hfal_blake_small.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-05-05
+ * \license  GPLv3 or later
+ * 
+ */
+
+#ifndef HFAL_BLAKE_SMALL_H_
+#define HFAL_BLAKE_SMALL_H_
+
+#include "hashfunction_descriptor.h"
+
+extern const hfdesc_t blake28_desc;
+extern const hfdesc_t blake32_desc;
+
+#endif /* HFAL_BLAKE_SMALL_H_ */
diff --git a/hfal/hfal_bmw_large.c b/hfal/hfal_bmw_large.c
new file mode 100644 (file)
index 0000000..348895f
--- /dev/null
@@ -0,0 +1,66 @@
+/* hfal_bmw_large.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/>.
+*/
+/**
+ * \file     hfal_bmw_large.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-04-28
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <stdlib.h>
+#include "hashfunction_descriptor.h"
+#include "bmw_large.h"
+
+
+static const char bmw384_str[]  = "BlueMidnightWish-384";
+static const char bmw512_str[]  = "BlueMidnightWish-512";
+
+const hfdesc_t bmw384_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       bmw384_str,
+       sizeof(bmw384_ctx_t),
+       BMW384_BLOCKSIZE,
+       384,
+       (hf_init_fpt)bmw384_init,
+       (hf_nextBlock_fpt)bmw384_nextBlock,
+       (hf_lastBlock_fpt)bmw384_lastBlock,
+       (hf_ctx2hash_fpt)bmw384_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)bmw384
+};
+
+const hfdesc_t bmw512_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       bmw512_str,
+       sizeof(bmw512_ctx_t),
+       BMW512_BLOCKSIZE,
+       512,
+       (hf_init_fpt)bmw512_init,
+       (hf_nextBlock_fpt)bmw512_nextBlock,
+       (hf_lastBlock_fpt)bmw512_lastBlock,
+       (hf_ctx2hash_fpt)bmw512_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)bmw512
+};
+
+
diff --git a/hfal/hfal_bmw_large.h b/hfal/hfal_bmw_large.h
new file mode 100644 (file)
index 0000000..5a28b2c
--- /dev/null
@@ -0,0 +1,36 @@
+/* hfal_bmw_large.h */
+/*
+    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/>.
+*/
+/**
+ * \file     hfal_bmw_large.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-04-28
+ * \license  GPLv3 or later
+ * 
+ */
+
+#ifndef HFAL_BMW_LARGE_H_
+#define HFAL_BMW_LARGE_H_
+
+#include "hashfunction_descriptor.h"
+
+extern const hfdesc_t bmw384_desc;
+extern const hfdesc_t bmw512_desc;
+
+#endif /* HFAL_BMW_LARGE_H_ */
diff --git a/hfal/hfal_bmw_small.c b/hfal/hfal_bmw_small.c
new file mode 100644 (file)
index 0000000..9bcd500
--- /dev/null
@@ -0,0 +1,66 @@
+/* hfal_bmw_small.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/>.
+*/
+/**
+ * \file     hfal_bmw_small.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-04-28
+ * \license  GPLv3 or later
+ * 
+ */
+
+#include <stdlib.h>
+#include "hashfunction_descriptor.h"
+#include "bmw_small.h"
+
+
+static const char bmw224_str[]  = "BlueMidnightWish-224";
+static const char bmw256_str[]  = "BlueMidnightWish-256";
+
+const hfdesc_t bmw224_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       bmw224_str,
+       sizeof(bmw224_ctx_t),
+       BMW224_BLOCKSIZE,
+       224,
+       (hf_init_fpt)bmw224_init,
+       (hf_nextBlock_fpt)bmw224_nextBlock,
+       (hf_lastBlock_fpt)bmw224_lastBlock,
+       (hf_ctx2hash_fpt)bmw224_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)bmw224
+};
+
+const hfdesc_t bmw256_desc  = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       bmw256_str,
+       sizeof(bmw256_ctx_t),
+       BMW256_BLOCKSIZE,
+       256,
+       (hf_init_fpt)bmw256_init,
+       (hf_nextBlock_fpt)bmw256_nextBlock,
+       (hf_lastBlock_fpt)bmw256_lastBlock,
+       (hf_ctx2hash_fpt)bmw256_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)bmw256
+};
+
+
diff --git a/hfal/hfal_bmw_small.h b/hfal/hfal_bmw_small.h
new file mode 100644 (file)
index 0000000..08f3c86
--- /dev/null
@@ -0,0 +1,36 @@
+/* hfal_bmw_small.h */
+/*
+    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/>.
+*/
+/**
+ * \file     hfal_bmw_small.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-04-28
+ * \license  GPLv3 or later
+ * 
+ */
+
+#ifndef HFAL_BMW_SMALL_H_
+#define HFAL_BMW_SMALL_H_
+
+#include "hashfunction_descriptor.h"
+
+extern const hfdesc_t bmw224_desc;
+extern const hfdesc_t bmw256_desc;
+
+#endif /* HFAL_BMW_SMALL_H_ */
diff --git a/hfal/hfal_cubehash.c b/hfal/hfal_cubehash.c
new file mode 100644 (file)
index 0000000..132f1dd
--- /dev/null
@@ -0,0 +1,98 @@
+/* hfal_cubehash.c */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2010 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/>.
+*/
+/**
+ * \file     hfal_cubehash.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte
+ * \date     2010-02-09
+ * \license  GPLv3 or later
+ *
+ */
+
+#include <stdlib.h>
+#include "hashfunction_descriptor.h"
+#include "cubehash.h"
+
+
+static const char cubehash224_str[] = "CubeHash-224";
+static const char cubehash256_str[] = "CubeHash-256";
+static const char cubehash384_str[] = "CubeHash-384";
+static const char cubehash512_str[] = "CubeHash-512";
+
+const hfdesc_t cubehash224_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       cubehash224_str,
+       sizeof(cubehash_ctx_t),
+       CUBEHASH224_BLOCKSIZE,
+       224,
+       (hf_init_fpt)cubehash224_init,
+       (hf_nextBlock_fpt)cubehash_nextBlock,
+       (hf_lastBlock_fpt)cubehash_lastBlock,
+       (hf_ctx2hash_fpt)cubehash224_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+
+const hfdesc_t cubehash256_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       cubehash256_str,
+       sizeof(cubehash_ctx_t),
+       CUBEHASH256_BLOCKSIZE,
+       256,
+       (hf_init_fpt)cubehash256_init,
+       (hf_nextBlock_fpt)cubehash_nextBlock,
+       (hf_lastBlock_fpt)cubehash_lastBlock,
+       (hf_ctx2hash_fpt)cubehash256_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+
+const hfdesc_t cubehash384_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       cubehash384_str,
+       sizeof(cubehash_ctx_t),
+       CUBEHASH384_BLOCKSIZE,
+       384,
+       (hf_init_fpt)cubehash384_init,
+       (hf_nextBlock_fpt)cubehash_nextBlock,
+       (hf_lastBlock_fpt)cubehash_lastBlock,
+       (hf_ctx2hash_fpt)cubehash384_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+
+const hfdesc_t cubehash512_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       cubehash512_str,
+       sizeof(cubehash_ctx_t),
+       CUBEHASH512_BLOCKSIZE,
+       512,
+       (hf_init_fpt)cubehash512_init,
+       (hf_nextBlock_fpt)cubehash_nextBlock,
+       (hf_lastBlock_fpt)cubehash_lastBlock,
+       (hf_ctx2hash_fpt)cubehash512_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+
+
diff --git a/hfal/hfal_cubehash.h b/hfal/hfal_cubehash.h
new file mode 100644 (file)
index 0000000..40441f3
--- /dev/null
@@ -0,0 +1,31 @@
+/* hfal_cubehash.h */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2010 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/>.
+*/
+
+#ifndef HFAL_CUBEHASH_H_
+#define HFAL_CUBEHASH_H_
+
+#include "hashfunction_descriptor.h"
+
+extern const hfdesc_t cubehash224_desc;
+extern const hfdesc_t cubehash256_desc;
+extern const hfdesc_t cubehash384_desc;
+extern const hfdesc_t cubehash512_desc;
+
+
+#endif /* HFAL_CUBEHASH_H_ */
diff --git a/hfal/hfal_echo.c b/hfal/hfal_echo.c
new file mode 100644 (file)
index 0000000..a8ce1a3
--- /dev/null
@@ -0,0 +1,98 @@
+/* hfal_echo.c */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2010 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/>.
+*/
+/**
+ * \file     hfal_echo.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte
+ * \date     2010-02-21
+ * \license  GPLv3 or later
+ *
+ */
+
+#include <stdlib.h>
+#include "hashfunction_descriptor.h"
+#include "echo.h"
+
+
+static const char echo224_str[]    = "ECHO-224";
+static const char echo256_str[]    = "ECHO-256";
+static const char echo384_str[]    = "ECHO-384";
+static const char echo512_str[]    = "ECHO-512";
+
+const hfdesc_t echo224_desc  = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       echo224_str,
+       sizeof(echo_small_ctx_t),
+       ECHO224_BLOCKSIZE,
+       224,
+       (hf_init_fpt)echo224_init,
+       (hf_nextBlock_fpt)echo_small_nextBlock,
+       (hf_lastBlock_fpt)echo_small_lastBlock,
+       (hf_ctx2hash_fpt)echo224_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+
+const hfdesc_t echo256_desc  = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       echo256_str,
+       sizeof(echo_small_ctx_t),
+       ECHO256_BLOCKSIZE,
+       256,
+       (hf_init_fpt)echo256_init,
+       (hf_nextBlock_fpt)echo_small_nextBlock,
+       (hf_lastBlock_fpt)echo_small_lastBlock,
+       (hf_ctx2hash_fpt)echo256_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+
+const hfdesc_t echo384_desc  = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       echo384_str,
+       sizeof(echo_large_ctx_t),
+       ECHO384_BLOCKSIZE,
+       384,
+       (hf_init_fpt)echo384_init,
+       (hf_nextBlock_fpt)echo_large_nextBlock,
+       (hf_lastBlock_fpt)echo_large_lastBlock,
+       (hf_ctx2hash_fpt)echo384_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+
+const hfdesc_t echo512_desc  = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       echo512_str,
+       sizeof(echo_large_ctx_t),
+       ECHO512_BLOCKSIZE,
+       512,
+       (hf_init_fpt)echo512_init,
+       (hf_nextBlock_fpt)echo_large_nextBlock,
+       (hf_lastBlock_fpt)echo_large_lastBlock,
+       (hf_ctx2hash_fpt)echo512_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+
+
diff --git a/hfal/hfal_echo.h b/hfal/hfal_echo.h
new file mode 100644 (file)
index 0000000..78be0db
--- /dev/null
@@ -0,0 +1,30 @@
+/* hfal_echo.h */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2010 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/>.
+*/
+
+#ifndef HFAL_ECHO_H_
+#define HFAL_ECHO_H_
+
+#include "hashfunction_descriptor.h"
+
+extern const hfdesc_t echo224_desc;
+extern const hfdesc_t echo256_desc;
+extern const hfdesc_t echo384_desc;
+extern const hfdesc_t echo512_desc;
+
+#endif /* HFAL_ECHO_H_ */
diff --git a/hfal/hfal_groestl_large.c b/hfal/hfal_groestl_large.c
new file mode 100644 (file)
index 0000000..e33be03
--- /dev/null
@@ -0,0 +1,67 @@
+/* hfal_groestl_large.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/>.
+*/
+/**
+ * \file     hfal_groestl_large.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-05-05
+ * \license  GPLv3 or later
+ * 
+ */
+
+
+#include <stdlib.h>
+#include "hashfunction_descriptor.h"
+#include "groestl_large.h"
+#include "groestl_small.h"
+
+
+static const char groestl384_str[] = "Groestl-384";
+static const char groestl512_str[] = "Groestl-512";
+
+const hfdesc_t groestl384_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       groestl384_str,
+       sizeof(groestl384_ctx_t),
+       GROESTL384_BLOCKSIZE,
+       384,
+       (hf_init_fpt)groestl384_init,
+       (hf_nextBlock_fpt)groestl_large_nextBlock,
+       (hf_lastBlock_fpt)groestl_large_lastBlock,
+       (hf_ctx2hash_fpt)groestl384_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)groestl384
+};
+
+const hfdesc_t groestl512_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       groestl512_str,
+       sizeof(groestl512_ctx_t),
+       GROESTL512_BLOCKSIZE,
+       512,
+       (hf_init_fpt)groestl512_init,
+       (hf_nextBlock_fpt)groestl_large_nextBlock,
+       (hf_lastBlock_fpt)groestl_large_lastBlock,
+       (hf_ctx2hash_fpt)groestl512_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)groestl512
+};
+
diff --git a/hfal/hfal_groestl_large.h b/hfal/hfal_groestl_large.h
new file mode 100644 (file)
index 0000000..cbf331b
--- /dev/null
@@ -0,0 +1,37 @@
+/* hfal_groestl_large.h */
+/*
+    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/>.
+*/
+/**
+ * \file     hfal_groestl_large.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-06-11
+ * \license  GPLv3 or later
+ * 
+ */
+
+#ifndef HFAL_GROESTL_LARGE_H_
+#define HFAL_GROESTL_LARGE_H_
+
+
+#include "hashfunction_descriptor.h"
+
+extern const hfdesc_t groestl384_desc;
+extern const hfdesc_t groestl512_desc;
+
+#endif /* HFAL_GROESTL_LARGE_H_ */
diff --git a/hfal/hfal_groestl_small.c b/hfal/hfal_groestl_small.c
new file mode 100644 (file)
index 0000000..00f3d3d
--- /dev/null
@@ -0,0 +1,67 @@
+/* hfal_groestl_small.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/>.
+*/
+/**
+ * \file     hfal_groestl_small.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-05-05
+ * \license  GPLv3 or later
+ * 
+ */
+
+
+#include <stdlib.h>
+#include "hashfunction_descriptor.h"
+#include "groestl_small.h"
+
+
+static const char groestl224_str[] = "Groestl-224";
+static const char groestl256_str[] = "Groestl-256";
+
+const hfdesc_t groestl224_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       groestl224_str,
+       sizeof(groestl224_ctx_t),
+       GROESTL224_BLOCKSIZE,
+       224,
+       (hf_init_fpt)groestl224_init,
+       (hf_nextBlock_fpt)groestl_small_nextBlock,
+       (hf_lastBlock_fpt)groestl_small_lastBlock,
+       (hf_ctx2hash_fpt)groestl224_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)groestl224
+};
+
+const hfdesc_t groestl256_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       groestl256_str,
+       sizeof(groestl256_ctx_t),
+       GROESTL256_BLOCKSIZE,
+       256,
+       (hf_init_fpt)groestl256_init,
+       (hf_nextBlock_fpt)groestl_small_nextBlock,
+       (hf_lastBlock_fpt)groestl_small_lastBlock,
+       (hf_ctx2hash_fpt)groestl256_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)groestl256
+};
+
+
diff --git a/hfal/hfal_groestl_small.h b/hfal/hfal_groestl_small.h
new file mode 100644 (file)
index 0000000..4295f37
--- /dev/null
@@ -0,0 +1,37 @@
+/* hfal_groestl_small.h */
+/*
+    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/>.
+*/
+/**
+ * \file     hfal_groestl_small.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-05-05
+ * \license  GPLv3 or later
+ * 
+ */
+
+#ifndef HFAL_GROESTL_SMALL_H_
+#define HFAL_GROESTL_SMALL_H_
+
+
+#include "hashfunction_descriptor.h"
+
+extern const hfdesc_t groestl224_desc;
+extern const hfdesc_t groestl256_desc;
+
+#endif /* HFAL_GROESTL_SMALL_H_ */
diff --git a/hfal/hfal_keccak.c b/hfal/hfal_keccak.c
new file mode 100644 (file)
index 0000000..b3981ea
--- /dev/null
@@ -0,0 +1,99 @@
+/* hfal_keccak.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/>.
+*/
+/**
+ * \file     hfal_keccak.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2010-02-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+
+#include <stdlib.h>
+#include "hashfunction_descriptor.h"
+#include "keccak.h"
+
+
+static const char keccak224_str[] = "Keccak-224";
+static const char keccak256_str[] = "Keccak-256";
+static const char keccak384_str[] = "Keccak-384";
+static const char keccak512_str[] = "Keccak-512";
+
+const hfdesc_t keccak224_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       keccak224_str,
+       sizeof(keccak_ctx_t),
+       KECCAK224_BLOCKSIZE,
+       224,
+       (hf_init_fpt)keccak224_init,
+       (hf_nextBlock_fpt)keccak_nextBlock,
+       (hf_lastBlock_fpt)keccak_lastBlock,
+       (hf_ctx2hash_fpt)keccak224_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+
+const hfdesc_t keccak256_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       keccak256_str,
+       sizeof(keccak_ctx_t),
+       KECCAK256_BLOCKSIZE,
+       256,
+       (hf_init_fpt)keccak256_init,
+       (hf_nextBlock_fpt)keccak_nextBlock,
+       (hf_lastBlock_fpt)keccak_lastBlock,
+       (hf_ctx2hash_fpt)keccak256_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+
+const hfdesc_t keccak384_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       keccak384_str,
+       sizeof(keccak_ctx_t),
+       KECCAK384_BLOCKSIZE,
+       384,
+       (hf_init_fpt)keccak384_init,
+       (hf_nextBlock_fpt)keccak_nextBlock,
+       (hf_lastBlock_fpt)keccak_lastBlock,
+       (hf_ctx2hash_fpt)keccak384_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+
+const hfdesc_t keccak512_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       keccak512_str,
+       sizeof(keccak_ctx_t),
+       KECCAK512_BLOCKSIZE,
+       512,
+       (hf_init_fpt)keccak512_init,
+       (hf_nextBlock_fpt)keccak_nextBlock,
+       (hf_lastBlock_fpt)keccak_lastBlock,
+       (hf_ctx2hash_fpt)keccak512_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+
+
diff --git a/hfal/hfal_keccak.h b/hfal/hfal_keccak.h
new file mode 100644 (file)
index 0000000..16ddeae
--- /dev/null
@@ -0,0 +1,39 @@
+/* hfal_keccak.h */
+/*
+    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/>.
+*/
+/**
+ * \file     hfal_keccak.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2010-02-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#ifndef HFAL_KECCAK_H_
+#define HFAL_KECCAK_H_
+
+
+#include "hashfunction_descriptor.h"
+
+extern const hfdesc_t keccak224_desc;
+extern const hfdesc_t keccak256_desc;
+extern const hfdesc_t keccak384_desc;
+extern const hfdesc_t keccak512_desc;
+
+#endif /* HFAL_KECCAK_H_ */
diff --git a/hfal/hfal_md5.c b/hfal/hfal_md5.c
new file mode 100644 (file)
index 0000000..8e3399c
--- /dev/null
@@ -0,0 +1,49 @@
+/* hfal_md5.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/>.
+*/
+/**
+ * \file     hfal_md5.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-02-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+
+#include <stdlib.h>
+#include "hashfunction_descriptor.h"
+#include "md5.h"
+
+static const char md5_str[] = "MD5";
+
+const hfdesc_t md5_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       md5_str,
+       sizeof(md5_ctx_t),
+       512,
+       128,
+       (hf_init_fpt)md5_init,
+       (hf_nextBlock_fpt)md5_nextBlock,
+       (hf_lastBlock_fpt)md5_lastBlock,
+       (hf_ctx2hash_fpt)md5_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)md5
+};
+
diff --git a/hfal/hfal_md5.h b/hfal/hfal_md5.h
new file mode 100644 (file)
index 0000000..3682493
--- /dev/null
@@ -0,0 +1,36 @@
+/* hfal_md5.h */
+/*
+    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/>.
+*/
+/**
+ * \file     hfal_md5.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-02-09
+ * \license  GPLv3 or later
+ * 
+ */
+
+#ifndef HFAL_MD5_H_
+#define HFAL_MD5_H_
+
+
+#include "hashfunction_descriptor.h"
+
+extern const hfdesc_t md5_desc;
+
+#endif /* HFAL_MD5_H_ */
diff --git a/hfal/hfal_sha1.c b/hfal/hfal_sha1.c
new file mode 100644 (file)
index 0000000..b38ab4d
--- /dev/null
@@ -0,0 +1,49 @@
+/* hfal_sha1.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/>.
+*/
+/**
+ * \file     hfal_sha1.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-02-04
+ * \license  GPLv3 or later
+ * 
+ */
+
+
+#include <stdlib.h>
+#include "hashfunction_descriptor.h"
+#include "sha1.h"
+
+static const char sha1_str[] = "SHA-1";
+
+const hfdesc_t sha1_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       sha1_str,
+       sizeof(sha1_ctx_t),
+       512,
+       160,
+       (hf_init_fpt)sha1_init,
+       (hf_nextBlock_fpt)sha1_nextBlock,
+       (hf_lastBlock_fpt)sha1_lastBlock,
+       (hf_ctx2hash_fpt)sha1_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)sha1
+};
+
diff --git a/hfal/hfal_sha1.h b/hfal/hfal_sha1.h
new file mode 100644 (file)
index 0000000..f0f6b8d
--- /dev/null
@@ -0,0 +1,36 @@
+/* hfal_sha1.h */
+/*
+    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/>.
+*/
+/**
+ * \file     hfal_sha1.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-02-04
+ * \license  GPLv3 or later
+ * 
+ */
+
+#ifndef HFAL_SHA1_H_
+#define HFAL_SHA1_H_
+
+
+#include "hashfunction_descriptor.h"
+
+extern const hfdesc_t sha1_desc;
+
+#endif /* HFAL_SHA1_H_ */
diff --git a/hfal/hfal_sha256.c b/hfal/hfal_sha256.c
new file mode 100644 (file)
index 0000000..2da04d8
--- /dev/null
@@ -0,0 +1,49 @@
+/* hfal_sha256.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/>.
+*/
+/**
+ * \file     hfal_sha256.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-02-04
+ * \license  GPLv3 or later
+ * 
+ */
+
+
+#include <stdlib.h>
+#include "hashfunction_descriptor.h"
+#include "sha256.h"
+
+static const char sha256_str[] = "SHA-256";
+
+const hfdesc_t sha256_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       sha256_str,
+       sizeof(sha256_ctx_t),
+       512,
+       256,
+       (hf_init_fpt)sha256_init,
+       (hf_nextBlock_fpt)sha256_nextBlock,
+       (hf_lastBlock_fpt)sha256_lastBlock,
+       (hf_ctx2hash_fpt)sha256_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)sha256
+};
+
diff --git a/hfal/hfal_sha256.h b/hfal/hfal_sha256.h
new file mode 100644 (file)
index 0000000..aa57598
--- /dev/null
@@ -0,0 +1,36 @@
+/* hfal_sha256.h */
+/*
+    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/>.
+*/
+/**
+ * \file     hfal_sha256.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-02-04
+ * \license  GPLv3 or later
+ * 
+ */
+
+#ifndef HFAL_SHA256_H_
+#define HFAL_SHA256_H_
+
+
+#include "hashfunction_descriptor.h"
+
+extern const hfdesc_t sha256_desc;
+
+#endif /* HFAL_SHA256_H_ */
diff --git a/hfal/hfal_shabal.c b/hfal/hfal_shabal.c
new file mode 100644 (file)
index 0000000..ec0c7b6
--- /dev/null
@@ -0,0 +1,113 @@
+/* hfal_shabal.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/>.
+*/
+/**
+ * \file     hfal_shabal.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-04-20
+ * \license  GPLv3 or later
+ * 
+ */
+
+
+#include <stdlib.h>
+#include "hashfunction_descriptor.h"
+#include "shabal.h"
+
+
+static const char shabal192_str[] = "Shabal-192";
+static const char shabal224_str[] = "Shabal-224";
+static const char shabal256_str[] = "Shabal-256";
+static const char shabal384_str[] = "Shabal-384";
+static const char shabal512_str[] = "Shabal-512";
+
+const hfdesc_t shabal192_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       shabal192_str,
+       sizeof(shabal_ctx_t),
+       SHABAL_BLOCKSIZE,
+       192,
+       (hf_init_fpt)shabal192_init,
+       (hf_nextBlock_fpt)shabal_nextBlock,
+       (hf_lastBlock_fpt)shabal_lastBlock,
+       (hf_ctx2hash_fpt)shabal192_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)shabal192
+};
+
+const hfdesc_t shabal224_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       shabal224_str,
+       sizeof(shabal_ctx_t),
+       SHABAL_BLOCKSIZE,
+       224,
+       (hf_init_fpt)shabal224_init,
+       (hf_nextBlock_fpt)shabal_nextBlock,
+       (hf_lastBlock_fpt)shabal_lastBlock,
+       (hf_ctx2hash_fpt)shabal224_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)shabal224
+};
+
+const hfdesc_t shabal256_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       shabal256_str,
+       sizeof(shabal_ctx_t),
+       SHABAL_BLOCKSIZE,
+       256,
+       (hf_init_fpt)shabal256_init,
+       (hf_nextBlock_fpt)shabal_nextBlock,
+       (hf_lastBlock_fpt)shabal_lastBlock,
+       (hf_ctx2hash_fpt)shabal256_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)shabal256
+};
+
+const hfdesc_t shabal384_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       shabal384_str,
+       sizeof(shabal_ctx_t),
+       SHABAL_BLOCKSIZE,
+       384,
+       (hf_init_fpt)shabal384_init,
+       (hf_nextBlock_fpt)shabal_nextBlock,
+       (hf_lastBlock_fpt)shabal_lastBlock,
+       (hf_ctx2hash_fpt)shabal384_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)shabal384
+};
+
+const hfdesc_t shabal512_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       shabal512_str,
+       sizeof(shabal_ctx_t),
+       SHABAL_BLOCKSIZE,
+       512,
+       (hf_init_fpt)shabal512_init,
+       (hf_nextBlock_fpt)shabal_nextBlock,
+       (hf_lastBlock_fpt)shabal_lastBlock,
+       (hf_ctx2hash_fpt)shabal512_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)shabal512
+};
diff --git a/hfal/hfal_shabal.h b/hfal/hfal_shabal.h
new file mode 100644 (file)
index 0000000..f56f604
--- /dev/null
@@ -0,0 +1,40 @@
+/* hfal_shabal.h */
+/*
+    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/>.
+*/
+/**
+ * \file     hfal_shabal.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-04-20
+ * \license  GPLv3 or later
+ * 
+ */
+
+#ifndef HFAL_SHABAL_H_
+#define HFAL_SHABAL_H_
+
+
+#include "hashfunction_descriptor.h"
+
+extern const hfdesc_t shabal192_desc;
+extern const hfdesc_t shabal224_desc;
+extern const hfdesc_t shabal256_desc;
+extern const hfdesc_t shabal384_desc;
+extern const hfdesc_t shabal512_desc;
+
+#endif /* HFAL_SHABAL_H_ */
diff --git a/hfal/hfal_skein1024.c b/hfal/hfal_skein1024.c
new file mode 100644 (file)
index 0000000..2ee3400
--- /dev/null
@@ -0,0 +1,162 @@
+/* hfal_skein1024.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/>.
+*/
+/**
+ * \file     hfal_skein1024.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-03-13
+ * \license  GPLv3 or later
+ * 
+ */
+
+
+#include <stdlib.h>
+#include "hashfunction_descriptor.h"
+#include "skein.h"
+
+
+static const char skein1024_128_str[] = "Skein-1024-128";
+static const char skein1024_160_str[] = "Skein-1024-160";
+static const char skein1024_224_str[] = "Skein-1024-224";
+static const char skein1024_256_str[] = "Skein-1024-256";
+static const char skein1024_384_str[] = "Skein-1024-384";
+static const char skein1024_512_str[] = "Skein-1024-512";
+static const char skein1024_1024_str[] = "Skein-1024-1024";
+
+void skein1024_128_init(skein1024_ctx_t* ctx){
+       skein1024_init(ctx, 128);
+}
+void skein1024_160_init(skein1024_ctx_t* ctx){
+       skein1024_init(ctx, 160);
+}
+void skein1024_224_init(skein1024_ctx_t* ctx){
+       skein1024_init(ctx, 224);
+}
+void skein1024_256_init(skein1024_ctx_t* ctx){
+       skein1024_init(ctx, 256);
+}
+void skein1024_384_init(skein1024_ctx_t* ctx){
+       skein1024_init(ctx, 384);
+}
+void skein1024_512_init(skein1024_ctx_t* ctx){
+       skein1024_init(ctx, 512);
+}
+void skein1024_1024_init(skein1024_ctx_t* ctx){
+       skein1024_init(ctx, 1024);
+}
+
+const hfdesc_t skein1024_128_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein1024_128_str,
+       sizeof(skein1024_ctx_t),
+       SKEIN1024_BLOCKSIZE,
+       128,
+       (hf_init_fpt)skein1024_128_init,
+       (hf_nextBlock_fpt)skein1024_nextBlock,
+       (hf_lastBlock_fpt)skein1024_lastBlock,
+       (hf_ctx2hash_fpt)skein1024_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+const hfdesc_t skein1024_160_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein1024_160_str,
+       sizeof(skein1024_ctx_t),
+       SKEIN1024_BLOCKSIZE,
+       160,
+       (hf_init_fpt)skein1024_160_init,
+       (hf_nextBlock_fpt)skein1024_nextBlock,
+       (hf_lastBlock_fpt)skein1024_lastBlock,
+       (hf_ctx2hash_fpt)skein1024_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+const hfdesc_t skein1024_224_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein1024_224_str,
+       sizeof(skein1024_ctx_t),
+       SKEIN1024_BLOCKSIZE,
+       224,
+       (hf_init_fpt)skein1024_224_init,
+       (hf_nextBlock_fpt)skein1024_nextBlock,
+       (hf_lastBlock_fpt)skein1024_lastBlock,
+       (hf_ctx2hash_fpt)skein1024_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+const hfdesc_t skein1024_256_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein1024_256_str,
+       sizeof(skein1024_ctx_t),
+       SKEIN1024_BLOCKSIZE,
+       256,
+       (hf_init_fpt)skein1024_256_init,
+       (hf_nextBlock_fpt)skein1024_nextBlock,
+       (hf_lastBlock_fpt)skein1024_lastBlock,
+       (hf_ctx2hash_fpt)skein1024_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+const hfdesc_t skein1024_384_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein1024_384_str,
+       sizeof(skein1024_ctx_t),
+       SKEIN1024_BLOCKSIZE,
+       384,
+       (hf_init_fpt)skein1024_384_init,
+       (hf_nextBlock_fpt)skein1024_nextBlock,
+       (hf_lastBlock_fpt)skein1024_lastBlock,
+       (hf_ctx2hash_fpt)skein1024_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+const hfdesc_t skein1024_512_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein1024_512_str,
+       sizeof(skein1024_ctx_t),
+       SKEIN1024_BLOCKSIZE,
+       512,
+       (hf_init_fpt)skein1024_512_init,
+       (hf_nextBlock_fpt)skein1024_nextBlock,
+       (hf_lastBlock_fpt)skein1024_lastBlock,
+       (hf_ctx2hash_fpt)skein1024_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+const hfdesc_t skein1024_1024_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein1024_1024_str,
+       sizeof(skein1024_ctx_t),
+       SKEIN1024_BLOCKSIZE,
+       1024,
+       (hf_init_fpt)skein1024_1024_init,
+       (hf_nextBlock_fpt)skein1024_nextBlock,
+       (hf_lastBlock_fpt)skein1024_lastBlock,
+       (hf_ctx2hash_fpt)skein1024_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+
diff --git a/hfal/hfal_skein1024.h b/hfal/hfal_skein1024.h
new file mode 100644 (file)
index 0000000..4deeca6
--- /dev/null
@@ -0,0 +1,42 @@
+/* hfal_skein1024.h */
+/*
+    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/>.
+*/
+/**
+ * \file     hfal_skein1024.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-03-13
+ * \license  GPLv3 or later
+ * 
+ */
+
+#ifndef HFAL_SKEIN1024_H_
+#define HFAL_SKEIN1024_H_
+
+
+#include "hashfunction_descriptor.h"
+
+extern const hfdesc_t skein1024_128_desc;
+extern const hfdesc_t skein1024_160_desc;
+extern const hfdesc_t skein1024_224_desc;
+extern const hfdesc_t skein1024_256_desc;
+extern const hfdesc_t skein1024_384_desc;
+extern const hfdesc_t skein1024_512_desc;
+extern const hfdesc_t skein1024_1024_desc;
+
+#endif /* HFAL_SHA1024_H_ */
diff --git a/hfal/hfal_skein256.c b/hfal/hfal_skein256.c
new file mode 100644 (file)
index 0000000..2daeb84
--- /dev/null
@@ -0,0 +1,143 @@
+/* hfal_skein256.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/>.
+*/
+/**
+ * \file     hfal_skein256.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-03-13
+ * \license  GPLv3 or later
+ * 
+ */
+
+
+#include <stdlib.h>
+#include "hashfunction_descriptor.h"
+#include "skein.h"
+
+
+static const char skein256_128_str[] = "Skein-256-128";
+static const char skein256_160_str[] = "Skein-256-160";
+static const char skein256_224_str[] = "Skein-256-224";
+static const char skein256_256_str[] = "Skein-256-256";
+static const char skein256_384_str[] = "Skein-256-384";
+static const char skein256_512_str[] = "Skein-256-512";
+
+void skein256_128_init(skein256_ctx_t* ctx){
+       skein256_init(ctx, 128);
+}
+void skein256_160_init(skein256_ctx_t* ctx){
+       skein256_init(ctx, 160);
+}
+void skein256_224_init(skein256_ctx_t* ctx){
+       skein256_init(ctx, 224);
+}
+void skein256_256_init(skein256_ctx_t* ctx){
+       skein256_init(ctx, 256);
+}
+void skein256_384_init(skein256_ctx_t* ctx){
+       skein256_init(ctx, 384);
+}
+void skein256_512_init(skein256_ctx_t* ctx){
+       skein256_init(ctx, 512);
+}
+
+const hfdesc_t skein256_128_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein256_128_str,
+       sizeof(skein256_ctx_t),
+       SKEIN256_BLOCKSIZE,
+       128,
+       (hf_init_fpt)skein256_128_init,
+       (hf_nextBlock_fpt)skein256_nextBlock,
+       (hf_lastBlock_fpt)skein256_lastBlock,
+       (hf_ctx2hash_fpt)skein256_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+const hfdesc_t skein256_160_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein256_160_str,
+       sizeof(skein256_ctx_t),
+       SKEIN256_BLOCKSIZE,
+       160,
+       (hf_init_fpt)skein256_160_init,
+       (hf_nextBlock_fpt)skein256_nextBlock,
+       (hf_lastBlock_fpt)skein256_lastBlock,
+       (hf_ctx2hash_fpt)skein256_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+const hfdesc_t skein256_224_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein256_224_str,
+       sizeof(skein256_ctx_t),
+       SKEIN256_BLOCKSIZE,
+       224,
+       (hf_init_fpt)skein256_224_init,
+       (hf_nextBlock_fpt)skein256_nextBlock,
+       (hf_lastBlock_fpt)skein256_lastBlock,
+       (hf_ctx2hash_fpt)skein256_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+const hfdesc_t skein256_256_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein256_256_str,
+       sizeof(skein256_ctx_t),
+       SKEIN256_BLOCKSIZE,
+       256,
+       (hf_init_fpt)skein256_256_init,
+       (hf_nextBlock_fpt)skein256_nextBlock,
+       (hf_lastBlock_fpt)skein256_lastBlock,
+       (hf_ctx2hash_fpt)skein256_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+const hfdesc_t skein256_384_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein256_384_str,
+       sizeof(skein256_ctx_t),
+       SKEIN256_BLOCKSIZE,
+       384,
+       (hf_init_fpt)skein256_384_init,
+       (hf_nextBlock_fpt)skein256_nextBlock,
+       (hf_lastBlock_fpt)skein256_lastBlock,
+       (hf_ctx2hash_fpt)skein256_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+const hfdesc_t skein256_512_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein256_512_str,
+       sizeof(skein256_ctx_t),
+       SKEIN256_BLOCKSIZE,
+       512,
+       (hf_init_fpt)skein256_512_init,
+       (hf_nextBlock_fpt)skein256_nextBlock,
+       (hf_lastBlock_fpt)skein256_lastBlock,
+       (hf_ctx2hash_fpt)skein256_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
diff --git a/hfal/hfal_skein256.h b/hfal/hfal_skein256.h
new file mode 100644 (file)
index 0000000..ec75a3d
--- /dev/null
@@ -0,0 +1,41 @@
+/* hfal_skein256.h */
+/*
+    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/>.
+*/
+/**
+ * \file     hfal_skein256.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-03-13
+ * \license  GPLv3 or later
+ * 
+ */
+
+#ifndef HFAL_SKEIN256_H_
+#define HFAL_SKEIN256_H_
+
+
+#include "hashfunction_descriptor.h"
+
+extern const hfdesc_t skein256_128_desc;
+extern const hfdesc_t skein256_160_desc;
+extern const hfdesc_t skein256_224_desc;
+extern const hfdesc_t skein256_256_desc;
+extern const hfdesc_t skein256_384_desc;
+extern const hfdesc_t skein256_512_desc;
+
+#endif /* HFAL_SKEIN256_H_ */
diff --git a/hfal/hfal_skein512.c b/hfal/hfal_skein512.c
new file mode 100644 (file)
index 0000000..b93dab1
--- /dev/null
@@ -0,0 +1,162 @@
+/* hfal_skein512.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/>.
+*/
+/**
+ * \file     hfal_skein512.c
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-03-13
+ * \license  GPLv3 or later
+ * 
+ */
+
+
+#include <stdlib.h>
+#include "hashfunction_descriptor.h"
+#include "skein.h"
+
+
+static const char skein512_128_str[] = "Skein-512-128";
+static const char skein512_160_str[] = "Skein-512-160";
+static const char skein512_224_str[] = "Skein-512-224";
+static const char skein512_256_str[] = "Skein-512-256";
+static const char skein512_384_str[] = "Skein-512-384";
+static const char skein512_512_str[] = "Skein-512-512";
+static const char skein512_1024_str[] = "Skein-512-1024";
+
+void skein512_128_init(skein512_ctx_t* ctx){
+       skein512_init(ctx, 128);
+}
+void skein512_160_init(skein512_ctx_t* ctx){
+       skein512_init(ctx, 160);
+}
+void skein512_224_init(skein512_ctx_t* ctx){
+       skein512_init(ctx, 224);
+}
+void skein512_256_init(skein512_ctx_t* ctx){
+       skein512_init(ctx, 256);
+}
+void skein512_384_init(skein512_ctx_t* ctx){
+       skein512_init(ctx, 384);
+}
+void skein512_512_init(skein512_ctx_t* ctx){
+       skein512_init(ctx, 512);
+}
+void skein512_1024_init(skein512_ctx_t* ctx){
+       skein512_init(ctx, 1024);
+}
+
+const hfdesc_t skein512_128_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein512_128_str,
+       sizeof(skein512_ctx_t),
+       SKEIN512_BLOCKSIZE,
+       128,
+       (hf_init_fpt)skein512_128_init,
+       (hf_nextBlock_fpt)skein512_nextBlock,
+       (hf_lastBlock_fpt)skein512_lastBlock,
+       (hf_ctx2hash_fpt)skein512_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+const hfdesc_t skein512_160_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein512_160_str,
+       sizeof(skein512_ctx_t),
+       SKEIN512_BLOCKSIZE,
+       160,
+       (hf_init_fpt)skein512_160_init,
+       (hf_nextBlock_fpt)skein512_nextBlock,
+       (hf_lastBlock_fpt)skein512_lastBlock,
+       (hf_ctx2hash_fpt)skein512_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+const hfdesc_t skein512_224_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein512_224_str,
+       sizeof(skein512_ctx_t),
+       SKEIN512_BLOCKSIZE,
+       224,
+       (hf_init_fpt)skein512_224_init,
+       (hf_nextBlock_fpt)skein512_nextBlock,
+       (hf_lastBlock_fpt)skein512_lastBlock,
+       (hf_ctx2hash_fpt)skein512_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+const hfdesc_t skein512_256_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein512_256_str,
+       sizeof(skein512_ctx_t),
+       SKEIN512_BLOCKSIZE,
+       256,
+       (hf_init_fpt)skein512_256_init,
+       (hf_nextBlock_fpt)skein512_nextBlock,
+       (hf_lastBlock_fpt)skein512_lastBlock,
+       (hf_ctx2hash_fpt)skein512_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+const hfdesc_t skein512_384_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein512_384_str,
+       sizeof(skein512_ctx_t),
+       SKEIN512_BLOCKSIZE,
+       384,
+       (hf_init_fpt)skein512_384_init,
+       (hf_nextBlock_fpt)skein512_nextBlock,
+       (hf_lastBlock_fpt)skein512_lastBlock,
+       (hf_ctx2hash_fpt)skein512_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+const hfdesc_t skein512_512_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein512_512_str,
+       sizeof(skein512_ctx_t),
+       SKEIN512_BLOCKSIZE,
+       512,
+       (hf_init_fpt)skein512_512_init,
+       (hf_nextBlock_fpt)skein512_nextBlock,
+       (hf_lastBlock_fpt)skein512_lastBlock,
+       (hf_ctx2hash_fpt)skein512_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+const hfdesc_t skein512_1024_desc = {
+       HFDESC_TYPE_HASHFUNCTION,
+       0,
+       skein512_1024_str,
+       sizeof(skein512_ctx_t),
+       SKEIN512_BLOCKSIZE,
+       1024,
+       (hf_init_fpt)skein512_1024_init,
+       (hf_nextBlock_fpt)skein512_nextBlock,
+       (hf_lastBlock_fpt)skein512_lastBlock,
+       (hf_ctx2hash_fpt)skein512_ctx2hash,
+       (hf_free_fpt)NULL,
+       (hf_mem_fpt)NULL
+};
+
diff --git a/hfal/hfal_skein512.h b/hfal/hfal_skein512.h
new file mode 100644 (file)
index 0000000..3947e43
--- /dev/null
@@ -0,0 +1,42 @@
+/* hfal_skein512.h */
+/*
+    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/>.
+*/
+/**
+ * \file     hfal_skein512.h
+ * \email    daniel.otte@rub.de
+ * \author   Daniel Otte 
+ * \date     2009-03-13
+ * \license  GPLv3 or later
+ * 
+ */
+
+#ifndef HFAL_SKEIN512_H_
+#define HFAL_SKEIN512_H_
+
+
+#include "hashfunction_descriptor.h"
+
+extern const hfdesc_t skein512_128_desc;
+extern const hfdesc_t skein512_160_desc;
+extern const hfdesc_t skein512_224_desc;
+extern const hfdesc_t skein512_256_desc;
+extern const hfdesc_t skein512_384_desc;
+extern const hfdesc_t skein512_512_desc;
+extern const hfdesc_t skein512_1024_desc;
+
+#endif /* HFAL_SHA512_H_ */
diff --git a/hfal_blake_large.c b/hfal_blake_large.c
deleted file mode 100644 (file)
index 8a432ff..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/* hfal_blake_large.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/>.
-*/
-/**
- * \file     hfal_blake_large.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-05-08
- * \license  GPLv3 or later
- * 
- */
-
-#include <stdlib.h>
-#include "hashfunction_descriptor.h"
-#include "blake_large.h"
-
-
-static const char blake48_str[]  = "Blake-48";
-static const char blake64_str[]  = "Blake-64";
-
-const hfdesc_t blake48_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       blake48_str,
-       sizeof(blake48_ctx_t),
-       BLAKE48_BLOCKSIZE,
-       384,
-       (hf_init_fpt)blake48_init,
-       (hf_nextBlock_fpt)blake_large_nextBlock,
-       (hf_lastBlock_fpt)blake_large_lastBlock,
-       (hf_ctx2hash_fpt)blake48_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)blake48
-};
-
-const hfdesc_t blake64_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       blake64_str,
-       sizeof(blake64_ctx_t),
-       BLAKE64_BLOCKSIZE,
-       512,
-       (hf_init_fpt)blake64_init,
-       (hf_nextBlock_fpt)blake_large_nextBlock,
-       (hf_lastBlock_fpt)blake_large_lastBlock,
-       (hf_ctx2hash_fpt)blake64_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)blake64
-};
-
-
diff --git a/hfal_blake_large.h b/hfal_blake_large.h
deleted file mode 100644 (file)
index a6740b5..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/* hfal_blake_large.h */
-/*
-    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/>.
-*/
-/**
- * \file     hfal_blake_large.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-05-08
- * \license  GPLv3 or later
- * 
- */
-
-#ifndef HFAL_BLAKE_LARGE_H_
-#define HFAL_BLAKE_LARGE_H_
-
-#include "hashfunction_descriptor.h"
-
-extern const hfdesc_t blake48_desc;
-extern const hfdesc_t blake64_desc;
-
-#endif /* HFAL_BLAKE_LARGE_H_ */
diff --git a/hfal_blake_small.c b/hfal_blake_small.c
deleted file mode 100644 (file)
index 7273abb..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/* hfal_blake_small.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/>.
-*/
-/**
- * \file     hfal_blake_small.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-05-05
- * \license  GPLv3 or later
- * 
- */
-
-#include <stdlib.h>
-#include "hashfunction_descriptor.h"
-#include "blake_small.h"
-
-
-static const char blake28_str[] = "Blake-28";
-static const char blake32_str[] = "Blake-32";
-
-const hfdesc_t blake28_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       blake28_str,
-       sizeof(blake28_ctx_t),
-       BLAKE28_BLOCKSIZE,
-       224,
-       (hf_init_fpt)blake28_init,
-       (hf_nextBlock_fpt)blake_small_nextBlock,
-       (hf_lastBlock_fpt)blake_small_lastBlock,
-       (hf_ctx2hash_fpt)blake28_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)blake28
-};
-
-const hfdesc_t blake32_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       blake32_str,
-       sizeof(blake32_ctx_t),
-       BLAKE32_BLOCKSIZE,
-       256,
-       (hf_init_fpt)blake32_init,
-       (hf_nextBlock_fpt)blake_small_nextBlock,
-       (hf_lastBlock_fpt)blake_small_lastBlock,
-       (hf_ctx2hash_fpt)blake32_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)blake32
-};
-
-
diff --git a/hfal_blake_small.h b/hfal_blake_small.h
deleted file mode 100644 (file)
index 925d72d..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/* hfal_blake_small.h */
-/*
-    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/>.
-*/
-/**
- * \file     hfal_blake_small.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-05-05
- * \license  GPLv3 or later
- * 
- */
-
-#ifndef HFAL_BLAKE_SMALL_H_
-#define HFAL_BLAKE_SMALL_H_
-
-#include "hashfunction_descriptor.h"
-
-extern const hfdesc_t blake28_desc;
-extern const hfdesc_t blake32_desc;
-
-#endif /* HFAL_BLAKE_SMALL_H_ */
diff --git a/hfal_bmw_large.c b/hfal_bmw_large.c
deleted file mode 100644 (file)
index 348895f..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/* hfal_bmw_large.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/>.
-*/
-/**
- * \file     hfal_bmw_large.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-04-28
- * \license  GPLv3 or later
- * 
- */
-
-#include <stdlib.h>
-#include "hashfunction_descriptor.h"
-#include "bmw_large.h"
-
-
-static const char bmw384_str[]  = "BlueMidnightWish-384";
-static const char bmw512_str[]  = "BlueMidnightWish-512";
-
-const hfdesc_t bmw384_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       bmw384_str,
-       sizeof(bmw384_ctx_t),
-       BMW384_BLOCKSIZE,
-       384,
-       (hf_init_fpt)bmw384_init,
-       (hf_nextBlock_fpt)bmw384_nextBlock,
-       (hf_lastBlock_fpt)bmw384_lastBlock,
-       (hf_ctx2hash_fpt)bmw384_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)bmw384
-};
-
-const hfdesc_t bmw512_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       bmw512_str,
-       sizeof(bmw512_ctx_t),
-       BMW512_BLOCKSIZE,
-       512,
-       (hf_init_fpt)bmw512_init,
-       (hf_nextBlock_fpt)bmw512_nextBlock,
-       (hf_lastBlock_fpt)bmw512_lastBlock,
-       (hf_ctx2hash_fpt)bmw512_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)bmw512
-};
-
-
diff --git a/hfal_bmw_large.h b/hfal_bmw_large.h
deleted file mode 100644 (file)
index 5a28b2c..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/* hfal_bmw_large.h */
-/*
-    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/>.
-*/
-/**
- * \file     hfal_bmw_large.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-04-28
- * \license  GPLv3 or later
- * 
- */
-
-#ifndef HFAL_BMW_LARGE_H_
-#define HFAL_BMW_LARGE_H_
-
-#include "hashfunction_descriptor.h"
-
-extern const hfdesc_t bmw384_desc;
-extern const hfdesc_t bmw512_desc;
-
-#endif /* HFAL_BMW_LARGE_H_ */
diff --git a/hfal_bmw_small.c b/hfal_bmw_small.c
deleted file mode 100644 (file)
index 9bcd500..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/* hfal_bmw_small.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/>.
-*/
-/**
- * \file     hfal_bmw_small.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-04-28
- * \license  GPLv3 or later
- * 
- */
-
-#include <stdlib.h>
-#include "hashfunction_descriptor.h"
-#include "bmw_small.h"
-
-
-static const char bmw224_str[]  = "BlueMidnightWish-224";
-static const char bmw256_str[]  = "BlueMidnightWish-256";
-
-const hfdesc_t bmw224_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       bmw224_str,
-       sizeof(bmw224_ctx_t),
-       BMW224_BLOCKSIZE,
-       224,
-       (hf_init_fpt)bmw224_init,
-       (hf_nextBlock_fpt)bmw224_nextBlock,
-       (hf_lastBlock_fpt)bmw224_lastBlock,
-       (hf_ctx2hash_fpt)bmw224_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)bmw224
-};
-
-const hfdesc_t bmw256_desc  = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       bmw256_str,
-       sizeof(bmw256_ctx_t),
-       BMW256_BLOCKSIZE,
-       256,
-       (hf_init_fpt)bmw256_init,
-       (hf_nextBlock_fpt)bmw256_nextBlock,
-       (hf_lastBlock_fpt)bmw256_lastBlock,
-       (hf_ctx2hash_fpt)bmw256_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)bmw256
-};
-
-
diff --git a/hfal_bmw_small.h b/hfal_bmw_small.h
deleted file mode 100644 (file)
index 08f3c86..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/* hfal_bmw_small.h */
-/*
-    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/>.
-*/
-/**
- * \file     hfal_bmw_small.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-04-28
- * \license  GPLv3 or later
- * 
- */
-
-#ifndef HFAL_BMW_SMALL_H_
-#define HFAL_BMW_SMALL_H_
-
-#include "hashfunction_descriptor.h"
-
-extern const hfdesc_t bmw224_desc;
-extern const hfdesc_t bmw256_desc;
-
-#endif /* HFAL_BMW_SMALL_H_ */
diff --git a/hfal_cubehash.c b/hfal_cubehash.c
deleted file mode 100644 (file)
index 132f1dd..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/* hfal_cubehash.c */
-/*
-    This file is part of the AVR-Crypto-Lib.
-    Copyright (C) 2010 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/>.
-*/
-/**
- * \file     hfal_cubehash.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte
- * \date     2010-02-09
- * \license  GPLv3 or later
- *
- */
-
-#include <stdlib.h>
-#include "hashfunction_descriptor.h"
-#include "cubehash.h"
-
-
-static const char cubehash224_str[] = "CubeHash-224";
-static const char cubehash256_str[] = "CubeHash-256";
-static const char cubehash384_str[] = "CubeHash-384";
-static const char cubehash512_str[] = "CubeHash-512";
-
-const hfdesc_t cubehash224_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       cubehash224_str,
-       sizeof(cubehash_ctx_t),
-       CUBEHASH224_BLOCKSIZE,
-       224,
-       (hf_init_fpt)cubehash224_init,
-       (hf_nextBlock_fpt)cubehash_nextBlock,
-       (hf_lastBlock_fpt)cubehash_lastBlock,
-       (hf_ctx2hash_fpt)cubehash224_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-
-const hfdesc_t cubehash256_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       cubehash256_str,
-       sizeof(cubehash_ctx_t),
-       CUBEHASH256_BLOCKSIZE,
-       256,
-       (hf_init_fpt)cubehash256_init,
-       (hf_nextBlock_fpt)cubehash_nextBlock,
-       (hf_lastBlock_fpt)cubehash_lastBlock,
-       (hf_ctx2hash_fpt)cubehash256_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-
-const hfdesc_t cubehash384_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       cubehash384_str,
-       sizeof(cubehash_ctx_t),
-       CUBEHASH384_BLOCKSIZE,
-       384,
-       (hf_init_fpt)cubehash384_init,
-       (hf_nextBlock_fpt)cubehash_nextBlock,
-       (hf_lastBlock_fpt)cubehash_lastBlock,
-       (hf_ctx2hash_fpt)cubehash384_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-
-const hfdesc_t cubehash512_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       cubehash512_str,
-       sizeof(cubehash_ctx_t),
-       CUBEHASH512_BLOCKSIZE,
-       512,
-       (hf_init_fpt)cubehash512_init,
-       (hf_nextBlock_fpt)cubehash_nextBlock,
-       (hf_lastBlock_fpt)cubehash_lastBlock,
-       (hf_ctx2hash_fpt)cubehash512_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-
-
diff --git a/hfal_cubehash.h b/hfal_cubehash.h
deleted file mode 100644 (file)
index 40441f3..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/* hfal_cubehash.h */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2010 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/>.
-*/
-
-#ifndef HFAL_CUBEHASH_H_
-#define HFAL_CUBEHASH_H_
-
-#include "hashfunction_descriptor.h"
-
-extern const hfdesc_t cubehash224_desc;
-extern const hfdesc_t cubehash256_desc;
-extern const hfdesc_t cubehash384_desc;
-extern const hfdesc_t cubehash512_desc;
-
-
-#endif /* HFAL_CUBEHASH_H_ */
diff --git a/hfal_echo.c b/hfal_echo.c
deleted file mode 100644 (file)
index a8ce1a3..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/* hfal_echo.c */
-/*
-    This file is part of the AVR-Crypto-Lib.
-    Copyright (C) 2010 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/>.
-*/
-/**
- * \file     hfal_echo.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte
- * \date     2010-02-21
- * \license  GPLv3 or later
- *
- */
-
-#include <stdlib.h>
-#include "hashfunction_descriptor.h"
-#include "echo.h"
-
-
-static const char echo224_str[]    = "ECHO-224";
-static const char echo256_str[]    = "ECHO-256";
-static const char echo384_str[]    = "ECHO-384";
-static const char echo512_str[]    = "ECHO-512";
-
-const hfdesc_t echo224_desc  = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       echo224_str,
-       sizeof(echo_small_ctx_t),
-       ECHO224_BLOCKSIZE,
-       224,
-       (hf_init_fpt)echo224_init,
-       (hf_nextBlock_fpt)echo_small_nextBlock,
-       (hf_lastBlock_fpt)echo_small_lastBlock,
-       (hf_ctx2hash_fpt)echo224_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-
-const hfdesc_t echo256_desc  = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       echo256_str,
-       sizeof(echo_small_ctx_t),
-       ECHO256_BLOCKSIZE,
-       256,
-       (hf_init_fpt)echo256_init,
-       (hf_nextBlock_fpt)echo_small_nextBlock,
-       (hf_lastBlock_fpt)echo_small_lastBlock,
-       (hf_ctx2hash_fpt)echo256_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-
-const hfdesc_t echo384_desc  = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       echo384_str,
-       sizeof(echo_large_ctx_t),
-       ECHO384_BLOCKSIZE,
-       384,
-       (hf_init_fpt)echo384_init,
-       (hf_nextBlock_fpt)echo_large_nextBlock,
-       (hf_lastBlock_fpt)echo_large_lastBlock,
-       (hf_ctx2hash_fpt)echo384_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-
-const hfdesc_t echo512_desc  = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       echo512_str,
-       sizeof(echo_large_ctx_t),
-       ECHO512_BLOCKSIZE,
-       512,
-       (hf_init_fpt)echo512_init,
-       (hf_nextBlock_fpt)echo_large_nextBlock,
-       (hf_lastBlock_fpt)echo_large_lastBlock,
-       (hf_ctx2hash_fpt)echo512_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-
-
diff --git a/hfal_echo.h b/hfal_echo.h
deleted file mode 100644 (file)
index 78be0db..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* hfal_echo.h */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2010 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/>.
-*/
-
-#ifndef HFAL_ECHO_H_
-#define HFAL_ECHO_H_
-
-#include "hashfunction_descriptor.h"
-
-extern const hfdesc_t echo224_desc;
-extern const hfdesc_t echo256_desc;
-extern const hfdesc_t echo384_desc;
-extern const hfdesc_t echo512_desc;
-
-#endif /* HFAL_ECHO_H_ */
diff --git a/hfal_groestl_large.c b/hfal_groestl_large.c
deleted file mode 100644 (file)
index e33be03..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/* hfal_groestl_large.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/>.
-*/
-/**
- * \file     hfal_groestl_large.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-05-05
- * \license  GPLv3 or later
- * 
- */
-
-
-#include <stdlib.h>
-#include "hashfunction_descriptor.h"
-#include "groestl_large.h"
-#include "groestl_small.h"
-
-
-static const char groestl384_str[] = "Groestl-384";
-static const char groestl512_str[] = "Groestl-512";
-
-const hfdesc_t groestl384_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       groestl384_str,
-       sizeof(groestl384_ctx_t),
-       GROESTL384_BLOCKSIZE,
-       384,
-       (hf_init_fpt)groestl384_init,
-       (hf_nextBlock_fpt)groestl_large_nextBlock,
-       (hf_lastBlock_fpt)groestl_large_lastBlock,
-       (hf_ctx2hash_fpt)groestl384_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)groestl384
-};
-
-const hfdesc_t groestl512_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       groestl512_str,
-       sizeof(groestl512_ctx_t),
-       GROESTL512_BLOCKSIZE,
-       512,
-       (hf_init_fpt)groestl512_init,
-       (hf_nextBlock_fpt)groestl_large_nextBlock,
-       (hf_lastBlock_fpt)groestl_large_lastBlock,
-       (hf_ctx2hash_fpt)groestl512_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)groestl512
-};
-
diff --git a/hfal_groestl_large.h b/hfal_groestl_large.h
deleted file mode 100644 (file)
index cbf331b..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* hfal_groestl_large.h */
-/*
-    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/>.
-*/
-/**
- * \file     hfal_groestl_large.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-06-11
- * \license  GPLv3 or later
- * 
- */
-
-#ifndef HFAL_GROESTL_LARGE_H_
-#define HFAL_GROESTL_LARGE_H_
-
-
-#include "hashfunction_descriptor.h"
-
-extern const hfdesc_t groestl384_desc;
-extern const hfdesc_t groestl512_desc;
-
-#endif /* HFAL_GROESTL_LARGE_H_ */
diff --git a/hfal_groestl_small.c b/hfal_groestl_small.c
deleted file mode 100644 (file)
index 00f3d3d..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/* hfal_groestl_small.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/>.
-*/
-/**
- * \file     hfal_groestl_small.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-05-05
- * \license  GPLv3 or later
- * 
- */
-
-
-#include <stdlib.h>
-#include "hashfunction_descriptor.h"
-#include "groestl_small.h"
-
-
-static const char groestl224_str[] = "Groestl-224";
-static const char groestl256_str[] = "Groestl-256";
-
-const hfdesc_t groestl224_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       groestl224_str,
-       sizeof(groestl224_ctx_t),
-       GROESTL224_BLOCKSIZE,
-       224,
-       (hf_init_fpt)groestl224_init,
-       (hf_nextBlock_fpt)groestl_small_nextBlock,
-       (hf_lastBlock_fpt)groestl_small_lastBlock,
-       (hf_ctx2hash_fpt)groestl224_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)groestl224
-};
-
-const hfdesc_t groestl256_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       groestl256_str,
-       sizeof(groestl256_ctx_t),
-       GROESTL256_BLOCKSIZE,
-       256,
-       (hf_init_fpt)groestl256_init,
-       (hf_nextBlock_fpt)groestl_small_nextBlock,
-       (hf_lastBlock_fpt)groestl_small_lastBlock,
-       (hf_ctx2hash_fpt)groestl256_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)groestl256
-};
-
-
diff --git a/hfal_groestl_small.h b/hfal_groestl_small.h
deleted file mode 100644 (file)
index 4295f37..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* hfal_groestl_small.h */
-/*
-    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/>.
-*/
-/**
- * \file     hfal_groestl_small.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-05-05
- * \license  GPLv3 or later
- * 
- */
-
-#ifndef HFAL_GROESTL_SMALL_H_
-#define HFAL_GROESTL_SMALL_H_
-
-
-#include "hashfunction_descriptor.h"
-
-extern const hfdesc_t groestl224_desc;
-extern const hfdesc_t groestl256_desc;
-
-#endif /* HFAL_GROESTL_SMALL_H_ */
diff --git a/hfal_keccak.c b/hfal_keccak.c
deleted file mode 100644 (file)
index b3981ea..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/* hfal_keccak.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/>.
-*/
-/**
- * \file     hfal_keccak.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2010-02-09
- * \license  GPLv3 or later
- * 
- */
-
-
-#include <stdlib.h>
-#include "hashfunction_descriptor.h"
-#include "keccak.h"
-
-
-static const char keccak224_str[] = "Keccak-224";
-static const char keccak256_str[] = "Keccak-256";
-static const char keccak384_str[] = "Keccak-384";
-static const char keccak512_str[] = "Keccak-512";
-
-const hfdesc_t keccak224_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       keccak224_str,
-       sizeof(keccak_ctx_t),
-       KECCAK224_BLOCKSIZE,
-       224,
-       (hf_init_fpt)keccak224_init,
-       (hf_nextBlock_fpt)keccak_nextBlock,
-       (hf_lastBlock_fpt)keccak_lastBlock,
-       (hf_ctx2hash_fpt)keccak224_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-
-const hfdesc_t keccak256_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       keccak256_str,
-       sizeof(keccak_ctx_t),
-       KECCAK256_BLOCKSIZE,
-       256,
-       (hf_init_fpt)keccak256_init,
-       (hf_nextBlock_fpt)keccak_nextBlock,
-       (hf_lastBlock_fpt)keccak_lastBlock,
-       (hf_ctx2hash_fpt)keccak256_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-
-const hfdesc_t keccak384_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       keccak384_str,
-       sizeof(keccak_ctx_t),
-       KECCAK384_BLOCKSIZE,
-       384,
-       (hf_init_fpt)keccak384_init,
-       (hf_nextBlock_fpt)keccak_nextBlock,
-       (hf_lastBlock_fpt)keccak_lastBlock,
-       (hf_ctx2hash_fpt)keccak384_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-
-const hfdesc_t keccak512_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       keccak512_str,
-       sizeof(keccak_ctx_t),
-       KECCAK512_BLOCKSIZE,
-       512,
-       (hf_init_fpt)keccak512_init,
-       (hf_nextBlock_fpt)keccak_nextBlock,
-       (hf_lastBlock_fpt)keccak_lastBlock,
-       (hf_ctx2hash_fpt)keccak512_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-
-
diff --git a/hfal_keccak.h b/hfal_keccak.h
deleted file mode 100644 (file)
index 16ddeae..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/* hfal_keccak.h */
-/*
-    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/>.
-*/
-/**
- * \file     hfal_keccak.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2010-02-09
- * \license  GPLv3 or later
- * 
- */
-
-#ifndef HFAL_KECCAK_H_
-#define HFAL_KECCAK_H_
-
-
-#include "hashfunction_descriptor.h"
-
-extern const hfdesc_t keccak224_desc;
-extern const hfdesc_t keccak256_desc;
-extern const hfdesc_t keccak384_desc;
-extern const hfdesc_t keccak512_desc;
-
-#endif /* HFAL_KECCAK_H_ */
diff --git a/hfal_md5.c b/hfal_md5.c
deleted file mode 100644 (file)
index 8e3399c..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* hfal_md5.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/>.
-*/
-/**
- * \file     hfal_md5.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-02-09
- * \license  GPLv3 or later
- * 
- */
-
-
-#include <stdlib.h>
-#include "hashfunction_descriptor.h"
-#include "md5.h"
-
-static const char md5_str[] = "MD5";
-
-const hfdesc_t md5_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       md5_str,
-       sizeof(md5_ctx_t),
-       512,
-       128,
-       (hf_init_fpt)md5_init,
-       (hf_nextBlock_fpt)md5_nextBlock,
-       (hf_lastBlock_fpt)md5_lastBlock,
-       (hf_ctx2hash_fpt)md5_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)md5
-};
-
diff --git a/hfal_md5.h b/hfal_md5.h
deleted file mode 100644 (file)
index 3682493..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/* hfal_md5.h */
-/*
-    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/>.
-*/
-/**
- * \file     hfal_md5.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-02-09
- * \license  GPLv3 or later
- * 
- */
-
-#ifndef HFAL_MD5_H_
-#define HFAL_MD5_H_
-
-
-#include "hashfunction_descriptor.h"
-
-extern const hfdesc_t md5_desc;
-
-#endif /* HFAL_MD5_H_ */
diff --git a/hfal_sha1.c b/hfal_sha1.c
deleted file mode 100644 (file)
index b38ab4d..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* hfal_sha1.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/>.
-*/
-/**
- * \file     hfal_sha1.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-02-04
- * \license  GPLv3 or later
- * 
- */
-
-
-#include <stdlib.h>
-#include "hashfunction_descriptor.h"
-#include "sha1.h"
-
-static const char sha1_str[] = "SHA-1";
-
-const hfdesc_t sha1_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       sha1_str,
-       sizeof(sha1_ctx_t),
-       512,
-       160,
-       (hf_init_fpt)sha1_init,
-       (hf_nextBlock_fpt)sha1_nextBlock,
-       (hf_lastBlock_fpt)sha1_lastBlock,
-       (hf_ctx2hash_fpt)sha1_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)sha1
-};
-
diff --git a/hfal_sha1.h b/hfal_sha1.h
deleted file mode 100644 (file)
index f0f6b8d..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/* hfal_sha1.h */
-/*
-    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/>.
-*/
-/**
- * \file     hfal_sha1.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-02-04
- * \license  GPLv3 or later
- * 
- */
-
-#ifndef HFAL_SHA1_H_
-#define HFAL_SHA1_H_
-
-
-#include "hashfunction_descriptor.h"
-
-extern const hfdesc_t sha1_desc;
-
-#endif /* HFAL_SHA1_H_ */
diff --git a/hfal_sha256.c b/hfal_sha256.c
deleted file mode 100644 (file)
index 2da04d8..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* hfal_sha256.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/>.
-*/
-/**
- * \file     hfal_sha256.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-02-04
- * \license  GPLv3 or later
- * 
- */
-
-
-#include <stdlib.h>
-#include "hashfunction_descriptor.h"
-#include "sha256.h"
-
-static const char sha256_str[] = "SHA-256";
-
-const hfdesc_t sha256_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       sha256_str,
-       sizeof(sha256_ctx_t),
-       512,
-       256,
-       (hf_init_fpt)sha256_init,
-       (hf_nextBlock_fpt)sha256_nextBlock,
-       (hf_lastBlock_fpt)sha256_lastBlock,
-       (hf_ctx2hash_fpt)sha256_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)sha256
-};
-
diff --git a/hfal_sha256.h b/hfal_sha256.h
deleted file mode 100644 (file)
index aa57598..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/* hfal_sha256.h */
-/*
-    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/>.
-*/
-/**
- * \file     hfal_sha256.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-02-04
- * \license  GPLv3 or later
- * 
- */
-
-#ifndef HFAL_SHA256_H_
-#define HFAL_SHA256_H_
-
-
-#include "hashfunction_descriptor.h"
-
-extern const hfdesc_t sha256_desc;
-
-#endif /* HFAL_SHA256_H_ */
diff --git a/hfal_shabal.c b/hfal_shabal.c
deleted file mode 100644 (file)
index ec0c7b6..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/* hfal_shabal.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/>.
-*/
-/**
- * \file     hfal_shabal.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-04-20
- * \license  GPLv3 or later
- * 
- */
-
-
-#include <stdlib.h>
-#include "hashfunction_descriptor.h"
-#include "shabal.h"
-
-
-static const char shabal192_str[] = "Shabal-192";
-static const char shabal224_str[] = "Shabal-224";
-static const char shabal256_str[] = "Shabal-256";
-static const char shabal384_str[] = "Shabal-384";
-static const char shabal512_str[] = "Shabal-512";
-
-const hfdesc_t shabal192_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       shabal192_str,
-       sizeof(shabal_ctx_t),
-       SHABAL_BLOCKSIZE,
-       192,
-       (hf_init_fpt)shabal192_init,
-       (hf_nextBlock_fpt)shabal_nextBlock,
-       (hf_lastBlock_fpt)shabal_lastBlock,
-       (hf_ctx2hash_fpt)shabal192_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)shabal192
-};
-
-const hfdesc_t shabal224_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       shabal224_str,
-       sizeof(shabal_ctx_t),
-       SHABAL_BLOCKSIZE,
-       224,
-       (hf_init_fpt)shabal224_init,
-       (hf_nextBlock_fpt)shabal_nextBlock,
-       (hf_lastBlock_fpt)shabal_lastBlock,
-       (hf_ctx2hash_fpt)shabal224_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)shabal224
-};
-
-const hfdesc_t shabal256_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       shabal256_str,
-       sizeof(shabal_ctx_t),
-       SHABAL_BLOCKSIZE,
-       256,
-       (hf_init_fpt)shabal256_init,
-       (hf_nextBlock_fpt)shabal_nextBlock,
-       (hf_lastBlock_fpt)shabal_lastBlock,
-       (hf_ctx2hash_fpt)shabal256_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)shabal256
-};
-
-const hfdesc_t shabal384_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       shabal384_str,
-       sizeof(shabal_ctx_t),
-       SHABAL_BLOCKSIZE,
-       384,
-       (hf_init_fpt)shabal384_init,
-       (hf_nextBlock_fpt)shabal_nextBlock,
-       (hf_lastBlock_fpt)shabal_lastBlock,
-       (hf_ctx2hash_fpt)shabal384_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)shabal384
-};
-
-const hfdesc_t shabal512_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       shabal512_str,
-       sizeof(shabal_ctx_t),
-       SHABAL_BLOCKSIZE,
-       512,
-       (hf_init_fpt)shabal512_init,
-       (hf_nextBlock_fpt)shabal_nextBlock,
-       (hf_lastBlock_fpt)shabal_lastBlock,
-       (hf_ctx2hash_fpt)shabal512_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)shabal512
-};
diff --git a/hfal_shabal.h b/hfal_shabal.h
deleted file mode 100644 (file)
index f56f604..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/* hfal_shabal.h */
-/*
-    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/>.
-*/
-/**
- * \file     hfal_shabal.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-04-20
- * \license  GPLv3 or later
- * 
- */
-
-#ifndef HFAL_SHABAL_H_
-#define HFAL_SHABAL_H_
-
-
-#include "hashfunction_descriptor.h"
-
-extern const hfdesc_t shabal192_desc;
-extern const hfdesc_t shabal224_desc;
-extern const hfdesc_t shabal256_desc;
-extern const hfdesc_t shabal384_desc;
-extern const hfdesc_t shabal512_desc;
-
-#endif /* HFAL_SHABAL_H_ */
diff --git a/hfal_skein1024.c b/hfal_skein1024.c
deleted file mode 100644 (file)
index 2ee3400..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/* hfal_skein1024.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/>.
-*/
-/**
- * \file     hfal_skein1024.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-03-13
- * \license  GPLv3 or later
- * 
- */
-
-
-#include <stdlib.h>
-#include "hashfunction_descriptor.h"
-#include "skein.h"
-
-
-static const char skein1024_128_str[] = "Skein-1024-128";
-static const char skein1024_160_str[] = "Skein-1024-160";
-static const char skein1024_224_str[] = "Skein-1024-224";
-static const char skein1024_256_str[] = "Skein-1024-256";
-static const char skein1024_384_str[] = "Skein-1024-384";
-static const char skein1024_512_str[] = "Skein-1024-512";
-static const char skein1024_1024_str[] = "Skein-1024-1024";
-
-void skein1024_128_init(skein1024_ctx_t* ctx){
-       skein1024_init(ctx, 128);
-}
-void skein1024_160_init(skein1024_ctx_t* ctx){
-       skein1024_init(ctx, 160);
-}
-void skein1024_224_init(skein1024_ctx_t* ctx){
-       skein1024_init(ctx, 224);
-}
-void skein1024_256_init(skein1024_ctx_t* ctx){
-       skein1024_init(ctx, 256);
-}
-void skein1024_384_init(skein1024_ctx_t* ctx){
-       skein1024_init(ctx, 384);
-}
-void skein1024_512_init(skein1024_ctx_t* ctx){
-       skein1024_init(ctx, 512);
-}
-void skein1024_1024_init(skein1024_ctx_t* ctx){
-       skein1024_init(ctx, 1024);
-}
-
-const hfdesc_t skein1024_128_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein1024_128_str,
-       sizeof(skein1024_ctx_t),
-       SKEIN1024_BLOCKSIZE,
-       128,
-       (hf_init_fpt)skein1024_128_init,
-       (hf_nextBlock_fpt)skein1024_nextBlock,
-       (hf_lastBlock_fpt)skein1024_lastBlock,
-       (hf_ctx2hash_fpt)skein1024_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-const hfdesc_t skein1024_160_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein1024_160_str,
-       sizeof(skein1024_ctx_t),
-       SKEIN1024_BLOCKSIZE,
-       160,
-       (hf_init_fpt)skein1024_160_init,
-       (hf_nextBlock_fpt)skein1024_nextBlock,
-       (hf_lastBlock_fpt)skein1024_lastBlock,
-       (hf_ctx2hash_fpt)skein1024_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-const hfdesc_t skein1024_224_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein1024_224_str,
-       sizeof(skein1024_ctx_t),
-       SKEIN1024_BLOCKSIZE,
-       224,
-       (hf_init_fpt)skein1024_224_init,
-       (hf_nextBlock_fpt)skein1024_nextBlock,
-       (hf_lastBlock_fpt)skein1024_lastBlock,
-       (hf_ctx2hash_fpt)skein1024_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-const hfdesc_t skein1024_256_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein1024_256_str,
-       sizeof(skein1024_ctx_t),
-       SKEIN1024_BLOCKSIZE,
-       256,
-       (hf_init_fpt)skein1024_256_init,
-       (hf_nextBlock_fpt)skein1024_nextBlock,
-       (hf_lastBlock_fpt)skein1024_lastBlock,
-       (hf_ctx2hash_fpt)skein1024_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-const hfdesc_t skein1024_384_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein1024_384_str,
-       sizeof(skein1024_ctx_t),
-       SKEIN1024_BLOCKSIZE,
-       384,
-       (hf_init_fpt)skein1024_384_init,
-       (hf_nextBlock_fpt)skein1024_nextBlock,
-       (hf_lastBlock_fpt)skein1024_lastBlock,
-       (hf_ctx2hash_fpt)skein1024_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-const hfdesc_t skein1024_512_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein1024_512_str,
-       sizeof(skein1024_ctx_t),
-       SKEIN1024_BLOCKSIZE,
-       512,
-       (hf_init_fpt)skein1024_512_init,
-       (hf_nextBlock_fpt)skein1024_nextBlock,
-       (hf_lastBlock_fpt)skein1024_lastBlock,
-       (hf_ctx2hash_fpt)skein1024_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-const hfdesc_t skein1024_1024_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein1024_1024_str,
-       sizeof(skein1024_ctx_t),
-       SKEIN1024_BLOCKSIZE,
-       1024,
-       (hf_init_fpt)skein1024_1024_init,
-       (hf_nextBlock_fpt)skein1024_nextBlock,
-       (hf_lastBlock_fpt)skein1024_lastBlock,
-       (hf_ctx2hash_fpt)skein1024_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-
diff --git a/hfal_skein1024.h b/hfal_skein1024.h
deleted file mode 100644 (file)
index 4deeca6..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/* hfal_skein1024.h */
-/*
-    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/>.
-*/
-/**
- * \file     hfal_skein1024.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-03-13
- * \license  GPLv3 or later
- * 
- */
-
-#ifndef HFAL_SKEIN1024_H_
-#define HFAL_SKEIN1024_H_
-
-
-#include "hashfunction_descriptor.h"
-
-extern const hfdesc_t skein1024_128_desc;
-extern const hfdesc_t skein1024_160_desc;
-extern const hfdesc_t skein1024_224_desc;
-extern const hfdesc_t skein1024_256_desc;
-extern const hfdesc_t skein1024_384_desc;
-extern const hfdesc_t skein1024_512_desc;
-extern const hfdesc_t skein1024_1024_desc;
-
-#endif /* HFAL_SHA1024_H_ */
diff --git a/hfal_skein256.c b/hfal_skein256.c
deleted file mode 100644 (file)
index 2daeb84..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/* hfal_skein256.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/>.
-*/
-/**
- * \file     hfal_skein256.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-03-13
- * \license  GPLv3 or later
- * 
- */
-
-
-#include <stdlib.h>
-#include "hashfunction_descriptor.h"
-#include "skein.h"
-
-
-static const char skein256_128_str[] = "Skein-256-128";
-static const char skein256_160_str[] = "Skein-256-160";
-static const char skein256_224_str[] = "Skein-256-224";
-static const char skein256_256_str[] = "Skein-256-256";
-static const char skein256_384_str[] = "Skein-256-384";
-static const char skein256_512_str[] = "Skein-256-512";
-
-void skein256_128_init(skein256_ctx_t* ctx){
-       skein256_init(ctx, 128);
-}
-void skein256_160_init(skein256_ctx_t* ctx){
-       skein256_init(ctx, 160);
-}
-void skein256_224_init(skein256_ctx_t* ctx){
-       skein256_init(ctx, 224);
-}
-void skein256_256_init(skein256_ctx_t* ctx){
-       skein256_init(ctx, 256);
-}
-void skein256_384_init(skein256_ctx_t* ctx){
-       skein256_init(ctx, 384);
-}
-void skein256_512_init(skein256_ctx_t* ctx){
-       skein256_init(ctx, 512);
-}
-
-const hfdesc_t skein256_128_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein256_128_str,
-       sizeof(skein256_ctx_t),
-       SKEIN256_BLOCKSIZE,
-       128,
-       (hf_init_fpt)skein256_128_init,
-       (hf_nextBlock_fpt)skein256_nextBlock,
-       (hf_lastBlock_fpt)skein256_lastBlock,
-       (hf_ctx2hash_fpt)skein256_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-const hfdesc_t skein256_160_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein256_160_str,
-       sizeof(skein256_ctx_t),
-       SKEIN256_BLOCKSIZE,
-       160,
-       (hf_init_fpt)skein256_160_init,
-       (hf_nextBlock_fpt)skein256_nextBlock,
-       (hf_lastBlock_fpt)skein256_lastBlock,
-       (hf_ctx2hash_fpt)skein256_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-const hfdesc_t skein256_224_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein256_224_str,
-       sizeof(skein256_ctx_t),
-       SKEIN256_BLOCKSIZE,
-       224,
-       (hf_init_fpt)skein256_224_init,
-       (hf_nextBlock_fpt)skein256_nextBlock,
-       (hf_lastBlock_fpt)skein256_lastBlock,
-       (hf_ctx2hash_fpt)skein256_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-const hfdesc_t skein256_256_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein256_256_str,
-       sizeof(skein256_ctx_t),
-       SKEIN256_BLOCKSIZE,
-       256,
-       (hf_init_fpt)skein256_256_init,
-       (hf_nextBlock_fpt)skein256_nextBlock,
-       (hf_lastBlock_fpt)skein256_lastBlock,
-       (hf_ctx2hash_fpt)skein256_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-const hfdesc_t skein256_384_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein256_384_str,
-       sizeof(skein256_ctx_t),
-       SKEIN256_BLOCKSIZE,
-       384,
-       (hf_init_fpt)skein256_384_init,
-       (hf_nextBlock_fpt)skein256_nextBlock,
-       (hf_lastBlock_fpt)skein256_lastBlock,
-       (hf_ctx2hash_fpt)skein256_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-const hfdesc_t skein256_512_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein256_512_str,
-       sizeof(skein256_ctx_t),
-       SKEIN256_BLOCKSIZE,
-       512,
-       (hf_init_fpt)skein256_512_init,
-       (hf_nextBlock_fpt)skein256_nextBlock,
-       (hf_lastBlock_fpt)skein256_lastBlock,
-       (hf_ctx2hash_fpt)skein256_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
diff --git a/hfal_skein256.h b/hfal_skein256.h
deleted file mode 100644 (file)
index ec75a3d..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/* hfal_skein256.h */
-/*
-    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/>.
-*/
-/**
- * \file     hfal_skein256.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-03-13
- * \license  GPLv3 or later
- * 
- */
-
-#ifndef HFAL_SKEIN256_H_
-#define HFAL_SKEIN256_H_
-
-
-#include "hashfunction_descriptor.h"
-
-extern const hfdesc_t skein256_128_desc;
-extern const hfdesc_t skein256_160_desc;
-extern const hfdesc_t skein256_224_desc;
-extern const hfdesc_t skein256_256_desc;
-extern const hfdesc_t skein256_384_desc;
-extern const hfdesc_t skein256_512_desc;
-
-#endif /* HFAL_SKEIN256_H_ */
diff --git a/hfal_skein512.c b/hfal_skein512.c
deleted file mode 100644 (file)
index b93dab1..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/* hfal_skein512.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/>.
-*/
-/**
- * \file     hfal_skein512.c
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-03-13
- * \license  GPLv3 or later
- * 
- */
-
-
-#include <stdlib.h>
-#include "hashfunction_descriptor.h"
-#include "skein.h"
-
-
-static const char skein512_128_str[] = "Skein-512-128";
-static const char skein512_160_str[] = "Skein-512-160";
-static const char skein512_224_str[] = "Skein-512-224";
-static const char skein512_256_str[] = "Skein-512-256";
-static const char skein512_384_str[] = "Skein-512-384";
-static const char skein512_512_str[] = "Skein-512-512";
-static const char skein512_1024_str[] = "Skein-512-1024";
-
-void skein512_128_init(skein512_ctx_t* ctx){
-       skein512_init(ctx, 128);
-}
-void skein512_160_init(skein512_ctx_t* ctx){
-       skein512_init(ctx, 160);
-}
-void skein512_224_init(skein512_ctx_t* ctx){
-       skein512_init(ctx, 224);
-}
-void skein512_256_init(skein512_ctx_t* ctx){
-       skein512_init(ctx, 256);
-}
-void skein512_384_init(skein512_ctx_t* ctx){
-       skein512_init(ctx, 384);
-}
-void skein512_512_init(skein512_ctx_t* ctx){
-       skein512_init(ctx, 512);
-}
-void skein512_1024_init(skein512_ctx_t* ctx){
-       skein512_init(ctx, 1024);
-}
-
-const hfdesc_t skein512_128_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein512_128_str,
-       sizeof(skein512_ctx_t),
-       SKEIN512_BLOCKSIZE,
-       128,
-       (hf_init_fpt)skein512_128_init,
-       (hf_nextBlock_fpt)skein512_nextBlock,
-       (hf_lastBlock_fpt)skein512_lastBlock,
-       (hf_ctx2hash_fpt)skein512_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-const hfdesc_t skein512_160_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein512_160_str,
-       sizeof(skein512_ctx_t),
-       SKEIN512_BLOCKSIZE,
-       160,
-       (hf_init_fpt)skein512_160_init,
-       (hf_nextBlock_fpt)skein512_nextBlock,
-       (hf_lastBlock_fpt)skein512_lastBlock,
-       (hf_ctx2hash_fpt)skein512_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-const hfdesc_t skein512_224_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein512_224_str,
-       sizeof(skein512_ctx_t),
-       SKEIN512_BLOCKSIZE,
-       224,
-       (hf_init_fpt)skein512_224_init,
-       (hf_nextBlock_fpt)skein512_nextBlock,
-       (hf_lastBlock_fpt)skein512_lastBlock,
-       (hf_ctx2hash_fpt)skein512_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-const hfdesc_t skein512_256_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein512_256_str,
-       sizeof(skein512_ctx_t),
-       SKEIN512_BLOCKSIZE,
-       256,
-       (hf_init_fpt)skein512_256_init,
-       (hf_nextBlock_fpt)skein512_nextBlock,
-       (hf_lastBlock_fpt)skein512_lastBlock,
-       (hf_ctx2hash_fpt)skein512_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-const hfdesc_t skein512_384_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein512_384_str,
-       sizeof(skein512_ctx_t),
-       SKEIN512_BLOCKSIZE,
-       384,
-       (hf_init_fpt)skein512_384_init,
-       (hf_nextBlock_fpt)skein512_nextBlock,
-       (hf_lastBlock_fpt)skein512_lastBlock,
-       (hf_ctx2hash_fpt)skein512_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-const hfdesc_t skein512_512_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein512_512_str,
-       sizeof(skein512_ctx_t),
-       SKEIN512_BLOCKSIZE,
-       512,
-       (hf_init_fpt)skein512_512_init,
-       (hf_nextBlock_fpt)skein512_nextBlock,
-       (hf_lastBlock_fpt)skein512_lastBlock,
-       (hf_ctx2hash_fpt)skein512_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-const hfdesc_t skein512_1024_desc = {
-       HFDESC_TYPE_HASHFUNCTION,
-       0,
-       skein512_1024_str,
-       sizeof(skein512_ctx_t),
-       SKEIN512_BLOCKSIZE,
-       1024,
-       (hf_init_fpt)skein512_1024_init,
-       (hf_nextBlock_fpt)skein512_nextBlock,
-       (hf_lastBlock_fpt)skein512_lastBlock,
-       (hf_ctx2hash_fpt)skein512_ctx2hash,
-       (hf_free_fpt)NULL,
-       (hf_mem_fpt)NULL
-};
-
diff --git a/hfal_skein512.h b/hfal_skein512.h
deleted file mode 100644 (file)
index 3947e43..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/* hfal_skein512.h */
-/*
-    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/>.
-*/
-/**
- * \file     hfal_skein512.h
- * \email    daniel.otte@rub.de
- * \author   Daniel Otte 
- * \date     2009-03-13
- * \license  GPLv3 or later
- * 
- */
-
-#ifndef HFAL_SKEIN512_H_
-#define HFAL_SKEIN512_H_
-
-
-#include "hashfunction_descriptor.h"
-
-extern const hfdesc_t skein512_128_desc;
-extern const hfdesc_t skein512_160_desc;
-extern const hfdesc_t skein512_224_desc;
-extern const hfdesc_t skein512_256_desc;
-extern const hfdesc_t skein512_384_desc;
-extern const hfdesc_t skein512_512_desc;
-extern const hfdesc_t skein512_1024_desc;
-
-#endif /* HFAL_SHA512_H_ */
index f8e78dcd5331d231f2378d656827c23ab1bf1774..5d7cfe75ea4530a84b5edb5ddb5b0921d1ceec92 100644 (file)
@@ -20,7 +20,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
-#include "memxor.h"
+#include "memxor/memxor.h"
 #include "keccak.h"
 
 #ifdef DEBUG
@@ -74,6 +74,7 @@ static const uint64_t rc[] = {
        0x0000000080000001LL, 0x8000000080008008LL
 };
 
+static inline
 uint64_t rotl64(uint64_t a, uint8_t r){
         return (a<<r)|(a>>(64-r));
 }
@@ -95,8 +96,6 @@ void keccak_round(uint64_t a[5][5], uint8_t rci){
        }
        for(i=0; i<5; ++i){
                b[i][1] = b[(4+i)%5][0] ^ rotl64(b[(i+1)%5][0], 1);
-       }
-       for(i=0; i<5; ++i){
                for(j=0; j<5; ++j){
                        a[j][i] ^= b[i][1];
                }
diff --git a/keccak/memxor.c b/keccak/memxor.c
deleted file mode 100644 (file)
index 7485b3e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdint.h>
-
-#include "memxor.h"
-
-void memxor(void* dest, const void* src, uint16_t n){
-  while(n--){
-    *((uint8_t*)dest) ^= *((uint8_t*)src);
-    dest = (uint8_t*)dest +1;
-    src  = (uint8_t*)src  +1;
-  }
-}
-
diff --git a/keccak/memxor.h b/keccak/memxor.h
deleted file mode 100644 (file)
index a62a616..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef MEMXOR_H_
-#define MEMXOR_H_
-#include <stdint.h>
-
-void memxor(void* dest, const void* src, uint16_t n);
-
-#endif
diff --git a/keysize_descriptor.c b/keysize_descriptor.c
deleted file mode 100644 (file)
index 8ffb06f..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/* keysize_descriptor.c */
-/*
-    This file is part of the ARM-Crypto-Lib.
-    Copyright (C) 2006-2010  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/>.
-*/
-/**
- * \file    keysize_descriptor.c 
- * \author  Daniel Otte
- * \email   daniel.otte@rub.de
- * \date    2009-01-07
- * \license GPLv3 or later
- */
-
-#include <stdint.h>
-#include "keysize_descriptor.h"
-
-uint8_t is_valid_keysize_P(const void* ks_desc, uint16_t keysize){
-       uint8_t type;
-       type = *((uint8_t*)ks_desc);
-       ks_desc = (uint8_t*)ks_desc + 1;
-       if(type==KS_TYPE_TERMINATOR)
-               return 0;
-       if(type==KS_TYPE_LIST){
-               uint8_t items;
-               uint16_t item;
-               items = *((uint8_t*)ks_desc);
-               ks_desc = (uint8_t*)ks_desc + 1;
-               while(items--){
-                       item = *((uint16_t*)ks_desc);
-                       ks_desc = (uint8_t*)ks_desc + 2;
-                       if(item==keysize)
-                               return 1;
-               }
-               ks_desc = (uint8_t*)ks_desc - 2;
-       }
-       if(type==KS_TYPE_RANGE){
-               uint16_t max, min;
-               min = *((uint16_t*)ks_desc);
-               ks_desc = (uint8_t*)ks_desc + 2;
-               max = *((uint16_t*)ks_desc);
-               if(min<=keysize && keysize<=max)
-                       return 1;
-       }
-       if(type==KS_TYPE_ARG_RANGE){
-               uint16_t max, min, dist, offset;
-               min = *((uint16_t*)ks_desc);
-               ks_desc = (uint8_t*)ks_desc + 2;
-               max = *((uint16_t*)ks_desc);
-               ks_desc = (uint8_t*)ks_desc + 2;
-               dist = *((uint16_t*)ks_desc);
-               ks_desc = (uint8_t*)ks_desc + 2;
-               offset = *((uint16_t*)ks_desc);
-               if(min<=keysize && keysize<=max && (keysize%dist==offset))
-                       return 1;
-       }
-       if(type>KS_TYPE_ARG_RANGE){
-               /* bad error, you may insert a big warning message here */
-               return 0;
-       }
-       return is_valid_keysize_P((uint8_t*)ks_desc+1, keysize); /* search the next record */
-}
-
-uint16_t get_keysize(const void* ks_desc){
-       uint8_t type;
-       uint16_t keysize;
-       type = *((uint8_t*)ks_desc);
-       if(type==KS_TYPE_LIST)
-               ks_desc = (uint8_t*)ks_desc + 1;
-       ks_desc = (uint8_t*)ks_desc + 1;
-       keysize = *((uint16_t*)ks_desc);
-       return keysize;
-}
-
-
diff --git a/keysize_descriptor.h b/keysize_descriptor.h
deleted file mode 100644 (file)
index 5595888..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/* keysize_descriptor.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/>.
-*/
-/**
- * \file    keysize_descriptor.h 
- * \author  Daniel Otte
- * \email   daniel.otte@rub.de
- * \date    2009-01-07
- * \license GPLv3 or later
- */
-
-#ifndef KEYSIZE_DESCRIPTOR_H_
-#define KEYSIZE_DESCRIPTOR_H_
-
-#include <stdint.h>
-
-#define KS_TYPE_TERMINATOR 0x00
-#define KS_TYPE_LIST       0x01
-#define KS_TYPE_RANGE      0x02
-#define KS_TYPE_ARG_RANGE  0x03
-
-#define KS_INT(a) ((a)&0xFF), ((a)>>8)
-
-typedef struct{ /* keysize is valid if listed in items */
-       uint8_t  n_items;  /* number of items (value 0 is reserved) */
-       uint16_t items[]; /* list of valid lengths */
-}keysize_desc_list_t;
-
-typedef struct{ /* keysize is valid if min<=keysize<=max */
-       uint16_t min;
-       uint16_t max;
-}keysize_desc_range_t;
-
-typedef struct{ /* keysize is valid if min<=keysize<=max and if keysize mod distance == offset */
-       uint16_t min;
-       uint16_t max;
-       uint16_t distance;
-       uint16_t offset;
-}keysize_desc_arg_range_t;
-
-uint8_t is_valid_keysize_P(const void* ks_desc, uint16_t keysize);
-uint16_t get_keysize(const void* ks_desc);
-#endif /* KEYSIZE_DESCRIPTOR_H_ */
diff --git a/memxor/memxor.c b/memxor/memxor.c
new file mode 100644 (file)
index 0000000..e438d5d
--- /dev/null
@@ -0,0 +1,12 @@
+#include <stdint.h>
+
+#include "memxor/memxor.h"
+
+void memxor(void* dest, const void* src, uint16_t n){
+  while(n--){
+    *((uint8_t*)dest) ^= *((uint8_t*)src);
+    dest = (uint8_t*)dest +1;
+    src  = (uint8_t*)src  +1;
+  }
+}
+
diff --git a/memxor/memxor.h b/memxor/memxor.h
new file mode 100644 (file)
index 0000000..a62a616
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef MEMXOR_H_
+#define MEMXOR_H_
+#include <stdint.h>
+
+void memxor(void* dest, const void* src, uint16_t n);
+
+#endif
diff --git a/memxor/memxor_c.c b/memxor/memxor_c.c
new file mode 100644 (file)
index 0000000..e438d5d
--- /dev/null
@@ -0,0 +1,12 @@
+#include <stdint.h>
+
+#include "memxor/memxor.h"
+
+void memxor(void* dest, const void* src, uint16_t n){
+  while(n--){
+    *((uint8_t*)dest) ^= *((uint8_t*)src);
+    dest = (uint8_t*)dest +1;
+    src  = (uint8_t*)src  +1;
+  }
+}
+
index 2659f86c599b04e5743453099ab10b335a81b4d2..2e459bfc58ebc7c084f06c66bdb7bca082a36c8f 100644 (file)
@@ -6,6 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 
 $(ALGO_NAME)_DIR      := aes/
+$(ALGO_NAME)_INCDIR   := gf256mul/ memxor/ bcal/
 $(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 \
index c79b89b665477a4a608a571b476a05b94e00877f..f6feec64cbf11f86082935d5e87ac0ec359730f6 100644 (file)
@@ -5,6 +5,7 @@ ALGO_NAME := BLAKE_C
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_DIR      := blake/
+$(ALGO_NAME)_INCDIR   := memxor/ hfal/
 $(ALGO_NAME)_OBJ      := blake_small.o blake_large.o blake_common.o memxor.o
 $(ALGO_NAME)_TEST_BIN := main-blake-test.o hfal_blake_small.o hfal_blake_large.o $(CLI_STD) $(HFAL_STD)
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
index 03a1e9e4c2f66a0fcd0c791c578f94e3a8444395..839859b83fe3578c5e52242c5c38d42d3b0aaf91 100644 (file)
@@ -5,6 +5,7 @@ ALGO_NAME := BMW_C
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_DIR      := bmw/
+$(ALGO_NAME)_INCDIR   := memxor/ hfal/
 $(ALGO_NAME)_OBJ      := bmw_small.o bmw_large.o memxor.o
 $(ALGO_NAME)_TEST_BIN := main-bmw-test.o hfal_bmw_small.o hfal_bmw_large.o $(CLI_STD) $(HFAL_STD)
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
index fb85d6b4215fe283640a2a3638928838408e9f0c..42b946548bbc47c06cc752742240a9f93c510ec3 100644 (file)
@@ -5,6 +5,7 @@ ALGO_NAME := BMW_C_SPEED
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_DIR      := bmw/
+$(ALGO_NAME)_INCDIR   := memxor/ hfal/
 $(ALGO_NAME)_OBJ      := bmw_small_speed.o bmw_large_speed.o memxor.o
 $(ALGO_NAME)_TEST_BIN := main-bmw-test.o hfal_bmw_small.o hfal_bmw_large.o $(CLI_STD) $(HFAL_STD)
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
index 7ed016903889ee7b84fd6a46c1f9d11e41c0524b..c47561a22c2ff99ecac589ae8c7ca1d0d3d29507 100644 (file)
@@ -5,6 +5,7 @@ ALGO_NAME := CUBEHASH_C
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_DIR      := cubehash/
+$(ALGO_NAME)_INCDIR   := memxor/ hfal/
 $(ALGO_NAME)_OBJ      := cubehash.o memxor.o
 $(ALGO_NAME)_TEST_BIN := main-cubehash-test.o hfal_cubehash.o  $(CLI_STD) $(HFAL_STD)
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
index 87d9846746a7c3ffcf20034869f98d4399b410d0..2d80958644913a6d36035f12a9cea4e4b0b01ffb 100644 (file)
@@ -5,6 +5,7 @@ ALGO_NAME := ECHO_C
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_DIR      := echo/
+$(ALGO_NAME)_INCDIR   := memxor/ aes/ gf256mul/ hfal/
 $(ALGO_NAME)_OBJ      := echo.o memxor.o aes_enc_round.o aes_sbox.o gf256mul.o
 $(ALGO_NAME)_TEST_BIN := main-echo-test.o hfal_echo.o  $(CLI_STD) $(HFAL_STD)
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
index 7d63a0d087c742701b05656c1181c89a82d07871..c219abf5d2b1c95b394cf834dfa974de6a2cb9fc 100644 (file)
@@ -5,6 +5,7 @@ ALGO_NAME := GROESTL_C
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_DIR      := groestl/
+$(ALGO_NAME)_INCDIR   := memxor/ aes/ gf256mul/ hfal/
 $(ALGO_NAME)_OBJ      := groestl_small.o groestl_large.o memxor.o aes_sbox.o gf256mul.o
 $(ALGO_NAME)_TEST_BIN := hfal_groestl_large.o hfal_groestl_small.o main-groestl-test.o $(CLI_STD) $(HFAL_STD)
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
index 2041438c97112e426ac369a3f3ea288989c1c3cc..a76ff4277e42fc8be8373a96ffacd341f5fd09d9 100644 (file)
@@ -5,6 +5,7 @@ ALGO_NAME := KECCAK_C
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_DIR      := keccak/
+$(ALGO_NAME)_INCDIR   := memxor/ hfal/
 $(ALGO_NAME)_OBJ      := keccak.o memxor.o
 $(ALGO_NAME)_TEST_BIN := main-keccak-test.o hfal_keccak.o  $(CLI_STD) $(HFAL_STD)
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
index 4fef34babfe1fc96b233eacb9adc36d3ab658aab..d77ca264e2493508ac22970f859af1e61d0380d6 100644 (file)
@@ -5,6 +5,7 @@ ALGO_NAME := SHA1_C
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_DIR      := sha1/
+$(ALGO_NAME)_INCDIR   := hfal/
 $(ALGO_NAME)_OBJ      := sha1.o
 $(ALGO_NAME)_TEST_BIN := main-sha1-test.o hfal_sha1.o $(CLI_STD) $(HFAL_STD)
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
index 1caf822ee94f00a53c83d00087011862a8b55f50..ec9bc6e6402e85e3649fdbd9f96f1d1fd0aa332c 100644 (file)
@@ -5,6 +5,7 @@ ALGO_NAME := SHA256_C
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_DIR      := sha256/
+$(ALGO_NAME)_INCDIR   := hfal/
 $(ALGO_NAME)_OBJ      := sha256.o
 $(ALGO_NAME)_TEST_BIN := main-sha256-test.o $(CLI_STD) $(HFAL_STD) hfal_sha256.o 
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
index d55c033c0a256767f6647e4b8ddad6f95457007c..6b0ff0ad748e4866add18f8112e4f65d10bcb90b 100644 (file)
@@ -5,6 +5,7 @@ ALGO_NAME := SHABAL_C
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_DIR      := shabal/
+$(ALGO_NAME)_INCDIR   := hfal/
 $(ALGO_NAME)_OBJ      := shabal.o shabal192.o shabal224.o shabal256.o shabal384.o shabal512.o
 $(ALGO_NAME)_TEST_BIN := main-shabal-test.o hfal_shabal.o $(CLI_STD) $(HFAL_STD)
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
index 676a0245f99148f234f439298f6943b709c462d2..3e94a4105cd8868542fc8f89b619124de467ecd5 100644 (file)
@@ -5,6 +5,7 @@ ALGO_NAME := SKEIN_C
 HASHES += $(ALGO_NAME)
 
 $(ALGO_NAME)_DIR      := skein/
+$(ALGO_NAME)_INCDIR   := threefish/ memxor/ hfal/
 $(ALGO_NAME)_OBJ      := threefish256_enc.o threefish512_enc.o threefish1024_enc.o threefish_mix_c.o\
                          ubi256.o ubi512.o ubi1024.o memxor.o skein256.o skein512.o skein1024.o
 $(ALGO_NAME)_TEST_BIN := main-skein-test.o hfal_skein256.o hfal_skein512.o hfal_skein1024.o $(CLI_STD) $(HFAL_STD)
diff --git a/noekeon/noekeon.c b/noekeon/noekeon.c
new file mode 100644 (file)
index 0000000..b487047
--- /dev/null
@@ -0,0 +1,199 @@
+/* noekeon.c */
+/*
+    This file is part of the ARM-Crypto-Lib.
+    Copyright (C) 2006-2010  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
+ * 
+ * 
+ * 
+ */
+
+#include <stdint.h>
+#include <string.h>
+
+#ifdef __AVR__
+       #include <avr/pgmspace.h>
+#endif
+#include "noekeon/noekeon.h"
+// #include "cli.h"
+
+#define ROUND_NR 16
+
+#define RC_POS 0
+
+static
+void gamma(uint32_t* a){
+       uint32_t tmp;
+       
+       a[1] ^= ~((a[3]) | (a[2]));
+       a[0] ^=   a[2] & a[1];  
+       
+       tmp=a[3]; a[3]=a[0]; a[0]=tmp;
+       a[2] ^= a[0] ^ a[1] ^ a[3];
+       
+       a[1] ^= ~((a[3]) | (a[2]));
+       a[0] ^=   a[2] & a[1];  
+}      
+
+#define ROTL32(a,n) (((a)<<n)|((a)>>(32-n)))
+#define ROTR32(a,n) (((a)>>n)|((a)<<(32-n)))
+
+static
+void pi1(uint32_t* a){
+       a[1] = ROTL32(a[1], 1);
+       a[2] = ROTL32(a[2], 5);
+       a[3] = ROTL32(a[3], 2);
+}
+
+static
+void pi2(uint32_t* a){
+       a[1] = ROTR32(a[1], 1);
+       a[2] = ROTR32(a[2], 5);
+       a[3] = ROTR32(a[3], 2);
+}
+
+static
+void theta(const uint32_t* k, uint32_t* a){
+       uint32_t temp;
+
+       temp = a[0] ^ a[2]; temp ^= ROTR32(temp, 8) ^ ROTL32(temp, 8);
+       a[1] ^= temp;
+       a[3] ^= temp;
+       
+       a[0] ^= k[0];
+       a[1] ^= k[1];
+       a[2] ^= k[2];
+       a[3] ^= k[3];
+
+       temp = a[1] ^ a[3]; temp ^= ROTR32(temp, 8) ^ ROTL32(temp, 8);
+       a[0] ^= temp;
+       a[2] ^= temp;   
+
+}
+
+static 
+void noekeon_round(uint32_t* key, uint32_t* state, uint8_t const1, uint8_t const2){
+       ((uint8_t*)state)[RC_POS] ^= const1;
+       theta(key, state);
+       ((uint8_t*)state)[RC_POS] ^= const2;
+       pi1(state);
+       gamma(state);
+       pi2(state);
+}
+
+uint8_t rc_tab[]
+#ifdef __AVR__
+ PROGMEM 
+#endif
+  = {
+/*     0x80, */
+             0x1B, 0x36, 0x6C, 0xD8, 0xAB, 0x4D, 0x9A,
+       0x2F, 0x5E, 0xBC, 0x63, 0xC6, 0x97, 0x35, 0x6A,
+       0xD4
+};
+/* for more rounds
+ 0xD4, 0xB3, 0x7D, 0xFA, 0xEF, 0xC5, 0x91, 0x39,
+ 0x72, 0xE4, 0xD3, 0xBD, 0x61, 0xC2, 0x9F, 0x25,
+*/
+
+static
+void changendian32(void* a){
+       ((uint8_t*)a)[0] ^= ((uint8_t*)a)[3];
+       ((uint8_t*)a)[3] ^= ((uint8_t*)a)[0];
+       ((uint8_t*)a)[0] ^= ((uint8_t*)a)[3];
+       
+       ((uint8_t*)a)[1] ^= ((uint8_t*)a)[2];
+       ((uint8_t*)a)[2] ^= ((uint8_t*)a)[1];
+       ((uint8_t*)a)[1] ^= ((uint8_t*)a)[2];
+}
+
+static
+void changendian(void* a){
+       changendian32((uint32_t*)(&(((uint32_t*)a)[0])));
+       changendian32((uint32_t*)(&(((uint32_t*)a)[1])));
+       changendian32((uint32_t*)(&(((uint32_t*)a)[2])));
+       changendian32((uint32_t*)(&(((uint32_t*)a)[3])));
+}
+
+/******************************************************************************/
+
+void noekeon_enc(void* buffer, const void* key){
+       uint8_t rc=0x80;
+       uint8_t keyb[16];
+       int8_t i;
+       
+       memcpy(keyb, key, 16);
+       changendian(buffer);
+       changendian(keyb);
+
+       for(i=0; i<ROUND_NR; ++i){
+               noekeon_round((uint32_t*)keyb, (uint32_t*)buffer, rc, 0);
+#ifdef __AVR__
+               rc = pgm_read_byte(rc_tab+i);
+#else
+               rc = rc_tab[i];
+#endif
+       }
+       ((uint8_t*)buffer)[RC_POS] ^= rc;
+       theta((uint32_t*)keyb, (uint32_t*)buffer);
+
+       changendian(buffer);
+}
+
+
+void noekeon_dec(void* buffer, const void* key){
+       uint8_t rc;
+       int8_t i;
+       uint8_t nullv[16];
+       uint8_t dkey[16];
+       
+
+       changendian(buffer);
+       
+       memset(nullv, 0, 16);
+       memcpy(dkey, key, 16);
+       changendian(dkey);
+       
+       theta((uint32_t*)nullv, (uint32_t*)dkey);
+//     cli_putstr("\r\nTheta: ");
+//     cli_hexdump(dkey, 16);
+       
+       for(i=ROUND_NR-1; i>=0; --i){
+#ifdef __AVR__
+               rc = pgm_read_byte(rc_tab+i);
+#else
+               rc = rc_tab[i];
+#endif
+               noekeon_round((uint32_t*)dkey, (uint32_t*)buffer, 0, rc);
+       }
+       theta((uint32_t*)dkey, (uint32_t*)buffer);
+       ((uint8_t*)buffer)[RC_POS] ^= 0x80;
+
+       changendian(buffer);
+}
+
+void noekeon_init(const void* key, noekeon_ctx_t* ctx){
+       uint8_t nullv[16];
+       
+       memset(nullv, 0, 16);
+       memcpy(ctx, key, 16);
+       noekeon_enc(ctx, nullv);
+}
+
diff --git a/noekeon/noekeon.h b/noekeon/noekeon.h
new file mode 100644 (file)
index 0000000..9c046f3
--- /dev/null
@@ -0,0 +1,85 @@
+/* noekeon.h */
+/*
+    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/>.
+*/
+#ifndef NOEKEON_H_
+#define NOEKEON_H_
+
+/**
+ * \file    noekeon.h
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2008-04-11
+ * \license GPLv3 or later
+ * \brief Implementation of the Noekeon block cipher
+ * \ingroup Noekeon
+ * This is an implementation of the Noekeon block cipher.
+ * For more details on Noekeon see http://gro.noekeon.org/
+ */
+
+#include <stdint.h>
+
+/** \typedef noekeon_ctx_t
+ * \brief holds key data for indirect mode
+ *  
+ * A variable of this type may hold the key data for the indirect mode.
+ * For direct mode simply pass the key directly to the encryption or
+ * decryption function.
+ */
+typedef uint8_t noekeon_ctx_t[16];
+
+/** \fn void noekeon_enc(void* buffer, const void* key)
+ * \brief noekeon encrytion funtion
+ * 
+ * This function encrypts a block (64 bit = 8 byte) with the noekeon encrytion
+ * algorithm. Due to the two modes of noekeon (direct mode and indirect mode)
+ * the second parameter either points directly to the key (direct mode) or to a
+ * context generated by the noekeon_init() function (indirect mode).
+ * \param buffer pointer to the 64 bit (8 byte) block to encrypt
+ * \param key    pointer to either the key (128 bit = 16 byte; direct mode) or 
+ * to the context (indirect mode)
+ */
+void noekeon_enc(void* buffer, const void* key);
+
+/** \fn void noekeon_dec(void* buffer, const void* key)
+ * \brief noekeon encrytion funtion
+ * 
+ * This function decrypts a block (64 bit = 8 byte) encrypted with the noekeon 
+ * encrytion algorithm. Due to the two modes of noekeon (direct mode and 
+ * indirect mode) the second parameter either points directly to the key 
+ * (direct mode) or to a context generated by the noekeon_init() function 
+ * (indirect mode).
+ * \param buffer pointer to the 64 bit (8 byte) block to decrypt
+ * \param key    pointer to either the key (128 bit = 16 byte; direct mode) or 
+ * to the context (indirect mode)
+ */
+void noekeon_dec(void* buffer, const void* key);
+
+
+/** \fn void noekeon_init(const void* key, noekeon_ctx_t* ctx)
+ * \brief noekeon context generation function for indirect mode
+ * 
+ * This function generates a context from the supplied key for using
+ * noekeon in indirect mode. For using noekeon in direct mode supply the key
+ * direct to the noekeon_enc() and noekeon_dec() functions.
+ * \param key pointer to the key (128 bit = 16 byte)
+ * \param ctx pointer to the context to fill with key material 
+ * to the context (indirect mode)
+ */
+void noekeon_init(const void* key, noekeon_ctx_t* ctx);
+
+#endif /*NOEKEON_H_*/
diff --git a/noekeon/noekeon_cbc_enc.h b/noekeon/noekeon_cbc_enc.h
new file mode 100644 (file)
index 0000000..b47048f
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef NOEKEON_CBC_ENC_H_
+#define NOEKEON_CBC_ENC_H_
+
+#include <stdint.h>
+#include "noekeon/noekeon.h"
+
+void noekeon_cbc_enc(void* buffer, uint8_t block_cnt, const void* key);
+
+#endif /*NOEKEON_CBC_ENC_H_*/
diff --git a/noekeon/noekeon_ctr.h b/noekeon/noekeon_ctr.h
new file mode 100644 (file)
index 0000000..19cbe36
--- /dev/null
@@ -0,0 +1,42 @@
+/* noekeon_ctr.h */
+/*
+    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/>.
+*/
+/*
+ * \author  Daniel Otte
+ * \email   daniel.otte@rub.de
+ * \date    2008-08-06
+ * \license GPLv3 or later
+ * 
+ * 
+ * 
+ */
+#ifndef NOEKEON_CTR_H_
+#define NOEKEON_CTR_H_
+
+#include <stdint.h>
+#include "noekeon/noekeon.h"
+
+typedef struct{
+       uint8_t counter[16];
+       uint8_t key[16];
+}noekeon_ctr_ctx_t;
+
+void noekeon_ctr_next(void* buffer, const noekeon_ctr_ctx_t* ctx);
+
+#endif /*NOEKEON_CTR_H_*/
diff --git a/noekeon/noekeon_prng.c b/noekeon/noekeon_prng.c
new file mode 100644 (file)
index 0000000..17c71a5
--- /dev/null
@@ -0,0 +1,67 @@
+/* noekeon_prng.c */
+/*
+ *   This file is part of the ARM-Crypto-Lib.
+ *   Copyright (C) 2006-2010  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
+ * \date       2008-08-24
+ * \license GPLv3 or later
+ * \brief   random number generator based on noekeon running in CFB-mode
+ * 
+ */
+
+#include "noekeon/noekeon.h"
+#include "memxor/memxor.h"
+#include <stdint.h>
+#include <string.h>
+
+static uint8_t random_state[16];
+static uint8_t random_key[16];
+static uint8_t i=0;
+
+uint8_t random8(void){
+       static uint8_t sr[16];
+       
+       if(i==0){
+               noekeon_enc(random_state, random_key);
+               memcpy(sr, random_state, 16);
+               i=15;
+               return sr[15];
+       }
+       --i;
+       return sr[i];
+}
+
+void random_block(void* dest){
+       i=0;
+       noekeon_enc(random_state, random_key);
+       memcpy(dest, random_state, 16);
+}
+
+void srandom32(uint32_t seed){
+       memcpy(random_key, &seed, 4);
+}
+
+void random_seed(const void* buffer){
+       memcpy(random_key, buffer, 16);
+}
+
+void random_add(const void* buffer){
+       memxor(random_key, buffer, 16);
+}
+
+
diff --git a/noekeon/noekeon_prng.h b/noekeon/noekeon_prng.h
new file mode 100644 (file)
index 0000000..ff9ca03
--- /dev/null
@@ -0,0 +1,40 @@
+/* noekeon_prng.h */
+/*
+ *   This file is part of the AVR-Crypto-Lib.
+ *   Copyright (C) 2006, 2007, 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/>.
+ */
+/**
+ * \author     Daniel Otte
+ * \date       2008-08-24
+ * \license GPLv3 or later
+ * \brief   random number generator based on noekeon running in CFB-mode
+ * 
+ */
+
+#ifndef PRNG_H_
+#define PRNG_H_
+
+#include <stdint.h>
+
+uint8_t random8(void);
+void random_block(void* dest);
+void srandom32(uint32_t seed);
+void random_seed(const void* buffer);
+void random_add(const void* buffer);
+
+#endif /* PRNG_H_*/
+
+
diff --git a/noekeon/omac_noekeon.h b/noekeon/omac_noekeon.h
new file mode 100644 (file)
index 0000000..c9f1067
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+    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_
+
+#include "noekeon/noekeon.h"
+#include <stdint.h>
+
+typedef uint8_t omac_noekeon_ctx_t[16];
+
+void omac_noekeon_init(omac_noekeon_ctx_t* ctx);
+void omac_noekeon_tweak(uint8_t t, const void* key, omac_noekeon_ctx_t* ctx);
+void omac_noekeon_next(const void* buffer, const void* key, 
+                       omac_noekeon_ctx_t* ctx);
+void omac_noekeon_last(const void* buffer, uint8_t length_b, const void* key, 
+                       omac_noekeon_ctx_t* ctx);
+void omac_noekeon(void* dest, const void* msg, uint16_t msglength_b,
+                  const void* key, uint8_t t);
+
+#endif /*NOEKEON_OMAC_H_*/
diff --git a/noekeon/omac_noekeon_C.c b/noekeon/omac_noekeon_C.c
new file mode 100644 (file)
index 0000000..923fc48
--- /dev/null
@@ -0,0 +1,74 @@
+#include "noekeon/noekeon.h"
+#include "omac_noekeon.h"
+#include "memxor/memxor.h"
+#include <string.h>
+#include <stdint.h>
+
+
+void omac_noekeon_init(omac_noekeon_ctx_t* ctx){
+       memset(ctx, 0, 16);
+}
+
+
+void omac_noekeon_tweak(uint8_t t, const void* key, omac_noekeon_ctx_t* ctx){
+       *ctx[15] = t;
+       noekeon_enc(ctx, key);
+}
+
+void omac_noekeon_next(const void* buffer, const void* key, omac_noekeon_ctx_t* ctx){
+       memxor(ctx, buffer, 16);
+       noekeon_enc(ctx, key);
+}
+
+static
+void omac_noekeon_comppad(uint8_t* pad, const void* key, uint8_t length_b){
+       uint8_t c1,c2,r,j;
+       memset(pad, 0, 16);
+       noekeon_enc(pad, key);
+       r=(length_b==128)?1:2;
+       for(;r!=0;--r){
+               c1=0;
+               for(j=0;j<16;++j){
+                       c2 = c1;
+                       c1 = (pad[15-j])>>7;
+                       pad[15-j] = ((pad[15-j])<<1) | c2;
+               }
+               if(c1){
+                       pad[15] ^= 0x87;
+               }
+       }
+       if(length_b<128){
+               pad[(length_b)/8] ^= 0x80 >> (length_b%8);
+       }
+}
+
+void omac_noekeon_last(const void* buffer, uint8_t length_b, const void* key, omac_noekeon_ctx_t* ctx){
+       while(length_b>128){
+               omac_noekeon_next(buffer, key, ctx);
+               buffer = (uint8_t*)buffer +16;
+               length_b -= 128;
+       }
+       uint8_t pad[16];
+       omac_noekeon_comppad(pad, key, length_b);
+       memxor(pad, buffer, (length_b+7)/8);
+       omac_noekeon_next(pad, key, ctx);
+}
+
+
+void omac_noekeon(void* dest, const void* msg, uint16_t msglength_b,
+                  const void* key, uint8_t t){
+       omac_noekeon_init(dest);
+       if(t!=0xff)
+               omac_noekeon_tweak(t,key,dest);
+       while(msglength_b>128){
+               omac_noekeon_next(msg, key, dest);
+               msg = (uint8_t*)msg +16;
+               msglength_b -= 128;
+       }
+       omac_noekeon_last(msg, msglength_b, key, dest);                         
+}
+
+
+
+
+
diff --git a/skein/memxor.c b/skein/memxor.c
deleted file mode 100644 (file)
index 7485b3e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdint.h>
-
-#include "memxor.h"
-
-void memxor(void* dest, const void* src, uint16_t n){
-  while(n--){
-    *((uint8_t*)dest) ^= *((uint8_t*)src);
-    dest = (uint8_t*)dest +1;
-    src  = (uint8_t*)src  +1;
-  }
-}
-
diff --git a/skein/memxor.h b/skein/memxor.h
deleted file mode 100644 (file)
index a62a616..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef MEMXOR_H_
-#define MEMXOR_H_
-#include <stdint.h>
-
-void memxor(void* dest, const void* src, uint16_t n);
-
-#endif
index a7d5326afe8cbf890fb7af3313a73cf845b312ea..07342b5133a480d3a10c8eb30c6c3d2ea668953f 100644 (file)
@@ -27,7 +27,7 @@
 #include <stdint.h>
 #include <string.h>
 #include "threefish.h"
-#include "memxor.h"
+#include "memxor/memxor.h"
 #include "ubi.h"
 
 void ubi1024_init(ubi1024_ctx_t* ctx, const void* g, uint8_t type){
index 5b0fc5749f324a0f78dc1e149da51d527256a463..9eeebd3c75ec4a2d869a9f362eb858de03471424 100644 (file)
@@ -27,7 +27,7 @@
 #include <stdint.h>
 #include <string.h>
 #include "threefish.h"
-#include "memxor.h"
+#include "memxor/memxor.h"
 #include "ubi.h"
 
 void ubi256_init(ubi256_ctx_t* ctx, const void* g, uint8_t type){
index e0e6dc0d444596fe266d45ec2f3b3fd09894fd77..b411690aaa624ae064637d4aa629e68488e3040d 100644 (file)
@@ -27,7 +27,7 @@
 #include <stdint.h>
 #include <string.h>
 #include "threefish.h"
-#include "memxor.h"
+#include "memxor/memxor.h"
 #include "ubi.h"
 
 void ubi512_init(ubi512_ctx_t* ctx, const void* g, uint8_t type){
index 393d2808d9934974c8a9022f0196294fa11da2ee..41977c953bd912bf7310bbc921943d645b676dfd 100644 (file)
@@ -29,8 +29,8 @@
 #include <string.h>
 #include <ctype.h>
 #include "blockcipher_descriptor.h"
-#include "bcal-basic.h"
-#include "bcal-cmac.h"
+#include "bcal/bcal-basic.h"
+#include "bcal/bcal-cmac.h"
 #include "cmacvs.h"
 #include "string-extras.h"
 #include "cli.h"
index 8b0f67ef9708e30d37c8606d949c85e2dc670ab6..83ec490bce3644d3812bdb347bd0a6a9c58a9602 100644 (file)
 #include "nessie_bc_test.h"
 #include "performance_test.h"
 
-#include "bcal_aes128.h"
-#include "bcal_aes192.h"
-#include "bcal_aes256.h"
-#include "bcal-cbc.h"
-#include "bcal-cfb_byte.h"
-#include "bcal-cfb_bit.h"
-#include "bcal-ofb.h"
-#include "bcal-ctr.h"
-#include "bcal-cmac.h"
-#include "bcal-eax.h"
+#include "bcal/bcal_aes128.h"
+#include "bcal/bcal_aes192.h"
+#include "bcal/bcal_aes256.h"
+#include "bcal/bcal-cbc.h"
+#include "bcal/bcal-cfb_byte.h"
+#include "bcal/bcal-cfb_bit.h"
+#include "bcal/bcal-ofb.h"
+#include "bcal/bcal-ctr.h"
+#include "bcal/bcal-cmac.h"
+#include "bcal/bcal-eax.h"
 #include "cmacvs.h"
-#include "bcal-performance.h"
+#include "bcal/bcal-performance.h"
 
 
 char* algo_name = "AES";
index 7a6fc12c5d7c7ca1431e04442e6b7640a2ecca13..9159b9a4db0a0f51ba19254bc42a55061eb4d037 100644 (file)
 #include "shavs.h"
 #include "nessie_hash_test.h"
 #include "performance_test.h"
-#include "hfal-nessie.h"
-#include "hfal-performance.h"
-#include "hfal-test.h"
+#include "hfal/hfal-nessie.h"
+#include "hfal/hfal-performance.h"
+#include "hfal/hfal-test.h"
 
 #include "blake_small.h"
 #include "blake_large.h"
-#include "hfal_blake_small.h"
-#include "hfal_blake_large.h"
+#include "hfal/hfal_blake_small.h"
+#include "hfal/hfal_blake_large.h"
 
 
 char* algo_name = "Blake";
index 5134743548ae1e8d6156ad75bb174334449d5a8b..846fb2babe81df6f39a95ec0a2849d9c4a0c547c 100644 (file)
 #include "shavs.h"\r
 #include "nessie_hash_test.h"\r
 #include "performance_test.h"\r
-#include "hfal-nessie.h"\r
-#include "hfal-performance.h"\r
-#include "hfal-test.h"\r
+#include "hfal/hfal-nessie.h"\r
+#include "hfal/hfal-performance.h"\r
+#include "hfal/hfal-test.h"\r
 \r
-#include "hfal_bmw_small.h"\r
-#include "hfal_bmw_large.h"\r
+#include "hfal/hfal_bmw_small.h"\r
+#include "hfal/hfal_bmw_large.h"\r
 #include "bmw_small.h"\r
 #include "bmw_large.h"\r
 \r
index e4e7ce7127101f18843da2ececc0675b6a9a6745..b998cc387ebb7130ae46a5f547bb67885d1b2bda 100644 (file)
 #include "shavs.h"
 #include "nessie_hash_test.h"
 #include "performance_test.h"
-#include "hfal-nessie.h"
-#include "hfal-performance.h"
-#include "hfal-test.h"
+#include "hfal/hfal-nessie.h"
+#include "hfal/hfal-performance.h"
+#include "hfal/hfal-test.h"
 
 #include "cubehash.h"
-#include "hfal_cubehash.h"
+#include "hfal/hfal_cubehash.h"
 
 #include <stdint.h>
 #include <string.h>
index a754c2f75480123d8dda3a056909838f517e87f0..75a2add7eecb37d3ae0fbf04b35794825aeb0604 100644 (file)
 #include "shavs.h"
 #include "nessie_hash_test.h"
 #include "performance_test.h"
-#include "hfal-nessie.h"
-#include "hfal-performance.h"
-#include "hfal-test.h"
+#include "hfal/hfal-nessie.h"
+#include "hfal/hfal-performance.h"
+#include "hfal/hfal-test.h"
 
 #include "echo.h"
-#include "hfal_echo.h"
+#include "hfal/hfal_echo.h"
 
 char* algo_name = "Echo";
 
index 3ed24091d53470794ba2e36462787195a788028d..0a0a9445eed65f71d7d9bc39fa75cf3e8e5f8c64 100644 (file)
 #include "shavs.h"
 #include "nessie_hash_test.h"
 #include "performance_test.h"
-#include "hfal-nessie.h"
-#include "hfal-performance.h"
-#include "hfal-test.h"
+#include "hfal/hfal-nessie.h"
+#include "hfal/hfal-performance.h"
+#include "hfal/hfal-test.h"
 
 #include "groestl_small.h"
 #include "groestl_large.h"
-#include "hfal_groestl_small.h"
-#include "hfal_groestl_large.h"
+#include "hfal/hfal_groestl_small.h"
+#include "hfal/hfal_groestl_large.h"
 
 const char* algo_name = "Groestl";
 
index f6ba4de74d98ad8f66215ed8c183eb68e2dcef16..5823da192fb050399b9427463a47fabfc040f14d 100644 (file)
 #include "shavs.h"
 #include "nessie_hash_test.h"
 #include "performance_test.h"
-#include "hfal-nessie.h"
-#include "hfal-performance.h"
-#include "hfal-test.h"
+#include "hfal/hfal-nessie.h"
+#include "hfal/hfal-performance.h"
+#include "hfal/hfal-test.h"
 
 #include "keccak.h"
-#include "hfal_keccak.h"
+#include "hfal/hfal_keccak.h"
 
 void uart0_putc(char byte){
        uart_putc(UART_0, byte);
index c0eb562339cc97f7ac13ba20cf7fe7131585ad0a..f3774d3e9673f0086502fb437a3491b6b1ee7781 100644 (file)
@@ -29,8 +29,8 @@
 #include "md5.h"
 #include "nessie_hash_test.h"
 #include "performance_test.h"
-#include "hfal_md5.h"
-#include "hfal-performance.h"
+#include "hfal/hfal_md5.h"
+#include "hfal/hfal-performance.h"
 
 #include <stdint.h>
 #include <string.h>
index 17e67092eb42a63eb4f37dd64154e7133435731c..62fa51d99e773421b16c4f7a1520a71f29a2ee6d 100644 (file)
 #include "shavs.h"
 #include "nessie_hash_test.h"
 #include "performance_test.h"
-#include "hfal-nessie.h"
-#include "hfal-performance.h"
-#include "hfal-test.h"
+#include "hfal/hfal-nessie.h"
+#include "hfal/hfal-performance.h"
+#include "hfal/hfal-test.h"
 
 #include "sha1.h"
-#include "hfal_sha1.h"
+#include "hfal/hfal_sha1.h"
 
 void uart0_putc(char byte){
        uart_putc(UART_0, byte);
index 872e071279f101fed593d7bf180d87e9ce146506..66e501891c32eddbc4189f32d4a80bae5b2ddae2 100644 (file)
 #include "shavs.h"
 #include "nessie_hash_test.h"
 #include "performance_test.h"
-#include "hfal-nessie.h"
-#include "hfal-performance.h"
-#include "hfal-test.h"
+#include "hfal/hfal-nessie.h"
+#include "hfal/hfal-performance.h"
+#include "hfal/hfal-test.h"
 
 #include "sha256.h"
-#include "hfal_sha256.h"
+#include "hfal/hfal_sha256.h"
 
 void uart0_putc(char byte){
        uart_putc(UART_0, byte);
index 27a524aa3fc0fbc1a6ff3818f1671b99c46fba43..ab7599dba80adf8c603826e459de83443171e242 100644 (file)
 #include "shavs.h"
 #include "nessie_hash_test.h"
 #include "performance_test.h"
-#include "hfal-nessie.h"
-#include "hfal-performance.h"
-#include "hfal-test.h"
+#include "hfal/hfal-nessie.h"
+#include "hfal/hfal-performance.h"
+#include "hfal/hfal-test.h"
 
 #include "shabal.h"
-#include "hfal_shabal.h"
+#include "hfal/hfal_shabal.h"
 
 void uart0_putc(char byte){
        uart_putc(UART_0, byte);
index b52fd43df6d7e11b4d424634b40ef1a362af48c0..3a1d9258440f9091f32f0d483681fa09d4f900dc 100644 (file)
 #include "shavs.h"
 #include "nessie_hash_test.h"
 #include "performance_test.h"
-#include "hfal-nessie.h"
-#include "hfal-performance.h"
-#include "hfal-test.h"
+#include "hfal/hfal-nessie.h"
+#include "hfal/hfal-performance.h"
+#include "hfal/hfal-test.h"
 
 #include "skein.h"
-#include "hfal_skein256.h"
-#include "hfal_skein512.h"
-#include "hfal_skein1024.h"
+#include "hfal/hfal_skein256.h"
+#include "hfal/hfal_skein512.h"
+#include "hfal/hfal_skein1024.h"
 
 
 void uart0_putc(char byte){
index 7ac8ec79f4c2460b179f8c2a4f01f196edb44042..70477c673990709a42df835b83dba0efa33b5fc9 100644 (file)
@@ -29,7 +29,7 @@
 #include <string.h>
 #include <ctype.h>
 #include "hashfunction_descriptor.h"
-#include "hfal-basic.h"
+#include "hfal/hfal-basic.h"
 #include "shavs.h"
 #include "string-extras.h"
 #include "cli.h"