fix chunk parser for ss aead

pull/787/head
Darien Raymond 7 years ago
parent 981c43afc2
commit 40222de0f7
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

@ -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 {

Loading…
Cancel
Save