1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-28 14:56:33 -04:00

fix chunk parser for ss aead

This commit is contained in:
Darien Raymond 2017-11-26 16:55:46 +01:00
parent 981c43afc2
commit 40222de0f7
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -43,7 +43,7 @@ func (p *AEADChunkSizeParser) SizeBytes() int {
}
func (p *AEADChunkSizeParser) Encode(size uint16, b []byte) []byte {
b = serial.Uint16ToBytes(size, b)
b = serial.Uint16ToBytes(size-uint16(p.Auth.Overhead()), b)
b, err := p.Auth.Seal(b[:0], b)
common.Must(err)
return b
@ -54,7 +54,7 @@ func (p *AEADChunkSizeParser) Decode(b []byte) (uint16, error) {
if err != nil {
return 0, err
}
return serial.BytesToUint16(b), nil
return serial.BytesToUint16(b) + uint16(p.Auth.Overhead()), nil
}
type ChunkStreamReader struct {