There were still three places where we could have undefined behavior if
C gave us an invalid rustls_result:
rustls_result_is_cert_error took a rustls_result as a parameter.
The callback for server certificate validation returned
rustls_result.
The callbacks for session storage returned rustls_result.
Change all of these to use u32 and the try_from implementation.
Fix the comment for the session storage callbacks, which indicated the
wrong error strategy.
Remove result_to_error in favor of directly implementing Display on
rustls_result. This fixes an issue where CertInvalidData was turned into
Either::String rather than Either::Error, which caused
rustls_result_is_cert_error to (incorrectly) say it wasn't a cert error.
This PR also removes the Either struct and the From impls on it.
There were still three places where we could have undefined behavior if C gave us an invalid rustls_result:
Change all of these to use u32 and the try_from implementation.
Fix the comment for the session storage callbacks, which indicated the wrong error strategy.
Remove result_to_error in favor of directly implementing Display on rustls_result. This fixes an issue where CertInvalidData was turned into Either::String rather than Either::Error, which caused rustls_result_is_cert_error to (incorrectly) say it wasn't a cert error. This PR also removes the Either struct and the From impls on it.
Fixes #226