diff --git a/.gitmodules b/.gitmodules index b2adc916d..18aa2320a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -43,3 +43,6 @@ [submodule "submodules/externals/libzrtpcpp"] path = submodules/externals/libzrtpcpp url = git://github.com/wernerd/ZRTPCPP.git +[submodule "submodules/externals/srtp"] + path = submodules/externals/srtp + url = git://git.linphone.org/srtp.git diff --git a/jni/Android.mk b/jni/Android.mk index 26eaa3408..dcbe70a3e 100755 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -10,6 +10,7 @@ LINPHONE_VIDEO=0 BUILD_X264=0 endif +BUILD_SRTP=0 ##ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) ifeq ($(BUILD_GPLV3_ZRTP), 1) @@ -20,6 +21,7 @@ endif ifeq ($(BUILD_SRTP), 1) SRTP_C_INCLUDE= \ + $(linphone-root-dir)/submodules/externals/srtp \ $(linphone-root-dir)/submodules/externals/srtp/include \ $(linphone-root-dir)/submodules/externals/srtp/crypto/include endif diff --git a/res/raw/linphonerc b/res/raw/linphonerc index b490f57df..c6d676668 100644 --- a/res/raw/linphonerc +++ b/res/raw/linphonerc @@ -18,6 +18,8 @@ default_proxy=0 auto_net_state_mon=0 keepalive_period=30000 auto_answer_replacing_calls=1 +media_encryption=srtp +media_encryption_mandatory=0 [rtp] audio_rtp_port=7076 diff --git a/src/org/linphone/core/LinphoneCallParamsImpl.java b/src/org/linphone/core/LinphoneCallParamsImpl.java index ef05eb228..c346dcd1f 100644 --- a/src/org/linphone/core/LinphoneCallParamsImpl.java +++ b/src/org/linphone/core/LinphoneCallParamsImpl.java @@ -28,6 +28,8 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { private native void enableVideo(long nativePtr, boolean b); private native boolean getVideoEnabled(long nativePtr); private native void audioBandwidth(long nativePtr, int bw); + private native void setMediaEncryption(long nativePtr, String menc); + private native String getMediaEncryption(long nativePtr); private native void destroy(long nativePtr); @@ -48,4 +50,12 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { public void setAudioBandwidth(int value) { audioBandwidth(nativePtr, value); } + + public String getMediaEncryption() { + return getMediaEncryption(nativePtr); + } + + public void setMediaEnctyption(String menc) { + setMediaEncryption(nativePtr, menc); + } } diff --git a/src/org/linphone/core/LinphoneCoreImpl.java b/src/org/linphone/core/LinphoneCoreImpl.java index 4b3f9e99c..355523d59 100644 --- a/src/org/linphone/core/LinphoneCoreImpl.java +++ b/src/org/linphone/core/LinphoneCoreImpl.java @@ -104,7 +104,12 @@ class LinphoneCoreImpl implements LinphoneCore { private native void enableEchoLimiter(long nativePtr2, boolean val); private native int setVideoDevice(long nativePtr2, int id); private native int getVideoDevice(long nativePtr2); - + private native String getMediaEncryption(long nativePtr); + private native void setMediaEncryption(long nativePtr, String menc); + private native boolean isMediaEncryptionMandatory(long nativePtr); + private native void setMediaEncryptionMandatory(long nativePtr, boolean yesno); + + LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata); @@ -515,7 +520,7 @@ class LinphoneCoreImpl implements LinphoneCore { public boolean isInConference() { // TODO Auto-generated method stub return false; - } + } public void leaveConference() { // TODO Auto-generated method stub @@ -545,4 +550,17 @@ class LinphoneCoreImpl implements LinphoneCore { // TODO Auto-generated method stub return null; } + + public String getMediaEncryption() { + return getMediaEncryption(nativePtr); + } + public boolean isMediaEncryptionMandatory() { + return isMediaEncryptionMandatory(nativePtr); + } + public void setMediaEncryption(String menc) { + setMediaEncryption(nativePtr, menc); + } + public void setMediaEncryptionMandatory(boolean yesno) { + setMediaEncryptionMandatory(nativePtr, yesno); + } } diff --git a/submodules/externals/build/srtp/Android.mk b/submodules/externals/build/srtp/Android.mk index c047702cd..e9c85e1e0 100644 --- a/submodules/externals/build/srtp/Android.mk +++ b/submodules/externals/build/srtp/Android.mk @@ -26,7 +26,7 @@ LOCAL_SRC_FILES := \ crypto/rng/ctr_prng.c \ crypto/rng/prng.c -LOCAL_CFLAGS := -Wall -O4 -fexpensive-optimizations -funroll-loops -DCPU_CISC +LOCAL_CFLAGS := -Wall -O4 -fexpensive-optimizations -funroll-loops -DCPU_CISC -include config.h ifeq ($(SRTP_USES_LINUX_KERNEL), 1) LOCAL_SRC_FILES += \ diff --git a/submodules/externals/build/srtp/config.h b/submodules/externals/build/srtp/config.h new file mode 100644 index 000000000..52e6cd654 --- /dev/null +++ b/submodules/externals/build/srtp/config.h @@ -0,0 +1,171 @@ +/* crypto/include/config.h. Generated by configure. */ +/* config_in.h. Generated from configure.in by autoheader. */ + +/* Define if building for a CISC machine (e.g. Intel). */ +#define CPU_CISC 1 + +/* Define if building for a RISC machine (assume slow byte access). */ +/* #undef CPU_RISC */ + +/* Path to random device */ +/* #undef DEV_URANDOM */ + +/* Define to compile in dynamic debugging system. */ +#define ENABLE_DEBUGGING 0 + +/* Report errors to this file. */ +/* #undef ERR_REPORTING_FILE */ + +/* Define to use logging to stdout. */ +#define ERR_REPORTING_STDOUT 1 + +/* Define this to use ISMAcryp code. */ +/* #undef GENERIC_AESICM */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BYTESWAP_H */ + +/* Define to 1 if you have the `inet_aton' function. */ +#define HAVE_INET_ATON 1 + +/* Define to 1 if the system has the type `int16_t'. */ +#define HAVE_INT16_T 1 + +/* Define to 1 if the system has the type `int32_t'. */ +#define HAVE_INT32_T 1 + +/* Define to 1 if the system has the type `int8_t'. */ +#define HAVE_INT8_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `socket' library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_MACHINE_TYPES_H 1*/ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYSLOG_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_INT_TYPES_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UIO_H 1 + +/* Define to 1 if the system has the type `uint16_t'. */ +#define HAVE_UINT16_T 1 + +/* Define to 1 if the system has the type `uint32_t'. */ +#define HAVE_UINT32_T 1 + +/* Define to 1 if the system has the type `uint64_t'. */ +#define HAVE_UINT64_T 1 + +/* Define to 1 if the system has the type `uint8_t'. */ +#define HAVE_UINT8_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `usleep' function. */ +#define HAVE_USLEEP 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINDOWS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define to use X86 inlined assembly code */ +/* #undef HAVE_X86 */ + +/* Define to the address where bug reports for this package should be sent. */ +/*#define PACKAGE_BUGREPORT ""*/ + +/* Define to the full name of this package. */ +/*#define PACKAGE_NAME ""*/ + +/* Define to the full name and version of this package. */ +/*#define PACKAGE_STRING ""*/ + +/* Define to the one symbol short name of this package. */ +/*#define PACKAGE_TARNAME ""*/ + +/* Define to the version of this package. */ +/*#define PACKAGE_VERSION ""*/ + +/* The size of a `unsigned long', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_LONG 4 + +/* The size of a `unsigned long long', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_LONG_LONG 8 + +/* Define to use GDOI. */ +/* #undef SRTP_GDOI */ + +/* Define to compile for kernel contexts. */ +/* #undef SRTP_KERNEL */ + +/* Define to compile for Linux kernel context. */ +/* #undef SRTP_KERNEL_LINUX */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Write errors to this file */ +/* #undef USE_ERR_REPORTING_FILE */ + +/* Define to use syslog logging. */ +/* #undef USE_SYSLOG */ + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +/* #undef WORDS_BIGENDIAN */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `unsigned' if does not define. */ +/* #undef size_t */ diff --git a/submodules/externals/srtp b/submodules/externals/srtp new file mode 160000 index 000000000..de53398a1 --- /dev/null +++ b/submodules/externals/srtp @@ -0,0 +1 @@ +Subproject commit de53398a1aa8f60a37bded8d6019649959e7b132 diff --git a/submodules/linphone b/submodules/linphone index 9ea9dcadb..514f67a88 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 9ea9dcadbd06bdc90cffc1e0e95d4e5d1c48fd8e +Subproject commit 514f67a88ad48a4a5a5eef9cfe77fd92b4a11081