mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-11 13:35:17 +00:00
More selective push of AES modifications and refactoring stuff.
This commit is contained in:
parent
4cd3d0bb76
commit
1ad555a071
@ -272,3 +272,8 @@ void KBKDFHMACSHA384(const uint8_t key[ZT_SYMMETRIC_KEY_SIZE],const char label,c
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ZeroTier
|
} // namespace ZeroTier
|
||||||
|
|
||||||
|
// Internally re-export to included C code, which includes some fast crypto code ported in on some platforms.
|
||||||
|
// This eliminates the need to link against a third party SHA512() from this code
|
||||||
|
extern "C" void ZT_sha512internal(void *digest,const void *data,unsigned int len)
|
||||||
|
{ ZeroTier::SHA512(digest,data,len); }
|
||||||
|
10
selftest.cpp
10
selftest.cpp
@ -198,7 +198,7 @@ static int testCrypto()
|
|||||||
bytes += 1234567.0;
|
bytes += 1234567.0;
|
||||||
}
|
}
|
||||||
uint64_t end = OSUtils::now();
|
uint64_t end = OSUtils::now();
|
||||||
SHA512::hash(buf1,bb,1234567);
|
SHA512(buf1,bb,1234567);
|
||||||
std::cout << ((bytes / 1048576.0) / ((long double)(end - start) / 1024.0)) << " MiB/second (" << Utils::hex(buf1,16,hexbuf) << ')' << std::endl;
|
std::cout << ((bytes / 1048576.0) / ((long double)(end - start) / 1024.0)) << " MiB/second (" << Utils::hex(buf1,16,hexbuf) << ')' << std::endl;
|
||||||
::free((void *)bb);
|
::free((void *)bb);
|
||||||
}
|
}
|
||||||
@ -250,13 +250,13 @@ static int testCrypto()
|
|||||||
bytes += 1234567.0;
|
bytes += 1234567.0;
|
||||||
}
|
}
|
||||||
uint64_t end = OSUtils::now();
|
uint64_t end = OSUtils::now();
|
||||||
SHA512::hash(buf1,bb,1234567);
|
SHA512(buf1,bb,1234567);
|
||||||
std::cout << ((bytes / 1048576.0) / ((long double)(end - start) / 1024.0)) << " MiB/second (" << Utils::hex(buf1,16,hexbuf) << ')' << std::endl;
|
std::cout << ((bytes / 1048576.0) / ((long double)(end - start) / 1024.0)) << " MiB/second (" << Utils::hex(buf1,16,hexbuf) << ')' << std::endl;
|
||||||
::free((void *)bb);
|
::free((void *)bb);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "[crypto] Testing SHA-512... "; std::cout.flush();
|
std::cout << "[crypto] Testing SHA-512... "; std::cout.flush();
|
||||||
SHA512::hash(buf1,sha512TV0Input,(unsigned int)strlen(sha512TV0Input));
|
SHA512(buf1,sha512TV0Input,(unsigned int)strlen(sha512TV0Input));
|
||||||
if (memcmp(buf1,sha512TV0Digest,64)) {
|
if (memcmp(buf1,sha512TV0Digest,64)) {
|
||||||
std::cout << "FAIL" << std::endl;
|
std::cout << "FAIL" << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
@ -617,8 +617,8 @@ static int testPacket()
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.armor(salsaKey,true);
|
a.armor(salsaKey,true,nullptr);
|
||||||
if (!a.dearmor(salsaKey)) {
|
if (!a.dearmor(salsaKey,nullptr)) {
|
||||||
std::cout << "FAIL (encrypt-decrypt/verify)" << std::endl;
|
std::cout << "FAIL (encrypt-decrypt/verify)" << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user