Skip to content

fix pkcs_1_v1_5_decode() when empty message #613

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

Merged
merged 3 commits into from
Mar 31, 2023

Conversation

SOuajih
Copy link
Contributor

@SOuajih SOuajih commented Mar 15, 2023

In case of EME-PKCS1-v1_5 decoding, the encoded message format is as follow : EM = 0x00 || 0x02 || PS || 0x00 || M. When using an empty message, the 0x00 octet that separates the padding string and message is located at the end. Thus, update the condition to pass the check in case of empty message.

This fixes the following AOSP cts test:
Module: CtsKeystoreTestCases
Test: testEmptyPlaintextEncryptsAndDecrypts
Link: https://android.googlesource.com/platform/cts/+/refs/tags/android-cts-12.0_r6/tests/tests/keystore/src/android/keystore/cts/CipherTest.java

Checklist

  • documentation is added or updated
  • tests are added or updated

SOuajih and others added 3 commits March 31, 2023 14:21
In case of EME-PKCS1-v1_5 decoding, the encoded message
format is as follow : EM = 0x00 || 0x02 || PS || 0x00 || M.
When using an empty message, the 0x00 octet that separates
the padding string and message is located at the end. Thus,
update the condition to pass the check in case of empty message.

This fixes the following AOSP cts test:
Module: CtsKeystoreTestCases
Test: testEmptyPlaintextEncryptsAndDecrypts
Link: https://android.googlesource.com/platform/cts/+/refs/tags/android-cts-12.0_r6/tests/tests/keystore/src/android/keystore/cts/CipherTest.java

Signed-off-by: Safae Ouajih <[email protected]>
If we allow the length to be 0, we should also prepare for the case where
the user doesn't want to provide a valid input-data pointer.

Signed-off-by: Steffen Jaeckel <[email protected]>
Copy link
Member

@sjaeckel sjaeckel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took the liberty to extend your PR a bit and force-push your branch.

@SOuajih
Copy link
Contributor Author

SOuajih commented Mar 31, 2023

I took the liberty to extend your PR a bit and force-push your branch.

Alright! .. Thank you for the review

@sjaeckel sjaeckel merged commit fae62af into libtom:develop Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants