-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AES256 CBC W3C padding scheme (instead of PKCS#7) #111
Conversation
Client implementation: readium/readium-lcp-client#26 |
@@ -74,7 +74,9 @@ func (r *paddedReader) Read(buf []byte) (int, error) { | |||
func (r *paddedReader) pad(buf []byte) (i int, err error) { | |||
capacity := cap(buf) | |||
for i = 0; capacity > 0 && r.left > 0; i++ { | |||
buf[i] = r.count | |||
if capacity == 1 && r.left == 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You assume here that the other padding bytes (not the last one set to r.count) are "arbitrary" ?
How do you know that they are not 0, or leaked for a part of memory ?
I think that we have to set all the padding bytes.
In the doc page in golang official web site, "make" function is described "it returns an initialized (not zeroed) value of type T". Thus we expected that other pad block except last one will has any value, not zero. |
…ader object, based on DRM-Inside's #111 Pull Request (updated unit tests too)
Thank you very much! |
@drminside there was a bug in your original code (fixed in the new PR): |
In reaction to:
#18 (comment)
It write pad size in the last of pad, and another pad block is not initialized.