Cleanup, optimization, multicast stuff, and it now compiles again.

This commit is contained in:
Adam Ierymenko 2019-09-11 15:34:55 -07:00
parent bccb86a401
commit d8dae365f6
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
13 changed files with 144 additions and 219 deletions

View file

@ -193,13 +193,13 @@ void Utils::getSecureRandom(void *buf,unsigned int bytes)
}
uint8_t h[48];
for(unsigned int k=0;k<4;++k) {
for(unsigned int k=0;k<4;++k) { // treat random state like a 256-bit counter; endian-ness is irrelevant since we just want random
if (++randomState[k] != 0)
break;
}
HMACSHA384((const uint8_t *)randomState,randomBuf,sizeof(randomBuf),h);
HMACSHA384((const uint8_t *)randomState,randomBuf,sizeof(randomBuf),h); // compute HMAC on random buffer using state as secret key
AES c(h);
c.ctr(h + 32,randomBuf,sizeof(randomBuf),randomBuf);
c.ctr(h + 32,randomBuf,sizeof(randomBuf),randomBuf); // encrypt random buffer with AES-CTR using HMAC result as key
}
((uint8_t *)buf)[i] = randomBuf[randomPtr++];