MCPcopy Create free account
hub / github.com/ceph/ceph / init

Function init

src/common/ceph_crypto.cc:99–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97#endif /* not OPENSSL_VERSION_NUMBER < 0x10100000L */
98
99static void init() {
100#if OPENSSL_VERSION_NUMBER < 0x10100000L
101 if (++crypto_refs == 1) {
102 // according to
103 // https://wiki.openssl.org/index.php/Library_Initialization#libcrypto_Initialization
104 OpenSSL_add_all_algorithms();
105 ERR_load_crypto_strings();
106
107 // initialize locking callbacks, needed for thread safety.
108 // http://www.openssl.org/support/faq.html#PROG1
109 CRYPTO_set_locking_callback(&ssl_locking_callback);
110 CRYPTO_set_id_callback(&ssl_get_thread_id);
111
112 OPENSSL_config(nullptr);
113 }
114
115 // we need to record IDs of all threads calling the initialization in
116 // order to *manually* free per-thread memory OpenSSL *automagically*
117 // allocated in ERR_get_state().
118 // XXX: this solution/nasty hack is IMPERFECT. A leak will appear when
119 // a client init()ializes the crypto subsystem with one thread and then
120 // uses it from another one in a way that results in ERR_get_state().
121 // XXX: for discussion about another approaches please refer to:
122 // https://www.mail-archive.com/openssl-users@openssl.org/msg59070.html
123 {
124 std::lock_guard l(init_records.lock);
125 CRYPTO_THREADID tmp;
126 CRYPTO_THREADID_current(&tmp);
127 init_records.tids.emplace_back(std::move(tmp));
128 }
129#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
130}
131
132static void shutdown() {
133#if OPENSSL_VERSION_NUMBER < 0x10100000L

Callers 13

bloom_filterMethod · 0.70
init_cryptoMethod · 0.70
calculateMethod · 0.70
verifyMethod · 0.70
initMethod · 0.50
perform_op_batchMethod · 0.50
write_entriesMethod · 0.50
mkfsMethod · 0.50
mountMethod · 0.50
mkfsMethod · 0.50
mountMethod · 0.50
erase_from_randomMethod · 0.50

Calls 1

emplace_backMethod · 0.45

Tested by

no test coverage detected