summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-02-26 18:33:55 +0000
committerNick Mathewson <nickm@torproject.org>2007-02-26 18:33:55 +0000
commit230fbd95c065518705fff7628ff8689b4710e6d4 (patch)
treee3265477ad81c5a23db950adce50045fb2d7237f
parent82e2d6001af8867851f43dbfa0f56997f503aa29 (diff)
downloadtor-230fbd95c065518705fff7628ff8689b4710e6d4.tar.gz
tor-230fbd95c065518705fff7628ff8689b4710e6d4.zip
r11956@catbus: nickm | 2007-02-26 13:33:49 -0500
Add a quick-and-dirty AES benchmark function to the bottom of aes.c so I can go collecting data. svn:r9660
-rw-r--r--src/common/aes.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/common/aes.c b/src/common/aes.c
index fa6de45252..9c40209f66 100644
--- a/src/common/aes.c
+++ b/src/common/aes.c
@@ -41,6 +41,7 @@ const char aes_c_id[] = "$Id$";
#undef USE_OPENSSL_AES
#undef USE_OPENSSL_EVP
#define USE_RIJNDAEL_COUNTER_OPTIMIZATION
+#undef FULL_UNROLL
/*======================================================================*/
/* From rijndael-alg-fst.h */
@@ -910,3 +911,20 @@ rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 ct[16]
}
#endif
+#ifdef AES_BENCHMARK
+int
+main(int c, char **v)
+{
+ int i;
+ char blob[509]; /* the size of a cell payload. */
+ char blob_out[509];
+ aes_cnt_cipher_t *cipher = aes_new_cipher();
+ aes_set_key(cipher, "aesbenchmarkkey!", 128);
+ memset(blob, 'z', sizeof(blob));
+
+ for (i=0;i<1000000; ++i) {
+ aes_crypt(cipher, blob, sizeof(blob), blob_out);
+ }
+ return 0;
+}
+#endif