summaryrefslogtreecommitdiff
path: root/selftest.cpp
diff options
context:
space:
mode:
authorGrant Limberg <grant.limberg@zerotier.com>2016-11-18 14:00:25 -0800
committerGrant Limberg <grant.limberg@zerotier.com>2016-11-18 14:00:25 -0800
commit2231e878d5470d86f4c6543cc708dc78661da462 (patch)
tree0bcd8215684b0091d7bd8856f75b4e433edef71e /selftest.cpp
parent299a7cab200c0af4743ab36d41994fd7a582f900 (diff)
parent673c0c811ea443c217b3a4ca17eeaed3ab596501 (diff)
downloadinfinitytier-2231e878d5470d86f4c6543cc708dc78661da462.tar.gz
infinitytier-2231e878d5470d86f4c6543cc708dc78661da462.zip
Merge branch 'dev' into systemtray
Diffstat (limited to 'selftest.cpp')
-rw-r--r--selftest.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/selftest.cpp b/selftest.cpp
index 7ca4ac3b..adac2f58 100644
--- a/selftest.cpp
+++ b/selftest.cpp
@@ -327,6 +327,17 @@ static int testCrypto()
}
std::cout << "PASS" << std::endl;
+ std::cout << "[crypto] Benchmarking C25519 ECC key agreement... "; std::cout.flush();
+ C25519::Pair bp[8];
+ for(int k=0;k<8;++k)
+ bp[k] = C25519::generate();
+ const uint64_t st = OSUtils::now();
+ for(unsigned int k=0;k<50;++k) {
+ C25519::agree(bp[~k & 7],bp[k & 7].pub,buf1,64);
+ }
+ const uint64_t et = OSUtils::now();
+ std::cout << ((double)(et - st) / 50.0) << "ms per agreement." << std::endl;
+
std::cout << "[crypto] Testing Ed25519 ECC signatures... "; std::cout.flush();
C25519::Pair didntSign = C25519::generate();
for(unsigned int i=0;i<10;++i) {
@@ -376,11 +387,15 @@ static int testIdentity()
std::cout << "FAIL (1)" << std::endl;
return -1;
}
- if (!id.locallyValidate()) {
- std::cout << "FAIL (2)" << std::endl;
- return -1;
+ const uint64_t vst = OSUtils::now();
+ for(int k=0;k<10;++k) {
+ if (!id.locallyValidate()) {
+ std::cout << "FAIL (2)" << std::endl;
+ return -1;
+ }
}
- std::cout << "PASS" << std::endl;
+ const uint64_t vet = OSUtils::now();
+ std::cout << "PASS (" << ((double)(vet - vst) / 10.0) << "ms per validation)" << std::endl;
std::cout << "[identity] Validate known-bad identity... "; std::cout.flush();
if (!id.fromString(KNOWN_BAD_IDENTITY)) {