Changeset 5726 for pjproject


Ignore:
Timestamp:
Jan 17, 2018 11:15:34 AM (7 years ago)
Author:
riza
Message:

Close #2083: Fix build error when building using LibreSSL.

Location:
pjproject/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/ssl_sock_ossl.c

    r5725 r5726  
    5656#include <openssl/rand.h> 
    5757#include <openssl/opensslconf.h> 
    58  
    59 #if !defined(OPENSSL_NO_EC) && OPENSSL_VERSION_NUMBER >= 0x1000200fL 
     58#include <openssl/opensslv.h> 
     59 
     60#define USING_LIBRESSL (defined(LIBRESSL_VERSION_NUMBER)) 
     61 
     62#if !USING_LIBRESSL && !defined(OPENSSL_NO_EC) \ 
     63        && OPENSSL_VERSION_NUMBER >= 0x1000200fL 
    6064 
    6165#   include <openssl/obj_mac.h> 
     
    115119 
    116120 
    117 #if OPENSSL_VERSION_NUMBER >= 0x10100000L 
     121#if !USING_LIBRESSL && OPENSSL_VERSION_NUMBER >= 0x10100000L 
    118122#  define OPENSSL_NO_SSL2           /* seems to be removed in 1.1.0 */ 
    119123#  define M_ASN1_STRING_data(x)     ASN1_STRING_get0_data(x) 
     
    539543 
    540544    /* Init OpenSSL lib */ 
    541 #if OPENSSL_VERSION_NUMBER < 0x10100000L 
     545#if USING_LIBRESSL || OPENSSL_VERSION_NUMBER < 0x10100000L 
    542546    SSL_library_init(); 
    543547    SSL_load_error_strings(); 
     
    560564        const char *cname; 
    561565 
    562 #if OPENSSL_VERSION_NUMBER < 0x10100000L 
     566#if (USING_LIBRESSL && LIBRESSL_VERSION_NUMBER < 0x2020100fL)\ 
     567    || OPENSSL_VERSION_NUMBER < 0x10100000L 
     568 
    563569        meth = (SSL_METHOD*)SSLv23_server_method(); 
    564570        if (!meth) 
     
    603609        SSL_set_session(ssl, SSL_SESSION_new()); 
    604610 
    605 #if !defined(OPENSSL_NO_EC) && OPENSSL_VERSION_NUMBER >= 0x1000200fL 
     611#if !USING_LIBRESSL && !defined(OPENSSL_NO_EC) \ 
     612    && OPENSSL_VERSION_NUMBER >= 0x1000200fL 
    606613        openssl_curves_num = SSL_get_shared_curve(ssl,-1); 
    607614        if (openssl_curves_num > PJ_ARRAY_SIZE(openssl_curves)) 
     
    795802 
    796803    /* Determine SSL method to use */ 
    797 #if OPENSSL_VERSION_NUMBER < 0x10100000L 
     804#if (USING_LIBRESSL && LIBRESSL_VERSION_NUMBER < 0x2020100fL)\ 
     805    || OPENSSL_VERSION_NUMBER < 0x10100000L 
    798806    switch (ssock->param.proto) { 
    799807    case PJ_SSL_SOCK_PROTO_TLS1: 
     
    12321240static pj_status_t set_curves_list(pj_ssl_sock_t *ssock) 
    12331241{ 
    1234 #if !defined(OPENSSL_NO_EC) && OPENSSL_VERSION_NUMBER >= 0x1000200fL 
     1242#if !USING_LIBRESSL && !defined(OPENSSL_NO_EC) \ 
     1243    && OPENSSL_VERSION_NUMBER >= 0x1000200fL 
    12351244    int ret; 
    12361245    int curves[PJ_SSL_SOCK_MAX_CURVES]; 
     
    12631272static pj_status_t set_sigalgs(pj_ssl_sock_t *ssock) 
    12641273{ 
    1265 #if OPENSSL_VERSION_NUMBER >= 0x1000200fL 
     1274#if !USING_LIBRESSL && OPENSSL_VERSION_NUMBER >= 0x1000200fL 
    12661275    int ret; 
    12671276 
  • pjproject/trunk/third_party/srtp/crypto/hash/hmac_ossl.c

    r5614 r5726  
    5252#include <openssl/evp.h> 
    5353#include <openssl/hmac.h> 
     54#include <openssl/opensslv.h> 
    5455 
    5556#define SHA1_DIGEST_SIZE                20 
     57#define USING_LIBRESSL (defined(LIBRESSL_VERSION_NUMBER)) 
    5658 
    5759/* the debug module for authentiation */ 
     
    7779/* OpenSSL 1.1.0 made HMAC_CTX an opaque structure, which must be allocated 
    7880   using HMAC_CTX_new.  But this function doesn't exist in OpenSSL 1.0.x. */ 
    79 #if OPENSSL_VERSION_NUMBER < 0x10100000L 
     81#if USING_LIBRESSL || OPENSSL_VERSION_NUMBER < 0x10100000L 
    8082    { 
    8183        /* allocate memory for auth and HMAC_CTX structures */ 
     
    122124    hmac_ctx = (HMAC_CTX*)a->state; 
    123125 
    124 #if OPENSSL_VERSION_NUMBER < 0x10100000L 
     126#if USING_LIBRESSL || OPENSSL_VERSION_NUMBER < 0x10100000L 
    125127    HMAC_CTX_cleanup(hmac_ctx); 
    126128 
Note: See TracChangeset for help on using the changeset viewer.