Ticket #860: nginx-openssl110pre5.patch

File nginx-openssl110pre5.patch, 1.3 KB (added by Gobelet@…, 11 years ago)

Patch nginx-1.9.15 to allow compiling with openssl-1.1.0-pre5

  • src/event/ngx_event_openssl.c

    a b  
    917917{
    918918    DH   *dh;
    919919    BIO  *bio;
     920#if OPENSSL_VERSION_NUMBER >= 0x10100005L
     921    BIGNUM *p, *g;
     922#endif
    920923
    921924    /*
    922925     * -----BEGIN DH PARAMETERS-----
    … …  
    950953            ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0, "DH_new() failed");
    951954            return NGX_ERROR;
    952955        }
     956#if OPENSSL_VERSION_NUMBER >= 0x10100005L
     957        p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
     958        g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
    953959
     960        if ((p == NULL) || (g == NULL) || !DH_set0_pqg(dh, p, NULL, g)) {
     961            ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0, "BN_bin2bn() failed");
     962            DH_free(dh);
     963            BN_free(p);
     964            BN_free(g);
     965            return NGX_ERROR;
     966        }
     967
     968#else
    954969        dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
    955970        dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
    956971
    … …  
    959974            DH_free(dh);
    960975            return NGX_ERROR;
    961976        }
     977#endif
    962978
    963979        SSL_CTX_set_tmp_dh(ssl->ctx, dh);
    964980
    965981        DH_free(dh);
     982#if OPENSSL_VERSION_NUMBER >= 0x10100005L
     983        BN_free(p);
     984        BN_free(g);
     985#endif
    966986
    967987        return NGX_OK;
    968988    }