MCPcopy Create free account
hub / github.com/SpartanJ/eepp / init

Method init

src/eepp/network/ssl/backend/openssl/opensslsocket.cpp:145–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145bool OpenSSLSocket::init() {
146#if OPENSSL_VERSION_NUMBER < 0x10100000L
147 CRYPTO_malloc_init(); // Initialize malloc, free, etc for OpenSSL's use
148
149 SSL_library_init();
150#else
151 OPENSSL_init_ssl( 0, NULL );
152#endif
153
154 SSL_load_error_strings(); // Load SSL error strings
155
156 ERR_load_BIO_strings(); // Load BIO error strings
157
158 OpenSSL_add_all_algorithms(); // Load all available encryption algorithms
159
160 ScopedBuffer data;
161
162 if ( FileSystem::fileExists( SSLSocket::CertificatesPath ) ) {
163 FileSystem::fileGet( SSLSocket::CertificatesPath, data );
164 } else if ( PackManager::instance()->isFallbackToPacksActive() ) {
165 std::string tPath( SSLSocket::CertificatesPath );
166
167 Pack* tPack = PackManager::instance()->exists( tPath );
168
169 if ( NULL != tPack ) {
170 tPack->extractFileToMemory( tPath, data );
171 }
172 }
173
174 if ( data.length() > 0 ) {
175 BIO* mem = BIO_new( BIO_s_mem() );
176
177 BIO_puts( mem, (const char*)data.get() );
178
179 while ( true ) {
180 X509* cert = PEM_read_bio_X509( mem, NULL, 0, NULL );
181
182 if ( !cert )
183 break;
184
185 sCerts.push_back( cert );
186 }
187
188 BIO_free( mem );
189 }
190
191 return true;
192}
193
194bool OpenSSLSocket::end() {
195 if ( !sCerts.empty() ) {

Callers

nothing calls this directly

Calls 5

push_backMethod · 0.80
existsMethod · 0.45
extractFileToMemoryMethod · 0.45
lengthMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected