From 8d143c95a0ceb4e0bff3a33863349ec712662117 Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <barracuda@macos-powerpc.org>
Date: Sun, 2 Nov 2025 11:14:38 +0800
Subject: [PATCH] libsrp6a-sha512: fix environ for Apple

---
 3rd_party/libsrp6a-sha512/t_misc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/3rd_party/libsrp6a-sha512/t_misc.c b/3rd_party/libsrp6a-sha512/t_misc.c
index abd8e5571..34b9509ce 100644
--- a/3rd_party/libsrp6a-sha512/t_misc.c
+++ b/3rd_party/libsrp6a-sha512/t_misc.c
@@ -77,7 +77,12 @@ SHA1_CTX randctxt;
  * tricks with variable ordering and sometimes define quirky
  * environment variables like $WINDOWID or $_.
  */
+#ifdef __APPLE__
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#else
 extern char ** environ;
+#endif
 
 static void
 t_envhash(unsigned char * out)
