Commit b95f5efd5b for freeswitch.com
commit b95f5efd5b3aaeed4e03ae325fa7df748823f181
Author: Andrey Volk <andywolk@gmail.com>
Date: Thu Nov 19 14:12:33 2026 +0300
[Core] Remove the --disable-srtp option and the ENABLE_SRTP guards
diff --git a/Makefile.am b/Makefile.am
index c1cbe575ab..edbd778d0d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -136,10 +136,6 @@ else
CORE_LIBS += libs/apr/libapr-1.la
endif
-if ENABLE_SRTP
-CORE_CFLAGS += -DENABLE_SRTP
-endif
-
MOD_LINK = $(switch_srcdir)/libfreeswitch.la
CLEANFILES = src/include/switch_version.h src/include/switch_swigable_cpp.h
BUILT_SOURCES = src/mod/modules.inc src/include/switch_version.h src/include/switch_swigable_cpp.h
diff --git a/configure.ac b/configure.ac
index f652fe0255..4d92c90d5c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -604,11 +604,6 @@ if test x"${LUA_LIBS}" = x"" ; then
LUA_LIBS="-llua"
fi
-AC_ARG_ENABLE(srtp,
-[AC_HELP_STRING([--disable-srtp],[build without srtp support])],[enable_srtp="$enableval"],[enable_srtp="yes"])
-
-AM_CONDITIONAL([ENABLE_SRTP],[test "${enable_srtp}" = "yes"])
-
have_openal=no
AC_CHECK_LIB(openal, alcLoopbackOpenDeviceSOFT, [have_openal="yes"])
AM_CONDITIONAL([HAVE_OPENAL],[test "${have_openal}" = "yes"])
diff --git a/src/switch_rtp.c b/src/switch_rtp.c
index 77265a773e..7fe7c66e07 100644
--- a/src/switch_rtp.c
+++ b/src/switch_rtp.c
@@ -99,7 +99,6 @@ typedef char switch_rtp_hdr_size_check_t[sizeof(switch_rtp_hdr_t) == 12 ? 1 : -1
#ifdef _MSC_VER
#pragma pack()
-#define ENABLE_SRTP
#endif
static switch_hash_t *alloc_hash = NULL;
@@ -1561,7 +1560,6 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
}
-#ifdef ENABLE_SRTP
SWITCH_DECLARE(void) switch_srtp_err_to_txt(srtp_err_status_t stat, char **msg)
{
if (stat == srtp_err_status_replay_fail) *msg="replay check failed";
@@ -1593,7 +1591,6 @@ SWITCH_DECLARE(void) switch_srtp_err_to_txt(srtp_err_status_t stat, char **msg)
else if (stat == srtp_err_status_pkt_idx_adv) *msg="packet index advanced, reset needed";
else *msg="";
}
-#endif
SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t *pool)
{
@@ -1601,7 +1598,6 @@ SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t *pool)
return;
}
switch_core_hash_init(&alloc_hash);
-#ifdef ENABLE_SRTP
{
srtp_err_status_t stat = srtp_init();
if (stat == srtp_err_status_ok) {
@@ -1625,7 +1621,6 @@ SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t *pool)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error initializing SRTP (%d).\n", stat);
}
}
-#endif
switch_mutex_init(&port_lock, SWITCH_MUTEX_NESTED, pool);
switch_rtp_dtls_init();
global_init = 1;
@@ -2559,7 +2554,6 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
-#ifdef ENABLE_SRTP
switch_mutex_lock(rtp_session->ice_mutex);
if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND]) {
int stat = 0;
@@ -2580,7 +2574,6 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
}
}
switch_mutex_unlock(rtp_session->ice_mutex);
-#endif
//#define DEBUG_EXTRA
#ifdef DEBUG_EXTRA
@@ -2663,13 +2656,11 @@ SWITCH_DECLARE(void) switch_rtp_shutdown(void)
switch_core_hash_destroy(&alloc_hash);
switch_mutex_unlock(port_lock);
-#ifdef ENABLE_SRTP
if (srtp_keepalive) {
srtp_dealloc(srtp_keepalive);
srtp_keepalive = NULL;
}
srtp_shutdown();
-#endif
switch_rtp_dtls_destroy();
global_init = 0;
}
@@ -3876,7 +3867,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_del_dtls(switch_rtp_t *rtp_session, d
}
-#ifdef ENABLE_SRTP
if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND]) {
int x;
@@ -3902,7 +3892,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_del_dtls(switch_rtp_t *rtp_session, d
}
}
}
-#endif
done:
@@ -4187,10 +4176,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_session, switch_rtp_crypto_direction_t direction, uint32_t index, switch_secure_settings_t *ssec)
{
-#ifndef ENABLE_SRTP
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_CRIT, "SRTP NOT SUPPORTED IN THIS BUILD!\n");
- return SWITCH_STATUS_FALSE;
-#else
switch_rtp_crypto_key_t *crypto_key;
srtp_policy_t *policy;
@@ -4528,7 +4513,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
return SWITCH_STATUS_SUCCESS;
-#endif
}
SWITCH_DECLARE(switch_status_t) switch_rtp_set_interval(switch_rtp_t *rtp_session, uint32_t ms_per_packet, uint32_t samples_per_interval)
@@ -5365,9 +5349,7 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
{
void *pop;
switch_socket_t *sock;
-#ifdef ENABLE_SRTP
int x;
-#endif
if (!rtp_session || !*rtp_session || !(*rtp_session)->ready) {
return;
@@ -5459,7 +5441,6 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
switch_socket_close(sock);
}
-#ifdef ENABLE_SRTP
if ((*rtp_session)->flags[SWITCH_RTP_FLAG_SECURE_SEND]) {
for(x = 0; x < 2; x++) {
if ((*rtp_session)->send_ctx[x]) {
@@ -5479,7 +5460,6 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
}
(*rtp_session)->flags[SWITCH_RTP_FLAG_SECURE_RECV] = 0;
}
-#endif
if ((*rtp_session)->timer.timer_interface) {
switch_core_timer_destroy(&(*rtp_session)->timer);
@@ -6656,7 +6636,6 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
if (rtp_session->has_rtcp) {
*flags |= SFF_RTCP;
-#ifdef ENABLE_SRTP
if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV]) {
int sbytes = (int) *bytes;
srtp_err_status_t stat = 0;
@@ -6676,7 +6655,6 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
*bytes = sbytes;
}
-#endif
switch_mutex_unlock(rtp_session->ice_mutex);
return SWITCH_STATUS_SUCCESS;
}
@@ -6806,7 +6784,6 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
if (*bytes) {
if (!rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] && !rtp_session->flags[SWITCH_RTP_FLAG_UDPTL]) {
-#ifdef ENABLE_SRTP
switch_mutex_lock(rtp_session->ice_mutex);
if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] && rtp_session->has_rtp &&
(check_recv_payload(rtp_session) ||
@@ -6883,7 +6860,6 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
*bytes = sbytes;
}
switch_mutex_unlock(rtp_session->ice_mutex);
-#endif
}
@@ -7661,7 +7637,6 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
}
}
-#ifdef ENABLE_SRTP
if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] && rtp_session->rtcp_recv_msg_p->header.version == 2) {
//if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] && (!rtp_session->ice.ice_user || rtp_session->rtcp_recv_msg_p->header.version == 2)) {
int sbytes = (int) *bytes;
@@ -7684,7 +7659,6 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
*bytes = sbytes;
}
-#endif
switch_mutex_unlock(rtp_session->ice_mutex);
@@ -8144,7 +8118,6 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
switch_rtp_test_flag(other_rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP)) {
other_rtp_session->rtcp_send_msg = rtp_session->rtcp_recv_msg;
-#ifdef ENABLE_SRTP
switch_mutex_lock(other_rtp_session->ice_mutex);
if (switch_rtp_test_flag(other_rtp_session, SWITCH_RTP_FLAG_SECURE_SEND)) {
int stat = 0;
@@ -8162,7 +8135,6 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
rtcp_bytes = sbytes;
}
switch_mutex_unlock(other_rtp_session->ice_mutex);
-#endif
if (switch_socket_sendto(other_rtp_session->rtcp_sock_output, other_rtp_session->rtcp_remote_addr, 0,
(const char*)&other_rtp_session->rtcp_send_msg, &rtcp_bytes ) != SWITCH_STATUS_SUCCESS) {
@@ -9119,7 +9091,6 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
switch_swap_linear((int16_t *)send_msg->body, (int) datalen);
}
-#ifdef ENABLE_SRTP
switch_mutex_lock(rtp_session->ice_mutex);
if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND]) {
int sbytes = (int) bytes;
@@ -9159,7 +9130,6 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
bytes = sbytes;
}
switch_mutex_unlock(rtp_session->ice_mutex);
-#endif
now = switch_micro_time_now();
#ifdef RTP_DEBUG_WRITE_DELTA
@@ -9646,7 +9616,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_write_raw(switch_rtp_t *rtp_session,
WRITE_INC(rtp_session);
if (process_encryption) {
-#ifdef ENABLE_SRTP
switch_mutex_lock(rtp_session->ice_mutex);
if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND]) {
@@ -9681,13 +9650,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_write_raw(switch_rtp_t *rtp_session,
*bytes = sbytes;
}
switch_mutex_unlock(rtp_session->ice_mutex);
-#endif
}
status = switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, data, bytes);
-#if defined(ENABLE_SRTP)
end:
-#endif
WRITE_DEC(rtp_session);