fix ChaCha20 header protection

This commit is contained in:
Marten Seemann
2020-03-02 10:04:37 +07:00
parent 17cb40a360
commit 3734fbc11e

View File

@@ -128,7 +128,7 @@ func (p *chachaHeaderProtector) apply(sample []byte, firstByte *byte, hdrBytes [
if err != nil {
panic(err)
}
cipher.SetCounter(binary.BigEndian.Uint32(sample[4:]))
cipher.SetCounter(binary.LittleEndian.Uint32(sample[:4]))
cipher.XORKeyStream(p.mask[:], p.mask[:])
p.applyMask(firstByte, hdrBytes)
}