Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Problem under Android with OpenSSL 1.1.1c and Qt 5.12.4.



  • Hello.

    I have a problem with OpenSSL v1.1.1b and Qt 5.12.4 under Android

    Everything works fine with a phone running with Android 7.1 but I get some error messages on tablets running on Android 4.4 and 5.0:

    qt.network.ssl: QSslSocket: cannot resolve OPENSSL_init_ssl
    qt.network.ssl: QSslSocket: cannot resolve OPENSSL_init_crypto
    qt.network.ssl: QSslSocket: cannot resolve ASN1_STRING_get0_data
    qt.network.ssl: QSslSocket: cannot resolve EVP_CIPHER_CTX_reset
    qt.network.ssl: QSslSocket: cannot resolve RSA_bits
    qt.network.ssl: QSslSocket: cannot resolve OPENSSL_sk_new_null
    qt.network.ssl: QSslSocket: cannot resolve OPENSSL_sk_push
    qt.network.ssl: QSslSocket: cannot resolve OPENSSL_sk_free
    qt.network.ssl: QSslSocket: cannot resolve OPENSSL_sk_num
    qt.network.ssl: QSslSocket: cannot resolve OPENSSL_sk_pop_free
    qt.network.ssl: QSslSocket: cannot resolve OPENSSL_sk_value
    qt.network.ssl: QSslSocket: cannot resolve DH_get0_pqg
    qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_options
    qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_ciphersuites
    qt.network.ssl: QSslSocket: cannot resolve SSL_set_psk_use_session_callback
    qt.network.ssl: QSslSocket: cannot resolve SSL_get_client_random
    qt.network.ssl: QSslSocket: cannot resolve SSL_SESSION_get_master_key
    qt.network.ssl: QSslSocket: cannot resolve SSL_session_reused
    qt.network.ssl: QSslSocket: cannot resolve SSL_set_options
    qt.network.ssl: QSslSocket: cannot resolve TLS_method
    qt.network.ssl: QSslSocket: cannot resolve TLS_client_method
    qt.network.ssl: QSslSocket: cannot resolve TLS_server_method
    qt.network.ssl: QSslSocket: cannot resolve X509_STORE_CTX_get0_chain
    qt.network.ssl: QSslSocket: cannot resolve X509_getm_notBefore
    qt.network.ssl: QSslSocket: cannot resolve X509_getm_notAfter
    qt.network.ssl: QSslSocket: cannot resolve X509_get_version
    qt.network.ssl: QSslSocket: cannot resolve OpenSSL_version_num
    qt.network.ssl: QSslSocket: cannot resolve OpenSSL_version
    qt.network.ssl: Incompatible version of OpenSSL
    qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed
    qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed
    

    In the pro file, I insert the files .so using this way.

    ANDROID_EXTRA_LIBS = \
                       $$PWD/android/lib/armv7/1.1/libcrypto.so \
                       $$PWD/android/lib/armv7/1.1/libssl.so
    

    I tried to compile the.so files or retrieve them from this site https://github.com/KDAB/android_openssl but the result is the same.

    Why do I get the message "Incompatible version of OpenSSL"? However, I use Openssl 1.1.1.1c with Qt 5.12.4

    Thanks,

    Best regards !

    Francky033


  • Lifetime Qt Champion

    Hi,

    IIRC these old versions of Android provided OpenSSL so I wonder if it's that version that gets loaded for some reason.



  • Yes. The problem seems to come from the fact that Android versions < 6.0 do not have the TLS 1.2 protocol enabled.
    So, the most prudent thing to do is to stay at the version of Qt 5.12.3 to maintain compatibility with the Android versions < 6.0



  • I had same problem and I obtained the next conclusion:
    In versions < 6.0, Android includes this libraries in system. To use your libraries must be rename it to libcrypto_1_1.so and libssl_1_1.so. Furthermore, this libraries must be compiled with ANDROID_API 16 (to works over Android 4.1).

    You can get the libraries from: https://github.com/KDAB/android_openssl/



  • @vcamblor I think there is a typo in the name of the libraries. The right names are: libcrypto_1_1.so and libssl_1_1.so

    Missing a "_" can be a nightmare at the moment of testing the APK :P



  • @xtingray Yes, you're right. I've made a mistake writing it


Log in to reply