<div dir="ltr">Hello Experts,<div><br></div><div>Came across a minor issue with handling of alert messages with an async crypto engine. </div><div>Would like to get feedback if this has already been resolved or if the attached fix will work ?</div><div> </div><div>Issue observed:</div><div>The client sends an encrypted "Close_Notify" and we use async processing for decryption. On resubmission of the decrypted data to the SSL_read(), the function returns with "0" and on invoking SSL_get_error() we see the previous error code "SSL_ERROR_WANT_ASYNC" being returned.</div><div><br></div><div>Likely Solution (file: ssl/record/rec_layer_s3.c):</div><div>In ssl3_read_bytes(), the "rwstate" variable is not reset when the alert has been processed. The following did ensure the return code now returned changed to "SSL_ERROR_ZERO_RETURN" on invoking SSL_get_error().</div><div><br></div><div>--- a/openssl/openssl-1.1.1c/ssl/record/rec_layer_s3.c<br>+++ b/openssl/openssl-1.1.1c/ssl/record/rec_layer_s3.c<br>@@ -1526,6 +1526,7 @@ int ssl3_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf,<br>         } else if (alert_descr == SSL_AD_CLOSE_NOTIFY<br>                 && (is_tls13 || alert_level == SSL3_AL_WARNING)) {<br>             s->shutdown |= SSL_RECEIVED_SHUTDOWN;<br>+            s->rwstate = SSL_NOTHING;<br>             return 0;<br>         } else if (alert_level == SSL3_AL_FATAL || is_tls13) {<br>             char tmp[16];<br></div><div><br></div><div>--<br></div><div>Thanks,</div><div>Narasimha</div></div>