summaryrefslogtreecommitdiff
path: root/selftest.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <[email protected]>2020-09-29 18:34:58 -0400
committerAdam Ierymenko <[email protected]>2020-09-29 18:34:58 -0400
commitc7dcbba442449a6890d6d36c08949a91c2ff2f2b (patch)
tree6871bca974e568b9d2fb54f7438868d4589aa9fc /selftest.cpp
parent255dee7a5ee0fcf146ee68d6b812c311050b10ba (diff)
Add an AES benchmark to 1.6 (backport)
Diffstat (limited to 'selftest.cpp')
-rw-r--r--selftest.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/selftest.cpp b/selftest.cpp
index 926a6ebc..d11f14ca 100644
--- a/selftest.cpp
+++ b/selftest.cpp
@@ -255,6 +255,31 @@ static int testCrypto()
::free((void *)bb);
}
+ std::cout << "[crypto] Benchmarking AES-GMAC-SIV... "; std::cout.flush();
+ {
+ uint64_t end,start = OSUtils::now();
+ uint64_t bytes = 0;
+ AES k0,k1;
+ k0.init(buf1);
+ k1.init(buf2);
+ AES::GMACSIVEncryptor enc(k0,k1);
+ for (;;) {
+ for(unsigned int i=0;i<10000;++i) {
+ enc.init(i,buf2);
+ enc.update1(buf1,sizeof(buf1));
+ enc.finish1();
+ enc.update2(buf1,sizeof(buf1));
+ enc.finish2();
+ buf1[0] = buf2[0];
+ bytes += sizeof(buf1);
+ }
+ end = OSUtils::now();
+ if ((end - start) >= 5000)
+ break;
+ }
+ std::cout << (((double)bytes / 1048576.0) / ((double)(end - start) / 1024.0)) << " MiB/second" << std::endl;
+ }
+
std::cout << "[crypto] Testing SHA-512... "; std::cout.flush();
SHA512(buf1,sha512TV0Input,(unsigned int)strlen(sha512TV0Input));
if (memcmp(buf1,sha512TV0Digest,64)) {