From 650f60ecf394b2de41419a91d1c8f034e62f79a1 Mon Sep 17 00:00:00 2001 From: Sebb Date: Wed, 1 Nov 2023 15:05:30 +0000 Subject: [PATCH] CRYPTO-171 - openssl(2) not supported --- .../commons/crypto/random/OpenSslCryptoRandomNative.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/native/org/apache/commons/crypto/random/OpenSslCryptoRandomNative.c b/src/main/native/org/apache/commons/crypto/random/OpenSslCryptoRandomNative.c index 966685b77..735ffeeb1 100644 --- a/src/main/native/org/apache/commons/crypto/random/OpenSslCryptoRandomNative.c +++ b/src/main/native/org/apache/commons/crypto/random/OpenSslCryptoRandomNative.c @@ -216,7 +216,15 @@ static void pthreads_locking_callback(int mode, int type, char *file, int line) static unsigned long pthreads_thread_id(void) { +// CRYPTO-171 - not supported on macOS M1 after 10.12 (Sierra) +// It would be best to throw an error, but that does not seem possible +// without access to the JNI environment, so print a message instead +#if defined(MAC_OS) && defined(__arm64__) + fprintf(stderr, "openssl(2) is not supported on this architecture\n"); + return 0; +#else return (unsigned long)syscall(SYS_gettid); +#endif } static void locks_setup(void)