mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-25 10:58:20 -10:00
If an SSL operation fails, we call SSL_get_error to determine how to proceed. SSL_get_error's logic is, essentially libcrypto_error ?? WANT_READ ?? WANT_WRITE ?? WANT_X509 ?? panic This means that if a previous call into libcrypto on the same thread had left something in the error queue when the operation goes into the WANT_READ state (etc) SSL_get_error will report that the request must have failed due to something in libcrypto. There are two different fixes being done here: 1) PKCS12_parse is a known contributor to this problem, clear out the queue on a successful exit. 2) Before any SSL stream operation (handshake, read, write, shutdown) clear the queue, in case there are other functions which are leaving dangling errors. With those mitigations in place, the intermittent errors seen during SslStream usage should hopefully be a thing of the past. Commit migrated from https://github.com/dotnet/corefx/commit/80a53ed415ece115d15bcf519e81e600362fd3dc