Small improvement to tolerate PEM files missing the terminating newline in the brssl...
[BearSSL] / src / ssl / ssl_engine.c
index 1f095f0..4d85be2 100644 (file)
@@ -1091,6 +1091,9 @@ jump_handshake(br_ssl_engine_context *cc, int action)
                cc->hlen_out = hlen_out;
                cc->action = action;
                cc->hsrun(&cc->cpu);
+               if (br_ssl_engine_closed(cc)) {
+                       return;
+               }
                if (cc->hbuf_out != cc->saved_hbuf_out) {
                        sendpld_ack(cc, cc->hbuf_out - cc->saved_hbuf_out);
                }
@@ -1296,6 +1299,7 @@ br_ssl_engine_hs_reset(br_ssl_engine_context *cc,
        cc->hsrun = hsrun;
        cc->shutdown_recv = 0;
        cc->application_data = 0;
+       cc->alert = 0;
        jump_handshake(cc, 0);
 }