.PHONY: hash_speed
hash_speed: $(foreach algo, $(HASHES), $(algo)_SPEED)
+.PHONY: blockcipher_speed
+blockcipher_speed: $(foreach algo, $(BLOCK_CIPHERS), $(algo)_SPEED)
#-------------------------------------------------------------------------------
.PHONY: hash_size
hash_size: $(foreach algo, $(HASHES), $(algo)_SIZE)
+.PHONY: blockcipher_size
+blockcipher_size: $(foreach algo, $(BLOCK_CIPHERS), $(algo)_SIZE)
+
#-------------------------------------------------------------------------------
.PHONY: tests
@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"
#-------------------------------------------------------------------------------
#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
}
}
+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;
return;
}
bcal_performance(bcd);
+ bcal_stacksize(bcd);
bcd_list = (void*)((uint8_t*)bcd_list + 2);
}
}
const bcdesc_t present_desc PROGMEM = {
BCDESC_TYPE_BLOCKCIPHER,
- BC_INIT_TYPE_1,
+ BC_INIT_TYPE_2,
present_str,
sizeof(present_ctx_t),
64,
param s: r20
*/
shiftleft32:
+ tst r20
+ brpl 10f
+ neg r20
+ rjmp shiftright32
+10:
clr r0
cpi r20, 8
brlo bitrotateleft_1
mov r23, r22
clr r22
subi r20, 8
- rjmp shiftleft32
+ rjmp 10b
/******************************************************************************/
/*
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
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
adiw r26, 4
;---
dec r17
- brne 10b
+ brpl 10b
;-----
sbiw r28, 4*8 /* Y points to q[24] */
movw r30, r28
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
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
param s: r20
*/
shiftleft32:
+ tst r20
+ brpl 10f
+ neg r20
+ rjmp shiftright32
+10:
clr r0
cpi r20, 8
brlo bitrotateleft_1
mov r23, r22
clr r22
subi r20, 8
- rjmp shiftleft32
+ rjmp 10b
/******************************************************************************/
/*
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
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
adiw r26, 4
;---
dec r17
- brne 10b
+ brpl 10b
;-----
sbiw r28, 4*8 /* Y points to q[24] */
movw r30, r28
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
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
param s: r20
*/
shiftleft32:
+ tst r20
+ brpl 10f
+ neg r20
+ rjmp shiftright32
+10:
clr r0
cpi r20, 8
brlo bitrotateleft_1
mov r23, r22
clr r22
subi r20, 8
- rjmp shiftleft32
+ rjmp 10b
/******************************************************************************/
/*
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
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
adiw r26, 4
;---
dec r17
- brne 10b
+ brpl 10b
;-----
sbiw r28, 4*8 /* Y points to q[24] */
movw r30, r28
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
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
$(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
$(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
$(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
$(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
$(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
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
$(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"
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
#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 *
*****************************************************************************/
/*****************************************************************************/
-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);
}
/*****************************************************************************
#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 *
*****************************************************************************/
}
/*****************************************************************************/
-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 *
*****************************************************************************/
#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 *
*****************************************************************************/
}
/*****************************************************************************/
-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);
}
/*****************************************************************************