zoukankan      html  css  js  c++  java
  • 载入OpenSSL的动态库——学会使用tryToLoadOpenSslWin32Library和QPair

    • Libraries name of openssl?

    The "library" portion of OpenSSL consists of two libraries.

    On posix system they are named:

    • libssl
    • libcrypto

    while on Windows(32bit) they are named completely different:

    • libeay32
    • ssleay32

    qsslocket_openssl_symbols.cpp

    static QPair<QSystemLibrary*, QSystemLibrary*> loadOpenSslWin32()
    {
        QPair<QSystemLibrary*,QSystemLibrary*> pair;
        pair.first = 0;
        pair.second = 0;
    
        // When OpenSSL is built using MSVC then the libraries are named 'ssleay32.dll' and 'libeay32'dll'.
        // When OpenSSL is built using GCC then different library names are used (depending on the OpenSSL version)
        // The oldest version of a GCC-based OpenSSL which can be detected by the code below is 0.9.8g (released in 2007)
        if (!tryToLoadOpenSslWin32Library(QLatin1String("ssleay32"), QLatin1String("libeay32"), pair)) {
            if (!tryToLoadOpenSslWin32Library(QLatin1String("libssl-10"), QLatin1String("libcrypto-10"), pair)) {
                if (!tryToLoadOpenSslWin32Library(QLatin1String("libssl-8"), QLatin1String("libcrypto-8"), pair)) {
                    tryToLoadOpenSslWin32Library(QLatin1String("libssl-7"), QLatin1String("libcrypto-7"), pair);
                }
            }
        }
    
        return pair;
    }
    

    ssl.pri

        # Add optional SSL libs
        # Static linking of OpenSSL with msvc:
        #   - Binaries http://slproweb.com/products/Win32OpenSSL.html
        #   - also needs -lUser32 -lAdvapi32 -lGdi32 -lCrypt32
        #   - libs in <OPENSSL_DIR>libVCstatic
        #   - configure: -openssl -openssl-linked -I <OPENSSL_DIR>include -L <OPENSSL_DIR>libVCstatic OPENSSL_LIBS="-lUser32 -lAdvapi32 -lGdi32" OPENSSL_LIBS_DEBUG="-lssleay32MDd -llibeay32MDd" OPENSSL_LIBS_RELEASE="-lssleay32MD -llibeay32MD"
    

    configure option

        -no-openssl ........ Do not compile support for OpenSSL.
     +  -openssl ........... Enable run-time OpenSSL support.
        -openssl-linked .... Enabled linked OpenSSL support.
    

    Reference

    • http://www.ski-epic.com/2007_notes_on_openssl/index.html
    • http://sophie.zarb.org/distrib/Fedora/18/i386/by-pkgid/75c6e42b0cde6481d0fb179df846c7c1/files/8
    • http://blog.debao.me/2013/12/openssl-and-qt/
  • 相关阅读:
    JavaScript语法
    javascript的用法
    格式和布局
    Css样式表
    HTML基本语言(表单的基本元素)
    HTML超文本语言(一般标签)
    C#项目打开/保存文件夹/指定类型文件,获取路径
    在DataGridView控件中加入ComboBox下拉列表框的实现
    DataGridView 中添加CheckBox和常用处理方式 .
    数据库建模模板、菜单显示出问题解决方案
  • 原文地址:https://www.cnblogs.com/findumars/p/4995465.html
Copyright © 2011-2022 走看看