Commit 435b6510a3 for openssl.org
commit 435b6510a35ae71e4d39506dc06e8fba91435ce2
Author: Joshua Rogers <MegaManSec@users.noreply.github.com>
Date: Sun Oct 12 22:08:04 2025 +0800
NonStop: reset hpns_connect_attempt at call start and on success
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)
diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c
index 6513f4e557..ac184b2314 100644
--- a/crypto/rand/rand_egd.c
+++ b/crypto/rand/rand_egd.c
@@ -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