Changeset 788 for trunk/src


Ignore:
Timestamp:
Oct 10, 2010, 9:22:38 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

network: Added OpenSSL support (closes #167).

Location:
trunk/src/network/ssl
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/network/ssl/qsslsocket_openssl.cpp

    r769 r788  
    188188        else if (protoString == QLatin1String("TLSv1"))
    189189            ciph.d->protocol = QSsl::TlsV1;
    190        
     190
    191191        if (descriptionList.at(2).startsWith(QLatin1String("Kx=")))
    192192            ciph.d->keyExchangeMethod = descriptionList.at(2).mid(3);
     
    341341    if (configuration.peerVerifyDepth != 0)
    342342        q_SSL_CTX_set_verify_depth(ctx, configuration.peerVerifyDepth);
    343    
     343
    344344    // Create and initialize SSL session
    345345    if (!(ssl = q_SSL_new(ctx))) {
     
    425425            do {
    426426                if (attempts < 500) {
    427 #ifdef Q_OS_UNIX
     427#if
    428428                    struct timespec ts = {0, 33333333};
    429429                    nanosleep(&ts, 0);
     
    534534    do {
    535535        transmitting = false;
    536        
     536
    537537        // If the connection is secure, we can transfer data from the write
    538538        // buffer (in plain text) to the write BIO through SSL_write.
  • trunk/src/network/ssl/qsslsocket_openssl_symbols.cpp

    r769 r788  
    262262    if (!(_q_##func = _q_PTR_##func(lib->resolve(#ordinal)))) \
    263263        qWarning("QSslSocket: cannot resolve "#func);
     264
     265
     266
     267
     268
    264269#else
    265270#define RESOLVEFUNC(func) \
     
    462467    libssl = libcrypto = 0;
    463468    return pair;
    464 
     469# elif defined(Q_OS_OS2)
     470    // note: the k* versions of libraries were in use once; support them for
     471    // backward compatibility
     472    static const char *ssl_dll[] = { "ssl10", "kssl10" };
     473    static const char *crypto_dll[] = { "crypto10", "kcrypt10" };
     474
     475    QLibrary *libssl;
     476    for (size_t i = 0; i < sizeof(ssl_dll)/sizeof(ssl_dll[0]); ++i) {
     477        libssl = new QLibrary(QLatin1String(ssl_dll[i]));
     478        if (libssl->load())
     479            break;
     480        delete libssl;
     481        libssl = 0;
     482    }
     483    if (!libssl) {
     484        return pair;
     485    }
     486
     487    QLibrary *libcrypto;
     488    for (size_t i = 0; i < sizeof(crypto_dll)/sizeof(crypto_dll[0]); ++i) {
     489        libcrypto = new QLibrary(QLatin1String(crypto_dll[i]));
     490        if (libcrypto->load())
     491            break;
     492        delete libcrypto;
     493        libcrypto = 0;
     494    }
     495    if (!libcrypto) {
     496        delete libssl;
     497        return pair;
     498    }
     499
     500    pair.first = libssl;
     501    pair.second = libcrypto;
     502    return pair;
    465503# else
    466504    // not implemented for this platform yet
     
    535573    RESOLVEFUNC(sk_free, 2571, libs.second )
    536574    RESOLVEFUNC(sk_num, 2576, libs.second )
    537     RESOLVEFUNC(sk_pop_free, 2578, libs.second )   
     575    RESOLVEFUNC(sk_pop_free, 2578, libs.second )
    538576    RESOLVEFUNC(sk_value, 2585, libs.second )
    539577    RESOLVEFUNC(SSL_CIPHER_description, 11, libs.first )
  • trunk/src/network/ssl/ssl.pri

    r561 r788  
    3737    # Add optional SSL libs
    3838    LIBS_PRIVATE += $$OPENSSL_LIBS
     39
     40
     41
     42
     43
    3944}
Note: See TracChangeset for help on using the changeset viewer.