Copyright(c) 2011-2016 Intel Corporation All rights reserved.
Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
+ modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
#include <stdlib.h> // for rand
#include <string.h> // for memcmp
#include "aes_xts.h"
+#include "aes_keyexp.h"
#include "test.h"
//#define CACHED_TEST
#ifdef CACHED_TEST
// Cached test, loop many times over small dataset
# define TEST_LEN 8*1024
-# define TEST_LOOPS 400000
+# define TEST_LOOPS 3000000
# define TEST_TYPE_STR "_warm"
#else
// Uncached test. Pull from large mem base.
# define GT_L3_CACHE 32*1024*1024 /* some number > last level cache */
# define TEST_LEN (2 * GT_L3_CACHE)
-# define TEST_LOOPS 50
+# define TEST_LOOPS 400
# define TEST_TYPE_STR "_cold"
#endif
unsigned char key1[16], key2[16], tinit[16];
unsigned char *pt, *ct;
+ uint8_t expkey1_enc[16 * 11], expkey2_enc[16 * 11];
+ uint8_t expkey1_dec[16 * 11], null_key[16 * 11];
printf("aes_xts_128_enc_perf:\n");
return -1;
}
+ /* Encode perf test */
+
mk_rand_data(key1, key2, tinit, pt, TEST_LEN);
XTS_AES_128_enc(key2, key1, tinit, TEST_LEN, pt, ct);
perf_stop(&stop);
- printf("aes_xts_128_enc" TEST_TYPE_STR ": ");
+ printf("aes_xts_128_enc" TEST_TYPE_STR ": ");
+ perf_print(stop, start, (long long)TEST_LEN * i);
+
+ /* Expanded keys perf test */
+
+ aes_keyexp_128(key1, expkey1_enc, expkey1_dec);
+ aes_keyexp_128(key2, expkey2_enc, null_key);
+ XTS_AES_128_enc_expanded_key(expkey2_enc, expkey1_enc, tinit, TEST_LEN, pt, ct);
+
+ perf_start(&start);
+
+ for (i = 0; i < TEST_LOOPS; i++) {
+ XTS_AES_128_enc_expanded_key(expkey2_enc, expkey1_enc, tinit, TEST_LEN, pt,
+ ct);
+ }
+
+ perf_stop(&stop);
+
+ printf("aes_xts_128_enc_expanded_key" TEST_TYPE_STR ": ");
perf_print(stop, start, (long long)TEST_LEN * i);
return 0;