Skip to content

Commit

Permalink
Add back AES-128 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ctz committed Jun 9, 2015
1 parent 832ade9 commit 2315db1
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/arm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ FUNCS = do_nothing stack_8w stack_64w \
poly1305_test hmacsha256_test \
curve25519_test \
norx_test \
aeadperf_aes128gcm \
aeadperf_aes128ccm \
aeadperf_aes128eax \
aeadperf_aes256gcm \
aeadperf_aes256ccm \
aeadperf_aes256eax \
Expand Down Expand Up @@ -52,6 +55,9 @@ CFLAGS_aes128eax_test = $(AES_OPTIONS) $(AES128_OPTIONS)
CFLAGS_aes128ccm_test = $(AES_OPTIONS) $(AES128_OPTIONS)
CFLAGS_poly1305_test = $(AES_OPTIONS) $(AES128_OPTIONS)

CFLAGS_aeadperf_aes128gcm = $(AES_OPTIONS) $(AES128_OPTIONS) $(AEADPERF_BRACKET)
CFLAGS_aeadperf_aes128eax = $(AES_OPTIONS) $(AES128_OPTIONS) $(AEADPERF_BRACKET)
CFLAGS_aeadperf_aes128ccm = $(AES_OPTIONS) $(AES128_OPTIONS) $(AEADPERF_BRACKET)
CFLAGS_aeadperf_aes256gcm = $(AES_OPTIONS) $(AES256_OPTIONS) $(AEADPERF_BRACKET)
CFLAGS_aeadperf_aes256eax = $(AES_OPTIONS) $(AES256_OPTIONS) $(AEADPERF_BRACKET)
CFLAGS_aeadperf_aes256ccm = $(AES_OPTIONS) $(AES256_OPTIONS) $(AEADPERF_BRACKET)
Expand Down
42 changes: 42 additions & 0 deletions src/arm/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,45 @@ static void aeadperf_chacha20poly1305(void)
aead_msg, bracket,
aead_cipher, aead_tag);
}
static void aeadperf_aes128gcm(void)
{
cf_aes_context ctx;
cf_aes_init(&ctx, aead_key, 16);

cf_gcm_encrypt(&cf_aes, &ctx,
aead_msg, bracket,
aead_aad, sizeof aead_aad,
aead_nonce, 12,
aead_cipher,
aead_tag, 16);
}

static void aeadperf_aes128ccm(void)
{
cf_aes_context ctx;
cf_aes_init(&ctx, aead_key, 16);

cf_ccm_encrypt(&cf_aes, &ctx,
aead_msg, bracket,
4,
aead_aad, sizeof aead_aad,
aead_nonce, 11,
aead_cipher,
aead_tag, 16);
}

static void aeadperf_aes128eax(void)
{
cf_aes_context ctx;
cf_aes_init(&ctx, aead_key, 16);

cf_eax_encrypt(&cf_aes, &ctx,
aead_msg, bracket,
aead_aad, sizeof aead_aad,
aead_nonce, 12,
aead_cipher,
aead_tag, 16);
}

static void aeadperf_aes256gcm(void)
{
Expand Down Expand Up @@ -399,6 +438,9 @@ int main(void)
(void) norx_test;
(void) aeadperf_norx;
(void) aeadperf_chacha20poly1305;
(void) aeadperf_aes128gcm;
(void) aeadperf_aes128ccm;
(void) aeadperf_aes128eax;
(void) aeadperf_aes256gcm;
(void) aeadperf_aes256ccm;
(void) aeadperf_aes256eax;
Expand Down
36 changes: 31 additions & 5 deletions src/arm/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
hmacsha256_test
curve25519_test
aeadperf_norx
aeadperf_aes128gcm
aeadperf_aes128eax
aeadperf_aes128ccm
aeadperf_aes256gcm
aeadperf_aes256eax
aeadperf_aes256ccm
Expand Down Expand Up @@ -208,8 +211,28 @@ def convert_brackets(metric, tests):

print json.dumps(out)

convert_brackets('cycle_count', ['aeadperf_norx', 'aeadperf_aes256gcm', 'aeadperf_aes256eax', 'aeadperf_aes256ccm', 'aeadperf_chacha20poly1305'])
convert_brackets('stack_usage', ['aeadperf_norx', 'aeadperf_aes256gcm', 'aeadperf_aes256eax', 'aeadperf_aes256ccm', 'aeadperf_chacha20poly1305'])
convert_brackets('cycle_count',
[
'aeadperf_norx',
'aeadperf_aes128gcm',
'aeadperf_aes128eax',
'aeadperf_aes128ccm',
'aeadperf_aes256gcm',
'aeadperf_aes256eax',
'aeadperf_aes256ccm',
'aeadperf_chacha20poly1305'
])
convert_brackets('stack_usage',
[
'aeadperf_norx',
'aeadperf_aes128gcm',
'aeadperf_aes128eax',
'aeadperf_aes128ccm',
'aeadperf_aes256gcm',
'aeadperf_aes256eax',
'aeadperf_aes256ccm',
'aeadperf_chacha20poly1305'
])

# screwed if we need other block ciphers
print '###', '128-bit key'
Expand Down Expand Up @@ -240,7 +263,10 @@ def do_table(title, test):
do_table('Curve25519', 'curve25519_test')

do_table('AEAD-Shootout: NORX', 'aeadperf_norx')
do_table('AEAD-Shootout: AES-128-GCM', 'aeadperf_aes256gcm')
do_table('AEAD-Shootout: AES-128-EAX', 'aeadperf_aes256eax')
do_table('AEAD-Shootout: AES-128-CCM', 'aeadperf_aes256ccm')
do_table('AEAD-Shootout: AES-128-GCM', 'aeadperf_aes128gcm')
do_table('AEAD-Shootout: AES-128-EAX', 'aeadperf_aes128eax')
do_table('AEAD-Shootout: AES-128-CCM', 'aeadperf_aes128ccm')
do_table('AEAD-Shootout: AES-256-GCM', 'aeadperf_aes256gcm')
do_table('AEAD-Shootout: AES-256-EAX', 'aeadperf_aes256eax')
do_table('AEAD-Shootout: AES-256-CCM', 'aeadperf_aes256ccm')
do_table('AEAD-Shootout: ChaCha20-Poly1305', 'aeadperf_chacha20poly1305')

0 comments on commit 2315db1

Please sign in to comment.