]> git.cryptolib.org Git - avr-crypto-lib.git/commitdiff
some modifications in test suits
authorbg <bg@b1d182e4-1ff8-0310-901f-bddb46175740>
Mon, 21 Jun 2010 21:08:03 +0000 (21:08 +0000)
committerbg <bg@b1d182e4-1ff8-0310-901f-bddb46175740>
Mon, 21 Jun 2010 21:08:03 +0000 (21:08 +0000)
18 files changed:
Makefile
bcal-performance.c
bcal_present.c
bmw/bmw_224-tinyasm.S
bmw/bmw_256-tinyasm.S
bmw/bmw_small-tinyasm.S
mkfiles/001_bcal_std.mk
mkfiles/aes.mk
mkfiles/aes128.mk
mkfiles/aes192.mk
mkfiles/aes256.mk
mkfiles/aes_asm_faster.mk
mkfiles/aes_c.mk
mkfiles/camellia_c.mk
mkfiles/shabea.mk
test_src/main-aes128-test.c
test_src/main-aes192-test.c
test_src/main-aes256-test.c

index 58b17e08708e62c9a3bba21a83d90d3ca4612c85..ebc4a6e75e7657b4951b3cfa89bf8529d19c2d42 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -179,6 +179,8 @@ $(foreach algo, $(ALGORITHMS), $(eval $(call Speed_Template, \
 .PHONY: hash_speed
 hash_speed: $(foreach algo, $(HASHES), $(algo)_SPEED)
 
+.PHONY: blockcipher_speed
+blockcipher_speed: $(foreach algo, $(BLOCK_CIPHERS), $(algo)_SPEED)
 #-------------------------------------------------------------------------------
 
 
@@ -195,6 +197,9 @@ $(foreach algo, $(ALGORITHMS), $(eval $(call Size_Template, \
 .PHONY: hash_size
 hash_size: $(foreach algo, $(HASHES), $(algo)_SIZE)
 
+.PHONY: blockcipher_size
+blockcipher_size: $(foreach algo, $(BLOCK_CIPHERS), $(algo)_SIZE)
+
 #-------------------------------------------------------------------------------
 
 .PHONY: tests
@@ -277,27 +282,29 @@ info:
        @echo "  auxiliary functions:"
        @echo "    $(AUX)"
        @echo " targets:"
-       @echo "  all           - all algorithm cores"
-       @echo "  cores         - all algorithm cores"
-       @echo "  listings      - all algorithm core listings"
-       @echo "  tests         - all algorithm test programs"
-       @echo "  stats         - all algorithm size statistics"
-       @echo "  blockciphers  - all blockcipher cores"
-       @echo "  streamciphers - all streamcipher cores"
-       @echo "  hashes        - all hash cores"
-       @echo "  macs          - all MAC cores"
-       @echo "  prngs         - all PRNG cores"
-       @echo "  all_testrun   - testrun all algorithms"
-       @echo "  hash_size     - measure size of all hash functions"
-       @echo "  hash_speed    - measure performance of all hash functions"
-       @echo "  docu          - build doxygen documentation"
-       @echo "  clean         - remove a lot of builded files"
-       @echo "  depclean      - also remove dependency files"
-       @echo "  *_TEST_BIN    - build test program"
-       @echo "  *_TESTRUN     - run nessie test"
-       @echo "  *_OBJ         - build algorithm core"
-       @echo "  *_FLASH       - flash test program"
-       @echo "  *_LIST        - build assembler listing"
+       @echo "  all                - all algorithm cores"
+       @echo "  cores              - all algorithm cores"
+       @echo "  listings           - all algorithm core listings"
+       @echo "  tests              - all algorithm test programs"
+       @echo "  stats              - all algorithm size statistics"
+       @echo "  blockciphers       - all blockcipher cores"
+       @echo "  streamciphers      - all streamcipher cores"
+       @echo "  hashes             - all hash cores"
+       @echo "  macs               - all MAC cores"
+       @echo "  prngs              - all PRNG cores"
+       @echo "  all_testrun        - testrun all algorithms"
+       @echo "  hash_size          - measure size of all hash functions"
+       @echo "  hash_speed         - measure performance of all hash functions"
+       @echo "  blockcipher_size   - measure size of all blockciphers"
+       @echo "  blockcipher_speed  - measure performance of all blockciphers"
+       @echo "  docu               - build doxygen documentation"
+       @echo "  clean              - remove a lot of builded files"
+       @echo "  depclean           - also remove dependency files"
+       @echo "  *_TEST_BIN         - build test program"
+       @echo "  *_TESTRUN          - run nessie test"
+       @echo "  *_OBJ              - build algorithm core"
+       @echo "  *_FLASH            - flash test program"
+       @echo "  *_LIST             - build assembler listing"
 
 
 #-------------------------------------------------------------------------------
index 447e4d173d41eeb74c8efb46d45e45d3e358936b..36cc82317948677733cee2f3b8f58dc61d6ff1c6 100644 (file)
 #include "keysize_descriptor.h"
 #include "blockcipher_descriptor.h"
 #include "performance_test.h"
+#include "stack_measuring.h"
 #include "cli.h"
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <avr/pgmspace.h>
 
-
+#define PATTERN_A 0xAA
+#define PATTERN_B 0x55
 
 
 static
@@ -137,6 +139,76 @@ void bcal_performance(const bcdesc_t* bcd){
        }
 }
 
+void bcal_stacksize(const bcdesc_t* bcd){
+       bcdesc_t bc;
+       stack_measuring_ctx_t smctx;
+       memcpy_P(&bc, bcd, sizeof(bcdesc_t));
+       uint8_t ctx[bc.ctxsize_B];
+       uint8_t data[(bc.blocksize_b+7)/8];
+       uint16_t keysize = get_keysize(bc.valid_keysize_desc);
+       uint8_t key[(keysize+7)/8];
+       uint16_t t1, t2;
+
+       if(bc.type!=BCDESC_TYPE_BLOCKCIPHER)
+               return;
+       cli_putstr_P(PSTR("\r\n\r\n === "));
+       cli_putstr_P(bc.name);
+       cli_putstr_P(PSTR(" stack-usage === "));
+
+       if(bc.init.init1){
+               if((bc.flags&BC_INIT_TYPE)==BC_INIT_TYPE_1){
+                       cli();
+                       stack_measure_init(&smctx, PATTERN_A);
+                       bc.init.init1(&ctx, key);
+                       t1 = stack_measure_final(&smctx);
+                       stack_measure_init(&smctx, PATTERN_B);
+                       bc.init.init1(&ctx, key);
+                       t2 = stack_measure_final(&smctx);
+                       sei();
+               } else {
+                       cli();
+                       stack_measure_init(&smctx, PATTERN_A);
+                       bc.init.init2(&ctx, keysize, key);
+                       t1 = stack_measure_final(&smctx);
+                       stack_measure_init(&smctx, PATTERN_B);
+                       bc.init.init2(&ctx, keysize, key);
+                       t2 = stack_measure_final(&smctx);
+                       sei();
+               }
+               t1 = (t1>t2)?t1:t2;
+               cli_putstr_P(PSTR("\r\n    init (bytes):       "));
+               printvalue((unsigned long)t1);
+       }
+       cli();
+       stack_measure_init(&smctx, PATTERN_A);
+       bc.enc.enc1(data, &ctx);
+       t1 = stack_measure_final(&smctx);
+       stack_measure_init(&smctx, PATTERN_B);
+       bc.enc.enc1(data, &ctx);
+       t2 = stack_measure_final(&smctx);
+       sei();
+
+       t1 = (t1>t2)?t1:t2;
+       cli_putstr_P(PSTR("\r\n    encBlock (bytes):   "));
+       printvalue((unsigned long)t1);
+
+       cli();
+       stack_measure_init(&smctx, PATTERN_A);
+       bc.dec.dec1(data, &ctx);
+       t1 = stack_measure_final(&smctx);
+       stack_measure_init(&smctx, PATTERN_B);
+       bc.dec.dec1(data, &ctx);
+       t2 = stack_measure_final(&smctx);
+       sei();
+
+       t1 = (t1>t2)?t1:t2;
+       cli_putstr_P(PSTR("\r\n    decBlock (bytes):   "));
+       printvalue((unsigned long)t1);
+
+       if(bc.free){
+               bc.free(&ctx);
+       }
+}
 
 void bcal_performance_multiple(const bcdesc_t** bcd_list){
        const bcdesc_t* bcd;
@@ -147,6 +219,7 @@ void bcal_performance_multiple(const bcdesc_t** bcd_list){
                        return;
                }
                bcal_performance(bcd);
+               bcal_stacksize(bcd);
                bcd_list = (void*)((uint8_t*)bcd_list + 2);
        }
 }
index 945bd59dda6bea4047004732dca018a884a1e0d0..96842b1d9b12ed7f8ddcf22905ccea8192774482 100644 (file)
@@ -38,7 +38,7 @@ const uint8_t present_keysize_desc[] PROGMEM = { KS_TYPE_LIST, 1, KS_INT(80),
 
 const bcdesc_t present_desc PROGMEM = {
        BCDESC_TYPE_BLOCKCIPHER,
-       BC_INIT_TYPE_1,
+       BC_INIT_TYPE_2,
        present_str,
        sizeof(present_ctx_t),
        64,
index e01752c4391110af90a669c183dabe1a2436e3de..5b3c65715abd0b23893cfe35504fe212b89481f8 100644 (file)
@@ -41,6 +41,11 @@ acc1 = 15
   param s: r20
 */
 shiftleft32:
+       tst r20
+       brpl 10f
+       neg r20
+       rjmp shiftright32
+10:
        clr r0
        cpi r20, 8
        brlo bitrotateleft_1
@@ -49,7 +54,7 @@ shiftleft32:
        mov r23, r22
        clr r22
        subi r20, 8
-       rjmp shiftleft32
+       rjmp 10b
 
 /******************************************************************************/
 /*
@@ -257,10 +262,11 @@ mov32_to_acc:
 
 f2_1_shift_table:
 ;      .byte 0x2B, 0x64, 0x66, 0x03, 0x51, 0x55, 0x87, 0x55
-       .byte 0x55, 0x87, 0x55, 0x51, 0x03, 0x66, 0x64, 0x2B
+;      .byte 0x55, 0x87, 0x55, 0x51, 0x03, 0x66, 0x64, 0x2B
+       .byte 5, -5, -7, 8, -5, 5, -1, 5, -3, 0, 6, -6, -4, 6, -11, 2
 f2_2_shift_table:
 ;      .byte (2<<1), (7<<1), (4<<1), (3<<1), (4<<1)+1, (6<<1)+1, (6<<1)
-       .byte (8<<1)+1, (6<<1), (6<<1)+1, (4<<1)+1, (3<<1), (4<<1), (7<<1), (2<<1)
+       .byte 8, -6, 6, 4, -3, -4, -7, -2
 expand2_rot_table:
        .byte 3,7,13,16,19,23,27
 
@@ -737,40 +743,21 @@ f2:
        movw r26, h0
        ldi r30, lo8(f2_1_shift_table)
        ldi r31, hi8(f2_1_shift_table)
-       ldi r17, 16
+       ldi r17, 15
 10:
 ;---
        movw r22, xh0
        movw r24, xh2
-       cpi r17, 9
-       brge 15f
-       clr r1
-       rjmp 26f
-15:    lpm r20, Z+
-       mov r1, r20
-       andi r20, 0x0f
-       clt
-       cpi r17, 16
-       breq 20f
-       cpi r17, 11
-       brne 21f
-20:    set
-21:    brts 25f
-       rcall shiftright32
-       rjmp 26f
-25:    rcall shiftleft32
-26: rcall mov32_to_acc
+       lpm r20, Z+
+       sbrc r17, 3
+       rcall shiftleft32
+    rcall mov32_to_acc
 ;---
        rcall load32_from_Y
-       mov r20, r1
-       clr r1
-       swap r20
-       andi r20, 0x0f
-       brts 27f
+       lpm r20, Z+
+       sbrc r17, 3
        rcall shiftleft32
-       rjmp 28f
-27:    rcall shiftright32
-28:    rcall eor32_to_acc
+       rcall eor32_to_acc
 ;---
        rcall load32_from_X
        rcall eor32_to_acc
@@ -778,7 +765,7 @@ f2:
        adiw r26, 4
 ;---
        dec r17
-       brne 10b
+       brpl 10b
 ;-----
        sbiw r28, 4*8 /* Y points to q[24] */
        movw r30, r28
@@ -799,20 +786,13 @@ f2:
 
        movw r26, h0
        ldi r17, 15
-       ldi r30, lo8(f2_2_shift_table)
-       ldi r31, hi8(f2_2_shift_table)
+       ldi r30, lo8(f2_2_shift_table-8)
+       ldi r31, hi8(f2_2_shift_table-8)
 10:    movw r22, xl0
        movw r24, xl2
-       sbrc r17, 3
-       rjmp 20f
        lpm r20, Z+
-       lsr r20
-       brcs 15f
-       rcall shiftright32
-       rjmp 20f
-15:
+       sbrs r17, 3
        rcall shiftleft32
-20:
        rcall mov32_to_acc
        rcall load32_from_Y
        rcall eor32_to_acc
@@ -1090,6 +1070,7 @@ bmw224:
        push_range 28, 29
        push_range 8, 9
        stack_alloc_large 64+4
+       adiw r30, 1
 10:    movw ctx0, r30
        movw dst0, r24
        movw msg0, r22
index 6327bc1e4c9a568c36c9fd2180df3068b9fc64c1..ef23de2b56d01050385e3b95979dd656d5ba4ec6 100644 (file)
@@ -41,6 +41,11 @@ acc1 = 15
   param s: r20
 */
 shiftleft32:
+       tst r20
+       brpl 10f
+       neg r20
+       rjmp shiftright32
+10:
        clr r0
        cpi r20, 8
        brlo bitrotateleft_1
@@ -49,7 +54,7 @@ shiftleft32:
        mov r23, r22
        clr r22
        subi r20, 8
-       rjmp shiftleft32
+       rjmp 10b
 
 /******************************************************************************/
 /*
@@ -257,10 +262,11 @@ mov32_to_acc:
 
 f2_1_shift_table:
 ;      .byte 0x2B, 0x64, 0x66, 0x03, 0x51, 0x55, 0x87, 0x55
-       .byte 0x55, 0x87, 0x55, 0x51, 0x03, 0x66, 0x64, 0x2B
+;      .byte 0x55, 0x87, 0x55, 0x51, 0x03, 0x66, 0x64, 0x2B
+       .byte 5, -5, -7, 8, -5, 5, -1, 5, -3, 0, 6, -6, -4, 6, -11, 2
 f2_2_shift_table:
 ;      .byte (2<<1), (7<<1), (4<<1), (3<<1), (4<<1)+1, (6<<1)+1, (6<<1)
-       .byte (8<<1)+1, (6<<1), (6<<1)+1, (4<<1)+1, (3<<1), (4<<1), (7<<1), (2<<1)
+       .byte 8, -6, 6, 4, -3, -4, -7, -2
 expand2_rot_table:
        .byte 3,7,13,16,19,23,27
 
@@ -738,40 +744,21 @@ f2:
        movw r26, h0
        ldi r30, lo8(f2_1_shift_table)
        ldi r31, hi8(f2_1_shift_table)
-       ldi r17, 16
+       ldi r17, 15
 10:
 ;---
        movw r22, xh0
        movw r24, xh2
-       cpi r17, 9
-       brge 15f
-       clr r1
-       rjmp 26f
-15:    lpm r20, Z+
-       mov r1, r20
-       andi r20, 0x0f
-       clt
-       cpi r17, 16
-       breq 20f
-       cpi r17, 11
-       brne 21f
-20:    set
-21:    brts 25f
-       rcall shiftright32
-       rjmp 26f
-25:    rcall shiftleft32
-26: rcall mov32_to_acc
+       lpm r20, Z+
+       sbrc r17, 3
+       rcall shiftleft32
+    rcall mov32_to_acc
 ;---
        rcall load32_from_Y
-       mov r20, r1
-       clr r1
-       swap r20
-       andi r20, 0x0f
-       brts 27f
+       lpm r20, Z+
+       sbrc r17, 3
        rcall shiftleft32
-       rjmp 28f
-27:    rcall shiftright32
-28:    rcall eor32_to_acc
+       rcall eor32_to_acc
 ;---
        rcall load32_from_X
        rcall eor32_to_acc
@@ -779,7 +766,7 @@ f2:
        adiw r26, 4
 ;---
        dec r17
-       brne 10b
+       brpl 10b
 ;-----
        sbiw r28, 4*8 /* Y points to q[24] */
        movw r30, r28
@@ -800,20 +787,13 @@ f2:
 
        movw r26, h0
        ldi r17, 15
-       ldi r30, lo8(f2_2_shift_table)
-       ldi r31, hi8(f2_2_shift_table)
+       ldi r30, lo8(f2_2_shift_table-8)
+       ldi r31, hi8(f2_2_shift_table-8)
 10:    movw r22, xl0
        movw r24, xl2
-       sbrc r17, 3
-       rjmp 20f
        lpm r20, Z+
-       lsr r20
-       brcs 15f
-       rcall shiftright32
-       rjmp 20f
-15:
+       sbrs r17, 3
        rcall shiftleft32
-20:
        rcall mov32_to_acc
        rcall load32_from_Y
        rcall eor32_to_acc
@@ -1122,6 +1102,7 @@ bmw256:
        push_range 28, 29
        push_range 8, 9
        stack_alloc_large 64+4
+       adiw r30, 1
 10:    movw ctx0, r30
        movw dst0, r24
        movw msg0, r22
index 2775ce5b75a4fe7ef13c70e5a4899ba7f6968530..fec6bb0fc42762f7794c77c464e6b1687ba07d6d 100644 (file)
@@ -41,6 +41,11 @@ acc1 = 15
   param s: r20
 */
 shiftleft32:
+       tst r20
+       brpl 10f
+       neg r20
+       rjmp shiftright32
+10:
        clr r0
        cpi r20, 8
        brlo bitrotateleft_1
@@ -49,7 +54,7 @@ shiftleft32:
        mov r23, r22
        clr r22
        subi r20, 8
-       rjmp shiftleft32
+       rjmp 10b
 
 /******************************************************************************/
 /*
@@ -257,10 +262,11 @@ mov32_to_acc:
 
 f2_1_shift_table:
 ;      .byte 0x2B, 0x64, 0x66, 0x03, 0x51, 0x55, 0x87, 0x55
-       .byte 0x55, 0x87, 0x55, 0x51, 0x03, 0x66, 0x64, 0x2B
+;      .byte 0x55, 0x87, 0x55, 0x51, 0x03, 0x66, 0x64, 0x2B
+       .byte 5, -5, -7, 8, -5, 5, -1, 5, -3, 0, 6, -6, -4, 6, -11, 2
 f2_2_shift_table:
 ;      .byte (2<<1), (7<<1), (4<<1), (3<<1), (4<<1)+1, (6<<1)+1, (6<<1)
-       .byte (8<<1)+1, (6<<1), (6<<1)+1, (4<<1)+1, (3<<1), (4<<1), (7<<1), (2<<1)
+       .byte 8, -6, 6, 4, -3, -4, -7, -2
 expand2_rot_table:
        .byte 3,7,13,16,19,23,27
 
@@ -739,40 +745,21 @@ f2:
        movw r26, h0
        ldi r30, lo8(f2_1_shift_table)
        ldi r31, hi8(f2_1_shift_table)
-       ldi r17, 16
+       ldi r17, 15
 10:
 ;---
        movw r22, xh0
        movw r24, xh2
-       cpi r17, 9
-       brge 15f
-       clr r1
-       rjmp 26f
-15:    lpm r20, Z+
-       mov r1, r20
-       andi r20, 0x0f
-       clt
-       cpi r17, 16
-       breq 20f
-       cpi r17, 11
-       brne 21f
-20:    set
-21:    brts 25f
-       rcall shiftright32
-       rjmp 26f
-25:    rcall shiftleft32
-26: rcall mov32_to_acc
+       lpm r20, Z+
+       sbrc r17, 3
+       rcall shiftleft32
+    rcall mov32_to_acc
 ;---
        rcall load32_from_Y
-       mov r20, r1
-       clr r1
-       swap r20
-       andi r20, 0x0f
-       brts 27f
+       lpm r20, Z+
+       sbrc r17, 3
        rcall shiftleft32
-       rjmp 28f
-27:    rcall shiftright32
-28:    rcall eor32_to_acc
+       rcall eor32_to_acc
 ;---
        rcall load32_from_X
        rcall eor32_to_acc
@@ -780,7 +767,7 @@ f2:
        adiw r26, 4
 ;---
        dec r17
-       brne 10b
+       brpl 10b
 ;-----
        sbiw r28, 4*8 /* Y points to q[24] */
        movw r30, r28
@@ -801,20 +788,13 @@ f2:
 
        movw r26, h0
        ldi r17, 15
-       ldi r30, lo8(f2_2_shift_table)
-       ldi r31, hi8(f2_2_shift_table)
+       ldi r30, lo8(f2_2_shift_table-8)
+       ldi r31, hi8(f2_2_shift_table-8)
 10:    movw r22, xl0
        movw r24, xl2
-       sbrc r17, 3
-       rjmp 20f
        lpm r20, Z+
-       lsr r20
-       brcs 15f
-       rcall shiftright32
-       rjmp 20f
-15:
+       sbrs r17, 3
        rcall shiftleft32
-20:
        rcall mov32_to_acc
        rcall load32_from_Y
        rcall eor32_to_acc
index 7045a5f0a4eb52af3da4cf27436d3c1ce5ec1e48..f47dc770c5b2fe0f319084b9fa91981a738f188c 100644 (file)
@@ -1,2 +1,3 @@
 BCAL_STD = nessie_common.o nessie_bc_test.o performance_test.o \
-           bcal-basic.o bcal-performance.o keysize_descriptor.o 
+           bcal-basic.o bcal-performance.o keysize_descriptor.o \
+           stack_measuring.o 
index 18bf9fab0d5c7023c012f6b2d5138ce9349f04f8..ca4c587466e0750dd00ce482209556cb9d742f3c 100644 (file)
@@ -7,12 +7,11 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 $(ALGO_NAME)_DIR      := aes/
 $(ALGO_NAME)_OBJ      := aes_enc-asm.o aes_dec-asm.o aes_sbox-asm.o aes_invsbox-asm.o  \
                          aes_keyschedule-asm.o 
-$(ALGO_NAME)_TEST_BIN := main-aes-test.o $(CLI_STD)  \
-                         nessie_bc_test.o nessie_common.o performance_test.o memxor.o \
-                         bcal_aes128.o bcal_aes192.o bcal_aes256.o bcal-basic.o bcal-cbc.o \
-                         keysize_descriptor.o dump-asm.o dump-decl.o bcal-cfb_byte.o       \
+$(ALGO_NAME)_TEST_BIN := main-aes-test.o $(CLI_STD) $(BCAL_STD)  \
+                         bcal_aes128.o bcal_aes192.o bcal_aes256.o bcal-cbc.o \
+                         dump-asm.o dump-decl.o bcal-cfb_byte.o       \
                          bcal-cfb_bit.o bcal-ofb.o bcal-ctr.o bcal-cmac.o cmacvs.o         \
-                         bcal-eax.o bcal-performance.o
+                         bcal-eax.o memxor.o
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
 
index e10e32b66e065fed6937ffd3daf627f37cf9b521..6afa9ab36f7f0e5f56b6a6e6bd5e036f20b1a2bf 100644 (file)
@@ -7,8 +7,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 $(ALGO_NAME)_DIR      := aes/
 $(ALGO_NAME)_OBJ      := aes_enc.o aes_dec.o aes_sbox.o aes_invsbox.o  \
                          aes_keyschedule.o gf256mul.o aes128_enc.o aes128_dec.o
-$(ALGO_NAME)_TEST_BIN := main-aes128-test.o $(CLI_STD) \
-                         nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-aes128-test.o $(CLI_STD) $(BCAL_STD) \
+                         bcal_aes128.o
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
 
index 81dda2f9218d427b08817877797dc6bc77fbb928..37b7d9b23da3583533fde91e7ed436f14eb546c0 100644 (file)
@@ -7,8 +7,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 $(ALGO_NAME)_DIR      := aes/
 $(ALGO_NAME)_OBJ      := aes_enc.o aes_dec.o aes_sbox.o aes_invsbox.o \
                          aes_keyschedule.o gf256mul.o aes192_enc.o aes192_dec.o
-$(ALGO_NAME)_TEST_BIN := main-aes192-test.o $(CLI_STD) \
-                         nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-aes192-test.o $(CLI_STD) $(BCAL_STD) \
+                         bcal_aes192.o
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
 
index fdd7362839dceae918864ca1ea0f8cb83bff78cb..3a77f42584546ec16350fe217c5d98a4614521a4 100644 (file)
@@ -7,8 +7,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 $(ALGO_NAME)_DIR      := aes/
 $(ALGO_NAME)_OBJ      := aes_enc.o aes_dec.o aes_sbox.o aes_invsbox.o \
                          aes_keyschedule.o gf256mul.o aes256_enc.o aes256_dec.o
-$(ALGO_NAME)_TEST_BIN := main-aes256-test.o $(CLI_STD) \
-                         nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-aes256-test.o $(CLI_STD) $(BCAL_STD) \
+                         bcal_aes256.o
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
 
index 44ced8d16dc9210dd1c2c23cba8c7d091fcd7e6c..ee5c6499b67230fe0a6711a7a661d7503bd7c11d 100644 (file)
@@ -8,8 +8,12 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 $(ALGO_NAME)_DIR      := aes/
 $(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 $(CLI_STD)  \
-                         nessie_bc_test.o nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-aes-test.o $(CLI_STD) $(BCAL_STD)  \
+                         bcal_aes128.o bcal_aes192.o bcal_aes256.o bcal-cbc.o \
+                         dump-asm.o dump-decl.o bcal-cfb_byte.o       \
+                         bcal-cfb_bit.o bcal-ofb.o bcal-ctr.o bcal-cmac.o cmacvs.o \
+                         bcal-eax.o memxor.o 
+
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
 
index fa9960632db684ebe9ece03088dceb81c3678651..a317624a544925e1cccffb30a24321aa386059f6 100644 (file)
@@ -10,12 +10,11 @@ $(ALGO_NAME)_OBJ      := aes_enc.o aes_dec.o aes_sbox.o aes_invsbox.o \
                          aes_keyschedule.o gf256mul.o \
                          aes128_enc.o aes128_dec.o aes192_enc.o aes192_dec.o \
                          aes256_enc.o aes256_dec.o
-$(ALGO_NAME)_TEST_BIN := main-aes-test.o $(CLI_STD)  \
-                         nessie_bc_test.o nessie_common.o performance_test.o memxor.o      \
-                         bcal_aes128.o bcal_aes192.o bcal_aes256.o bcal-basic.o bcal-cbc.o \
-                         keysize_descriptor.o dump-asm.o dump-decl.o bcal-cfb_byte.o       \
+$(ALGO_NAME)_TEST_BIN := main-aes-test.o $(CLI_STD) $(BCAL_STD)  \
+                         bcal_aes128.o bcal_aes192.o bcal_aes256.o  bcal-cbc.o \
+                         dump-asm.o dump-decl.o bcal-cfb_byte.o       \
                          bcal-cfb_bit.o bcal-ofb.o bcal-ctr.o bcal-cmac.o cmacvs.o         \
-                         bcal-eax.o
+                         bcal-eax.o memxor.o
 $(ALGO_NAME)_NESSIE_TEST      := test nessie
 $(ALGO_NAME)_PERFORMANCE_TEST := performance
 
index a1d4599f1af288c87f9d1f8a063e78252d5f982b..d754f0e4da7262c82d8037efb6a930f82474f36b 100644 (file)
@@ -6,8 +6,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
 
 $(ALGO_NAME)_DIR      := camellia/
 $(ALGO_NAME)_OBJ      := camellia_C.o
-$(ALGO_NAME)_TEST_BIN := main-camellia-test.o $(CLI_STD) nessie_bc_test.o \
-                        nessie_common.o performance_test.o
+$(ALGO_NAME)_TEST_BIN := main-camellia-test.o $(CLI_STD) $(BCAL_STD)  \
+                        bcal_camellia128.o
 $(ALGO_NAME)_NESSIE_TEST      := "nessie"
 $(ALGO_NAME)_PERFORMANCE_TEST := "performance"
 
index 9c05cb3abf49d197f03d1979b3507216b95211d6..3d11cea99ff67a8d93f57f82e54e13dcf3344584 100644 (file)
@@ -2,7 +2,7 @@
 ALGO_NAME := SHABEA
 
 # comment out the following line for removement of SHABEA from the build process
-BLOCK_CIPHERS += $(ALGO_NAME)
+BLOCK_CIPHERS_DONTUSE += $(ALGO_NAME)
 
 $(ALGO_NAME)_DIR      := shabea/
 $(ALGO_NAME)_OBJ      := shabea.o sha256-asm.o memxor.o
index 72e06f6198bbcd0819395eb3ddbdbe79b810b255..1934026022b6c9e3c72f057da0e4ed58ab500fc9 100644 (file)
@@ -30,6 +30,9 @@
 #include "nessie_bc_test.h"
 #include "cli.h"
 #include "performance_test.h"
+#include "blockcipher_descriptor.h"
+#include "bcal-performance.h"
+#include "bcal_aes128.h"
 #include <stdint.h>
 #include <string.h>
 #include <stdlib.h>
 
 char* algo_name = "AES-128";
 
+const bcdesc_t* algolist[] PROGMEM = {
+       (bcdesc_t*)&aes128_desc,
+       NULL
+};
+
+
 /*****************************************************************************
  *  additional validation-functions                                                                                     *
  *****************************************************************************/
@@ -102,48 +111,8 @@ void testrun_testkey_aes(void){
 
 /*****************************************************************************/
 
-void testrun_performance_aes128(void){
-       uint64_t t;
-       char str[16];
-       uint8_t key[32], data[16];
-       aes128_ctx_t ctx;
-
-       calibrateTimer();
-       print_overhead();
-
-       memset(key,  0, 32);
-       memset(data, 0, 16);
-
-       startTimer(1);
-       aes128_init(key, &ctx);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-
-
-       startTimer(1);
-       aes128_enc(data, &ctx);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-
-
-       startTimer(1);
-       aes128_dec(data, &ctx);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-
-       cli_putstr_P(PSTR("\r\n"));
-}
-
 void testrun_performance_aes(void){
-       cli_putstr_P(PSTR("\r\n -=AES Performance Test=-\r\n"));
-       cli_putstr_P(PSTR("\r\n       AES-128\r\n"));
-       testrun_performance_aes128();
+       bcal_performance_multiple(algolist);
 }
 
 /*****************************************************************************
index 2324705fa5c66bb456e38f3c5a5d68a0272b51d0..1274b28ab3098cae7dde2c517021e95c2c0368c0 100644 (file)
 #include "debug.h"
 
 #include "aes/aes.h"
-
 #include "nessie_bc_test.h"
 #include "cli.h"
 #include "performance_test.h"
-
+#include "blockcipher_descriptor.h"
+#include "bcal-performance.h"
+#include "bcal_aes192.h"
 #include <stdint.h>
 #include <string.h>
 #include <stdlib.h>
+#include <avr/pgmspace.h>
 
 char* algo_name = "AES-192";
 
+const bcdesc_t* algolist[] PROGMEM = {
+       (bcdesc_t*)&aes192_desc,
+       NULL
+};
+
 /*****************************************************************************
  *  additional validation-functions                                                                                     *
  *****************************************************************************/
@@ -80,50 +87,12 @@ void testrun_testkey_aes(void){
 }
 /*****************************************************************************/
 
-void testrun_performance_aes192(void){
-       uint64_t t;
-       char str[16];
-       uint8_t key[32], data[16];
-       aes192_ctx_t ctx;
-
-       calibrateTimer();
-       print_overhead();
-
-       memset(key,  0, 32);
-       memset(data, 0, 16);
-
-       startTimer(1);
-       aes192_init(key, &ctx);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-
-
-       startTimer(1);
-       aes192_enc(data, &ctx);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-
-
-       startTimer(1);
-       aes192_dec(data, &ctx);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-
-       cli_putstr_P(PSTR("\r\n"));
-}
 
 void testrun_performance_aes(void){
-       cli_putstr_P(PSTR("\r\n -=AES Performance Test=-\r\n"));
-       cli_putstr_P(PSTR("\r\n       AES-192\r\n"));
-       testrun_performance_aes192();
+       bcal_performance_multiple(algolist);
 }
 
+
 /*****************************************************************************
  *  main                                                                                                                                        *
  *****************************************************************************/
index d75fc526bcde4bf4126b1cc09f1cd0c091a760a1..1715026b8761c00a85f7f9b73fa91ed894b846e7 100644 (file)
 #include "debug.h"
 
 #include "aes/aes.h"
-
 #include "nessie_bc_test.h"
 #include "cli.h"
 #include "performance_test.h"
-
+#include "blockcipher_descriptor.h"
+#include "bcal-performance.h"
+#include "bcal_aes256.h"
 #include <stdint.h>
 #include <string.h>
 #include <stdlib.h>
+#include <avr/pgmspace.h>
 
 char* algo_name = "AES-256";
 
+const bcdesc_t* algolist[] PROGMEM = {
+       (bcdesc_t*)&aes256_desc,
+       NULL
+};
 /*****************************************************************************
  *  additional validation-functions                                                                                     *
  *****************************************************************************/
@@ -82,48 +88,8 @@ void testrun_testkey_aes(void){
 }
 /*****************************************************************************/
 
-void testrun_performance_aes256(void){
-       uint64_t t;
-       char str[16];
-       uint8_t key[32], data[16];
-       aes256_ctx_t ctx;
-
-       calibrateTimer();
-       print_overhead();
-
-       memset(key,  0, 32);
-       memset(data, 0, 16);
-
-       startTimer(1);
-       aes256_init(key, &ctx);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-
-
-       startTimer(1);
-       aes256_enc(data, &ctx);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tencrypt time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-
-
-       startTimer(1);
-       aes256_dec(data, &ctx);
-       t = stopTimer();
-       cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
-       ultoa((unsigned long)t, str, 10);
-       cli_putstr(str);
-
-       cli_putstr_P(PSTR("\r\n"));
-}
-
 void testrun_performance_aes(void){
-       cli_putstr_P(PSTR("\r\n -=AES Performance Test=-\r\n"));
-       cli_putstr_P(PSTR("\r\n       AES-256\r\n"));
-       testrun_performance_aes256();
+       bcal_performance_multiple(algolist);
 }
 
 /*****************************************************************************