ssl_server2.c: Flush stdout to improve logs timeliness

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron
2026-01-29 16:04:55 +01:00
parent 1b5a0b1877
commit 8ab14401d7

View File

@@ -3490,6 +3490,7 @@ handshake:
* 5. Verify the client certificate
*/
mbedtls_printf(" . Verifying peer X.509 certificate...");
fflush(stdout);
if ((flags = mbedtls_ssl_get_verify_result(&ssl)) != 0) {
char vrfy_buf[512];
@@ -3507,6 +3508,7 @@ handshake:
char crt_buf[512];
mbedtls_printf(" . Peer certificate information ...\n");
fflush(stdout);
mbedtls_x509_crt_info(crt_buf, sizeof(crt_buf), " ",
mbedtls_ssl_get_peer_cert(&ssl));
mbedtls_printf("%s\n", crt_buf);
@@ -3959,6 +3961,7 @@ data_exchange:
size_t buf_len;
mbedtls_printf(" . Serializing live connection...");
fflush(stdout);
ret = mbedtls_ssl_context_save(&ssl, NULL, 0, &buf_len);
if (ret != MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL) {
@@ -3993,6 +3996,7 @@ data_exchange:
size_t b64_len;
mbedtls_printf(" . Save serialized context to a file... ");
fflush(stdout);
mbedtls_base64_encode(NULL, 0, &b64_len, context_buf, buf_len);
@@ -4041,6 +4045,7 @@ data_exchange:
if (opt.serialize == 1) {
/* nothing to do here, done by context_save() already */
mbedtls_printf(" . Context has been reset... ok\n");
fflush(stdout);
}
/*
@@ -4053,6 +4058,7 @@ data_exchange:
*/
if (opt.serialize == 2) {
mbedtls_printf(" . Freeing and reinitializing context...");
fflush(stdout);
mbedtls_ssl_free(&ssl);
@@ -4089,6 +4095,7 @@ data_exchange:
}
mbedtls_printf(" . Deserializing connection...");
fflush(stdout);
if ((ret = mbedtls_ssl_context_load(&ssl, context_buf,
buf_len)) != 0) {
@@ -4118,6 +4125,7 @@ data_exchange:
*/
close_notify:
mbedtls_printf(" . Closing the connection...");
fflush(stdout);
/* No error checking, the connection might be closed already */
do {