Commit 87b0f363dc for openssl.org

commit 87b0f363dccbdbdbeb22202de0c1db3e5fbc4f72
Author: Eugene Syromiatnikov <esyr@openssl.org>
Date:   Sat Jun 27 12:44:06 2026 +0200

    demos/sslecho/echecho.c: check return values of SSL_* calls

    As otherwise it triggers -Werror=unused-result when built
    with --strict-warnings.

    Complements: 50580382caca "Documents initial agreed APIs for Encrypted Client Hello (ECH) and includes a minimal demo for some of those APIs."
    Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>

    Reviewed-by: Neil Horman <nhorman@openssl.org>
    Reviewed-by: Bob Beck <beck@openssl.org>
    MergeDate: Mon Jul 20 11:19:01 2026
    (Merged from https://github.com/openssl/openssl/pull/31751)

diff --git a/demos/sslecho/echecho.c b/demos/sslecho/echecho.c
index c8dc57b263..71b3d5565b 100644
--- a/demos/sslecho/echecho.c
+++ b/demos/sslecho/echecho.c
@@ -251,7 +251,11 @@ int main(int argc, char **argv)

             /* Create server SSL structure using newly accepted client socket */
             ssl = SSL_new(ssl_ctx);
-            SSL_set_fd(ssl, client_skt);
+            if (SSL_set_fd(ssl, client_skt) <= 0) {
+                puts("Unable to set fd for the SSL object");
+                ERR_print_errors_fp(stderr);
+                exit(EXIT_FAILURE);
+            }

             /* Wait for SSL connection from the client */
             if (SSL_accept(ssl) <= 0) {
@@ -332,11 +336,19 @@ int main(int argc, char **argv)

         /* Create client SSL structure using dedicated client socket */
         ssl = SSL_new(ssl_ctx);
-        SSL_set_fd(ssl, client_skt);
+        if (SSL_set_fd(ssl, client_skt) <= 0) {
+            puts("Unable to set fd for the SSL object");
+            ERR_print_errors_fp(stderr);
+            exit(EXIT_FAILURE);
+        }
         /* Set hostname for SNI */
         SSL_set_tlsext_host_name(ssl, rem_server_ip);
         /* Configure server hostname check */
-        SSL_set1_ipaddr(ssl, rem_server_ip);
+        if (SSL_set1_ipaddr(ssl, rem_server_ip) <= 0) {
+            puts("Unable to set IP address for the SSL object");
+            ERR_print_errors_fp(stderr);
+            exit(EXIT_FAILURE);
+        }

         /* Now do SSL connect with server */
         if (SSL_connect(ssl) == 1) {