diff --git a/A5_1.c b/A5_1.c
index b05edbe..a07b484 100644
--- a/A5_1.c
+++ b/A5_1.c
@@ -1,6 +1,6 @@
/* A5_1.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/A5_1.h b/A5_1.h
index 25703d6..fab0171 100644
--- a/A5_1.h
+++ b/A5_1.h
@@ -1,6 +1,6 @@
/* A5_1.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/Makefile b/Makefile
index 830d5e7..c4899a2 100644
--- a/Makefile
+++ b/Makefile
@@ -43,7 +43,7 @@ all: $(foreach algo, $(ALGORITHMS), $(algo)_OBJ)
define MAIN_OBJ_TEMPLATE
$(2): $(3) $(4)
- @echo "[ld]: $$@"
+ @echo "[ld] : $$@"
# echo $$^
@$(CC) $(CFLAGS) $(LDFLAGS)$(patsubst %.elf,%.map,$(2)) -o \
$(2) \
@@ -120,6 +120,15 @@ $(TESTBIN_DIR)%.o: $(TESTSRC_DIR)%.S
@echo "[as] : $@"
@$(CC) $(ASFLAGS) -c -o $@ $<
+$(TESTBIN_DIR)%.o: %.c
+ @echo "[gcc]: $@"
+ @$(CC) $(CFLAGS) -c -o $@ $<
+
+$(TESTBIN_DIR)%.o: %.S
+ @echo "[as] : $@"
+ @$(CC) $(ASFLAGS) -c -o $@ $<
+
+
%.o: %.c
@echo "[gcc]: $@"
diff --git a/aes.h b/aes.h
index 7a5b0d1..9d5b770 100644
--- a/aes.h
+++ b/aes.h
@@ -1,6 +1,6 @@
/* aes.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes128_dec.c b/aes128_dec.c
index 153328f..f3746a7 100644
--- a/aes128_dec.c
+++ b/aes128_dec.c
@@ -1,6 +1,6 @@
/* aes128_dec.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes128_dec.h b/aes128_dec.h
index 79bb5f1..97e04d1 100644
--- a/aes128_dec.h
+++ b/aes128_dec.h
@@ -1,6 +1,6 @@
/* aes128_dec.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes128_enc.c b/aes128_enc.c
index 00329a9..3790854 100644
--- a/aes128_enc.c
+++ b/aes128_enc.c
@@ -1,6 +1,6 @@
/* aes128_enc.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes128_enc.h b/aes128_enc.h
index cbdc871..169e5c9 100644
--- a/aes128_enc.h
+++ b/aes128_enc.h
@@ -1,6 +1,6 @@
/* aes128_enc.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes192_dec.c b/aes192_dec.c
index a28f830..99cc1b1 100644
--- a/aes192_dec.c
+++ b/aes192_dec.c
@@ -1,6 +1,6 @@
/* aes192_dec.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes192_dec.h b/aes192_dec.h
index 0c7ba48..44d237a 100644
--- a/aes192_dec.h
+++ b/aes192_dec.h
@@ -1,6 +1,6 @@
/* aes192_dec.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes192_enc.c b/aes192_enc.c
index 52a7f62..05cb71b 100644
--- a/aes192_enc.c
+++ b/aes192_enc.c
@@ -1,6 +1,6 @@
/* aes192_enc.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes192_enc.h b/aes192_enc.h
index b6d92c8..b82504b 100644
--- a/aes192_enc.h
+++ b/aes192_enc.h
@@ -1,6 +1,6 @@
/* aes192_enc.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes256_dec.c b/aes256_dec.c
index a74d43b..9bbb016 100644
--- a/aes256_dec.c
+++ b/aes256_dec.c
@@ -1,6 +1,6 @@
/* aes256_dec.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes256_dec.h b/aes256_dec.h
index 7a6a1a4..b8abfe8 100644
--- a/aes256_dec.h
+++ b/aes256_dec.h
@@ -1,6 +1,6 @@
/* aes256_dec.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes256_enc.c b/aes256_enc.c
index 017f7ec..cb2f3ff 100644
--- a/aes256_enc.c
+++ b/aes256_enc.c
@@ -1,6 +1,6 @@
/* aes256_enc.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes256_enc.h b/aes256_enc.h
index e854e63..f5ba0fa 100644
--- a/aes256_enc.h
+++ b/aes256_enc.h
@@ -1,6 +1,6 @@
/* aes256_enc.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes_dec-asm.S b/aes_dec-asm.S
index 90e046e..78dffad 100644
--- a/aes_dec-asm.S
+++ b/aes_dec-asm.S
@@ -1,6 +1,6 @@
/* aes_dec-asm.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes_dec-asm_faster.S b/aes_dec-asm_faster.S
index 8822c32..e743678 100644
--- a/aes_dec-asm_faster.S
+++ b/aes_dec-asm_faster.S
@@ -1,6 +1,6 @@
/* aes_dec-asm.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes_dec.c b/aes_dec.c
index 72078ac..8c476de 100644
--- a/aes_dec.c
+++ b/aes_dec.c
@@ -1,6 +1,6 @@
/* aes.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes_dec.h b/aes_dec.h
index b033e35..631d953 100644
--- a/aes_dec.h
+++ b/aes_dec.h
@@ -1,6 +1,6 @@
/* aes_dec.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes_enc-asm.S b/aes_enc-asm.S
index 14514f6..5b46a2a 100644
--- a/aes_enc-asm.S
+++ b/aes_enc-asm.S
@@ -1,6 +1,6 @@
/* aes_enc-asm.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes_enc.c b/aes_enc.c
index bfb4fea..dadf9f4 100644
--- a/aes_enc.c
+++ b/aes_enc.c
@@ -1,6 +1,6 @@
/* aes_enc.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes_enc.h b/aes_enc.h
index eb31521..f3c4dfa 100644
--- a/aes_enc.h
+++ b/aes_enc.h
@@ -1,6 +1,6 @@
/* aes_enc.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes_invsbox-asm.S b/aes_invsbox-asm.S
index 11dec96..6720003 100644
--- a/aes_invsbox-asm.S
+++ b/aes_invsbox-asm.S
@@ -1,6 +1,6 @@
/* aes_sbox-asm.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes_invsbox.h b/aes_invsbox.h
index fef65a9..42fe9a8 100644
--- a/aes_invsbox.h
+++ b/aes_invsbox.h
@@ -1,6 +1,6 @@
/* aes_invsbox.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes_keyschedule-asm.S b/aes_keyschedule-asm.S
index dada311..c5d69ea 100644
--- a/aes_keyschedule-asm.S
+++ b/aes_keyschedule-asm.S
@@ -1,6 +1,6 @@
/* aes_keyschedule-asm */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes_keyschedule.c b/aes_keyschedule.c
index 0515419..9e58eb5 100644
--- a/aes_keyschedule.c
+++ b/aes_keyschedule.c
@@ -1,6 +1,6 @@
/* aes_keyschedule.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes_keyschedule.h b/aes_keyschedule.h
index 109446a..7d6d840 100644
--- a/aes_keyschedule.h
+++ b/aes_keyschedule.h
@@ -1,6 +1,6 @@
/* aes_keyschedule.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes_sbox-asm.S b/aes_sbox-asm.S
index f3e99e7..e609698 100644
--- a/aes_sbox-asm.S
+++ b/aes_sbox-asm.S
@@ -1,6 +1,6 @@
/* aes_sbox-asm.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/aes_sbox.h b/aes_sbox.h
index 325fc9c..5bc03b7 100644
--- a/aes_sbox.h
+++ b/aes_sbox.h
@@ -1,6 +1,6 @@
/* aes_sbox.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/arcfour-asm.S b/arcfour-asm.S
index 6c8c351..1ef8218 100644
--- a/arcfour-asm.S
+++ b/arcfour-asm.S
@@ -1,6 +1,6 @@
/* arcfour-asm.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/arcfour.c b/arcfour.c
index bc9a6dd..e07193f 100644
--- a/arcfour.c
+++ b/arcfour.c
@@ -1,6 +1,6 @@
/* arcfour.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/arcfour.h b/arcfour.h
index 15d3ccf..3daaf81 100644
--- a/arcfour.h
+++ b/arcfour.h
@@ -1,6 +1,6 @@
/* arcfour.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/avr-asm-macros.S b/avr-asm-macros.S
index 57007ac..0fd325d 100644
--- a/avr-asm-macros.S
+++ b/avr-asm-macros.S
@@ -1,6 +1,6 @@
/* avr-asm-macros.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal-basic.c b/bcal-basic.c
index bc31c56..d37f40a 100644
--- a/bcal-basic.c
+++ b/bcal-basic.c
@@ -1,6 +1,6 @@
/* bcal-basic.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal-basic.h b/bcal-basic.h
index f4d66e3..4d79ef8 100644
--- a/bcal-basic.h
+++ b/bcal-basic.h
@@ -1,6 +1,6 @@
/* bcal-basic.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
@@ -17,9 +17,19 @@
along with this program. If not, see .
*/
+#ifndef BCAL_BASIC_H_
+#define BCAL_BASIC_H_
+
#include
#include
#include "blockciper_descriptor.h"
#include "keysize_descriptor.h"
+uint8_t bcal_cipher_init(const bcdesc_t* cipher_descriptor,
+ const void* key, uint16_t keysize, 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);
+
+#endif /* BCAL_BASIC_H_ */
diff --git a/bcal_aes128.c b/bcal_aes128.c
index 5860943..8bdde25 100644
--- a/bcal_aes128.c
+++ b/bcal_aes128.c
@@ -1,6 +1,6 @@
/* bcal_aes128.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_aes128.h b/bcal_aes128.h
index f344c98..ff65689 100644
--- a/bcal_aes128.h
+++ b/bcal_aes128.h
@@ -1,6 +1,6 @@
/* bcal_aes128.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_aes192.c b/bcal_aes192.c
index 0935f28..a74d9a8 100644
--- a/bcal_aes192.c
+++ b/bcal_aes192.c
@@ -1,6 +1,6 @@
/* bcal_aes192.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_aes192.h b/bcal_aes192.h
index 255fb09..7abc44e 100644
--- a/bcal_aes192.h
+++ b/bcal_aes192.h
@@ -1,6 +1,6 @@
/* bcal_aes192.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_aes256.c b/bcal_aes256.c
index ac0dd4b..03a5075 100644
--- a/bcal_aes256.c
+++ b/bcal_aes256.c
@@ -1,6 +1,6 @@
/* bcal_aes256.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_aes256.h b/bcal_aes256.h
index 820d739..216342b 100644
--- a/bcal_aes256.h
+++ b/bcal_aes256.h
@@ -1,6 +1,6 @@
/* bcal_aes256.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_camellia128.c b/bcal_camellia128.c
index fa8098a..a891b9d 100644
--- a/bcal_camellia128.c
+++ b/bcal_camellia128.c
@@ -1,6 +1,6 @@
/* bcal_camellia128.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_camellia128.h b/bcal_camellia128.h
index 1de0424..fcd6970 100644
--- a/bcal_camellia128.h
+++ b/bcal_camellia128.h
@@ -1,6 +1,6 @@
/* bcal_camellia128.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_cast5.c b/bcal_cast5.c
index 9e119ab..bc91297 100644
--- a/bcal_cast5.c
+++ b/bcal_cast5.c
@@ -1,6 +1,6 @@
/* bcal_cast5.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_cast5.h b/bcal_cast5.h
index 6ad5bbd..b5ade13 100644
--- a/bcal_cast5.h
+++ b/bcal_cast5.h
@@ -1,6 +1,6 @@
/* bcal_cast5.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_des.c b/bcal_des.c
index 26555e2..601469c 100644
--- a/bcal_des.c
+++ b/bcal_des.c
@@ -1,6 +1,6 @@
/* bcal_des.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_des.h b/bcal_des.h
index c233cbd..571c6c6 100644
--- a/bcal_des.h
+++ b/bcal_des.h
@@ -1,6 +1,6 @@
/* bcal_des.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_present.c b/bcal_present.c
index b6b7d77..945bd59 100644
--- a/bcal_present.c
+++ b/bcal_present.c
@@ -1,6 +1,6 @@
/* bcal_present.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_present.h b/bcal_present.h
index b584fba..52cabe7 100644
--- a/bcal_present.h
+++ b/bcal_present.h
@@ -1,6 +1,6 @@
/* bcal_present.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_rc5.c b/bcal_rc5.c
index 73cd086..9702168 100644
--- a/bcal_rc5.c
+++ b/bcal_rc5.c
@@ -1,6 +1,6 @@
/* bcal_rc5.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_rc5.h b/bcal_rc5.h
index 10ab772..6c33993 100644
--- a/bcal_rc5.h
+++ b/bcal_rc5.h
@@ -1,6 +1,6 @@
/* bcal_rc5.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_rc6.c b/bcal_rc6.c
index 8ab036d..e1b98e1 100644
--- a/bcal_rc6.c
+++ b/bcal_rc6.c
@@ -1,6 +1,6 @@
/* bcal_rc6.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_rc6.h b/bcal_rc6.h
index f46a765..9c5745c 100644
--- a/bcal_rc6.h
+++ b/bcal_rc6.h
@@ -1,6 +1,6 @@
/* bcal_rc6.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_seed.c b/bcal_seed.c
index edda0c5..590f027 100644
--- a/bcal_seed.c
+++ b/bcal_seed.c
@@ -1,6 +1,6 @@
/* bcal_seed.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_seed.h b/bcal_seed.h
index 207190f..9bd1f18 100644
--- a/bcal_seed.h
+++ b/bcal_seed.h
@@ -1,6 +1,6 @@
/* bcal_seed.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_serpent.c b/bcal_serpent.c
index edd4fb7..df1b578 100644
--- a/bcal_serpent.c
+++ b/bcal_serpent.c
@@ -1,6 +1,6 @@
/* bcal_serpent.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_serpent.h b/bcal_serpent.h
index ec3bec2..dc3674a 100644
--- a/bcal_serpent.h
+++ b/bcal_serpent.h
@@ -1,6 +1,6 @@
/* bcal_serpent.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_skipjack.c b/bcal_skipjack.c
index 6275feb..09caead 100644
--- a/bcal_skipjack.c
+++ b/bcal_skipjack.c
@@ -1,6 +1,6 @@
/* bcal_skipjack.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_skipjack.h b/bcal_skipjack.h
index 5bde085..ba15424 100644
--- a/bcal_skipjack.h
+++ b/bcal_skipjack.h
@@ -1,6 +1,6 @@
/* bcal_skipjack.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_tdes.c b/bcal_tdes.c
index 01d597b..adecd80 100644
--- a/bcal_tdes.c
+++ b/bcal_tdes.c
@@ -1,6 +1,6 @@
/* bcal_tdes.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_tdes.h b/bcal_tdes.h
index 5e66fae..43ee27f 100644
--- a/bcal_tdes.h
+++ b/bcal_tdes.h
@@ -1,6 +1,6 @@
/* bcal_tdes.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_xtea.c b/bcal_xtea.c
index 798d674..5902c10 100644
--- a/bcal_xtea.c
+++ b/bcal_xtea.c
@@ -1,6 +1,6 @@
/* bcal_xtea.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/bcal_xtea.h b/bcal_xtea.h
index d1ab0e8..4142386 100644
--- a/bcal_xtea.h
+++ b/bcal_xtea.h
@@ -1,6 +1,6 @@
/* bcal_xtea.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/blockcipher_descriptor.h b/blockcipher_descriptor.h
index 4dc3c55..a58ad8a 100644
--- a/blockcipher_descriptor.h
+++ b/blockcipher_descriptor.h
@@ -1,11 +1,41 @@
/* blockcipher_descriptor.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 .
+*/
+/**
+ * \file blockcipher_descriptor.h
+ * \author Daniel Otte
+ * \date 2009-02-04
+ *
+ * \license GPLv3 or later
+ *
+ */
#ifndef BLOCKCIPHER_DESCRIPTOR_H_
#define BLOCKCIPHER_DESCRIPTOR_H_
#include
#include
+
+#ifndef VOID_FPT
+#define VOID_FPT
typedef void(*void_fpt)(void);
+#endif
+
typedef void(*bc_init1_fpt)(void*, void*);
typedef void(*bc_init2_fpt)(void*, uint16_t,void*);
typedef void(*bc_enc1_fpt)(void*, void*);
diff --git a/camellia-asm.S b/camellia-asm.S
index dc558c4..f768893 100644
--- a/camellia-asm.S
+++ b/camellia-asm.S
@@ -1,6 +1,6 @@
/* camellia-asm.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/camellia.h b/camellia.h
index d55d08f..7609613 100644
--- a/camellia.h
+++ b/camellia.h
@@ -1,6 +1,6 @@
/* camellia.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/camellia128-stub.c b/camellia128-stub.c
index 8cc95de..95fb5df 100644
--- a/camellia128-stub.c
+++ b/camellia128-stub.c
@@ -1,6 +1,6 @@
/* camellia128-stub.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/camellia_C.c b/camellia_C.c
index 0c0e6ac..e6ea17f 100644
--- a/camellia_C.c
+++ b/camellia_C.c
@@ -1,6 +1,6 @@
/* camellia_C.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/cast5-sbox.h b/cast5-sbox.h
index b948ec0..4a8b6bf 100644
--- a/cast5-sbox.h
+++ b/cast5-sbox.h
@@ -1,6 +1,6 @@
/* cast5-sbox.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/cast5.c b/cast5.c
index 427b8b1..8488a2b 100644
--- a/cast5.c
+++ b/cast5.c
@@ -1,6 +1,6 @@
/* cast5.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/cast5.h b/cast5.h
index 4996570..f7d4cb9 100644
--- a/cast5.h
+++ b/cast5.h
@@ -1,6 +1,6 @@
/* cast5.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/config.h b/config.h
index a813f10..21404d4 100644
--- a/config.h
+++ b/config.h
@@ -1,6 +1,6 @@
/* config.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/debug.h b/debug.h
index 08de3bf..b285dfe 100644
--- a/debug.h
+++ b/debug.h
@@ -1,6 +1,6 @@
/* debug.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/des.c b/des.c
index 0ad3361..57bc7e3 100644
--- a/des.c
+++ b/des.c
@@ -1,6 +1,6 @@
/* des.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/des.h b/des.h
index e2e2435..082de13 100644
--- a/des.h
+++ b/des.h
@@ -1,6 +1,6 @@
/* des.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/entropium.c b/entropium.c
index ebb6422..ed56607 100644
--- a/entropium.c
+++ b/entropium.c
@@ -1,6 +1,6 @@
/* entropium.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/entropium.h b/entropium.h
index 00121a1..303619d 100644
--- a/entropium.h
+++ b/entropium.h
@@ -1,6 +1,6 @@
/* entropium.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/gf256mul.S b/gf256mul.S
index 0f9dfa0..b269d3a 100644
--- a/gf256mul.S
+++ b/gf256mul.S
@@ -1,6 +1,6 @@
/* gf256mul.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/gf256mul.h b/gf256mul.h
index 70d11d6..87f1cb3 100644
--- a/gf256mul.h
+++ b/gf256mul.h
@@ -1,6 +1,6 @@
/* gf256mul.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/grain.c b/grain.c
index 895f28b..8d30d22 100644
--- a/grain.c
+++ b/grain.c
@@ -1,6 +1,6 @@
/* grain.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/grain.h b/grain.h
index 0f10442..2526fdc 100644
--- a/grain.h
+++ b/grain.h
@@ -1,6 +1,6 @@
/* grain.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/hashfunction_descriptor.h b/hashfunction_descriptor.h
new file mode 100644
index 0000000..3440cd0
--- /dev/null
+++ b/hashfunction_descriptor.h
@@ -0,0 +1,45 @@
+/* hashfunction_descriptor.h */
+
+#ifndef HASHFUNCTION_DESCRIPTOR_H_
+#define HASHFUNCTION_DESCRIPTOR_H_
+#include
+#include
+
+#ifndef VOID_FPT
+#define VOID_FPT
+typedef void(*void_fpt)(void);
+#endif
+
+typedef void(*hf_init_fpt)(void*);
+typedef void(*hf_nextBlock_fpt)(void*, const void*);
+typedef void(*hf_lastBlock_fpt)(void*, const void*, uint16_t);
+typedef void(*hf_ctx2hash_fpt)(void*, void*);
+typedef void(*hf_free_fpt)(void*);
+typedef void(*hf_mem_fpt)(void*, void*, uint32_t);
+
+
+#define HFDESC_TYPE_HASHFUNCTION 0x02
+
+typedef struct {
+ uint8_t type; /* 2 == hashfunction */
+ uint8_t flags;
+ PGM_P name;
+ uint16_t ctxsize_B;
+ uint16_t blocksize_b;
+ uint16_t hashsize_b;
+
+ hf_init_fpt init;
+ hf_nextBlock_fpt nextBlock;
+ hf_lastBlock_fpt lastBlock;
+ hf_ctx2hash_fpt ctx2hash;
+ hf_free_fpt free;
+ hf_mem_fpt mem;
+} hfdesc_t; /* blockcipher descriptor type */
+
+typedef struct{
+ hfdesc_t* desc_ptr;
+ void* ctx;
+} hfgen_ctx_t;
+
+#endif /* HASHFUNCTION_DESCRIPTOR_H_ */
+
diff --git a/hfal-basic.c b/hfal-basic.c
new file mode 100644
index 0000000..cd6c026
--- /dev/null
+++ b/hfal-basic.c
@@ -0,0 +1,83 @@
+/* hfal-basic.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 .
+*/
+
+#include
+#include "hashfunction_descriptor.h"
+#include "hfal-basic.h"
+#include
+
+uint8_t hfal_hash_init(const hfdesc_t* hash_descriptor, hfgen_ctx_t* ctx){
+ hf_init_fpt f;
+ ctx->desc_ptr = (hfdesc_t*)hash_descriptor;
+ if(!(ctx->ctx=malloc(pgm_read_word(&(hash_descriptor->ctxsize_B)))))
+ return 3;
+ f= (hf_init_fpt)pgm_read_word(hash_descriptor->init);
+ f(ctx->ctx);
+ return 0;
+}
+
+void hfal_hash_nextBlock(hfgen_ctx_t* ctx, const void* block){
+ hf_nextBlock_fpt f;
+ hfdesc_t* x=(ctx->desc_ptr);
+ f =(hf_nextBlock_fpt)pgm_read_word(&(x->nextBlock));
+ f(ctx->ctx, block);
+}
+
+void hfal_hash_lastBlock(hfgen_ctx_t* ctx, const void* block, uint16_t size){
+ hf_lastBlock_fpt f;
+ hfdesc_t* x=ctx->desc_ptr;
+ f =(hf_lastBlock_fpt)pgm_read_word(&(x->lastBlock));
+ f(ctx->ctx, block, size);
+}
+
+void hfal_hash_ctx2hash(void* dest, hfgen_ctx_t* ctx){
+ hf_ctx2hash_fpt f;
+ hfdesc_t* x=ctx->desc_ptr;
+ f =(hf_ctx2hash_fpt)pgm_read_word(&(x->ctx2hash));
+ f(dest, ctx->ctx);
+}
+
+void hfal_hash_free(hfgen_ctx_t* ctx){
+ hf_free_fpt f;
+ hfdesc_t* x=ctx->desc_ptr;
+ f =(hf_free_fpt)pgm_read_word(&(x->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;
+ uint16_t bs,bsb;
+ uint8_t ctx[pgm_read_word(&(hash_descriptor->ctxsize_B))];
+ f=(void_fpt)pgm_read_word(&(hash_descriptor->init));
+ ((hf_init_fpt)f)(ctx);
+ bs=pgm_read_word(&(hash_descriptor->blocksize_b));
+ bsb=bs/8;
+ f=(void_fpt)pgm_read_word(&(hash_descriptor->nextBlock));
+ while(length_b>=bs){
+ ((hf_nextBlock_fpt)f)(ctx, msg);
+ length_b -= bs;
+ msg = (uint8_t*)msg + bsb;
+ }
+ f=(void_fpt)pgm_read_word(&(hash_descriptor->lastBlock));
+ ((hf_lastBlock_fpt)f)(ctx, msg, length_b);
+ f=(void_fpt)pgm_read_word(&(hash_descriptor->ctx2hash));
+ ((hf_ctx2hash_fpt)f)(dest, ctx);
+}
diff --git a/hfal-basic.h b/hfal-basic.h
new file mode 100644
index 0000000..08dbb31
--- /dev/null
+++ b/hfal-basic.h
@@ -0,0 +1,33 @@
+/* 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 .
+*/
+
+#ifndef HFAL_BASIC_H_
+#define HFAL_BASIC_H_
+
+#include
+#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 size);
+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);
+
+#endif /* HFAL_BASIC_H_ */
diff --git a/hfal_sha256.c b/hfal_sha256.c
new file mode 100644
index 0000000..3dac2ac
--- /dev/null
+++ b/hfal_sha256.c
@@ -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 .
+*/
+/**
+ * \file hfal_sha256.c
+ * \email daniel.otte@rub.de
+ * \author Daniel Otte
+ * \date 2009-02-04
+ * \license GPLv3 or later
+ *
+ */
+
+#include
+#include
+#include "hashfunction_descriptor.h"
+#include "sha256.h"
+
+const char sha256_str[] PROGMEM = "SHA-256";
+
+const hfdesc_t sha256_desc PROGMEM = {
+ 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)NULL
+};
+
diff --git a/hfal_sha256.h b/hfal_sha256.h
new file mode 100644
index 0000000..bf308a5
--- /dev/null
+++ b/hfal_sha256.h
@@ -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 .
+*/
+/**
+ * \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
+#include "hashfunction_descriptor.h"
+
+extern const hfdesc_t sha256_desc;
+
+#endif /* HFAL_SHA256_H_ */
diff --git a/hmac-sha1.c b/hmac-sha1.c
index d70e481..45a2afb 100644
--- a/hmac-sha1.c
+++ b/hmac-sha1.c
@@ -1,6 +1,6 @@
/* hmac-sha1.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/hmac-sha1.h b/hmac-sha1.h
index 5651d83..2fdb243 100644
--- a/hmac-sha1.h
+++ b/hmac-sha1.h
@@ -1,6 +1,6 @@
/* hmac-sha256.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/hmac-sha256.c b/hmac-sha256.c
index d84f46d..148fc7d 100644
--- a/hmac-sha256.c
+++ b/hmac-sha256.c
@@ -1,6 +1,6 @@
/* hmac-sha256.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/hmac-sha256.h b/hmac-sha256.h
index 0334a7d..4a3d7f3 100644
--- a/hmac-sha256.h
+++ b/hmac-sha256.h
@@ -1,6 +1,6 @@
/* hmac-sha256.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/host/get_test.rb b/host/get_test.rb
index 2e5985c..f917c33 100644
--- a/host/get_test.rb
+++ b/host/get_test.rb
@@ -2,6 +2,15 @@
require 'serialport'
+def read_line
+ s = $sp.gets()
+ if s==nil
+ puts "ERROR: read timeout!\n";
+ return nil
+ end
+ s.gsub(/\006/, '');
+end
+
def readTestVector(param)
fname=$dir;
lb="";
@@ -9,11 +18,8 @@ def readTestVector(param)
set=0;
vector=0;
begin
- ctr=$extended_wait;
- while((lb=$sp.gets())==nil && ctr>=0)do
- ctr -= 1;
- end
- if (m=/unknown command/.match(lb) || m=/[Ee][Rr]{2}[Oo][Rr]/.match(lb))
+ lb = read_line()
+ if (m=/unknown command/.match(lb) || m=/[Ee][Rr]{2}[Oo][Rr]/.match(lb))
puts("ERROR: "+lb);
exit(2);
end
@@ -24,10 +30,7 @@ def readTestVector(param)
buffer += lb;
begin
- ctr=$extended_wait;
- while((lb=$sp.gets())==nil && ctr>=0)do
- ctr -= 1;
- end
+ lb = read_line()
if(lb==nil)
return false;
end
@@ -40,10 +43,7 @@ def readTestVector(param)
fname+=m[1]+".";
end
buffer+=lb;
- ctr=$extended_wait;
- while((lb=$sp.gets())==nil && ctr>=0)do
- ctr -= 1;
- end
+ lb = read_line();
end
if(param!="")
fname+=param+".";
@@ -65,10 +65,7 @@ def readTestVector(param)
end
printf(" %4u", vector);
end
- ctr=$extended_wait;
- while((lb=$sp.gets())==nil && ctr>=0)do
- ctr -= 1;
- end
+ lb=read_line();
if(lb==nil)
file.close();
return false;
diff --git a/keysize_descriptor.c b/keysize_descriptor.c
index 17f4d47..193c07a 100644
--- a/keysize_descriptor.c
+++ b/keysize_descriptor.c
@@ -1,6 +1,6 @@
/* keysize_descriptor.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/keysize_descriptor.h b/keysize_descriptor.h
index aeda6fc..e256ddf 100644
--- a/keysize_descriptor.h
+++ b/keysize_descriptor.h
@@ -1,6 +1,6 @@
/* keysize_descriptor.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/md5-asm.S b/md5-asm.S
index e48c28d..469f9ab 100644
--- a/md5-asm.S
+++ b/md5-asm.S
@@ -1,6 +1,6 @@
/* md5-asm.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/md5.c b/md5.c
index 1ecf02a..ddad0b9 100644
--- a/md5.c
+++ b/md5.c
@@ -1,6 +1,6 @@
/* md5.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/md5.h b/md5.h
index d76046e..6b65c4a 100644
--- a/md5.h
+++ b/md5.h
@@ -1,6 +1,6 @@
/* md5.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/md5_sbox.h b/md5_sbox.h
index c421fad..b8ab636 100644
--- a/md5_sbox.h
+++ b/md5_sbox.h
@@ -1,6 +1,6 @@
/* md5_sbox.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/memxor.S b/memxor.S
index 3d234f5..885dad5 100644
--- a/memxor.S
+++ b/memxor.S
@@ -1,6 +1,6 @@
/* memxor.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/mkfiles/a5_1.mk b/mkfiles/a5_1.mk
index 76692f0..d4617f0 100644
--- a/mkfiles/a5_1.mk
+++ b/mkfiles/a5_1.mk
@@ -6,7 +6,7 @@ STREAM_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := A5_1.o
$(ALGO_NAME)_TEST_BIN := main-a5_1-test.o debug.o uart.o serial-tools.o \
- nessie_stream_test.o nessie_common.o cli.o
+ nessie_stream_test.o nessie_common.o cli.o string-extras.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/aes.mk b/mkfiles/aes.mk
index b3d8510..f9367f6 100644
--- a/mkfiles/aes.mk
+++ b/mkfiles/aes.mk
@@ -8,7 +8,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := aes_enc-asm.o aes_dec-asm.o aes_sbox-asm.o aes_invsbox.o \
aes_keyschedule-asm.o
$(ALGO_NAME)_TEST_BIN := main-aes-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
diff --git a/mkfiles/aes_asm_faster.mk b/mkfiles/aes_asm_faster.mk
index c73be1f..6a6079b 100644
--- a/mkfiles/aes_asm_faster.mk
+++ b/mkfiles/aes_asm_faster.mk
@@ -8,7 +8,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := aes_enc-asm.o aes_dec-asm_faster.o aes_sbox-asm.o aes_invsbox-asm.o \
aes_keyschedule-asm.o
$(ALGO_NAME)_TEST_BIN := main-aes-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
diff --git a/mkfiles/aes_c.mk b/mkfiles/aes_c.mk
index eae1c79..dcd2240 100644
--- a/mkfiles/aes_c.mk
+++ b/mkfiles/aes_c.mk
@@ -10,7 +10,7 @@ $(ALGO_NAME)_OBJ := aes_enc.o aes_dec.o aes_sbox.o aes_invsbox.o \
aes128_enc.o aes128_dec.o aes192_enc.o aes192_dec.o \
aes256_enc.o aes256_dec.o
$(ALGO_NAME)_TEST_BIN := main-aes-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
diff --git a/mkfiles/arcfour.mk b/mkfiles/arcfour.mk
index c1345ae..7e8e33b 100644
--- a/mkfiles/arcfour.mk
+++ b/mkfiles/arcfour.mk
@@ -6,7 +6,7 @@ STREAM_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := arcfour-asm.o
$(ALGO_NAME)_TEST_BIN := main-arcfour-test.o debug.o uart.o serial-tools.o \
- nessie_stream_test.o nessie_common.o cli.o \
+ nessie_stream_test.o nessie_common.o cli.o string-extras.o \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/arcfour_c.mk b/mkfiles/arcfour_c.mk
index 7f70977..b349614 100644
--- a/mkfiles/arcfour_c.mk
+++ b/mkfiles/arcfour_c.mk
@@ -6,7 +6,7 @@ STREAM_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := arcfour.o
$(ALGO_NAME)_TEST_BIN := main-arcfour-test.o debug.o uart.o serial-tools.o \
- nessie_stream_test.o nessie_common.o cli.o \
+ nessie_stream_test.o nessie_common.o cli.o string-extras.o \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/camellia.mk b/mkfiles/camellia.mk
index f6befb0..db85f50 100644
--- a/mkfiles/camellia.mk
+++ b/mkfiles/camellia.mk
@@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := camellia128-stub.o camellia-asm.o
$(ALGO_NAME)_TEST_BIN := main-camellia-test.o debug.o uart.o serial-tools.o \
nessie_bc_test.o \
- nessie_common.o cli.o performance_test.o
+ nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/cast5.mk b/mkfiles/cast5.mk
index 1b772e4..dacc177 100644
--- a/mkfiles/cast5.mk
+++ b/mkfiles/cast5.mk
@@ -5,7 +5,7 @@ ALGO_NAME := CAST5
BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := cast5.o
-$(ALGO_NAME)_TEST_BIN := main-cast5-test.o debug.o uart.o serial-tools.o cli.o\
+$(ALGO_NAME)_TEST_BIN := main-cast5-test.o debug.o uart.o serial-tools.o cli.o string-extras.o\
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/des.mk b/mkfiles/des.mk
index ccfcc13..8e2b162 100644
--- a/mkfiles/des.mk
+++ b/mkfiles/des.mk
@@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := des.o
$(ALGO_NAME)_TEST_BIN := main-des-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/entropium.mk b/mkfiles/entropium.mk
index 466d6ae..2ee6de6 100644
--- a/mkfiles/entropium.mk
+++ b/mkfiles/entropium.mk
@@ -6,7 +6,7 @@ PRNGS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := entropium.o sha256-asm.o
$(ALGO_NAME)_TEST_BIN := main-entropium-test.o debug.o uart.o serial-tools.o \
- cli.o performance_test.o
+ cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/grain.mk b/mkfiles/grain.mk
index 4fbdfcb..8d83a81 100644
--- a/mkfiles/grain.mk
+++ b/mkfiles/grain.mk
@@ -6,7 +6,7 @@ STREAM_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := grain.o
$(ALGO_NAME)_TEST_BIN := main-grain-test.o debug.o uart.o serial-tools.o \
- nessie_stream_test.o nessie_common.o cli.o \
+ nessie_stream_test.o nessie_common.o cli.o string-extras.o \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/hmac-sha1.mk b/mkfiles/hmac-sha1.mk
index fa2053b..428177b 100644
--- a/mkfiles/hmac-sha1.mk
+++ b/mkfiles/hmac-sha1.mk
@@ -5,7 +5,7 @@ ALGO_NAME := HMAC-SHA1
MACS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := hmac-sha1.o sha1-asm.o
-$(ALGO_NAME)_TEST_BIN := main-hmac-sha1-test.o debug.o uart.o serial-tools.o cli.o \
+$(ALGO_NAME)_TEST_BIN := main-hmac-sha1-test.o debug.o uart.o serial-tools.o cli.o string-extras.o \
nessie_mac_test.o nessie_common.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/hmac-sha256.mk b/mkfiles/hmac-sha256.mk
index 4bed2fa..e7ec3d8 100644
--- a/mkfiles/hmac-sha256.mk
+++ b/mkfiles/hmac-sha256.mk
@@ -6,7 +6,7 @@ MACS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := hmac-sha256.o sha256-asm.o
$(ALGO_NAME)_TEST_BIN := main-hmac-sha256-test.o debug.o uart.o serial-tools.o \
- nessie_mac_test.o nessie_common.o cli.o
+ nessie_mac_test.o nessie_common.o cli.o string-extras.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/md5.mk b/mkfiles/md5.mk
index 8c00703..de4498b 100644
--- a/mkfiles/md5.mk
+++ b/mkfiles/md5.mk
@@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := md5.o
$(ALGO_NAME)_TEST_BIN := main-md5-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/md5_asm.mk b/mkfiles/md5_asm.mk
index 00a1fde..a0603b7 100644
--- a/mkfiles/md5_asm.mk
+++ b/mkfiles/md5_asm.mk
@@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := md5-asm.o
$(ALGO_NAME)_TEST_BIN := main-md5-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/noekeon.mk b/mkfiles/noekeon.mk
index 0398879..db2252b 100644
--- a/mkfiles/noekeon.mk
+++ b/mkfiles/noekeon.mk
@@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := noekeon_asm.o
$(ALGO_NAME)_TEST_BIN := main-noekeon-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
diff --git a/mkfiles/noekeon_c.mk b/mkfiles/noekeon_c.mk
index 84696fb..d69c370 100644
--- a/mkfiles/noekeon_c.mk
+++ b/mkfiles/noekeon_c.mk
@@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := noekeon.o
$(ALGO_NAME)_TEST_BIN := main-noekeon-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
diff --git a/mkfiles/omac_noekeon.mk b/mkfiles/omac_noekeon.mk
index 41c5dff..f5a8d0c 100644
--- a/mkfiles/omac_noekeon.mk
+++ b/mkfiles/omac_noekeon.mk
@@ -7,7 +7,7 @@ MACS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := noekeon_asm.o omac_noekeon.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-omac-noekeon-test.o debug.o uart.o serial-tools.o \
- nessie_mac_test.o nessie_common.o cli.o performance_test.o
+ nessie_mac_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
diff --git a/mkfiles/omac_noekeon_c.mk b/mkfiles/omac_noekeon_c.mk
index d142283..fedd271 100644
--- a/mkfiles/omac_noekeon_c.mk
+++ b/mkfiles/omac_noekeon_c.mk
@@ -7,7 +7,7 @@ MACS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := noekeon_asm.o omac_noekeon_C.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-omac-noekeon-test.o debug.o uart.o serial-tools.o \
- nessie_mac_test.o nessie_common.o cli.o performance_test.o
+ nessie_mac_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
diff --git a/mkfiles/present.mk b/mkfiles/present.mk
index b614cc9..6a1a614 100644
--- a/mkfiles/present.mk
+++ b/mkfiles/present.mk
@@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := present.o
$(ALGO_NAME)_TEST_BIN := main-present-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/rc5.mk b/mkfiles/rc5.mk
index a64db3d..d165950 100644
--- a/mkfiles/rc5.mk
+++ b/mkfiles/rc5.mk
@@ -8,7 +8,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := rc5.o
$(ALGO_NAME)_TEST_BIN := main-rc5-test.o debug.o uart.o serial-tools.o \
nessie_bc_test.o \
- nessie_common.o cli.o performance_test.o
+ nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
diff --git a/mkfiles/rc6.mk b/mkfiles/rc6.mk
index c660d29..4f15d03 100644
--- a/mkfiles/rc6.mk
+++ b/mkfiles/rc6.mk
@@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := rc6.o
$(ALGO_NAME)_TEST_BIN := main-rc6-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance
diff --git a/mkfiles/seed.mk b/mkfiles/seed.mk
index ed6e878..25723b4 100644
--- a/mkfiles/seed.mk
+++ b/mkfiles/seed.mk
@@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := seed-asm.o
$(ALGO_NAME)_TEST_BIN := main-seed-test.o debug.o uart.o serial-tools.o \
nessie_bc_test.o nessie_common.o \
- cli.o performance_test.o
+ cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/seed_C.mk b/mkfiles/seed_C.mk
index 3005819..970c3dd 100644
--- a/mkfiles/seed_C.mk
+++ b/mkfiles/seed_C.mk
@@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := seed_C.o
$(ALGO_NAME)_TEST_BIN := main-seed-test.o debug.o uart.o serial-tools.o \
nessie_bc_test.o nessie_common.o \
- cli.o performance_test.o
+ cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/serpent-bitslice.mk b/mkfiles/serpent-bitslice.mk
index efd8bf6..4fa8936 100644
--- a/mkfiles/serpent-bitslice.mk
+++ b/mkfiles/serpent-bitslice.mk
@@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := serpent-asm.o serpent-sboxes-bitslice-asm.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/serpent_asm_bitslice.mk b/mkfiles/serpent_asm_bitslice.mk
index ddfc418..731bf7b 100644
--- a/mkfiles/serpent_asm_bitslice.mk
+++ b/mkfiles/serpent_asm_bitslice.mk
@@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := serpent-sboxes-bitslice-asm.o serpent-asm.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/serpent_asm_fast.mk b/mkfiles/serpent_asm_fast.mk
index 58258e7..b73460f 100644
--- a/mkfiles/serpent_asm_fast.mk
+++ b/mkfiles/serpent_asm_fast.mk
@@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := serpent-asm.o serpent-sboxes-fast.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/serpent_asm_small.mk b/mkfiles/serpent_asm_small.mk
index c696e2e..c0f5509 100644
--- a/mkfiles/serpent_asm_small.mk
+++ b/mkfiles/serpent_asm_small.mk
@@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := serpent-asm.o serpent-sboxes-small.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/serpent_c.mk b/mkfiles/serpent_c.mk
index 94d05e6..bc2411f 100644
--- a/mkfiles/serpent_c.mk
+++ b/mkfiles/serpent_c.mk
@@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := serpent.o serpent-sboxes_c.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/sha1.mk b/mkfiles/sha1.mk
index 8bdcef8..13e4180 100644
--- a/mkfiles/sha1.mk
+++ b/mkfiles/sha1.mk
@@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := sha1-asm.o
$(ALGO_NAME)_TEST_BIN := main-sha1-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/sha1_c.mk b/mkfiles/sha1_c.mk
index 4dce2d9..5ee92ed 100644
--- a/mkfiles/sha1_c.mk
+++ b/mkfiles/sha1_c.mk
@@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := sha1.o
$(ALGO_NAME)_TEST_BIN := main-sha1-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o \
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/sha256.mk b/mkfiles/sha256.mk
index d1dd3f5..ef14ba4 100644
--- a/mkfiles/sha256.mk
+++ b/mkfiles/sha256.mk
@@ -6,7 +6,8 @@ HASHES += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := sha256-asm.o
$(ALGO_NAME)_TEST_BIN := main-sha256-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o \
+ hfal-basic.o hfal_sha256.o shavs.o dump.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/sha256_c.mk b/mkfiles/sha256_c.mk
index 0a85c4f..90e55a1 100644
--- a/mkfiles/sha256_c.mk
+++ b/mkfiles/sha256_c.mk
@@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := sha256.o
$(ALGO_NAME)_TEST_BIN := main-sha256-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/shabea.mk b/mkfiles/shabea.mk
index 1b55cbd..eb9ff26 100644
--- a/mkfiles/shabea.mk
+++ b/mkfiles/shabea.mk
@@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := shabea.o sha256-asm.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-shabea-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/shacal1enc.mk b/mkfiles/shacal1enc.mk
index 56087b7..b4a99ab 100644
--- a/mkfiles/shacal1enc.mk
+++ b/mkfiles/shacal1enc.mk
@@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := shacal1_enc.o sha1-asm.o
$(ALGO_NAME)_TEST_BIN := main-shacal1_enc-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/shacal2enc.mk b/mkfiles/shacal2enc.mk
index d82b282..77f0334 100644
--- a/mkfiles/shacal2enc.mk
+++ b/mkfiles/shacal2enc.mk
@@ -7,7 +7,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := shacal2_enc.o sha256-asm.o
$(ALGO_NAME)_TEST_BIN := main-shacal2_enc-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/skipjack.mk b/mkfiles/skipjack.mk
index f82cd21..e0db90b 100644
--- a/mkfiles/skipjack.mk
+++ b/mkfiles/skipjack.mk
@@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := skipjack.o
$(ALGO_NAME)_TEST_BIN := main-skipjack-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o \
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/tdes.mk b/mkfiles/tdes.mk
index f151aa8..898b7c2 100644
--- a/mkfiles/tdes.mk
+++ b/mkfiles/tdes.mk
@@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := des.o
$(ALGO_NAME)_TEST_BIN := main-tdes-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/trivium.mk b/mkfiles/trivium.mk
index 1c65bd8..79cfeb6 100644
--- a/mkfiles/trivium.mk
+++ b/mkfiles/trivium.mk
@@ -6,7 +6,7 @@ STREAM_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := trivium.o
$(ALGO_NAME)_TEST_BIN := main-trivium-test.o debug.o uart.o serial-tools.o \
- nessie_stream_test.o nessie_common.o cli.o \
+ nessie_stream_test.o nessie_common.o cli.o string-extras.o \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/twister224.mk b/mkfiles/twister224.mk
index 18addb5..65b7851 100644
--- a/mkfiles/twister224.mk
+++ b/mkfiles/twister224.mk
@@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := twister-small-asm.o twister-asm.o twister224.o
$(ALGO_NAME)_TEST_BIN := main-twister224-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/twister224_c.mk b/mkfiles/twister224_c.mk
index fd4945c..5e5f0e7 100644
--- a/mkfiles/twister224_c.mk
+++ b/mkfiles/twister224_c.mk
@@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := twister.o twister-small.o memxor.o gf256mul.o
$(ALGO_NAME)_TEST_BIN := main-twister224-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/twister256.mk b/mkfiles/twister256.mk
index 260bb24..a95aeaa 100644
--- a/mkfiles/twister256.mk
+++ b/mkfiles/twister256.mk
@@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := twister-asm.o twister-small-asm.o twister256.o
$(ALGO_NAME)_TEST_BIN := main-twister256-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/twister256_c.mk b/mkfiles/twister256_c.mk
index 0ea4df1..e9cac66 100644
--- a/mkfiles/twister256_c.mk
+++ b/mkfiles/twister256_c.mk
@@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := twister.o twister-small.o memxor.o gf256mul.o
$(ALGO_NAME)_TEST_BIN := main-twister256-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/twister384.mk b/mkfiles/twister384.mk
index dacd8f1..ef04aa8 100644
--- a/mkfiles/twister384.mk
+++ b/mkfiles/twister384.mk
@@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := twister-asm.o twister-big-asm.o twister384.o
$(ALGO_NAME)_TEST_BIN := main-twister384-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/twister384_c.mk b/mkfiles/twister384_c.mk
index d478f5e..247d4d9 100644
--- a/mkfiles/twister384_c.mk
+++ b/mkfiles/twister384_c.mk
@@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := twister.o twister-big.o memxor.o gf256mul.o
$(ALGO_NAME)_TEST_BIN := main-twister384-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/twister512.mk b/mkfiles/twister512.mk
index cfbc341..0d7455b 100644
--- a/mkfiles/twister512.mk
+++ b/mkfiles/twister512.mk
@@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := twister-asm.o twister-big-asm.o twister512.o
$(ALGO_NAME)_TEST_BIN := main-twister512-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/twister512_c.mk b/mkfiles/twister512_c.mk
index e13306f..07ce27a 100644
--- a/mkfiles/twister512_c.mk
+++ b/mkfiles/twister512_c.mk
@@ -6,7 +6,7 @@ HASHES += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := twister.o twister-big.o memxor.o gf256mul.o
$(ALGO_NAME)_TEST_BIN := main-twister512-test.o debug.o uart.o serial-tools.o \
- nessie_hash_test.o nessie_common.o cli.o performance_test.o
+ nessie_hash_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/xtea.mk b/mkfiles/xtea.mk
index 0128f86..bfe5f17 100644
--- a/mkfiles/xtea.mk
+++ b/mkfiles/xtea.mk
@@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := xtea-asm.o
$(ALGO_NAME)_TEST_BIN := main-xtea-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/mkfiles/xtea_c.mk b/mkfiles/xtea_c.mk
index 6f10d76..6d88540 100644
--- a/mkfiles/xtea_c.mk
+++ b/mkfiles/xtea_c.mk
@@ -6,7 +6,7 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := xtea.o
$(ALGO_NAME)_TEST_BIN := main-xtea-test.o debug.o uart.o serial-tools.o \
- nessie_bc_test.o nessie_common.o cli.o performance_test.o
+ nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"
diff --git a/noekeon.c b/noekeon.c
index fe720a6..4b80755 100644
--- a/noekeon.c
+++ b/noekeon.c
@@ -1,6 +1,6 @@
/* noekeon.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/noekeon.h b/noekeon.h
index c6cc9e8..c637ce2 100644
--- a/noekeon.h
+++ b/noekeon.h
@@ -1,6 +1,6 @@
/* noekeon.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/noekeon_asm.S b/noekeon_asm.S
index 7fc0506..b0a2a16 100644
--- a/noekeon_asm.S
+++ b/noekeon_asm.S
@@ -1,6 +1,6 @@
/* noekeon_asm.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/noekeon_cbc_enc.S b/noekeon_cbc_enc.S
index f914544..3b7d690 100644
--- a/noekeon_cbc_enc.S
+++ b/noekeon_cbc_enc.S
@@ -1,6 +1,6 @@
/* noekeon_cbc_enc.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/noekeon_ctr.S b/noekeon_ctr.S
index 3c2a60f..bf366ba 100644
--- a/noekeon_ctr.S
+++ b/noekeon_ctr.S
@@ -1,6 +1,6 @@
/* noekeon_ctr.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/noekeon_ctr.h b/noekeon_ctr.h
index 259ec07..d7a601f 100644
--- a/noekeon_ctr.h
+++ b/noekeon_ctr.h
@@ -1,6 +1,6 @@
/* noekeon_ctr.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/omac_noekeon.S b/omac_noekeon.S
index fc3984e..598280b 100644
--- a/omac_noekeon.S
+++ b/omac_noekeon.S
@@ -1,6 +1,6 @@
/* noekeon_omac.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/present.c b/present.c
index 88d3079..03792c5 100644
--- a/present.c
+++ b/present.c
@@ -1,6 +1,6 @@
/* present.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/present.h b/present.h
index 1a43ddc..320a1d8 100644
--- a/present.h
+++ b/present.h
@@ -1,6 +1,6 @@
/* present.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/rc5.c b/rc5.c
index c3f1820..441f61d 100644
--- a/rc5.c
+++ b/rc5.c
@@ -1,6 +1,6 @@
/* rc5.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/rc5.h b/rc5.h
index da3698d..2a0182c 100644
--- a/rc5.h
+++ b/rc5.h
@@ -1,6 +1,6 @@
/* rc5.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/rc6.c b/rc6.c
index 49b72ec..ea4d7bb 100644
--- a/rc6.c
+++ b/rc6.c
@@ -1,6 +1,6 @@
/* rc6.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/rc6.h b/rc6.h
index 0ee4eaf..429a1d3 100644
--- a/rc6.h
+++ b/rc6.h
@@ -1,6 +1,6 @@
/* rc6.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/seed-asm.S b/seed-asm.S
index cf2d7a5..84866c3 100644
--- a/seed-asm.S
+++ b/seed-asm.S
@@ -1,6 +1,6 @@
/* seed-asm.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/seed.h b/seed.h
index 5128632..fed393f 100644
--- a/seed.h
+++ b/seed.h
@@ -1,6 +1,6 @@
/* seed.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/seed_C.c b/seed_C.c
index e93da31..4460fa5 100644
--- a/seed_C.c
+++ b/seed_C.c
@@ -1,6 +1,6 @@
/* seed_C.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/seed_sbox.h b/seed_sbox.h
index 0c79bf0..9937913 100644
--- a/seed_sbox.h
+++ b/seed_sbox.h
@@ -1,6 +1,6 @@
/* seed_sbox.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/serpent-asm.S b/serpent-asm.S
index 6569fb7..f5f7cc5 100644
--- a/serpent-asm.S
+++ b/serpent-asm.S
@@ -1,6 +1,6 @@
/* serpent_asm.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/serpent-sboxes-bitslice-asm.S b/serpent-sboxes-bitslice-asm.S
index 4f0fcc6..4e0d7db 100644
--- a/serpent-sboxes-bitslice-asm.S
+++ b/serpent-sboxes-bitslice-asm.S
@@ -1,6 +1,6 @@
/* serpent-sboxes-bitslice.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/serpent-sboxes-bitslice.c b/serpent-sboxes-bitslice.c
index c18f116..96f9c68 100644
--- a/serpent-sboxes-bitslice.c
+++ b/serpent-sboxes-bitslice.c
@@ -1,6 +1,6 @@
/* serpent-sboxes-bitslice.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/serpent-sboxes-fast.S b/serpent-sboxes-fast.S
index 047d82a..9242272 100644
--- a/serpent-sboxes-fast.S
+++ b/serpent-sboxes-fast.S
@@ -1,6 +1,6 @@
/* serpent-sboxes-fast.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/serpent-sboxes-small.S b/serpent-sboxes-small.S
index 76aafdb..028fd77 100644
--- a/serpent-sboxes-small.S
+++ b/serpent-sboxes-small.S
@@ -1,6 +1,6 @@
/* serpent_sboxes.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/serpent-sboxes.h b/serpent-sboxes.h
index 3384810..c391edc 100644
--- a/serpent-sboxes.h
+++ b/serpent-sboxes.h
@@ -1,6 +1,6 @@
/* serpent-sboxes.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/serpent-sboxes_c.c b/serpent-sboxes_c.c
index 36e7fdf..3a59969 100644
--- a/serpent-sboxes_c.c
+++ b/serpent-sboxes_c.c
@@ -1,6 +1,6 @@
/* serpent-sboxes.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/serpent.c b/serpent.c
index 6506b2a..40ccecd 100644
--- a/serpent.c
+++ b/serpent.c
@@ -1,6 +1,6 @@
/* serpent.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/serpent.h b/serpent.h
index 19b8816..84e4a87 100644
--- a/serpent.h
+++ b/serpent.h
@@ -1,6 +1,6 @@
/* serpent.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/sha1-asm.S b/sha1-asm.S
index 5d0a241..5d6dd31 100644
--- a/sha1-asm.S
+++ b/sha1-asm.S
@@ -1,6 +1,6 @@
/* sha1-asm.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/sha1.c b/sha1.c
index 045af10..1dd6acf 100644
--- a/sha1.c
+++ b/sha1.c
@@ -1,6 +1,6 @@
/* sha1.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/sha1.h b/sha1.h
index 895ac49..c993741 100644
--- a/sha1.h
+++ b/sha1.h
@@ -1,6 +1,6 @@
/* sha1.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/sha256-asm.S b/sha256-asm.S
index a9f7c43..b099bdd 100644
--- a/sha256-asm.S
+++ b/sha256-asm.S
@@ -1,6 +1,6 @@
/* sha256-asm.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/sha256.c b/sha256.c
index f310f7c..f654968 100644
--- a/sha256.c
+++ b/sha256.c
@@ -1,6 +1,6 @@
/* sha256.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/sha256.h b/sha256.h
index dad3323..24960a3 100644
--- a/sha256.h
+++ b/sha256.h
@@ -1,6 +1,6 @@
/* sha256.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/shacal1_enc.c b/shacal1_enc.c
index 1d5c6c9..634f18d 100644
--- a/shacal1_enc.c
+++ b/shacal1_enc.c
@@ -1,6 +1,6 @@
/* shacal1_enc.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/shacal1_enc.h b/shacal1_enc.h
index b5f81b4..e1bdd98 100644
--- a/shacal1_enc.h
+++ b/shacal1_enc.h
@@ -1,6 +1,6 @@
/* shacal1_enc.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/shacal2_enc.c b/shacal2_enc.c
index 96e32d8..b5380e5 100644
--- a/shacal2_enc.c
+++ b/shacal2_enc.c
@@ -1,6 +1,6 @@
/* shacal2_enc.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/shacal2_enc.h b/shacal2_enc.h
index 56067ad..ffa277c 100644
--- a/shacal2_enc.h
+++ b/shacal2_enc.h
@@ -1,6 +1,6 @@
/* shacal2_enc.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/skipjack.c b/skipjack.c
index ce16355..04eb437 100644
--- a/skipjack.c
+++ b/skipjack.c
@@ -1,6 +1,6 @@
/* skipjack.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/skipjack.h b/skipjack.h
index 4b4372a..00f033d 100644
--- a/skipjack.h
+++ b/skipjack.h
@@ -1,6 +1,6 @@
/* skipjack.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/test_src/cli.c b/test_src/cli.c
index 35f0aa2..5fe4c8e 100644
--- a/test_src/cli.c
+++ b/test_src/cli.c
@@ -31,6 +31,7 @@
#include
#include
#include
+#include "string-extras.h"
#include "cli.h"
#include "config.h"
@@ -38,6 +39,29 @@ cli_rx_fpt cli_rx = NULL;
cli_tx_fpt cli_tx = NULL;
uint8_t cli_echo=1;
+void cli_putc(char c){
+ if(cli_tx)
+ cli_tx(c);
+}
+
+uint16_t cli_getc(void){
+ if(cli_rx)
+ return cli_rx();
+ return ((uint16_t)-1);
+}
+
+
+uint16_t cli_getc_cecho(void){
+ char c;
+ if(cli_rx){
+ c = cli_rx();
+ if(cli_tx && cli_echo)
+ cli_tx(c);
+ return c;
+ }
+ return ((uint16_t)-1);
+}
+
void cli_putstr(char* s){
if(!cli_tx)
return;
@@ -71,6 +95,21 @@ void cli_hexdump(void* data, uint16_t length){
}
}
+void cli_hexdump2(void* data, uint16_t length){
+ char hex_tab[] = {'0', '1', '2', '3',
+ '4', '5', '6', '7',
+ '8', '9', 'A', 'B',
+ 'C', 'D', 'E', 'F'};
+ if(!cli_tx)
+ return;
+ while(length--){
+ cli_tx(hex_tab[(*((uint8_t*)data))>>4]);
+ cli_tx(hex_tab[(*((uint8_t*)data))&0xf]);
+ cli_tx(' ');
+ data = (uint8_t*)data +1;
+ }
+}
+
static
void cli_auto_help(uint16_t maxcmdlength, PGM_VOID_P cmdlist){
cmdlist_entry_t item;
@@ -84,7 +123,7 @@ void cli_auto_help(uint16_t maxcmdlength, PGM_VOID_P cmdlist){
item.cmd_name = (void*)pgm_read_word(cmdlist+0);
item.cmd_param_str = (void*)pgm_read_word(cmdlist+2);
item.cmd_function = (void_fpt)pgm_read_word(cmdlist+4);
- cmdlist = (uint8_t*)cmdlist+6;
+ cmdlist = (uint8_t*)cmdlist+CMDLIST_ENTRY_SIZE;
if(item.cmd_name==NULL){
return;
}
@@ -109,15 +148,8 @@ void cli_auto_help(uint16_t maxcmdlength, PGM_VOID_P cmdlist){
}
}
-static
-uint16_t firstword_length(char* s){
- uint16_t ret=0;
- while(isalnum(*s++))
- ret++;
- return ret;
-}
-
void echo_ctrl(char* s){
+ s = strstrip(s);
if(s==NULL || *s=='\0'){
cli_putstr_P(PSTR("\r\necho is "));
cli_putstr_P(cli_echo?PSTR("on"):PSTR("off"));
@@ -156,7 +188,7 @@ int8_t search_and_call(char* cmd, uint16_t maxcmdlength, PGM_VOID_P cmdlist){
item.cmd_name = (void*)pgm_read_word(cmdlist+0);
item.cmd_param_str = (void*)pgm_read_word(cmdlist+2);
item.cmd_function = (void_fpt)pgm_read_word(cmdlist+4);
- cmdlist = (uint8_t*)cmdlist+6;
+ cmdlist = (uint8_t*)cmdlist+CMDLIST_ENTRY_SIZE;
}while(item.cmd_name!=NULL && strcmp_P(fw, item.cmd_name));
if(item.cmd_name==NULL){
cli_auto_help(maxcmdlength, cmdlist_orig);
@@ -188,7 +220,7 @@ uint16_t max_cmd_length(PGM_VOID_P cmdlist){
char* str;
for(;;){
str = (char*)pgm_read_word(cmdlist);
- cmdlist = (uint8_t*)cmdlist + 6;
+ cmdlist = (uint8_t*)cmdlist + CMDLIST_ENTRY_SIZE;
if(str==NULL)
return ret;
t = strlen_P(str);
@@ -197,18 +229,6 @@ uint16_t max_cmd_length(PGM_VOID_P cmdlist){
}
}
-uint16_t stridentcnt_P(char* a, PGM_P b){
- uint16_t i=0;
- char c;
- for(;;){
- c = pgm_read_byte(b++);
- if(*a != c || c=='\0')
- return i;
- i++;
- a++;
- }
-}
-
uint8_t cli_completion(char* buffer, uint16_t maxcmdlength, PGM_VOID_P cmdlist){
uint8_t i=0;
char ref[maxcmdlength+1];
@@ -216,14 +236,14 @@ uint8_t cli_completion(char* buffer, uint16_t maxcmdlength, PGM_VOID_P cmdlist){
ref[0]='\0';
/* check if we are behind the first word */
while(buffer[i]){
- if(!isalnum(buffer[i++]))
+ if(!isgraph(buffer[i++]))
return 0;
}
for(;;){
itemstr = (char*)pgm_read_word(cmdlist);
if(itemstr==NULL)
break;
- cmdlist = (uint8_t*)cmdlist +6;
+ cmdlist = (uint8_t*)cmdlist +CMDLIST_ENTRY_SIZE;
if(!strncmp_P(buffer, itemstr, i)){
if(!ref[0]){
strcpy_P(ref, itemstr);
@@ -248,7 +268,7 @@ void cli_option_listing(char* buffer, PGM_VOID_P cmdlist){
cli_putstr(buffer);
return;
}
- cmdlist = (uint8_t*)cmdlist +6;
+ cmdlist = (uint8_t*)cmdlist +CMDLIST_ENTRY_SIZE;
if(!strncmp_P(buffer, itemstr, len)){
cli_putstr_P(PSTR("\r\n "));
cli_putstr_P(itemstr);
diff --git a/test_src/cli.h b/test_src/cli.h
index 6504ee2..3fbe8a7 100644
--- a/test_src/cli.h
+++ b/test_src/cli.h
@@ -22,25 +22,35 @@
#include
#include
+#ifndef VOID_FPT
+#define VOID_FPT
typedef void(*void_fpt)(void);
+#endif
typedef char (*cli_rx_fpt)(void);
typedef void (*cli_tx_fpt)(char);
#define CLI_BUFFER_BS 20
+#define CMDLIST_ENTRY_SIZE 8
typedef struct {
PGM_P cmd_name; /* string containing the function name */
PGM_P cmd_param_str; /* param descriptor string */
void_fpt cmd_function; /* function pointer */
+ void_fpt options;
} cmdlist_entry_t;
extern cli_rx_fpt cli_rx;
extern cli_tx_fpt cli_tx;
extern uint8_t cli_echo;
+
+void cli_putc(char c);
+uint16_t cli_getc(void);
+uint16_t cli_getc_cecho(void);
void cli_putstr(char* s);
void cli_putstr_P(PGM_P s);
void cli_hexdump(void* data, uint16_t length);
+void cli_hexdump2(void* data, uint16_t length);
void echo_ctrl(char* s);
int8_t cmd_interface(PGM_VOID_P cmd_desc);
diff --git a/test_src/dump.c b/test_src/dump.c
new file mode 100644
index 0000000..04b35cb
--- /dev/null
+++ b/test_src/dump.c
@@ -0,0 +1,127 @@
+/* dump.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 .
+*/
+/**
+ * \file dump.c
+ * \email daniel.otte@rub.de
+ * \author Daniel Otte
+ * \date 2009-02-04
+ * \license GPLv3 or later
+ *
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include "cli.h"
+#include "string-extras.h"
+
+#define DUMP_WIDTH 16
+
+static
+void dump_chars(uint8_t* buffer){
+ uint8_t i;
+ cli_putc('|');
+ for(i=0; i=DUMP_WIDTH){
+ if(flash){
+ for(i=0; i.
+*/
+/**
+ * \file dump.h
+ * \email daniel.otte@rub.de
+ * \author Daniel Otte
+ * \date 2009-02-04
+ * \license GPLv3 or later
+ *
+ */
+
+#ifndef DUMP_H_
+#define DUMP_H_
+
+#include
+#include
+#include
+#include
+#include "cli.h"
+#include "string-extras.h"
+
+#define DUMP_WIDTH 16
+
+void dump(char* s);
+
+#endif /* DUMP_H_ */
diff --git a/test_src/main-a5_1-test.c b/test_src/main-a5_1-test.c
index 7afb223..98d63fa 100644
--- a/test_src/main-a5_1-test.c
+++ b/test_src/main-a5_1-test.c
@@ -69,10 +69,10 @@ const char performance_str[] PROGMEM = "performance";
const char echo_str[] PROGMEM = "echo";
cmdlist_entry_t cmdlist[] PROGMEM = {
- { nessie_str, NULL, testrun_nessie_a51 },
-/* { performance_str, NULL, testrun_performance_a51}, */
- { echo_str, (void*)1, (void_fpt)echo_ctrl},
- { NULL, NULL, NULL}
+ { nessie_str, NULL, testrun_nessie_a51, NULL},
+/* { performance_str, NULL, testrun_performance_a51, NULL}, */
+ { echo_str, (void*)1, (void_fpt)echo_ctrl, NULL},
+ { NULL, NULL, NULL, NULL}
};
int main (void){
diff --git a/test_src/main-sha256-test.c b/test_src/main-sha256-test.c
index a4ba9f9..6adb2ff 100644
--- a/test_src/main-sha256-test.c
+++ b/test_src/main-sha256-test.c
@@ -34,6 +34,9 @@
#include
#include
#include "cli.h"
+#include "shavs.h"
+#include "hfal_sha256.h"
+#include "dump.h"
char* algo_name = "SHA-256";
@@ -106,13 +109,24 @@ const char nessie_str[] PROGMEM = "nessie";
const char test_str[] PROGMEM = "test";
const char performance_str[] PROGMEM = "performance";
const char echo_str[] PROGMEM = "echo";
+const char shavs_list_str[] PROGMEM = "shavs_list";
+const char shavs_set_str[] PROGMEM = "shavs_set";
+const char dump_str[] PROGMEM = "dump";
+
+const hfdesc_t* algo_list[] PROGMEM = {
+ (hfdesc_t*)&sha256_desc,
+ NULL
+};
cmdlist_entry_t cmdlist[] PROGMEM = {
- { nessie_str, NULL, testrun_nessie_sha256},
- { test_str, NULL, testrun_nessie_sha256},
- { performance_str, NULL, testrun_performance_sha256},
- { echo_str, (void*)1, (void_fpt)echo_ctrl},
- { NULL, NULL, NULL}
+ { nessie_str, NULL, testrun_nessie_sha256},
+ { test_str, NULL, testrun_nessie_sha256},
+ { performance_str, NULL, testrun_performance_sha256},
+ { echo_str, (void*)1, (void_fpt)echo_ctrl},
+ { shavs_list_str, NULL, shavs_listalgos},
+ { shavs_set_str, (void*)1, (void_fpt)shavs_setalgo},
+ { dump_str, (void*)1, (void_fpt)dump},
+ { NULL, NULL, NULL}
};
int main (void){
@@ -120,6 +134,7 @@ int main (void){
uart_putstr("\r\n");
cli_rx = uart_getc;
cli_tx = uart_putc;
+ algolist=algo_list;
for(;;){
uart_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
uart_putstr(algo_name);
diff --git a/test_src/nessie_bc_test.c b/test_src/nessie_bc_test.c
index 3d96c62..3f05a55 100644
--- a/test_src/nessie_bc_test.c
+++ b/test_src/nessie_bc_test.c
@@ -63,12 +63,14 @@ void nessie_bc_enc(uint8_t* key, uint8_t* pt){
memcpy(buffer, pt, nessie_bc_ctx.blocksize_B);
for(i=0; i<100; ++i){
nessie_bc_ctx.cipher_enc(buffer, ctx);
+ NESSIE_SEND_ALIVE_A(i);
}
nessie_print_item("Iterated 100 times", buffer, nessie_bc_ctx.blocksize_B);
#ifndef NESSIE_NO1KTEST
/* 1000 times test, we use the 100 precedig steps to fasten things a bit */
for(; i<1000; ++i){
nessie_bc_ctx.cipher_enc(buffer, ctx);
+ NESSIE_SEND_ALIVE_A(i);
}
nessie_print_item("Iterated 1000 times", buffer, nessie_bc_ctx.blocksize_B);
#endif
diff --git a/test_src/nessie_common.c b/test_src/nessie_common.c
index 4a57465..6d66a1c 100644
--- a/test_src/nessie_common.c
+++ b/test_src/nessie_common.c
@@ -30,7 +30,19 @@
#include
#include
#include /* utoa() */
-#include "uart.h"
+#include "nessie_common.h"
+
+
+#ifdef NESSIE_ALIVE
+void nessie_send_alive(void){
+ NESSIE_PUTC(NESSIE_ALIVE_CHAR);
+}
+
+void nessie_send_alive_a(uint16_t i){
+ if((i&63)==63)
+ NESSIE_PUTC(NESSIE_ALIVE_CHAR);
+}
+#endif
void nessie_print_block(uint8_t* block, uint16_t blocksize_bit){
char tab [] = {'0', '1', '2', '3',
@@ -39,8 +51,8 @@ void nessie_print_block(uint8_t* block, uint16_t blocksize_bit){
'C', 'D', 'E', 'F'};
uint16_t i;
for(i=0; i<(blocksize_bit+7)/8; ++i){
- uart_putc(tab[(block[i])>>4]);
- uart_putc(tab[(block[i])&0xf]);
+ NESSIE_PUTC(tab[(block[i])>>4]);
+ NESSIE_PUTC(tab[(block[i])&0xf]);
}
}
@@ -52,15 +64,15 @@ void nessie_print_item(char* name, uint8_t* buffer, uint16_t size_B){
uint8_t i;
name_len=strlen(name);
if(name_len>SPACES-1){
- uart_putstr_P(PSTR("\r\n!!! formatting error !!!\r\n"));
+ NESSIE_PUTSTR_P(PSTR("\r\n!!! formatting error !!!\r\n"));
return;
}
- uart_putstr_P(PSTR("\r\n"));
+ NESSIE_PUTSTR_P(PSTR("\r\n"));
for(i=0; i 0){
- uart_putstr_P(PSTR("\r\n"));
+ NESSIE_PUTSTR_P(PSTR("\r\n"));
for(i=0; iBYTESPERLINE)?BYTESPERLINE:toprint)*8);
buffer += BYTESPERLINE;
@@ -84,14 +96,14 @@ void nessie_print_item(char* name, uint8_t* buffer, uint16_t size_B){
void nessie_print_set_vector(uint8_t set, uint16_t vector){
- uart_putstr_P(PSTR("\r\n\r\nSet "));
- uart_putc('0'+set%10);
- uart_putstr_P(PSTR(", vector#"));
- uart_putc((vector<1000)?' ':'0'+vector/1000);
- uart_putc((vector<100)?' ':'0'+(vector/100)%10);
- uart_putc((vector<10 )?' ':'0'+(vector/10)%10);
- uart_putc('0'+vector%10);
- uart_putc(':');
+ NESSIE_PUTSTR_P(PSTR("\r\n\r\nSet "));
+ NESSIE_PUTC('0'+set%10);
+ NESSIE_PUTSTR_P(PSTR(", vector#"));
+ NESSIE_PUTC((vector<1000)?' ':'0'+vector/1000);
+ NESSIE_PUTC((vector<100)?' ':'0'+(vector/100)%10);
+ NESSIE_PUTC((vector<10 )?' ':'0'+(vector/10)%10);
+ NESSIE_PUTC('0'+vector%10);
+ NESSIE_PUTC(':');
}
/* example:
@@ -99,9 +111,9 @@ Test vectors -- set 3
=====================
*/
void nessie_print_setheader(uint8_t set){
- uart_putstr_P(PSTR("\r\n\r\nTest vectors -- set "));
- uart_putc('0'+set%10);
- uart_putstr_P(PSTR("\r\n====================="));
+ NESSIE_PUTSTR_P(PSTR("\r\n\r\nTest vectors -- set "));
+ NESSIE_PUTC('0'+set%10);
+ NESSIE_PUTSTR_P(PSTR("\r\n====================="));
}
/* example:
@@ -122,58 +134,58 @@ void nessie_print_header(char* name,
uint16_t macsize_b,
uint16_t ivsize_b ){
uint16_t i;
- uart_putstr_P(PSTR("\r\n\r\n"
+ NESSIE_PUTSTR_P(PSTR("\r\n\r\n"
"********************************************************************************\r\n"
"* micro-crypt - crypto primitives for microcontrolles by Daniel Otte *\r\n"
"********************************************************************************\r\n"
"\r\n"));
- uart_putstr_P(PSTR("Primitive Name: "));
- uart_putstr(name);
- uart_putstr_P(PSTR("\r\n"));
+ NESSIE_PUTSTR_P(PSTR("Primitive Name: "));
+ NESSIE_PUTSTR(name);
+ NESSIE_PUTSTR_P(PSTR("\r\n"));
/* underline */
for(i=0; i<16+strlen(name); ++i){
- uart_putc('=');
+ NESSIE_PUTC('=');
}
char str[6]; /* must catch numbers up to 65535 + terminatin \0 */
if(keysize_b){
- uart_putstr_P(PSTR("\r\nKey size: "));
+ NESSIE_PUTSTR_P(PSTR("\r\nKey size: "));
utoa(keysize_b, str, 10);
- uart_putstr(str);
- uart_putstr_P(PSTR(" bits"));
+ NESSIE_PUTSTR(str);
+ NESSIE_PUTSTR_P(PSTR(" bits"));
}
if(blocksize_b){
- uart_putstr_P(PSTR("\r\nBlock size: "));
+ NESSIE_PUTSTR_P(PSTR("\r\nBlock size: "));
utoa(blocksize_b, str, 10);
- uart_putstr(str);
- uart_putstr_P(PSTR(" bits"));
+ NESSIE_PUTSTR(str);
+ NESSIE_PUTSTR_P(PSTR(" bits"));
}
if(hashsize_b){
- uart_putstr_P(PSTR("\r\nHash size: "));
+ NESSIE_PUTSTR_P(PSTR("\r\nHash size: "));
utoa(hashsize_b, str, 10);
- uart_putstr(str);
- uart_putstr_P(PSTR(" bits"));
+ NESSIE_PUTSTR(str);
+ NESSIE_PUTSTR_P(PSTR(" bits"));
}
if(macsize_b){
- uart_putstr_P(PSTR("\r\nMac size: "));
+ NESSIE_PUTSTR_P(PSTR("\r\nMac size: "));
utoa(macsize_b, str, 10);
- uart_putstr(str);
- uart_putstr_P(PSTR(" bits"));
+ NESSIE_PUTSTR(str);
+ NESSIE_PUTSTR_P(PSTR(" bits"));
}
if(ivsize_b){
if(ivsize_b==(uint16_t)-1){
- uart_putstr_P(PSTR("\r\nNo initial value (IV) mode"));
+ NESSIE_PUTSTR_P(PSTR("\r\nNo initial value (IV) mode"));
}
{
- uart_putstr_P(PSTR("\r\nIV size: "));
+ NESSIE_PUTSTR_P(PSTR("\r\nIV size: "));
utoa(ivsize_b, str, 10);
- uart_putstr(str);
- uart_putstr_P(PSTR(" bits"));
+ NESSIE_PUTSTR(str);
+ NESSIE_PUTSTR_P(PSTR(" bits"));
}
}
- uart_putstr_P(PSTR("\r\n"));
+ NESSIE_PUTSTR_P(PSTR("\r\n"));
}
void nessie_print_footer(void){
- uart_putstr_P(PSTR("\r\n\r\n\r\n\r\nEnd of test vectors\r\n\r\n"));
+ NESSIE_PUTSTR_P(PSTR("\r\n\r\n\r\n\r\nEnd of test vectors\r\n\r\n"));
}
diff --git a/test_src/nessie_common.h b/test_src/nessie_common.h
index 0d1754b..b2d2b14 100644
--- a/test_src/nessie_common.h
+++ b/test_src/nessie_common.h
@@ -29,9 +29,35 @@
#ifndef NESSIE_COMMON_H_
#define NESSIE_COMMON_H_
+#define NESSIE_ALIVE_CHAR 0x06
+#define NESSIE_ALIVE
+#define NESSIE_USE_CLI
#include
+#ifdef NESSIE_ALIVE
+#define NESSIE_SEND_ALIVE nessie_send_alive()
+void nessie_send_alive(void);
+#define NESSIE_SEND_ALIVE_A(i) nessie_send_alive_a(i)
+void nessie_send_alive_a(uint16_t i);
+#else
+#define NESSIE_SEND_ALIVE
+#define NESSIE_SEND_ALIVE_A(i)
+#endif
+
+
+#ifdef NESSIE_USE_CLI
+#include "cli.h"
+#define NESSIE_PUTC cli_putc
+#define NESSIE_PUTSTR cli_putstr
+#define NESSIE_PUTSTR_P cli_putstr_P
+#else
+#include "uart.h"
+#define NESSIE_PUTC uart_putc
+#define NESSIE_PUTSTR uart_putstr
+#define NESSIE_PUTSTR_P uart_putstr_P
+#endif
+
void nessie_print_block(uint8_t* block, uint16_t blocksize_bit);
void nessie_print_item(char* name, uint8_t* buffer, uint16_t size_B);
void nessie_print_set_vector(uint8_t set, uint16_t vector);
diff --git a/test_src/nessie_hash_test.c b/test_src/nessie_hash_test.c
index fccc176..63e4b53 100644
--- a/test_src/nessie_hash_test.c
+++ b/test_src/nessie_hash_test.c
@@ -39,8 +39,8 @@ void ascii_hash(char* data, char* desc){
uint8_t hash[(nessie_hash_ctx.hashsize_b+7)/8];
uint16_t sl;
- uart_putstr_P(PSTR("\r\n message="));
- uart_putstr(desc);
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR(desc);
nessie_hash_ctx.hash_init(ctx);
sl = strlen(data);
while(sl>=nessie_hash_ctx.blocksize_B){
@@ -61,14 +61,16 @@ void amillion_hash(void){
uint8_t hash[(nessie_hash_ctx.hashsize_b+7)/8];
uint8_t block[nessie_hash_ctx.blocksize_B];
uint32_t n=1000000LL;
+ uint16_t i=0;
- uart_putstr_P(PSTR("\r\n message="));
- uart_putstr_P(PSTR("1 million times \"a\""));
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR_P(PSTR("1 million times \"a\""));
memset(block, 'a', nessie_hash_ctx.blocksize_B);
nessie_hash_ctx.hash_init(ctx);
while(n>=nessie_hash_ctx.blocksize_B){
nessie_hash_ctx.hash_next(block, ctx);
n -= nessie_hash_ctx.blocksize_B;
+ NESSIE_SEND_ALIVE_A(i++);
}
nessie_hash_ctx.hash_last(block, n*8, ctx);
nessie_hash_ctx.hash_conv(hash, ctx);
@@ -82,17 +84,17 @@ void zero_hash(uint16_t n){
uint8_t hash[(nessie_hash_ctx.hashsize_b+7)/8];
uint8_t block[nessie_hash_ctx.blocksize_B];
- uart_putstr_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
if(n>=10000)
- uart_putc('0'+n/10000);
+ NESSIE_PUTC('0'+n/10000);
if(n>=1000)
- uart_putc('0'+(n/1000)%10);
+ NESSIE_PUTC('0'+(n/1000)%10);
if(n>=100)
- uart_putc('0'+(n/100)%10);
+ NESSIE_PUTC('0'+(n/100)%10);
if(n>=10)
- uart_putc('0'+(n/10)%10);
- uart_putc('0'+n%10);
- uart_putstr_P(PSTR(" zero bits"));
+ NESSIE_PUTC('0'+(n/10)%10);
+ NESSIE_PUTC('0'+n%10);
+ NESSIE_PUTSTR_P(PSTR(" zero bits"));
memset(block, 0, nessie_hash_ctx.blocksize_B);
nessie_hash_ctx.hash_init(ctx);
@@ -115,24 +117,24 @@ void one_in512_hash(uint16_t pos){
"08", "04", "02", "01" };
pos&=511;
- uart_putstr_P(PSTR("\r\n message="));
- uart_putstr_P(PSTR("512-bit string: "));
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR_P(PSTR("512-bit string: "));
if((pos/8) >=10){
- uart_putc('0'+(pos/8/10)%10);
+ NESSIE_PUTC('0'+(pos/8/10)%10);
} else {
- uart_putc(' ');
+ NESSIE_PUTC(' ');
}
- uart_putc('0'+(pos/8)%10);
- uart_putstr_P(PSTR("*00,"));
- uart_putstr(tab[pos&7]);
- uart_putc(',');
+ NESSIE_PUTC('0'+(pos/8)%10);
+ NESSIE_PUTSTR_P(PSTR("*00,"));
+ NESSIE_PUTSTR(tab[pos&7]);
+ NESSIE_PUTC(',');
if(63-(pos/8) >=10){
- uart_putc('0'+((63-pos/8)/10)%10);
+ NESSIE_PUTC('0'+((63-pos/8)/10)%10);
} else {
- uart_putc(' ');
+ NESSIE_PUTC(' ');
}
- uart_putc('0'+(63-pos/8)%10);
- uart_putstr_P(PSTR("*00"));
+ NESSIE_PUTC('0'+(63-pos/8)%10);
+ NESSIE_PUTSTR_P(PSTR("*00"));
/* now the real stuff */
memset(block, 0, 512/8);
@@ -155,18 +157,18 @@ void tv4_hash(void){
uint16_t n=nessie_hash_ctx.hashsize_b;
uint32_t i;
- uart_putstr_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
if(nessie_hash_ctx.hashsize_b>=10000)
- uart_putc('0' + (nessie_hash_ctx.hashsize_b/10000)%10);
+ NESSIE_PUTC('0' + (nessie_hash_ctx.hashsize_b/10000)%10);
if(nessie_hash_ctx.hashsize_b>=1000)
- uart_putc('0' + (nessie_hash_ctx.hashsize_b/1000)%10);
+ NESSIE_PUTC('0' + (nessie_hash_ctx.hashsize_b/1000)%10);
if(nessie_hash_ctx.hashsize_b>=100)
- uart_putc('0' + (nessie_hash_ctx.hashsize_b/100)%10);
+ NESSIE_PUTC('0' + (nessie_hash_ctx.hashsize_b/100)%10);
if(nessie_hash_ctx.hashsize_b>=10)
- uart_putc('0' + (nessie_hash_ctx.hashsize_b/10)%10);
- uart_putc('0' + nessie_hash_ctx.hashsize_b%10);
+ NESSIE_PUTC('0' + (nessie_hash_ctx.hashsize_b/10)%10);
+ NESSIE_PUTC('0' + nessie_hash_ctx.hashsize_b%10);
- uart_putstr_P(PSTR(" zero bits"));
+ NESSIE_PUTSTR_P(PSTR(" zero bits"));
memset(block, 0, 256/8);
nessie_hash_ctx.hash_init(ctx);
@@ -181,6 +183,7 @@ void tv4_hash(void){
nessie_hash_ctx.hash_init(ctx);
nessie_hash_ctx.hash_last(hash, nessie_hash_ctx.hashsize_b, ctx);
nessie_hash_ctx.hash_conv(hash, ctx);
+ NESSIE_SEND_ALIVE_A(i);
}
nessie_print_item("iterated 100000 times", hash, (nessie_hash_ctx.hashsize_b+7)/8);
}
diff --git a/test_src/nessie_mac_test.c b/test_src/nessie_mac_test.c
index ef4c0d8..90e33de 100644
--- a/test_src/nessie_mac_test.c
+++ b/test_src/nessie_mac_test.c
@@ -45,8 +45,8 @@ void ascii_mac(char* data, char* desc, uint8_t* key){
uint8_t mac[MACSIZE_B];
uint16_t sl;
- uart_putstr_P(PSTR("\r\n message="));
- uart_putstr(desc);
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR(desc);
PRINTKEY;
nessie_mac_ctx.mac_init(key, nessie_mac_ctx.keysize_b, ctx);
sl = strlen(data);
@@ -68,9 +68,10 @@ void amillion_mac(uint8_t* key){
uint8_t mac[MACSIZE_B];
uint8_t block[nessie_mac_ctx.blocksize_B];
uint32_t n=1000000LL;
+ uint16_t i=0;
- uart_putstr_P(PSTR("\r\n message="));
- uart_putstr_P(PSTR("1 million times \"a\""));
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR_P(PSTR("1 million times \"a\""));
PRINTKEY;
memset(block, 'a', nessie_mac_ctx.blocksize_B);
@@ -78,6 +79,7 @@ void amillion_mac(uint8_t* key){
while(n>nessie_mac_ctx.blocksize_B){
nessie_mac_ctx.mac_next(block, ctx);
n -= nessie_mac_ctx.blocksize_B;
+ NESSIE_SEND_ALIVE_A(i++);
}
nessie_mac_ctx.mac_last(block, n*8, key, nessie_mac_ctx.keysize_b, ctx);
nessie_mac_ctx.mac_conv(mac, ctx);
@@ -91,17 +93,17 @@ void zero_mac(uint16_t n, uint8_t* key){
uint8_t mac[MACSIZE_B];
uint8_t block[nessie_mac_ctx.blocksize_B];
- uart_putstr_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
if(n>=10000)
- uart_putc('0'+n/10000);
+ NESSIE_PUTC('0'+n/10000);
if(n>=1000)
- uart_putc('0'+(n/1000)%10);
+ NESSIE_PUTC('0'+(n/1000)%10);
if(n>=100)
- uart_putc('0'+(n/100)%10);
+ NESSIE_PUTC('0'+(n/100)%10);
if(n>=10)
- uart_putc('0'+(n/10)%10);
- uart_putc('0'+n%10);
- uart_putstr_P(PSTR(" zero bits"));
+ NESSIE_PUTC('0'+(n/10)%10);
+ NESSIE_PUTC('0'+n%10);
+ NESSIE_PUTSTR_P(PSTR(" zero bits"));
PRINTKEY;
memset(block, 0, nessie_mac_ctx.blocksize_B);
@@ -125,24 +127,24 @@ void one_in512_mac(uint16_t pos, uint8_t* key){
"08", "04", "02", "01" };
pos&=511;
- uart_putstr_P(PSTR("\r\n message="));
- uart_putstr_P(PSTR("512-bit string: "));
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR_P(PSTR("512-bit string: "));
if((pos/8) >=10){
- uart_putc('0'+(pos/8/10)%10);
+ NESSIE_PUTC('0'+(pos/8/10)%10);
} else {
- uart_putc(' ');
+ NESSIE_PUTC(' ');
}
- uart_putc('0'+(pos/8)%10);
- uart_putstr_P(PSTR("*00,"));
- uart_putstr(tab[pos&7]);
- uart_putc(',');
+ NESSIE_PUTC('0'+(pos/8)%10);
+ NESSIE_PUTSTR_P(PSTR("*00,"));
+ NESSIE_PUTSTR(tab[pos&7]);
+ NESSIE_PUTC(',');
if(63-(pos/8) >=10){
- uart_putc('0'+((63-pos/8)/10)%10);
+ NESSIE_PUTC('0'+((63-pos/8)/10)%10);
} else {
- uart_putc(' ');
+ NESSIE_PUTC(' ');
}
- uart_putc('0'+(63-pos/8)%10);
- uart_putstr_P(PSTR("*00"));
+ NESSIE_PUTC('0'+(63-pos/8)%10);
+ NESSIE_PUTSTR_P(PSTR("*00"));
PRINTKEY;
/* now the real stuff */
@@ -169,8 +171,8 @@ void tv4_mac(uint8_t* key){
uint16_t n=256;
uint32_t i;
- uart_putstr_P(PSTR("\r\n message="));
- uart_putstr(PSTR("256 zero bits"));
+ NESSIE_PUTSTR_P(PSTR("\r\n message="));
+ NESSIE_PUTSTR(PSTR("256 zero bits"));
memset(block, 0, 256/8);
nessie_mac_ctx.mac_init(key, nessie_mac_ctx.keysize_b, ctx);;
@@ -185,6 +187,7 @@ void tv4_mac(uint8_t* key){
nessie_mac_ctx.mac_init(key, nessie_mac_ctx.keysize_b, ctx);;
nessie_mac_ctx.mac_last(mac, nessie_mac_ctx.macsize_b, key, nessie_mac_ctx.keysize_b, ctx);
nessie_mac_ctx.mac_conv(mac, ctx);
+ NESSIE_SEND_ALIVE_A(i);
}
nessie_print_item("iterated 100000 times", mac, MACSIZE_B);
}
diff --git a/test_src/nessie_stream_test.c b/test_src/nessie_stream_test.c
index 461f5cb..cc4ac1f 100644
--- a/test_src/nessie_stream_test.c
+++ b/test_src/nessie_stream_test.c
@@ -118,6 +118,7 @@ void nessie_stream_enc_large(uint8_t* key){
for(i=0; i<((65472-0)/BLOCKSIZE_B-1); ++i){
nessie_gen_block(ctx, buffer);
memxor(xorbuffer, buffer, BLOCKSIZE_B);
+ NESSIE_SEND_ALIVE_A(i);
}
nessie_gen_block(ctx, buffer);
@@ -131,6 +132,7 @@ void nessie_stream_enc_large(uint8_t* key){
for(i=0; i<((131008-65536)/BLOCKSIZE_B-1); ++i){
nessie_gen_block(ctx, buffer);
memxor(xorbuffer, buffer, BLOCKSIZE_B);
+ NESSIE_SEND_ALIVE_A(i);
}
nessie_gen_block(ctx, buffer);
diff --git a/test_src/shavs.c b/test_src/shavs.c
new file mode 100644
index 0000000..bde453b
--- /dev/null
+++ b/test_src/shavs.c
@@ -0,0 +1,91 @@
+/* shavs.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 .
+*/
+/**
+ * \file shavs.c
+ * \author Daniel Otte
+ * \date 2006-05-16
+ * \license GPLv3 or later
+ *
+ */
+
+#include
+#include
+#include
+#include "hashfunction_descriptor.h"
+#include "shavs.h"
+#include "string-extras.h"
+#include "cli.h"
+
+hfdesc_t* algo=NULL;
+hfdesc_t** algolist=NULL;
+
+void shavs_listalgos(void){
+ char option = 'a';
+
+ cli_putstr_P(PSTR("\r\nDBG: &algolist: "));
+ cli_hexdump(&algolist, 2);
+ cli_putstr_P(PSTR("\r\nDBG: algolist[0]: "));
+ cli_hexdump(algolist, 8);
+
+ hfdesc_t* t;
+ uint8_t i=0;
+ cli_putstr_P(PSTR("\r\nthe following algorithms are available:\r\n"));
+ while(option<='z' && (t=(hfdesc_t*)pgm_read_word(&(algolist[i])))){
+ cli_putc('\t');
+ cli_putc((t==algo)?'*':' ');
+ cli_putc(option++);
+ cli_putstr_P(PSTR(":\t"));
+ cli_putstr_P((void*)(pgm_read_word(&(t->name))));
+ cli_putstr_P(PSTR("\r\n"));
+ i++;
+ }
+}
+
+void shavs_setalgo(char* param){
+ param = strstrip(param);
+ if(param[1]=='\0'){ /* single letter specified */
+ uint8_t i,option = param[0]-'a';
+
+ if(!algolist){
+ cli_putstr_P(PSTR("\r\nERROR: algolist not set!"));
+ return;
+ }
+ for(i=0; i<=option; ++i){
+ if((void*)pgm_read_word(&(algolist[i]))==NULL){
+ cli_putstr_P(PSTR("\r\nERROR: invalid selection!"));
+ return;
+ }
+ }
+ algo=(hfdesc_t*)pgm_read_word(&(algolist[option]));
+ } else { /* name specifyed */
+ hfdesc_t* t=NULL;
+ uint8_t i=0;
+ while((t=(hfdesc_t*)pgm_read_word(&(algolist[i]))) &&
+ strcasecmp_P(param, (void*)pgm_read_word(&(t->name))))
+ ++i;
+ if(t){
+ algo=t;
+ }else{
+ cli_putstr_P(PSTR("\r\nERROR: could not find \""));
+ cli_putstr(param);
+ cli_putstr_P(PSTR("\"!"));
+ }
+ }
+}
+
diff --git a/test_src/shavs.h b/test_src/shavs.h
new file mode 100644
index 0000000..a64f3a6
--- /dev/null
+++ b/test_src/shavs.h
@@ -0,0 +1,39 @@
+/* shavs.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 .
+*/
+/**
+ * \file shavs.h
+ * \author Daniel Otte
+ * \date 2006-05-16
+ * \license GPLv3 or later
+ *
+ */
+
+#ifndef SHAVS_H_
+#define SHAVS_H_
+
+#include
+#include "hashfunction_descriptor.h"
+
+extern hfdesc_t* algo;
+extern hfdesc_t** algolist;
+
+void shavs_listalgos(void);
+void shavs_setalgo(char* param);
+
+#endif /* SHAVS */
diff --git a/trivium.c b/trivium.c
index 12fd013..3ac69c3 100644
--- a/trivium.c
+++ b/trivium.c
@@ -1,6 +1,6 @@
/* trivium.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/trivium.h b/trivium.h
index 3a0428a..14a005f 100644
--- a/trivium.h
+++ b/trivium.h
@@ -1,6 +1,6 @@
/* trivium.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/twister-asm.S b/twister-asm.S
index ad69e38..7ae3842 100644
--- a/twister-asm.S
+++ b/twister-asm.S
@@ -1,6 +1,6 @@
/* twister-asm.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/twister-big-asm.S b/twister-big-asm.S
index 5cdd02b..e6e7691 100644
--- a/twister-big-asm.S
+++ b/twister-big-asm.S
@@ -1,6 +1,6 @@
/* twister-big-asm.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/twister-big.c b/twister-big.c
index f323307..7951909 100644
--- a/twister-big.c
+++ b/twister-big.c
@@ -1,6 +1,6 @@
/* twister-big.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/twister-small-asm.S b/twister-small-asm.S
index 9a1f0c7..b5167ef 100644
--- a/twister-small-asm.S
+++ b/twister-small-asm.S
@@ -1,6 +1,6 @@
/* twister-small-asm.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/twister.c b/twister.c
index 5dd3808..c82e22e 100644
--- a/twister.c
+++ b/twister.c
@@ -1,6 +1,6 @@
/* twister.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
@@ -25,17 +25,17 @@
#include "twister_tables.h"
#include "memxor.h"
-#ifndef TWISTER_MUL_TABLE
+//#ifndef TWISTER_MUL_TABLE
# include "gf256mul.h"
-#endif
+//#endif
#define MDS(a,b) pgm_read_byte(&(twister_mds[(a)][(b)]))
-#ifdef TWISTER_MUL_TABLE
-# define MULT(a,b) pgm_read_byte(&(twister_multab[(a)][(b)]))
-#else
+//#ifdef TWISTER_MUL_TABLE
+//# define MULT(a,b) pgm_read_byte(&(twister_multab[(a)][(b)]))
+//#else
# define MULT(a,b) gf256mul((a),(b), 0x4D)
-#endif
+//#endif
void twister_blank_round(twister_state_t* ctx){
uint8_t i,j,k;
@@ -57,19 +57,25 @@ void twister_blank_round(twister_state_t* ctx){
for( j=0; j<8; j++ ){
k=(i+1)&7;
ctx->s[j][i] =
- MULT( MDS(j,0), tmp[0][i] ) ^
- MULT( MDS(j,1), tmp[1][k] ) ^
- MULT( MDS(j,2), tmp[2][(++k)&7] ) ^
- MULT( MDS(j,3), tmp[3][(++k)&7] ) ^
- MULT( MDS(j,4), tmp[4][(++k)&7] ) ^
- MULT( MDS(j,5), tmp[5][(++k)&7] ) ^
- MULT( MDS(j,6), tmp[6][(++k)&7] ) ^
- MULT( MDS(j,7), tmp[7][(++k)&7] ) ;
+ MULT( MDS(j,0), (tmp[0][i]) );
+ ctx->s[j][i] ^=
+ MULT( MDS(j,1), (tmp[1][k]) );
+ ctx->s[j][i] ^=
+ MULT( MDS(j,2), (tmp[2][((++k)&7)]) );
+ ctx->s[j][i] ^=
+ MULT( MDS(j,3), (tmp[3][((++k)&7)]) );
+ ctx->s[j][i] ^=
+ MULT( MDS(j,4), (tmp[4][((++k)&7)]) );
+ ctx->s[j][i] ^=
+ MULT( MDS(j,5), (tmp[5][((++k)&7)]) );
+ ctx->s[j][i] ^=
+ MULT( MDS(j,6), (tmp[6][((++k)&7)]) );
+ ctx->s[j][i] ^=
+ MULT( MDS(j,7), (tmp[7][((++k)&7)]) );
}
}
}
-
void twister_mini_round(twister_state_t* ctx, const void* msg){
/* inject message */
uint8_t i;
diff --git a/twister.h b/twister.h
index 07c6be0..ec6b219 100644
--- a/twister.h
+++ b/twister.h
@@ -1,6 +1,6 @@
/* twister.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/twister224.S b/twister224.S
index 160d880..e97ed55 100644
--- a/twister224.S
+++ b/twister224.S
@@ -1,6 +1,6 @@
/* twister224.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/twister256.S b/twister256.S
index fb854fa..ce1dc11 100644
--- a/twister256.S
+++ b/twister256.S
@@ -1,6 +1,6 @@
/* twister256.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/twister384.S b/twister384.S
index 03d911c..e586243 100644
--- a/twister384.S
+++ b/twister384.S
@@ -1,6 +1,6 @@
/* twister384.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/twister512.S b/twister512.S
index 70d98ed..f2f701f 100644
--- a/twister512.S
+++ b/twister512.S
@@ -1,6 +1,6 @@
/* twister512.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/uart.h b/uart.h
index e72d95f..946ed38 100644
--- a/uart.h
+++ b/uart.h
@@ -1,6 +1,6 @@
/* uart.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/xtea-asm.S b/xtea-asm.S
index f117e07..826f123 100644
--- a/xtea-asm.S
+++ b/xtea-asm.S
@@ -1,6 +1,6 @@
/* xtea-asm.S */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/xtea.c b/xtea.c
index 36050f6..4605cb0 100644
--- a/xtea.c
+++ b/xtea.c
@@ -1,6 +1,6 @@
/* xtea.c */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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
diff --git a/xtea.h b/xtea.h
index 53bd2a6..b753bf7 100644
--- a/xtea.h
+++ b/xtea.h
@@ -1,6 +1,6 @@
/* xtea.h */
/*
- This file is part of the This file is part of the AVR-Crypto-Lib.
+ 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