• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
CRYPTO_MUTEX_init(CRYPTO_MUTEX * lock)19 void CRYPTO_MUTEX_init(CRYPTO_MUTEX *lock) {}
20 
CRYPTO_MUTEX_lock_read(CRYPTO_MUTEX * lock)21 void CRYPTO_MUTEX_lock_read(CRYPTO_MUTEX *lock) {}
22 
CRYPTO_MUTEX_lock_write(CRYPTO_MUTEX * lock)23 void CRYPTO_MUTEX_lock_write(CRYPTO_MUTEX *lock) {}
24 
CRYPTO_MUTEX_unlock_read(CRYPTO_MUTEX * lock)25 void CRYPTO_MUTEX_unlock_read(CRYPTO_MUTEX *lock) {}
26 
CRYPTO_MUTEX_unlock_write(CRYPTO_MUTEX * lock)27 void CRYPTO_MUTEX_unlock_write(CRYPTO_MUTEX *lock) {}
28 
CRYPTO_MUTEX_cleanup(CRYPTO_MUTEX * lock)29 void CRYPTO_MUTEX_cleanup(CRYPTO_MUTEX *lock) {}
30 
CRYPTO_STATIC_MUTEX_lock_read(struct CRYPTO_STATIC_MUTEX * lock)31 void CRYPTO_STATIC_MUTEX_lock_read(struct CRYPTO_STATIC_MUTEX *lock) {}
32 
CRYPTO_STATIC_MUTEX_lock_write(struct CRYPTO_STATIC_MUTEX * lock)33 void CRYPTO_STATIC_MUTEX_lock_write(struct CRYPTO_STATIC_MUTEX *lock) {}
34 
CRYPTO_STATIC_MUTEX_unlock_read(struct CRYPTO_STATIC_MUTEX * lock)35 void CRYPTO_STATIC_MUTEX_unlock_read(struct CRYPTO_STATIC_MUTEX *lock) {}
36 
CRYPTO_STATIC_MUTEX_unlock_write(struct CRYPTO_STATIC_MUTEX * lock)37 void CRYPTO_STATIC_MUTEX_unlock_write(struct CRYPTO_STATIC_MUTEX *lock) {}
38 
CRYPTO_once(CRYPTO_once_t * once,void (* init)(void))39 void CRYPTO_once(CRYPTO_once_t *once, void (*init)(void)) {
40   if (*once) {
41     return;
42   }
43   *once = 1;
44   init();
45 }
46 
47 static void *g_thread_locals[NUM_OPENSSL_THREAD_LOCALS];
48 
CRYPTO_get_thread_local(thread_local_data_t index)49 void *CRYPTO_get_thread_local(thread_local_data_t index) {
50   return g_thread_locals[index];
51 }
52 
CRYPTO_set_thread_local(thread_local_data_t index,void * value,thread_local_destructor_t destructor)53 int CRYPTO_set_thread_local(thread_local_data_t index, void *value,
54                             thread_local_destructor_t destructor) {
55   g_thread_locals[index] = value;
56   return 1;
57 }
58 
59 #endif  /* OPENSSL_NO_THREADS */
60