Merge pull request #2396 from lucas-clemente/fix-chacha20-header-protection

fix ChaCha20 header protection
This commit is contained in:
Marten Seemann
2020-03-02 18:37:09 +07:00
committed by GitHub

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)
}