Simplify DecryptingInputStream implementation
Categories
(Core :: Storage: Quota Manager, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox129 | --- | fixed |
People
(Reporter: janv, Assigned: janv)
References
Details
Attachments
(5 files)
There are several things which can be removed or simplified:
-
The extra
Seek
andParseNextChunk
inDecryptingInputStream::Seek
(when readBytes) is zero can be removed:
See https://searchfox.org/mozilla-central/rev/46d0387f0b582f00a5722c20d4e6b8693793631b/dom/quota/DecryptingInputStream_impl.h#419-437 -
mLastBlockLength
can be removed and then all related code can be simplified -
DecryptingInputStream::Tell
can be simplified to not usemPlainBytes
in the position calculation
Assignee | ||
Comment 1•10 months ago
|
||
Now when we have proper boundary checks, the extra Seek and ParseNextChunk can
be safely removed.
Assignee | ||
Comment 2•10 months ago
|
||
Assignee | ||
Comment 3•10 months ago
|
||
DecryptingInputStream::ReadSegments resets mPlainBytes and mNextByte to zero
when the position in the plain buffer reaches the end.
DecryptingInputStream::Seek doesn't do that and keeps mPlainBytes and mNextByte
having the same value. It's not strictly required for
DecryptingInputStream::Seek to do the resetting, but the code will read better
if the handling is the same (and will help with understanding of the next
patch).
Assignee | ||
Comment 4•10 months ago
|
||
Assignee | ||
Comment 5•10 months ago
|
||
DecryptingInputStream::ReadSegments and DecryptingInputStream::Seek currently
reset mPlainBytes and mNextByte to zero when the position in the plain buffer
reaches the end. The current position calculation then requires extra member
variable mLastBlockLength which complicates the logic even more. It turns out
that mLastBlockLength can be removed when the resetting of mPlainBytes and
mNextByte is avoided.
Comment 7•9 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/f69e403c8f98
https://hg.mozilla.org/mozilla-central/rev/8a4dbb3e2c03
https://hg.mozilla.org/mozilla-central/rev/637f8eff63e1
https://hg.mozilla.org/mozilla-central/rev/1833678d1f85
https://hg.mozilla.org/mozilla-central/rev/55e6d2b6042a
Description
•