*/
static void tls_close ( struct tls_connection *tls, int rc ) {
- /* Send closure alert */
- tls_send_alert ( tls, TLS_ALERT_WARNING, TLS_ALERT_CLOSE_NOTIFY );
-
/* Remove pending operations, if applicable */
pending_put ( &tls->client.negotiation );
pending_put ( &tls->server.negotiation );
tls_tx_resume_all ( tls->session );
}
+/**
+ * Send closure alert and finish with TLS connection
+ *
+ * @v tls TLS connection
+ * @v rc Status code
+ */
+static void tls_close_alert ( struct tls_connection *tls, int rc ) {
+
+ /* Send closure alert */
+ tls_send_alert ( tls, TLS_ALERT_WARNING, TLS_ALERT_CLOSE_NOTIFY );
+
+ /* Close connection */
+ tls_close ( tls, rc );
+}
+
/******************************************************************************
*
* Key schedule
INTF_OP ( xfer_window, struct tls_connection *,
tls_plainstream_window ),
INTF_OP ( job_progress, struct tls_connection *, tls_progress ),
- INTF_OP ( intf_close, struct tls_connection *, tls_close ),
+ INTF_OP ( intf_close, struct tls_connection *, tls_close_alert ),
};
/** TLS plaintext stream interface descriptor */
/* Process data if buffer is now full */
if ( iob_tailroom ( dest ) == 0 ) {
if ( ( rc = process ( tls ) ) != 0 ) {
- tls_close ( tls, rc );
+ tls_close_alert ( tls, rc );
goto done;
}
}
return;
err:
- tls_close ( tls, rc );
+ tls_close_alert ( tls, rc );
return;
}
return;
err:
- tls_close ( tls, rc );
+ tls_close_alert ( tls, rc );
}
/** TLS TX process descriptor */