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
soter: make sure we have the RSA private key before trying to decrypt… #334
Conversation
Fixes #332 The |
@secumod thank you for this fix! Could you please update code because tests are crashing at this point.
|
Yes, I saw that - older OpenSSL libs (< 1.1.0) do not have this accessor function. |
… data Some OpenSSL versions do not handle gracefully, when you try to do RSA decryption with a public key (no private part in the RSA structure) and just crash the whole process. So we add an explicit check we have the private part before attempting the decryption.
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.
I've tested this change with OpenSSL 1.0.2, OpenSSL 1.1.0, and LibreSSL 2.8.2. The code from linked issue no longer crashes for me as well. Themis behavior is now identical across all supported crypto backends (BoringSSL already returns THEMIS_FAIL in this case).
LGTM 👍
I guess this resolves the issue. Thank you, @secumod!
Thanks for testing. I guess we should decide separately, if we should fix the return codes. Any opinions @vixentael ? |
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.
LGTM
Thank you @secumod and @ilammy for such quick testing and fixing
This fix will be part of |
@secumod agree, I think matching Soter and Themis error codes requires more discussion and is definitely a different issue. Shall we open a new one? |
… data
Some OpenSSL versions do not handle gracefully, when you try to do RSA
decryption with a public key (no private part in the RSA structure) and just
crash the whole process. So we add an explicit check we have the private part
before attempting the decryption.