@ -50,24 +50,6 @@ void quarterround(uint32_t *x, int a, int b, int c, int d)
@@ -50,24 +50,6 @@ void quarterround(uint32_t *x, int a, int b, int c, int d)
x[c]+=x[d];x[b]=rotl32(x[b]^x[c],7);
}
structState_t
{
State_t(){};
State_t(State_t&&)=delete;
State_t&operator+=(constState_t&other)
{
for(inti=0;i<16;i++)
data[i]+=other.data[i];
return*this;
}
voidCopy(constState_t&other)
{
memcpy(data,other.data,sizeof(uint32_t)*16);
}
uint32_tdata[16];
};
structBlock_t
{
@ -76,7 +58,7 @@ void quarterround(uint32_t *x, int a, int b, int c, int d)
@@ -76,7 +58,7 @@ void quarterround(uint32_t *x, int a, int b, int c, int d)
uint8_tdata[blocksize];
voidoperator<<(constState_t&st)
voidoperator<<(constChacha20State&st)
{
inti;
for(i=0;i<16;i++)
@ -84,10 +66,10 @@ void quarterround(uint32_t *x, int a, int b, int c, int d)
@@ -84,10 +66,10 @@ void quarterround(uint32_t *x, int a, int b, int c, int d)
boolAEADChaCha20Poly1305(constuint8_t*msg,size_tmsgLen,constuint8_t*ad,size_tadLen,constuint8_t*key,constuint8_t*nonce,uint8_t*buf,size_tlen,boolencrypt);// msgLen is len without tag
voidAEADChaCha20Poly1305Encrypt(std::vector<std::pair<void*,std::size_t>>&bufs,constuint8_t*key,constuint8_t*nonce,uint8_t*mac);// encrypt multiple buffers with zero ad