Optimization stuff

This commit is contained in:
Adam Ierymenko 2019-08-26 18:15:32 -07:00
parent 990333e7ec
commit b9ef09dd58
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
3 changed files with 97 additions and 63 deletions

View file

@ -135,11 +135,21 @@ public:
const uint8_t *i = (const uint8_t *)in;
uint8_t *o = (uint8_t *)out;
while (len >= 16) {
_encryptSW((const uint8_t *)ctr,(uint8_t *)cenc);
ctr[1] = Utils::hton(++bctr);
#ifdef ZT_NO_TYPE_PUNNING
for(unsigned int k=0;k<16;++k)
*(o++) = *(i++) ^ ((uint8_t *)cenc)[k];
#else
*((uint64_t *)o) = *((const uint64_t *)i) ^ cenc[0];
o += 8;
i += 8;
*((uint64_t *)o) = *((const uint64_t *)i) ^ cenc[1];
o += 8;
i += 8;
#endif
len -= 16;
}
@ -280,7 +290,7 @@ private:
#endif
struct {
uint64_t h[2];
uint32_t ek[30];
uint32_t ek[60];
} sw;
} _k;
/**************************************************************************/