Changeset 788 for trunk


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
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/README.OS2

    r760 r788  
    6969
    7070      http://web.os2power.com/download/lib/pthread-20100217-os2.zip
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
    7183
    7284
     
    93105for applications based on qmake project files which most of them are). If you
    94106go that way, you may skip the rest of this section and proceed directly to
    95 section called "USING OFFICIAL BINARY QT ARCHIVES" or further.
     107section
    96108
    97109If you use the full source code ZIP distribution of the Qt library or work
     
    156168    You will also need to make sure that pthread.lib is placed somewhere in your
    157169    system library path so that the compiler can find it.
     170
     171
     172
     173
     174
     175
     176
     177
     178
     179
     180
     181
    158182
    159183
  • trunk/configure.cmd

    r772 r788  
    288288    G.CFG_QGTKSTYLE = "auto"
    289289    G.CFG_OPENSSL = "auto"
    290     G.CFG_OPENSSL_LIBS = ""
    291290    G.CFG_DBUS = "auto"
    292291    G.CFG_LARGEFILE = "auto"
     
    599598
    600599    /* detect the CUPS support */
    601 
    602600    G.CUPS_INCLUDEPATH = GetEnv('CUPS_INCLUDEPATH')
    603601    G.CUPS_LIBS = GetEnv('CUPS_LIBS')
     
    618616        drop G.CUPS.
    619617    end
    620     if (G.CUPS_LIBS \== '') then do
     618    if (G.CUPS_ then do
    621619        call SayVerbose 'CUPS include path : 'G.CUPS_INCLUDEPATH
    622620        call SayVerbose 'CUPS libraries    : 'G.CUPS_LIBS
     621
    623622        G.CFG_CUPS = 'yes'
    624623    end
    625624    else do
    626         call SayVerbose 'CUPS libraries are not specified, CUPS support is disabled.'
     625        call SayVerbose 'WARNING: CUPS libraries are not specified, CUPS support is disabled.'
     626        call SayVerbose 'Use CUPS_INCLUDEPATH and CUPS_LIBS environment variables to specify'
     627        call SayVerbose 'the location of the libraries.'
     628        call SayVerbose
    627629        G.CFG_CUPS = 'no'
    628630    end
     
    632634        call SayLog 'WARNING: Printing support is completely disabled due to',
    633635                    'disabled CUPS support.'
     636
    634637        G.QCONFIG_FLAGS = Join(G.QCONFIG_FLAGS, "QT_NO_PRINTER")
     638
     639
     640
     641
     642
     643
     644
     645
     646
     647
     648
     649
     650
     651
     652
     653
     654
    635655    end
    636656
     
    651671    G.CFG_NIS = "no"
    652672    G.CFG_DBUS = "no"
    653     G.CFG_OPENSSL = "no"
    654673    G.CFG_QGTKSTYLE = "no"
    655674    G.CFG_LARGEFILE = "no"
     
    11661185    if (G.CFG_GSTREAMER == "yes") then
    11671186        G.QT_CONFIG = Join(G.QT_CONFIG, "gstreamer")
    1168     if (G.CFG_DBUS == "linked") then
    1169         G.QT_CONFIG = Join(G.QT_CONFIG dbus, "dbus-linked")
    11701187    if (G.CFG_NAS == "system") then
    11711188        G.QT_CONFIG = Join(G.QT_CONFIG, "nas")
    1172     if (G.CFG_OPENSSL == "linked") then
    1173         G.QT_CONFIG = Join(G.QT_CONFIG, "openssl-linked")
    11741189*/
    11751190    if (G.CFG_OPENSSL == "yes") then
    11761191        G.QT_CONFIG = Join(G.QT_CONFIG, "openssl")
     1192
     1193
    11771194    if (G.CFG_DBUS == "yes") then
    11781195        G.QT_CONFIG = Join(G.QT_CONFIG, "dbus")
     1196
     1197
    11791198
    11801199    if (G.D_FLAGS \== "") then
     
    14611480    if (G.CFG_OPENSSL \== "yes") then
    14621481        G.QCONFIG_FLAGS = Join(G.QCONFIG_FLAGS, "QT_NO_OPENSSL")
     1482
     1483
    14631484    if (G.CFG_DBUS \== "yes") then
    14641485        G.QCONFIG_FLAGS = Join(G.QCONFIG_FLAGS, "QT_NO_DBUS")
     
    14961517    if (G.CFG_NAS == "no") then
    14971518        G.QCONFIG_FLAGS = Join(G.QCONFIG_FLAGS, "QT_NO_NAS")
    1498     if (G.CFG_OPENSSL == "linked") then
    1499         G.QCONFIG_FLAGS = Join(G.QCONFIG_FLAGS, "QT_LINKED_OPENSSL")
    15001519*/
    15011520
     
    17341753        call charout qmake_cache_new, 'DEFINES *= QT_EDITION=QT_EDITION_DESKTOP'
    17351754
    1736     /* dump in the OPENSSL_LIBS info */
    1737     OPENSSL_LIBS = GetEnv("OPENSSL_LIBS")
    1738     if (OPENSSL_LIBS \== "") then
    1739         call lineout qmake_cache_new, 'OPENSSL_LIBS = 'OPENSSL_LIBS
    1740     else if (G.CFG_OPENSSL == "linked") then
    1741         call lineout qmake_cache_new, 'OPENSSL_LIBS = -lssl -lcrypto'
    1742 
    17431755    /* dump CUPS_INCLUDEPATH and friends */
    17441756    if (G.CFG_CUPS == "yes") then do
     
    17471759        if (G.CUPS_LIBS \== "") then
    17481760            call lineout qmake_cache_new, 'CUPS_LIBS = 'G.CUPS_LIBS
     1761
     1762
     1763
     1764
     1765
     1766
     1767
     1768
    17491769    end
    17501770
     
    19341954"or compile needed modules into the library."G.EOL||,
    19351955G.EOL
    1936     if (G.CFG_OPENSSL == "linked" &  OPENSSL_LIBS == "") then
     1956
     1957    if (G.CFG_OPENSSL == "linked" & G.OPENSSL_LIBS == "") then
    19371958        call SayLog,,
    19381959G.EOL||,
    1939 "NOTE: When linking against OpenSSL, you can override the default"G.EOL||,
    1940 "library names through OPENSSL_LIBS."G.EOL||,
    1941 "For example:"G.EOL||,
    1942 "    configure -openssl-linked OPENSSL_LIBS='-L/path/to/lib -lssl -lcrypto'"G.EOL||,
     1960"WARNING: You are linking against OpenSSL but didn't specify the OpenSSL library"G.EOL||,
     1961"names, so the build will most likely fail. You may fix this by setting the"G.EOL||,
     1962"OPENSSL_LIBS environment variable."G.EOL||,
    19431963G.EOL
    19441964
  • 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.