[Opalvoip-svn] SF.net SVN: opalvoip:[34814] opal/trunk
Brought to you by:
csoutheren,
rjongbloed
From: <rjo...@us...> - 2016-05-05 11:05:34
|
Revision: 34814 http://sourceforge.net/p/opalvoip/code/34814 Author: rjongbloed Date: 2016-05-05 11:05:32 +0000 (Thu, 05 May 2016) Log Message: ----------- Added support for system based SRTP library version 1.5 API. Modified Paths: -------------- opal/trunk/configure opal/trunk/configure.ac opal/trunk/include/opal_config.h.in opal/trunk/src/rtp/srtp_session.cxx Modified: opal/trunk/configure =================================================================== --- opal/trunk/configure 2016-05-03 08:41:16 UTC (rev 34813) +++ opal/trunk/configure 2016-05-05 11:05:32 UTC (rev 34814) @@ -7186,8 +7186,42 @@ SRTP_MSG="yes (system)" + oldCPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS " + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SRTP const in error functions" >&5 +$as_echo_n "checking for SRTP const in error functions... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#inclide <srtp/srtp.h> +int +main () +{ +err_status_t err_reporting_init(const char *ident) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + usable=yes else + usable=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $usable" >&5 +$as_echo "$usable" >&6; } + CPPFLAGS="$oldCPPFLAGS" + + if test "x$usable" = "xyes"; then : + $as_echo "#define OPAL_SRTP_ERROR_CONST const" >>confdefs.h + + +fi + + + +else + enable_option_checking=no @@ -7196,7 +7230,9 @@ $as_echo "#define HAS_SRTP_SRTP_H 0" >>confdefs.h SRTP_MSG="yes (internal)" + $as_echo "#define OPAL_SRTP_ERROR_CONST /*const*/" >>confdefs.h + fi fi Modified: opal/trunk/configure.ac =================================================================== --- opal/trunk/configure.ac 2016-05-03 08:41:16 UTC (rev 34813) +++ opal/trunk/configure.ac 2016-05-05 11:05:32 UTC (rev 34814) @@ -185,10 +185,18 @@ AS_VAR_IF([SRTP_SYSTEM],[yes],[ AC_DEFINE(HAS_SRTP_SRTP_H,1) SRTP_MSG="yes (system)" + MY_COMPILE_IFELSE( + [for SRTP const in error functions], + [], + [#inclide <srtp/srtp.h>], + [err_status_t err_reporting_init(const char *ident)], + [AC_DEFINE(OPAL_SRTP_ERROR_CONST, const)] + ) ],[ AC_CONFIG_SUBDIRS(src/rtp/libsrtp) AC_DEFINE(HAS_SRTP_SRTP_H,0) SRTP_MSG="yes (internal)" + AC_DEFINE(OPAL_SRTP_ERROR_CONST, [/*const*/]) ]) ) Modified: opal/trunk/include/opal_config.h.in =================================================================== --- opal/trunk/include/opal_config.h.in 2016-05-03 08:41:16 UTC (rev 34813) +++ opal/trunk/include/opal_config.h.in 2016-05-05 11:05:32 UTC (rev 34814) @@ -288,6 +288,7 @@ #if OPAL_PTLIB_SSL #undef OPAL_SRTP + #undef OPAL_SRTP_ERROR_CONST #undef HAS_SRTP_SRTP_H #endif Modified: opal/trunk/src/rtp/srtp_session.cxx =================================================================== --- opal/trunk/src/rtp/srtp_session.cxx 2016-05-03 08:41:16 UTC (rev 34813) +++ opal/trunk/src/rtp/srtp_session.cxx 2016-05-05 11:05:32 UTC (rev 34814) @@ -41,6 +41,7 @@ #include <rtp/dtls_srtp_session.h> #include <h323/h323caps.h> #include <ptclib/cypher.h> +#include <ptclib/random.h> #define PTraceModule() "SRTP" @@ -179,12 +180,12 @@ extern "C" { err_reporting_level_t err_level = err_level_none; - err_status_t err_reporting_init(char *) + err_status_t err_reporting_init(OPAL_SRTP_ERROR_CONST char *) { return err_status_ok; } - void err_report(int PTRACE_PARAM(priority), char * PTRACE_PARAM(format), ...) + void err_report(int PTRACE_PARAM(priority), OPAL_SRTP_ERROR_CONST char * PTRACE_PARAM(format), ...) { #if PTRACING va_list args; @@ -396,11 +397,8 @@ void OpalSRTPKeyInfo::Randomise() { - m_key.SetSize(m_cryptoSuite.GetCipherKeyBytes()); - rand_source_get_octet_string(m_key.GetPointer(), m_key.GetSize()); - - m_salt.SetSize(m_cryptoSuite.GetAuthSaltBytes()); - rand_source_get_octet_string(m_salt.GetPointer(), m_salt.GetSize()); + m_key = PRandom::Octets(m_key.GetSize()); + m_salt = PRandom::Octets(m_cryptoSuite.GetAuthSaltBytes()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |