]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
NonStop: reset hpns_connect_attempt at call start and on success
authorJoshua Rogers <MegaManSec@users.noreply.github.com>
Sun, 12 Oct 2025 14:08:04 +0000 (22:08 +0800)
committerNeil Horman <nhorman@openssl.org>
Thu, 12 Mar 2026 18:17:44 +0000 (14:17 -0400)
Ensure the NonStop fallback state does not leak across calls by clearing hpns_connect_attempt at the beginning of RAND_query_egd_bytes and after a successful connect. No impact on other platforms.

Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Thu Mar 12 18:22:00 2026
(Merged from https://github.com/openssl/openssl/pull/28909)

crypto/rand/rand_egd.c

index 6513f4e557fe8bab41408f5527abf17cb78388eb..ac184b2314efdfc95f0ab982f15620d4164b5601 100644 (file)
@@ -110,6 +110,9 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
     struct sockaddr_un addr;
     int mybuffer, ret = -1, i, numbytes, fd = -1;
     unsigned char tempbuf[255];
+#if defined(OPENSSL_SYS_TANDEM)
+    hpns_connect_attempt = 0;
+#endif
 
     if (bytes <= 0 || bytes > (int)sizeof(tempbuf))
         return -1;
@@ -131,9 +134,13 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
 
     /* Try to connect */
     for (;;) {
-        if (connect(fd, (struct sockaddr *)&addr, i) == 0)
+        if (connect(fd, (struct sockaddr *)&addr, i) == 0) {
+#if defined(OPENSSL_SYS_TANDEM)
+            hpns_connect_attempt = 0;
+#endif
             break;
-#ifdef EISCONN
+        }
+# ifdef EISCONN
         if (errno == EISCONN)
             break;
 #endif