This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-crypto.git


The following commit(s) were added to refs/heads/master by this push:
     new 650f60ec CRYPTO-171 - openssl(2) not supported
650f60ec is described below

commit 650f60ecf394b2de41419a91d1c8f034e62f79a1
Author: Sebb <s...@apache.org>
AuthorDate: Wed Nov 1 15:05:30 2023 +0000

    CRYPTO-171 - openssl(2) not supported
---
 .../org/apache/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 966685b7..735ffeeb 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)

Reply via email to