From: Joshua Rogers Date: Sun, 12 Oct 2025 14:08:04 +0000 (+0800) Subject: NonStop: reset hpns_connect_attempt at call start and on success X-Git-Tag: openssl-4.0.0-beta1~62 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=d0abfd1844c0fd7fb5e63f65ef6a45183c3f7230;p=thirdparty%2Fopenssl.git 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 Reviewed-by: Saša Nedvědický Reviewed-by: Eugene Syromiatnikov Reviewed-by: Neil Horman MergeDate: Thu Mar 12 18:22:00 2026 (Merged from https://github.com/openssl/openssl/pull/28909) (cherry picked from commit 435b6510a35ae71e4d39506dc06e8fba91435ce2) --- diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c index 6513f4e557f..ac184b2314e 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