No, there is no reliable way because in OpenSSL the internal structures keep changing between versions, and quite a few functions are actually macros which access/manipulate the structure members directly.
Still if you are SURE your application does not use any such macros and willing to take the risk the structures may change and your app won't work, you can dlopen()
the libcrypto.so and dlsym() the functions you use. There would be around 20 of them. Keep in mind that many functions you may be using, such as SSL_CTX_set_options
and SSL_want_read/SSL_want_write
are actually macros which result in calling the same functions.
Another option would be to link statically with libcrypto.a
and libssl.a
. This would also make your app to run on systems which do not have OpenSSL installed at all (although those are few). Expect this to add 300-900kb to the size of your app though.