1 // Copyright 2015 The BoringSSL Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "internal.h"
16 
17 #if !defined(OPENSSL_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_once(CRYPTO_once_t * once,void (* init)(void))31 void CRYPTO_once(CRYPTO_once_t *once, void (*init)(void)) {
32   if (*once) {
33     return;
34   }
35   *once = 1;
36   init();
37 }
38 
39 static void *g_thread_locals[NUM_OPENSSL_THREAD_LOCALS];
40 
CRYPTO_get_thread_local(thread_local_data_t index)41 void *CRYPTO_get_thread_local(thread_local_data_t index) {
42   return g_thread_locals[index];
43 }
44 
CRYPTO_set_thread_local(thread_local_data_t index,void * value,thread_local_destructor_t destructor)45 int CRYPTO_set_thread_local(thread_local_data_t index, void *value,
46                             thread_local_destructor_t destructor) {
47   g_thread_locals[index] = value;
48   return 1;
49 }
50 
51 #endif  // !OPENSSL_THREADS
52