1/* Copyright (c) 2015, Google Inc.
2 *
3 * Permission to use, copy, modify, and/or distribute this software for any
4 * purpose with or without fee is hereby granted, provided that the above
5 * copyright notice and this permission notice appear in all copies.
6 *
7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14
15#include "internal.h"
16
17#if defined(OPENSSL_NO_THREADS)
18
19void CRYPTO_MUTEX_init(CRYPTO_MUTEX *lock) {}
20
21void CRYPTO_MUTEX_lock_read(CRYPTO_MUTEX *lock) {}
22
23void CRYPTO_MUTEX_lock_write(CRYPTO_MUTEX *lock) {}
24
25void CRYPTO_MUTEX_unlock(CRYPTO_MUTEX *lock) {}
26
27void CRYPTO_MUTEX_cleanup(CRYPTO_MUTEX *lock) {}
28
29void CRYPTO_STATIC_MUTEX_lock_read(struct CRYPTO_STATIC_MUTEX *lock) {}
30
31void CRYPTO_STATIC_MUTEX_lock_write(struct CRYPTO_STATIC_MUTEX *lock) {}
32
33void CRYPTO_STATIC_MUTEX_unlock(struct CRYPTO_STATIC_MUTEX *lock) {}
34
35void CRYPTO_once(CRYPTO_once_t *once, void (*init)(void)) {
36  if (*once) {
37    return;
38  }
39  *once = 1;
40  init();
41}
42
43static void *g_thread_locals[NUM_OPENSSL_THREAD_LOCALS];
44
45void *CRYPTO_get_thread_local(thread_local_data_t index) {
46  return g_thread_locals[index];
47}
48
49int CRYPTO_set_thread_local(thread_local_data_t index, void *value,
50                            thread_local_destructor_t destructor) {
51  g_thread_locals[index] = value;
52  return 1;
53}
54
55#endif  /* OPENSSL_NO_THREADS */
56