mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
Commented out code to generates some AES-GMAC-SIV test vectors that are now part of the Rust code base to make sure it works right.
This commit is contained in:
parent
b4cec0b4a8
commit
895ee77c38
1 changed files with 29 additions and 0 deletions
29
selftest.cpp
29
selftest.cpp
|
@ -255,6 +255,35 @@ static int testCrypto()
|
||||||
::free((void *)bb);
|
::free((void *)bb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
AES k0,k1;
|
||||||
|
k0.init("00000000000000000000000000000000");
|
||||||
|
k1.init("11111111111111111111111111111111");
|
||||||
|
uint8_t test_pt[65536];
|
||||||
|
uint8_t test_ct[65536];
|
||||||
|
uint8_t test_aad[65536];
|
||||||
|
uint8_t ct_hash[48];
|
||||||
|
char hex_tmp[128];
|
||||||
|
for(unsigned int i=0;i<65536;++i) {
|
||||||
|
test_pt[i] = (uint8_t)i;
|
||||||
|
test_aad[i] = (uint8_t)i;
|
||||||
|
}
|
||||||
|
AES::GMACSIVEncryptor enc(k0,k1);
|
||||||
|
for(unsigned int test_length=0;test_length<65536;test_length+=777) {
|
||||||
|
memset(test_ct, 0, test_length);
|
||||||
|
enc.init((uint64_t)test_length, test_ct);
|
||||||
|
enc.aad(test_aad, test_length);
|
||||||
|
enc.update1(test_pt, test_length);
|
||||||
|
enc.finish1();
|
||||||
|
enc.update2(test_pt, test_length);
|
||||||
|
const void *tag = enc.finish2();
|
||||||
|
SHA384(ct_hash, test_ct, test_length);
|
||||||
|
std::cout << "(" << test_length << ", \"" << Utils::hex(ct_hash, 48, hex_tmp) << "\", \"" << Utils::hex(tag, 16, hex_tmp) << "\")," <<std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
std::cout << "[crypto] Benchmarking AES-GMAC-SIV... "; std::cout.flush();
|
std::cout << "[crypto] Benchmarking AES-GMAC-SIV... "; std::cout.flush();
|
||||||
{
|
{
|
||||||
uint64_t end,start = OSUtils::now();
|
uint64_t end,start = OSUtils::now();
|
||||||
|
|
Loading…
Add table
Reference in a new issue