Closed dur-randir closed 2 years ago
@toddr, I can provide a pull request for either of those variants, if you tell which one you think is an appropriate fix for this issue.
I'm open to either solution. Do what you think is the clearest error to the developer?
Internally, I've patches this using second approach, as it retains public API of verify().
I look forward to the PR. Thanks!
Consider the following perl program
After the failed verify() call internal OpenSSL error stack is left non-empty with errors in it. That's a problem for end user, since that stack is global and isn't cleared by OpenSSL itself. So if someone peeks into it after the next openssl call, he'll find errors in it, but will assume that it's from theirs call, while in fact they're from verify().
In RSA.xs there's the following block
which should presumably handle this situation, but CHECK_OPEN_SSL macro unwraps into
but ERR_peek_error() returns a positive error code, which makes (!p_result) condition to fail, in turn making croakSelf() and thus ERR_clear_error() to not get called.
I propose two possible solutions for this: