From 3b5d22485b167c357c4bf725910662ce2e2f9116 Mon Sep 17 00:00:00 2001
From: Aditya Kamath <Aditya.Kamath1@ibm.com>
Date: Wed, 20 May 2026 05:04:07 -0500
Subject: [PATCH 2/2] Block syscall.h and avoid syscall for now

---
 crypto/rand_extra/getrandom_fillin.h | 2 ++
 crypto/rand_extra/urandom.c          | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/crypto/rand_extra/getrandom_fillin.h b/crypto/rand_extra/getrandom_fillin.h
index 9b18b7e9f..9778eef48 100644
--- a/crypto/rand_extra/getrandom_fillin.h
+++ b/crypto/rand_extra/getrandom_fillin.h
@@ -10,7 +10,9 @@
 
 #if defined(OPENSSL_RAND_URANDOM)
 
+#ifndef _AIX
 #include <sys/syscall.h>
+#endif
 
 #if defined(OPENSSL_X86_64)
 #define EXPECTED_NR_getrandom 318
diff --git a/crypto/rand_extra/urandom.c b/crypto/rand_extra/urandom.c
index c8b611abe..a61fa142b 100644
--- a/crypto/rand_extra/urandom.c
+++ b/crypto/rand_extra/urandom.c
@@ -28,7 +28,9 @@
 #include <linux/random.h>
 #include <sys/ioctl.h>
 #include <sys/param.h>
+#ifndef _AIX
 #include <sys/syscall.h>
+#endif
 
 #if defined(OPENSSL_ANDROID)
 #include <sys/system_properties.h>
@@ -195,7 +197,11 @@ static ssize_t wrapper_getrandom(void *buf, size_t buf_len, int block) {
   long backoff = INITIAL_BACKOFF_DELAY;
 
   do {
+#ifndef _AIX
     ret = syscall(__NR_getrandom, buf, buf_len, block ? 0 : GRND_NONBLOCK);
+#else
+  ret = -1; errno = ENOSYS;
+#endif
     if ((ret == -1) && (errno != EINTR)) {
       // Don't block in non-block mode except if a signal handler interrupted
       // |getrandom|.
@@ -352,6 +358,7 @@ static void ensure_getrandom_is_initialized(void) {
 
 static void ensure_dev_urandom_is_initialized(void) {
 
+#ifndef _AIX
   // On platforms where urandom doesn't block at startup, we ensure that the
   // kernel has sufficient entropy before continuing.
   for (;;) {
@@ -377,6 +384,7 @@ static void ensure_dev_urandom_is_initialized(void) {
     nanosleep(&sleep_time, &sleep_time);
   }
 
+#endif
   random_flavor_state = STATE_READY;
 }
 
-- 
2.51.2

