Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Langley <agl@google.com>2015-05-08 04:28:27 +0300
committerAdam Langley <agl@google.com>2015-05-08 21:34:55 +0300
commit65a7e9442c4605b0f1581a3ff3c5afc7a8d13c13 (patch)
tree61e9141e937576f2bfd98bdf91367518b0297751 /crypto/internal.h
parent4d2e7ce47bab29c7c872790edd1e262776176678 (diff)
Support Trusty, an embedded platform.
Trusty doesn't have setjmp.h and nor does it have threads. Change-Id: I005f7a009a13e6632513be9fab2bbe62294519a4 Reviewed-on: https://boringssl-review.googlesource.com/4660 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/internal.h')
-rw-r--r--crypto/internal.h33
1 files changed, 20 insertions, 13 deletions
diff --git a/crypto/internal.h b/crypto/internal.h
index a4cd3d8a..42125dbc 100644
--- a/crypto/internal.h
+++ b/crypto/internal.h
@@ -112,12 +112,13 @@
#include <openssl/ex_data.h>
#include <openssl/thread.h>
-#if !defined(OPENSSL_WINDOWS)
-#include <pthread.h>
-#else
+#if defined(OPENSSL_NO_THREADS)
+#elif defined(OPENSSL_WINDOWS)
#pragma warning(push, 3)
#include <windows.h>
#pragma warning(pop)
+#else
+#include <pthread.h>
#endif
#if defined(__cplusplus)
@@ -332,12 +333,15 @@ static inline int constant_time_select_int(unsigned int mask, int a, int b) {
/* Thread-safe initialisation. */
-#if !defined(OPENSSL_WINDOWS)
-typedef pthread_once_t CRYPTO_once_t;
-#define CRYPTO_ONCE_INIT PTHREAD_ONCE_INIT
-#else
+#if defined(OPENSSL_NO_THREADS)
+typedef uint32_t CRYPTO_once_t;
+#define CRYPTO_ONCE_INIT 0
+#elif defined(OPENSSL_WINDOWS)
typedef LONG CRYPTO_once_t;
#define CRYPTO_ONCE_INIT 0
+#else
+typedef pthread_once_t CRYPTO_once_t;
+#define CRYPTO_ONCE_INIT PTHREAD_ONCE_INIT
#endif
/* CRYPTO_once calls |init| exactly once per process. This is thread-safe: if
@@ -365,17 +369,20 @@ OPENSSL_EXPORT void CRYPTO_once(CRYPTO_once_t *once, void (*init)(void));
* |CRYPTO_once_t| to ensure that the lock is setup before use. This is done
* automatically by |CRYPTO_STATIC_MUTEX_lock_*|. */
-#if !defined(OPENSSL_WINDOWS)
-struct CRYPTO_STATIC_MUTEX {
- pthread_rwlock_t lock;
-};
-#define CRYPTO_STATIC_MUTEX_INIT { PTHREAD_RWLOCK_INITIALIZER }
-#else
+#if defined(OPENSSL_NO_THREADS)
+struct CRYPTO_STATIC_MUTEX {};
+#define CRYPTO_STATIC_MUTEX_INIT {}
+#elif defined(OPENSSL_WINDOWS)
struct CRYPTO_STATIC_MUTEX {
CRYPTO_once_t once;
CRITICAL_SECTION lock;
};
#define CRYPTO_STATIC_MUTEX_INIT { CRYPTO_ONCE_INIT, { 0 } }
+#else
+struct CRYPTO_STATIC_MUTEX {
+ pthread_rwlock_t lock;
+};
+#define CRYPTO_STATIC_MUTEX_INIT { PTHREAD_RWLOCK_INITIALIZER }
#endif
/* CRYPTO_MUTEX_init initialises |lock|. If |lock| is a static variable, use a