Commit 5e37fa55 authored by johan's avatar johan

Move srtp from ortp to mediastreamer2

parent fbe5a32a
......@@ -34,19 +34,11 @@ set(ORTP_SO_VERSION "9")
option(ENABLE_STATIC "Build static library (default is shared library)." NO)
option(ENABLE_NTP_TIMESTAMP "Turn on NTP timestamping on packet reception." NO)
option(ENABLE_PERF "Disable costly features to reduce cpu consumtion and increase performance." NO)
option(ENABLE_SRTP "Build oRTP with the SRTP transport support." YES)
option(ENABLE_TESTS "Enable compilation of test programs." NO)
set(CACHE WITH_THREAD_STACK_SIZE "0" CACHE STRING "Set thread stack size (0 is the OS default).")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_PREFIX_PATH}/share/cmake/Modules)
if(ENABLE_SRTP)
find_package(SRTP)
if(NOT SRTP_FOUND)
message(WARNING "Could not find SRTP library, oRTP will be compiled without SRTP support.")
set(ENABLE_SRTP OFF CACHE BOOL "Build oRTP with the SRTP transport support." FORCE)
endif()
endif()
find_package(Doxygen)
......@@ -147,17 +139,11 @@ include_directories(
src/
${CMAKE_CURRENT_BINARY_DIR}
)
if(SRTP_FOUND)
include_directories(${SRTP_INCLUDE_DIRS})
endif()
if(MSVC)
include_directories(${CMAKE_PREFIX_PATH}/include/MSVC)
endif()
if(SRTP_FOUND)
set(HAVE_SRTP 1)
endif()
if(ENABLE_STATIC)
set(ORTP_STATIC 1)
endif()
......@@ -197,9 +183,6 @@ set(ORTP_CPPFLAGS )
if(ORTP_STATIC)
list(APPEND ORTP_CPPFLAGS "-DORTP_STATIC")
endif()
if(SRTP_FOUND)
list(APPEND ORTP_CPPFLAGS "-DORTP_HAVE_SRTP")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FindORTP.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FindORTP.cmake @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FindORTP.cmake
DESTINATION share/cmake/Modules
......@@ -233,9 +216,6 @@ set(libdir ${prefix}/lib)
set(includedir ${prefix}/include)
set(ORTP_PKGCONFIG_VERSION "${ORTP_VERSION}")
set(ORTPDEPS_LIBS )
if(SRTP_FOUND)
list(APPEND ORTPDEPS_LIBS "-lsrtp")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ortp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/ortp.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ortp.pc DESTINATION lib/pkgconfig)
......
......@@ -129,18 +129,6 @@ AC_ARG_ENABLE(debug,
[debug_enabled=no]
)
AC_ARG_ENABLE(broken_srtp,
[AS_HELP_STRING([--enable-broken-srtp], [Skip some sanity test (default=no)])],
[case "${enableval}" in
yes) test_for_broken_srtp=no;;
no) test_for_broken_srtp=yes;;
*) AC_MSG_ERROR("Bad value for --enable-broken-srtp");;
esac],
[test_for_broken_srtp=yes]
)
hpux_host=no
posixtimer_interval=10000
PTHREAD_LDFLAGS=
......@@ -236,66 +224,6 @@ if test "$rt_enabled" = "yes" ; then
fi
dnl check for libsrtp support (secure rtp)
AC_ARG_WITH(srtp,
AC_HELP_STRING([--with-srtp], [Set prefix where libsrtp can be found or "none" to disable (ex:/usr or /usr/local) [[default=/usr]]]),
[srtp_prefix=$withval],
[srtp_prefix=/usr]
)
if test "${srtp_prefix}" != "none" ; then
if test "${srtp_prefix}" != "/usr" || test "$mingw_found" = "yes" ; then
SRTP_CFLAGS="-I${srtp_prefix}/include -I${srtp_prefix}/include/srtp"
SRTP_LIBS="-L${srtp_prefix}/lib"
fi
SRTP_LIBS="$SRTP_LIBS -lsrtp"
dnl check srtp headers
have_srtp=no
CPPFLAGS_save=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $SRTP_CFLAGS"
AC_CHECK_HEADER([srtp/srtp.h],have_srtp_headers=yes)
CPPFLAGS=$CPPFLAGS_save
dnl check for srtp lib
LDFLAGS_save=$LDFLAGS
LDFLAGS="$LDFLAGS $SRTP_LIBS"
LIBS_save=$LIBS
AC_CHECK_LIB(srtp,srtp_init,have_srtp_lib=yes)
AC_CHECK_LIB(srtp,srtp_shutdown,[AC_DEFINE([HAVE_SRTP_SHUTDOWN],1,[Defined when srtp_shutdown() exists.])])
LDFLAGS=$LDFLAGS_save
LIBS=$LIBS_save
if test "$have_srtp_headers$have_srtp_lib" = "yesyes" ; then
have_srtp=yes
if test "$test_for_broken_srtp" = yes; then
LDFLAGS_save=$LDFLAGS
LDFLAGS="$LDFLAGS $SRTP_LIBS"
LIBS_save=$LIBS
AC_CHECK_LIB(srtp,sha1_update,[
AC_MSG_ERROR([This libsrtp version exports symbols conflicting with polar ssl, resulting in a bad execution path.
Please use the one from git://git.linphone.org/srtp.git
You could also track resolution of defect on https://github.com/cisco/libsrtp/issues/28
If you are not linking against polar ssl, you may prefer to skip this test with --enable-broken-srtp
])], have_srtp=yes)
LDFLAGS=$LDFLAGS_save
LIBS=$LIBS_save
fi
AC_DEFINE(HAVE_SRTP, 1, [Defined when srtp support is compiled])
ORTP_DEFS="$ORTP_DEFS -DORTP_HAVE_SRTP"
else
AC_MSG_NOTICE([Could not find libsrtp headers or lib, cryto transport disabled.])
SRTP_CFLAGS=
SRTP_LIBS=
fi
AC_SUBST(SRTP_CFLAGS)
AC_SUBST(SRTP_LIBS)
else
have_srtp=no
SRTP_CFLAGS=
SRTP_LIBS=
fi
if test $debug_enabled = "yes"; then
ORTP_DEFS="$ORTP_DEFS -DORTP_DEBUG_MODE"
CFLAGS=`echo $CFLAGS | sed 's/-O.//'`
......@@ -369,8 +297,8 @@ fi
AC_SUBST(SSL_LIBS)
ORTPDEPS_LIBS="$ORTPDEPS_LIBS $PTHREAD_LIBS $PTHREAD_LDFLAGS $RT_LIBS $SRTP_LIBS $SSL_LIBS"
ORTPDEPS_CFLAGS="$ORTPDEPS_CFLAGS $PTHREAD_CFLAGS $ORTP_DEFS $SRTP_CFLAGS"
ORTPDEPS_LIBS="$ORTPDEPS_LIBS $PTHREAD_LIBS $PTHREAD_LDFLAGS $RT_LIBS $SSL_LIBS"
ORTPDEPS_CFLAGS="$ORTPDEPS_CFLAGS $PTHREAD_CFLAGS $ORTP_DEFS"
CFLAGS="$CFLAGS $ORTP_DEFS"
echo "$ORTPDEPS_CFLAGS" > ortp.defs
......
......@@ -5,7 +5,7 @@ ortp_includedir=$(includedir)/ortp
ortp_include_HEADERS=str_utils.h rtpsession.h rtp.h port.h logging.h \
ortp.h telephonyevents.h sessionset.h payloadtype.h rtpprofile.h rtpsignaltable.h \
rtcp.h \
event.h stun.h stun_udp.h ortp_srtp.h \
event.h stun.h stun_udp.h \
b64.h
EXTRA_DIST=$(ortp_include_HEADERS)
/*
The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ortp_srtp_h
#define ortp_srtp_h
#if defined(HAVE_SRTP) || defined(ORTP_HAVE_SRTP)
#if defined(ANDROID) || !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
// Android and Windows phone don't use make install
# include <srtp.h>
# else
# include <srtp/srtp.h>
# endif
#else
typedef void* srtp_t;
typedef int err_status_t;
typedef struct srtp_policy srtp_policy_t;
#endif
/*srtp defines all this stuff*/
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#include <ortp/rtpsession.h>
#ifdef __cplusplus
extern "C"{
#endif
enum ortp_srtp_crypto_suite_t {
AES_128_SHA1_80 = 1,
AES_128_SHA1_32,
AES_128_NO_AUTH,
NO_CIPHER_SHA1_80,
AES_256_SHA1_80,
AES_256_SHA1_32
};
ORTP_PUBLIC err_status_t ortp_srtp_init(void);
ORTP_PUBLIC err_status_t ortp_srtp_create(srtp_t *session, const srtp_policy_t *policy);
ORTP_PUBLIC err_status_t ortp_srtp_dealloc(srtp_t session);
ORTP_PUBLIC err_status_t ortp_srtp_add_stream(srtp_t session, const srtp_policy_t *policy);
ORTP_PUBLIC err_status_t ortp_srtp_remove_stream(srtp_t session, uint32_t ssrc);
ORTP_PUBLIC err_status_t ortp_crypto_get_random(uint8_t *tmp, int size);
ORTP_PUBLIC bool_t ortp_srtp_supported(void);
/**
* @deprecated Use srtp_transport_modifier_new() instead. Using #srtp_transport_new will prevent usage of multiple
* encryptions and/or custom packets transmission.
*/
ORTP_PUBLIC int srtp_transport_new(srtp_t srtp, RtpTransport **rtpt, RtpTransport **rtcpt );
ORTP_PUBLIC void srtp_transport_destroy(RtpTransport *tp);
ORTP_PUBLIC srtp_t ortp_srtp_create_configure_session(enum ortp_srtp_crypto_suite_t suite, uint32_t ssrc, const char* snd_key, const char* rcv_key);
ORTP_PUBLIC int srtp_transport_modifier_new(srtp_t srtp, RtpTransportModifier **rtpt, RtpTransportModifier **rtcpt );
ORTP_PUBLIC void srtp_transport_modifier_destroy(RtpTransportModifier *tp);
ORTP_PUBLIC void ortp_srtp_shutdown(void);
#ifdef __cplusplus
}
#endif
#endif
......@@ -24,9 +24,6 @@ set(LIBS ${CMAKE_THREAD_LIBS_INIT})
if(HAVE_RT)
list(APPEND LIBS rt)
endif()
if(SRTP_FOUND)
list(APPEND LIBS ${SRTP_LIBRARIES})
endif()
set(SOURCE_FILES
avprofile.c
......@@ -36,7 +33,6 @@ set(SOURCE_FILES
logging.c
netsim.c
ortp.c
ortp_srtp.c
payloadtype.c
port.c
posixtimer.c
......
......@@ -11,8 +11,7 @@ AM_CFLAGS=\
$(STRICT_OPTIONS) \
$(STRICT_OPTIONS_CC) \
$(PTHREAD_CFLAGS) \
$(TRUESPEECH_CFLAGS) \
$(SRTP_CFLAGS)
$(TRUESPEECH_CFLAGS)
AM_LDFLAGS=$(PTHREAD_LDFLAGS)
......@@ -43,11 +42,10 @@ libortp_la_SOURCES= str_utils.c \
rtcpparse.c \
event.c \
stun.c stun_udp.c \
ortp_srtp.c \
b64.c \
netsim.c
libortp_la_LIBADD= $(PTHREAD_LIBS) $(RT_LIBS) -lm $(SRTP_LIBS) $(SSL_LIBS)
libortp_la_LIBADD= $(PTHREAD_LIBS) $(RT_LIBS) -lm $(SSL_LIBS)
libortp_la_LDFLAGS= -version-info $(LIBORTP_SO_VERSION) -no-undefined
......
......@@ -31,15 +31,6 @@ rtp_stats_t ortp_global_stats;
int ortp_allocations=0;
#endif
#ifdef HAVE_SRTP
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#include "ortp/ortp_srtp.h"
#endif
RtpScheduler *__ortp_scheduler;
......@@ -90,9 +81,6 @@ void ortp_init()
ortp_global_stats_reset();
init_random_number_generator();
#ifdef HAVE_SRTP
ortp_srtp_init();
#endif
ortp_message("oRTP-" ORTP_VERSION " initialized.");
}
......@@ -139,9 +127,6 @@ void ortp_exit()
rtp_scheduler_destroy(__ortp_scheduler);
__ortp_scheduler=NULL;
}
#ifdef HAVE_SRTP
ortp_srtp_shutdown();
#endif
}
}
......
This diff is collapsed.
......@@ -22,32 +22,32 @@
set(RTPSEND_SOURCES rtpsend.c)
add_executable(rtpsend ${RTPSEND_SOURCES})
target_link_libraries(rtpsend ${SRTP_LIBRARIES} ${ZRTP_LIBRARIES} ortp)
target_link_libraries(rtpsend ortp)
set(RTPRECV_SOURCES rtprecv.c)
add_executable(rtprecv ${RTPRECV_SOURCES})
target_link_libraries(rtprecv ${SRTP_LIBRARIES} ${ZRTP_LIBRARIES} ortp)
target_link_libraries(rtprecv ortp)
set(MRTPSEND_SOURCES mrtpsend.c)
add_executable(mrtpsend ${MRTPSEND_SOURCES})
target_link_libraries(mrtpsend ${SRTP_LIBRARIES} ${ZRTP_LIBRARIES} ortp)
target_link_libraries(mrtpsend ortp)
set(MRTPRECV_SOURCES mrtprecv.c)
add_executable(mrtprecv ${RTPRECV_SOURCES})
target_link_libraries(mrtprecv ${SRTP_LIBRARIES} ${ZRTP_LIBRARIES} ortp)
target_link_libraries(mrtprecv ortp)
set(TEST_TIMER_SOURCES test_timer.c)
add_executable(test_timer ${TEST_TIMER_SOURCES})
target_link_libraries(test_timer ${SRTP_LIBRARIES} ${ZRTP_LIBRARIES} ortp)
target_link_libraries(test_timer ortp)
set(TEVRTPSEND_SOURCES tevrtpsend.c)
add_executable(tevrtpsend ${TEVRTPSEND_SOURCES})
target_link_libraries(tevrtpsend ${SRTP_LIBRARIES} ${ZRTP_LIBRARIES} ortp)
target_link_libraries(tevrtpsend ortp)
set(TEVRTPRECV_SOURCES tevrtprecv.c)
add_executable(tevrtprecv ${TEVRTPRECV_SOURCES})
target_link_libraries(tevrtprecv ${SRTP_LIBRARIES} ${ZRTP_LIBRARIES} ortp)
target_link_libraries(tevrtprecv ortp)
set(RTPSEND_STUPID_SOURCES rtpsend_stupid.c)
add_executable(rtpsend_stupid ${RTPSEND_STUPID_SOURCES})
target_link_libraries(rtpsend_stupid ${SRTP_LIBRARIES} ${ZRTP_LIBRARIES} ortp)
target_link_libraries(rtpsend_stupid ortp)
......@@ -29,4 +29,4 @@ endif
AM_CPPFLAGS=-I$(top_srcdir)/include/
AM_CFLAGS=-D_ORTP_SOURCE $(PTHREAD_CFLAGS)
AM_LDFLAGS=$(PTHREAD_LDFLAGS)
LDADD=$(top_builddir)/src/libortp.la $(SRTP_LIBS) $(SSL_LIBS) $(LIBZRTPCPP_LIBS)
LDADD=$(top_builddir)/src/libortp.la $(SSL_LIBS)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment