OpenBSD Support Includes bits by me and Robert Nagy <robert.nagy@gmail.com> who has a google CLA. Update-Note: Additionally, BoringSSL now requires macOS 10.12 or later for getentropy support. This is consistent with https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md WANT_LGTM=all Change-Id: I5ab74fa8a6677fac29c316aa29a954df401ba647 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/59225 Commit-Queue: Bob Beck <bbe@google.com> Reviewed-by: David Benjamin <davidben@google.com> Reviewed-by: Adam Langley <agl@google.com>
diff --git a/include/openssl/base.h b/include/openssl/base.h index 67429c0..3141676 100644 --- a/include/openssl/base.h +++ b/include/openssl/base.h
@@ -164,6 +164,10 @@ #define OPENSSL_FREEBSD #endif +#if defined(__OpenBSD__) +#define OPENSSL_OPENBSD +#endif + // BoringSSL requires platform's locking APIs to make internal global state // thread-safe, including the PRNG. On some single-threaded embedded platforms, // locking APIs may not exist, so this dependency may be disabled with the
diff --git a/include/openssl/thread.h b/include/openssl/thread.h index c6e357e..afa9f08 100644 --- a/include/openssl/thread.h +++ b/include/openssl/thread.h
@@ -78,6 +78,10 @@ void *handle; } CRYPTO_MUTEX; #elif !defined(__GLIBC__) +#if defined(OPENSSL_OPENBSD) +// OpenBSD does not guarantee pthread_rwlock_t in sys/types.h yet. +#include <pthread.h> +#endif typedef pthread_rwlock_t CRYPTO_MUTEX; #else // On glibc, |pthread_rwlock_t| is hidden under feature flags, and we can't