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
digest_verify
and digest_verify_final
return Err
with empty error stack, instead of Ok(false)
as documented, on invalid signature
#2200
Comments
Yeah, that sounds right, though the Ok(false) case is extremely unfortunate to have to remember to check for :( From a usability perspective I might say we want to diverge from OpenSSL a bit and just return a |
I can see that being desirable, but I also think that From my perspective it might be nice to funnel the return value into |
heh, case in point: my error was passing in a base64-encoded signature to the verify function, so it seems that case causes an empty ErrorStack as well. Not sure what the return value is in that case. EDIT: I added a debug line, it returned |
I'd honestly be pretty surprised if OpenSSL would commonly if ever expose information about why a signature was invalid, since information leaks like that can be exploited. I might expect that the Err case is actually only for internal errors like a failure to allocate memory etc. |
I suppose you're right; other than the length of the signature being wrong (i.e. the signature can't possibly be right and it's not worth trying to even check it), there are probably no other errors that can't be exploited. |
https://www.openssl.org/docs/man1.1.1/man3/EVP_DigestVerifyFinal.html says
However this crate, using the
cvt
function, maps a return code of zero toErr(ErrorStack::get())
rust-openssl/openssl/src/md_ctx.rs
Line 372 in 9f29412
rust-openssl/openssl/src/lib.rs
Lines 220 to 227 in 9f29412
I could certainly be wrong, but it looks to me that this should be
cvt_n
instead, which only treats negative values as errors.The text was updated successfully, but these errors were encountered: