Merge "res_rtp_asterisk: Don't leak temporary key when enabling PFS." into 13

This commit is contained in:
Mark Michelson
2015-08-05 12:45:09 -05:00
committed by Gerrit Code Review

View File

@@ -1268,6 +1268,9 @@ static int ast_rtp_dtls_set_configuration(struct ast_rtp_instance *instance, con
{ {
struct ast_rtp *rtp = ast_rtp_instance_get_data(instance); struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
int res; int res;
#ifndef HAVE_OPENSSL_ECDH_AUTO
EC_KEY *ecdh;
#endif
if (!dtls_cfg->enabled) { if (!dtls_cfg->enabled) {
return 0; return 0;
@@ -1291,8 +1294,11 @@ static int ast_rtp_dtls_set_configuration(struct ast_rtp_instance *instance, con
#ifdef HAVE_OPENSSL_ECDH_AUTO #ifdef HAVE_OPENSSL_ECDH_AUTO
SSL_CTX_set_ecdh_auto(rtp->ssl_ctx, 1); SSL_CTX_set_ecdh_auto(rtp->ssl_ctx, 1);
#else #else
SSL_CTX_set_tmp_ecdh(rtp->ssl_ctx, ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
EC_KEY_new_by_curve_name(NID_X9_62_prime256v1)); if (ecdh) {
SSL_CTX_set_tmp_ecdh(rtp->ssl_ctx, ecdh);
EC_KEY_free(ecdh);
}
#endif #endif
rtp->dtls_verify = dtls_cfg->verify; rtp->dtls_verify = dtls_cfg->verify;