rustls / rustls-ffi

Use Rustls from any language
Other
125 stars 30 forks source link

Improve handling of errors #227

Closed jsha closed 2 years ago

jsha commented 2 years ago

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

kevinburke commented 2 years ago

Looks OK to me, should we update the changelog now vs. later?

jsha commented 2 years ago

We should update the CHANGELOG as part of the PR - I'll push a commit with that later on.

djc commented 2 years ago

Seems okay to me.