mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-22 03:12:43 +00:00
[core] Use auto DH params with openssl3
Co-authored-by: Matteo Brancaleoni <matteo.brancaleoni@voismart.it>
This commit is contained in:
parent
9cad385930
commit
ffadaffdd8
@ -3642,10 +3642,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
|
|||||||
unsigned long ssl_ctx_error = 0;
|
unsigned long ssl_ctx_error = 0;
|
||||||
const SSL_METHOD *ssl_method;
|
const SSL_METHOD *ssl_method;
|
||||||
SSL_CTX *ssl_ctx;
|
SSL_CTX *ssl_ctx;
|
||||||
|
#if OPENSSL_VERSION_NUMBER < 0x30000000
|
||||||
BIO *bio;
|
BIO *bio;
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000
|
|
||||||
EVP_PKEY *dh_pk;
|
|
||||||
#else
|
|
||||||
DH *dh;
|
DH *dh;
|
||||||
#endif
|
#endif
|
||||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||||
@ -3726,8 +3724,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
|
|||||||
|
|
||||||
switch_assert(dtls->ssl_ctx);
|
switch_assert(dtls->ssl_ctx);
|
||||||
|
|
||||||
bio = BIO_new_file(dtls->pem, "r");
|
|
||||||
#if OPENSSL_VERSION_NUMBER < 0x30000000
|
#if OPENSSL_VERSION_NUMBER < 0x30000000
|
||||||
|
bio = BIO_new_file(dtls->pem, "r");
|
||||||
dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
|
dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
|
||||||
BIO_free(bio);
|
BIO_free(bio);
|
||||||
if (dh) {
|
if (dh) {
|
||||||
@ -3735,12 +3733,9 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
|
|||||||
DH_free(dh);
|
DH_free(dh);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if((dh_pk = PEM_read_bio_PrivateKey(bio, NULL, NULL, NULL)) != NULL) {
|
if(!SSL_CTX_set_dh_auto(dtls->ssl_ctx, 1)) {
|
||||||
SSL_CTX_set0_tmp_dh_pkey(dtls->ssl_ctx, dh_pk);
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Failed enable auto DH!\n");
|
||||||
EVP_PKEY_free(dh_pk);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BIO_free(bio);
|
|
||||||
#endif
|
#endif
|
||||||
SSL_CTX_set_mode(dtls->ssl_ctx, SSL_MODE_AUTO_RETRY);
|
SSL_CTX_set_mode(dtls->ssl_ctx, SSL_MODE_AUTO_RETRY);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user