crypto/attachments: hash correct data while decrypting
Some checks failed
Go / Lint (latest) (push) Has been cancelled
Go / Build (old, libolm) (push) Has been cancelled
Go / Build (latest, libolm) (push) Has been cancelled
Go / Build (old, goolm) (push) Has been cancelled
Go / Build (latest, goolm) (push) Has been cancelled

This commit is contained in:
Tulir Asokan 2025-08-11 10:58:24 +03:00
commit 5d84bddc62

View file

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