Incorrect padding of data when using input channel
|User & Date:||anonymous 2019-06-06 08:43:14|
- Change assignee to "nobody"
- Change closer to "nobody"
- Change cmimetype to "text/plain"
- Change comment to:
Blowfish pads an incoming stream improperly. This was seen and reported by Jim in this thread on comp.lang.tcl: https://groups.google.com/forum/#!topic/comp.lang.tcl/XhDe5-yLzw0
The improper padding happens in the procedure blowfish::Chunk which already contains a FIXME comment. The procedure needs to care about 2 things:
1. Data must always be processed in multiples of 8 bytes. However, it's not guaranteed that a multiple of 8 bytes is read even in the middle of a stream. Reasons can be an odd user provided chunk size or a nonblocking channel. My patch introduces a new variable state(remainder) to hold the modulo data.
2. Apply padding at the end of the stream, and only there. Don't pad an empty string. Unfortunately, blowfish::Pad is doing exactly this. I think an empty string should not be padded. Likewise an empty data set encrpyts to an empty data set. If this is not correct then extra care has to be taken with the remainig data at EOF. Also, blowfish::Chunk didn't call pad with the user provided pad character.
The attached patch takes care of both points.
Missing: A test for the input channel API.
-- Stephan Effelsberg
- Change foundin to "1.0.4"
- Change is_private to "0"
- Change login to "anonymous"
- Change priority to "5 Medium"
- Change private_contact to "87a8af3af6267b859f2893f3f1d57a347c5b095a"
- Change resolution to "None"
- Change severity to "Minor"
- Change status to "Open"
- Change submitter to "anonymous"
- Change subsystem to "blowfish"
- Change title to "Incorrect padding of data when using input channel"
- Change type to "Bug"