forked from quic-go/quic-go
Merge pull request #2078 from lucas-clemente/speed-up-header-encryption
speed up header encryption / decryption
This commit is contained in:
@@ -246,7 +246,7 @@ func (a *updatableAEAD) Overhead() int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *updatableAEAD) EncryptHeader(sample []byte, firstByte *byte, pnBytes []byte) {
|
func (a *updatableAEAD) EncryptHeader(sample []byte, firstByte *byte, pnBytes []byte) {
|
||||||
if len(sample) != a.hpEncrypter.BlockSize() {
|
if len(sample) != len(a.hpMask) {
|
||||||
panic("invalid sample size")
|
panic("invalid sample size")
|
||||||
}
|
}
|
||||||
a.hpEncrypter.Encrypt(a.hpMask, sample)
|
a.hpEncrypter.Encrypt(a.hpMask, sample)
|
||||||
@@ -257,7 +257,7 @@ func (a *updatableAEAD) EncryptHeader(sample []byte, firstByte *byte, pnBytes []
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *updatableAEAD) DecryptHeader(sample []byte, firstByte *byte, pnBytes []byte) {
|
func (a *updatableAEAD) DecryptHeader(sample []byte, firstByte *byte, pnBytes []byte) {
|
||||||
if len(sample) != a.hpDecrypter.BlockSize() {
|
if len(sample) != len(a.hpMask) {
|
||||||
panic("invalid sample size")
|
panic("invalid sample size")
|
||||||
}
|
}
|
||||||
a.hpDecrypter.Encrypt(a.hpMask, sample)
|
a.hpDecrypter.Encrypt(a.hpMask, sample)
|
||||||
|
|||||||
Reference in New Issue
Block a user