From cf756626600b4517ecf810e9d3bc4668366d92c1 Mon Sep 17 00:00:00 2001 From: aymeric Date: Sun, 11 Jan 2009 20:57:48 +0000 Subject: [PATCH] update STUN/fix unix compilation git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@228 3f6dc0c8-ddfe-455d-9043-3cd528dc4637 --- linphone/oRTP/configure.ac | 7 ++++++- linphone/oRTP/src/Makefile.am | 2 +- linphone/oRTP/src/stun.c | 28 ++-------------------------- linphone/oRTP/src/tests/Makefile.am | 2 +- 4 files changed, 10 insertions(+), 29 deletions(-) diff --git a/linphone/oRTP/configure.ac b/linphone/oRTP/configure.ac index 6feb26f64..c3bc04427 100644 --- a/linphone/oRTP/configure.ac +++ b/linphone/oRTP/configure.ac @@ -233,7 +233,12 @@ if test $GCC = yes && test $wall_werror = yes; then CFLAGS="$CFLAGS -Werror " fi -ORTPDEPS_LIBS="$ORTPDEPS_LIBS $PTHREAD_LIBS $PTHREAD_LDFLAGS $SRTP_LIBS" +AC_CHECK_LIB(ssl,SSL_CTX_new,[SSL_LIBS="-lssl"]) +AC_CHECK_LIB(crypto,MD5,[SSL_LIBS="$SSL_LIBS -lcrypto"]) + +AC_SUBST(SSL_LIBS) + +ORTPDEPS_LIBS="$ORTPDEPS_LIBS $PTHREAD_LIBS $PTHREAD_LDFLAGS $SRTP_LIBS $SSL_LIBS" ORTPDEPS_CFLAGS="$ORTPDEPS_CFLAGS $PTHREAD_CFLAGS $ORTP_DEFS $SRTP_CFLAGS" CFLAGS="$CFLAGS $ORTP_DEFS" echo "$ORTPDEPS_CFLAGS" > ortp.defs diff --git a/linphone/oRTP/src/Makefile.am b/linphone/oRTP/src/Makefile.am index 3a6ca3780..7a381f62d 100644 --- a/linphone/oRTP/src/Makefile.am +++ b/linphone/oRTP/src/Makefile.am @@ -33,7 +33,7 @@ libortp_la_SOURCES= str_utils.c \ b64.c -libortp_la_LIBADD= $(PTHREAD_LIBS) -lm $(SRTP_LIBS) +libortp_la_LIBADD= $(PTHREAD_LIBS) -lm $(SRTP_LIBS) $(SSL_LIBS) libortp_la_LDFLAGS= -version-info $(LIBORTP_SO_VERSION) diff --git a/linphone/oRTP/src/stun.c b/linphone/oRTP/src/stun.c index 3de68e5c4..92dd3326a 100644 --- a/linphone/oRTP/src/stun.c +++ b/linphone/oRTP/src/stun.c @@ -1198,10 +1198,10 @@ computeHmac_longterm(char* hmac, const char* input, int length, { unsigned int resultSize=0; unsigned char HA1[16]; - unsigned char HA1_text[1024]; + char HA1_text[1024]; snprintf(HA1_text, sizeof(HA1_text), "%s:%s:%s", username, realm, password); - MD5(HA1_text, strlen(HA1_text), HA1); + MD5((unsigned char *)HA1_text, strlen(HA1_text), HA1); HMAC(EVP_sha1(), HA1, 16, @@ -1220,28 +1220,6 @@ computeHmac_shortterm(char* hmac, const char* input, int length, const char* key } #endif - -static void -toHex(const char* buffer, int bufferSize, char* output) -{ - int i; - static char hexmap[] = "0123456789abcdef"; - - const char* p = buffer; - char* r = output; - for (i=0; i < bufferSize; i++) - { - unsigned char temp = *p++; - - int hi = (temp & 0xf0)>>4; - int low = (temp & 0xf); - - *r++ = hexmap[hi]; - *r++ = hexmap[low]; - } - *r = 0; -} - UInt64 stunGetSystemTimeSecs(void) { @@ -2566,8 +2544,6 @@ turnSendAllocate( Socket myFd, StunAddress4 *dest, const StunAtrString *username, const StunAtrString *password, StunMessage *resp) { - bool_t discard=FALSE; - StunMessage req; char buf[STUN_MAX_MESSAGE_SIZE]; int len = STUN_MAX_MESSAGE_SIZE; diff --git a/linphone/oRTP/src/tests/Makefile.am b/linphone/oRTP/src/tests/Makefile.am index a0ca2e3e0..81daf553f 100644 --- a/linphone/oRTP/src/tests/Makefile.am +++ b/linphone/oRTP/src/tests/Makefile.am @@ -24,5 +24,5 @@ rtpsend_stupid_SOURCES=rtpsend_stupid.c AM_CFLAGS= -D_ORTP_SOURCE $(PTHREAD_CFLAGS) AM_LDFLAGS= $(PTHREAD_LDFLAGS) -LDADD=$(top_builddir)/src/libortp.la $(SRTP_LIBS) +LDADD=$(top_builddir)/src/libortp.la $(SRTP_LIBS) $(SSL_LIBS) INCLUDES=-I$(top_srcdir)/include/