mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
crypto/attachments: hash correct data while decrypting
Some checks failed
Some checks failed
This commit is contained in:
parent
23df81f1cc
commit
5d84bddc62
1 changed files with 6 additions and 1 deletions
|
|
@ -207,8 +207,13 @@ func (r *encryptingReader) Read(dst []byte) (n int, err error) {
|
|||
}
|
||||
}
|
||||
n, err = r.source.Read(dst)
|
||||
if r.isDecrypting {
|
||||
r.hash.Write(dst[:n])
|
||||
}
|
||||
r.stream.XORKeyStream(dst[:n], dst[:n])
|
||||
r.hash.Write(dst[:n])
|
||||
if !r.isDecrypting {
|
||||
r.hash.Write(dst[:n])
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue