Better choice of first bytes.

GitOrigin-RevId: 7855a68ec4b1e9c43371bd29cbf6766009f45ac2
This commit is contained in:
levlam 2019-07-20 01:49:22 +03:00
parent 6e65e51774
commit 0481329037

View File

@ -147,12 +147,15 @@ void ObfuscatedTransport::init(ChainBufferReader *input, ChainBufferWriter *outp
try_cnt++; try_cnt++;
CHECK(try_cnt < 10); CHECK(try_cnt < 10);
Random::secure_bytes(header_slice.ubegin(), header.size()); Random::secure_bytes(header_slice.ubegin(), header.size());
if (secret_.emulate_tls()) {
break;
}
if (as<uint8>(header.data()) == 0xef) { if (as<uint8>(header.data()) == 0xef) {
continue; continue;
} }
uint32 first_int = as<uint32>(header.data()); uint32 first_int = as<uint32>(header.data());
if (first_int == 0x44414548 || first_int == 0x54534f50 || first_int == 0x20544547 || first_int == 0x4954504f || if (first_int == 0x44414548 || first_int == 0x54534f50 || first_int == 0x20544547 || first_int == 0x4954504f ||
first_int == 0xdddddddd || first_int == 0xeeeeeeee) { first_int == 0xdddddddd || first_int == 0xeeeeeeee || first_int == 0x02010316) {
continue; continue;
} }
uint32 second_int = as<uint32>(header.data() + sizeof(uint32)); uint32 second_int = as<uint32>(header.data() + sizeof(uint32));