@@ -158,6 +158,8 @@ static void OpenLibraryOnce(void)
158
158
159
159
static pthread_once_t g_openLibrary = PTHREAD_ONCE_INIT ;
160
160
161
+ typedef unsigned long (* OpenSSL_version_num_ptr_private )(void );
162
+
161
163
int OpenLibrary (void )
162
164
{
163
165
pthread_once (& g_openLibrary , OpenLibraryOnce );
@@ -184,6 +186,25 @@ void InitializeOpenSSLShim(void)
184
186
// libcrypto.so.1.1.0/libssl.so.1.1.0
185
187
const void * v1_0_sentinel = dlsym (libssl , "SSL_state" );
186
188
189
+ if (v1_0_sentinel )
190
+ {
191
+ printf ("OpenSSL version: 1.0.x\n" );
192
+ }
193
+ else
194
+ {
195
+ const OpenSSL_version_num_ptr_private opensslnum = (OpenSSL_version_num_ptr_private )dlsym (libssl , "OpenSSL_version_num" );
196
+
197
+ if (opensslnum )
198
+ {
199
+ unsigned long ver = opensslnum ();
200
+ printf ("OpenSSL version: 0x%lx\n" , ver );
201
+ }
202
+ else
203
+ {
204
+ printf ("OpenSSL version could not be determiend.\n" );
205
+ }
206
+ }
207
+
187
208
// Only permit a single assignment here so that two assemblies both triggering the initializer doesn't cause a
188
209
// race where the fn_ptr is nullptr, then properly bound, then goes back to nullptr right before being used (then bound again).
189
210
void * volatile tmp_ptr ;
@@ -234,7 +255,7 @@ void InitializeOpenSSLShim(void)
234
255
235
256
#if defined(TARGET_ARM ) && defined(TARGET_LINUX )
236
257
c_static_assert_msg (sizeof (time_t ) == 8 , "Build requires 64-bit time_t." );
237
-
258
+
238
259
// This value will represent a time in year 2038 if 64-bit time is used,
239
260
// or 1901 if the lower 32 bits are interpreted as a 32-bit time_t value.
240
261
time_t timeVal = (time_t )0x80000000U ;
0 commit comments