Rename openssl libs. ZRTP API and makefiles.
This commit is contained in:
parent
7d6d9cf676
commit
a715bd27de
12 changed files with 239 additions and 10 deletions
|
@ -4,11 +4,26 @@ BUILD_AMR=light
|
|||
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||
BUILD_X264=1
|
||||
LINPHONE_VIDEO=1
|
||||
else
|
||||
BUILD_X264=0
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||
ifeq ($(BUILD_GPLV3_ZRTP), 1)
|
||||
WITH_OPENSSL=1
|
||||
BUILD_SRTP=1
|
||||
ZRTP_C_INCLUDE= \
|
||||
$(root-dir)/submodules/externals/libzrtpcpp/src
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_SRTP), 1)
|
||||
SRTP_C_INCLUDE= \
|
||||
$(root-dir)/submodules/externals/srtp/include \
|
||||
$(root-dir)/submodules/externals/srtp/crypto/include
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
|
||||
include $(root-dir)/submodules/externals/build/speex/Android.mk
|
||||
|
||||
include $(root-dir)/submodules/externals/build/gsm/Android.mk
|
||||
|
@ -26,6 +41,8 @@ include $(root-dir)/submodules/linphone/oRTP/build/android/Android.mk
|
|||
include $(root-dir)/submodules/linphone/mediastreamer2/build/android/Android.mk
|
||||
include $(root-dir)/submodules/linphone/mediastreamer2/tests/Android.mk
|
||||
|
||||
|
||||
|
||||
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||
include $(root-dir)/submodules/msilbc/Android.mk
|
||||
|
||||
|
@ -35,8 +52,17 @@ include $(root-dir)/submodules/externals/build/x264/Android.mk
|
|||
endif
|
||||
|
||||
include $(root-dir)/submodules/externals/build/ffmpeg/Android.mk
|
||||
|
||||
ifeq ($(BUILD_GPLV3_ZRTP), 1)
|
||||
include $(root-dir)/submodules/externals/build/libzrtpcpp/Android.mk
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_SRTP), 1)
|
||||
include $(root-dir)/submodules/externals/build/srtp/Android.mk
|
||||
endif
|
||||
endif #armeabi-v7a
|
||||
|
||||
|
||||
include $(root-dir)/submodules/linphone/build/android/Android.mk
|
||||
|
||||
ifneq ($(BUILD_AMR), 0)
|
||||
|
@ -45,3 +71,4 @@ include $(root-dir)/submodules/msamr/Android.mk
|
|||
endif
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
APP_PROJECT_PATH := $(call my-dir)/../
|
||||
APP_MODULES :=libspeex libgsm libortp libosip2 libeXosip2 libmediastreamer2 liblinphone
|
||||
#APP_STL := stlport_static
|
||||
APP_STL := stlport_static
|
||||
|
||||
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||
APP_MODULES +=libmsilbc
|
||||
|
@ -15,7 +15,7 @@ APP_MODULES += libopencoreamr libmsamr
|
|||
endif
|
||||
|
||||
ifeq ($(WITH_OPENSSL),1)
|
||||
APP_MODULES += libcrypto libssl
|
||||
APP_MODULES += liblincrypto liblinssl
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_X264),1)
|
||||
|
@ -26,6 +26,17 @@ ifeq ($(RING),yes)
|
|||
APP_MODULES += libring
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||
ifeq ($(BUILD_GPLV3_ZRTP), 1)
|
||||
APP_MODULES += libzrtpcpp
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_SRTP), 1)
|
||||
APP_MODULES += libsrtp
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
APP_BUILD_SCRIPT:=$(call my-dir)/Android.mk
|
||||
APP_PLATFORM := android-8
|
||||
APP_ABI := armeabi armeabi-v7a
|
||||
|
|
|
@ -420,6 +420,17 @@ public class DialerActivity extends SoftVolumeActivity implements LinphoneGuiLis
|
|||
}
|
||||
}
|
||||
|
||||
public void onCallEncryptionChanged(LinphoneCall call, boolean encrypted,
|
||||
String authenticationToken) {
|
||||
if (encrypted) {
|
||||
boolean verified=call.isAuthenticationTokenVerified();
|
||||
mStatus.setText("Call encrypted ["+ authenticationToken+"] "
|
||||
+ (verified ? "verified":"unverified"));
|
||||
} else {
|
||||
mStatus.setText("Call not encrypted");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
// When coming back from a video call, if the phone orientation is different
|
||||
|
@ -434,4 +445,6 @@ public class DialerActivity extends SoftVolumeActivity implements LinphoneGuiLis
|
|||
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -112,11 +112,11 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
private static Transports initialTransports;
|
||||
private static LinphonePreferenceManager lpm;
|
||||
private String lastLcStatusMessage;
|
||||
|
||||
private String basePath;
|
||||
|
||||
|
||||
private LinphoneManager(final Context c) {
|
||||
String basePath = c.getFilesDir().getAbsolutePath();
|
||||
basePath = c.getFilesDir().getAbsolutePath();
|
||||
linphoneInitialConfigFile = basePath + "/linphonerc";
|
||||
linphoneConfigFile = basePath + "/.linphonerc";
|
||||
ringSoundFile = basePath + "/oldphone_mono.wav";
|
||||
|
@ -322,6 +322,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
this, linphoneConfigFile, linphoneInitialConfigFile, null);
|
||||
|
||||
mLc.enableIpv6(mPref.getBoolean(getString(R.string.pref_ipv6_key), false));
|
||||
mLc.setZrtpSecretsCache(basePath+"/zrtp_secrets");
|
||||
|
||||
mLc.setPlaybackGain(3);
|
||||
mLc.setRing(null);
|
||||
|
@ -400,7 +401,8 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
|
||||
try {
|
||||
// Configure audio codecs
|
||||
enableDisableAudioCodec("speex", 32000, R.string.pref_codec_speex32_key);
|
||||
// enableDisableAudioCodec("speex", 32000, R.string.pref_codec_speex32_key);
|
||||
enableDisableAudioCodec("speex", 32000, false);
|
||||
enableDisableAudioCodec("speex", 16000, R.string.pref_codec_speex16_key);
|
||||
enableDisableAudioCodec("speex", 8000, R.string.pref_codec_speex8_key);
|
||||
enableDisableAudioCodec("iLBC", 8000, R.string.pref_codec_ilbc_key);
|
||||
|
@ -545,6 +547,12 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
mLc.enablePayloadType(pt, enable);
|
||||
}
|
||||
}
|
||||
private void enableDisableAudioCodec(String codec, int rate, boolean enable) throws LinphoneCoreException {
|
||||
PayloadType pt = mLc.findPayloadType(codec, rate);
|
||||
if (pt !=null) {
|
||||
mLc.enablePayloadType(pt, enable);
|
||||
}
|
||||
}
|
||||
|
||||
private void enableDisableVideoCodecs(PayloadType videoCodec) throws LinphoneCoreException {
|
||||
String mime = videoCodec.getMime();
|
||||
|
@ -609,6 +617,8 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
void onRingerPlayerCreated(MediaPlayer mRingerPlayer);
|
||||
void onDisplayStatus(String message);
|
||||
void onAlreadyInVideoCall();
|
||||
void onCallEncryptionChanged(LinphoneCall call, boolean encrypted,
|
||||
String authenticationToken);
|
||||
}
|
||||
|
||||
public interface EcCalibrationListener {
|
||||
|
@ -700,6 +710,10 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
serviceListener.onCallStateChanged(call, state, message);
|
||||
}
|
||||
|
||||
public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,
|
||||
boolean encrypted, String authenticationToken) {
|
||||
serviceListener.onCallEncryptionChanged(call, encrypted, authenticationToken);
|
||||
}
|
||||
|
||||
public void ecCalibrationStatus(final LinphoneCore lc,final EcCalibratorStatus status, final int delayMs,
|
||||
final Object data) {
|
||||
|
|
|
@ -260,6 +260,8 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
|
|||
void onGlobalStateChangedToOn(String message);
|
||||
// void onRegistrationStateChanged(RegistrationState state, String message);
|
||||
void onCallStateChanged(LinphoneCall call, State state, String message);
|
||||
void onCallEncryptionChanged(LinphoneCall call, boolean encrypted,
|
||||
String authenticationToken);
|
||||
}
|
||||
|
||||
|
||||
|
@ -302,5 +304,15 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
|
|||
public void onAlreadyInVideoCall() {
|
||||
LinphoneActivity.instance().startVideoActivity();
|
||||
}
|
||||
|
||||
public void onCallEncryptionChanged(final LinphoneCall call, final boolean encrypted,
|
||||
final String authenticationToken) {
|
||||
mHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
if (guiListener() != null)
|
||||
guiListener().onCallEncryptionChanged(call, encrypted, authenticationToken);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,9 @@ class LinphoneCallImpl implements LinphoneCall {
|
|||
private native int getDuration(long nativePtr);
|
||||
private native float getCurrentQuality(long nativePtr);
|
||||
private native float getAverageQuality(long nativePtr);
|
||||
private native String getAuthenticationToken(long nativePtr);
|
||||
private native boolean isAuthenticationTokenVerified(long nativePtr);
|
||||
private native boolean areStreamsEncrypted(long nativePtr);
|
||||
|
||||
protected LinphoneCallImpl(long aNativePtr) {
|
||||
nativePtr = aNativePtr;
|
||||
|
@ -110,4 +113,13 @@ class LinphoneCallImpl implements LinphoneCall {
|
|||
return getCurrentQuality(nativePtr);
|
||||
}
|
||||
|
||||
public String getAuthenticationToken(){
|
||||
return getAuthenticationToken(nativePtr);
|
||||
}
|
||||
public boolean isAuthenticationTokenVerified(){
|
||||
return isAuthenticationTokenVerified(nativePtr);
|
||||
}
|
||||
public boolean areStreamsEncrypted() {
|
||||
return areStreamsEncrypted(nativePtr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,10 +32,22 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
|
|||
}
|
||||
|
||||
static {
|
||||
// FFMPEG (audio/video)
|
||||
loadOptionalLibrary("avutil");
|
||||
loadOptionalLibrary("swscale");
|
||||
loadOptionalLibrary("avcore");
|
||||
loadOptionalLibrary("avcodec");
|
||||
|
||||
// OPENSSL (cryptography)
|
||||
// lin prefix avoids collision with libs in /system/lib
|
||||
loadOptionalLibrary("lincrypto");
|
||||
loadOptionalLibrary("linssl");
|
||||
|
||||
// Secure RTP and key negotiation
|
||||
loadOptionalLibrary("srtp");
|
||||
loadOptionalLibrary("zrtpcpp"); // GPLv3+
|
||||
|
||||
//Main library
|
||||
System.loadLibrary("linphone");
|
||||
}
|
||||
@Override
|
||||
|
|
|
@ -101,6 +101,7 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
private native int resumeCall(long nativePtr, long callPtr);
|
||||
private native void setUploadPtime(long nativePtr, int ptime);
|
||||
private native void setDownloadPtime(long nativePtr, int ptime);
|
||||
private native void setZrtpSecretsCache(long nativePtr, String file);
|
||||
|
||||
LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException {
|
||||
mListener=listener;
|
||||
|
@ -493,4 +494,8 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
public void setUploadPtime(int ptime) {
|
||||
setUploadPtime(nativePtr,ptime);
|
||||
}
|
||||
|
||||
public void setZrtpSecretsCache(String file) {
|
||||
setZrtpSecretsCache(nativePtr,file);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ public class Version {
|
|||
public static final int API09_GINGERBREAD_23 = 9;
|
||||
public static final int API11_HONEYCOMB_30 = 11;
|
||||
|
||||
private static native boolean nativeHasZrtp();
|
||||
private static native boolean nativeHasNeon();
|
||||
private static Boolean hasNeon;
|
||||
|
||||
|
@ -69,4 +70,7 @@ public class Version {
|
|||
return !Version.sdkStrictlyBelow(5) && Version.hasNeon() && Hacks.hasCamera();
|
||||
}
|
||||
|
||||
public static boolean hasZrtp(){
|
||||
return nativeHasZrtp();
|
||||
}
|
||||
}
|
||||
|
|
66
submodules/externals/build/libzrtpcpp/Android.mk
vendored
Normal file
66
submodules/externals/build/libzrtpcpp/Android.mk
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
|
||||
LOCAL_EXTERNALS:= $(call my-dir)/../..
|
||||
LOCAL_PATH:= $(LOCAL_EXTERNALS:=)/libzrtpcpp
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE:= libzrtpcpp
|
||||
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
src/Base32.cpp \
|
||||
src/ZIDFile.cpp \
|
||||
src/ZIDRecord.cpp \
|
||||
src/ZrtpCallbackWrapper.cpp \
|
||||
src/ZrtpConfigure.cpp \
|
||||
src/ZRtp.cpp \
|
||||
src/ZrtpCrc32.cpp \
|
||||
src/ZrtpCWrapper.cpp \
|
||||
src/ZrtpPacketClearAck.cpp \
|
||||
src/ZrtpPacketCommit.cpp \
|
||||
src/ZrtpPacketConf2Ack.cpp \
|
||||
src/ZrtpPacketConfirm.cpp \
|
||||
src/ZrtpPacketDHPart.cpp \
|
||||
src/ZrtpPacketErrorAck.cpp \
|
||||
src/ZrtpPacketError.cpp \
|
||||
src/ZrtpPacketGoClear.cpp \
|
||||
src/ZrtpPacketHelloAck.cpp \
|
||||
src/ZrtpPacketHello.cpp \
|
||||
src/ZrtpPacketPingAck.cpp \
|
||||
src/ZrtpPacketPing.cpp \
|
||||
src/ZrtpStateClass.cpp \
|
||||
src/ZrtpTextData.cpp
|
||||
|
||||
LOCAL_SRC_FILES += \
|
||||
src/libzrtpcpp/crypto/openssl/AesCFB.cpp \
|
||||
src/libzrtpcpp/crypto/openssl/hmac256.cpp \
|
||||
src/libzrtpcpp/crypto/openssl/hmac384.cpp \
|
||||
src/libzrtpcpp/crypto/openssl/InitializeOpenSSL.cpp \
|
||||
src/libzrtpcpp/crypto/openssl/sha256.cpp \
|
||||
src/libzrtpcpp/crypto/openssl/sha384.cpp \
|
||||
src/libzrtpcpp/crypto/openssl/ZrtpDH.cpp \
|
||||
src/libzrtpcpp/crypto/TwoCFB.cpp \
|
||||
src/libzrtpcpp/crypto/twofish.c \
|
||||
src/libzrtpcpp/crypto/twofish_cfb.c
|
||||
|
||||
|
||||
# src/ZrtpQueue.cpp
|
||||
|
||||
# src/libzrtpcpp/crypto/gcrypt/gcryptAesCFB.cpp \
|
||||
src/libzrtpcpp/crypto/gcrypt/gcrypthmac256.cpp \
|
||||
src/libzrtpcpp/crypto/gcrypt/gcrypthmac384.cpp \
|
||||
src/libzrtpcpp/crypto/gcrypt/gcryptsha256.cpp \
|
||||
src/libzrtpcpp/crypto/gcrypt/gcryptsha384.cpp \
|
||||
src/libzrtpcpp/crypto/gcrypt/gcryptZrtpDH.cpp \
|
||||
src/libzrtpcpp/crypto/gcrypt/InitializeGcrypt.cpp \
|
||||
|
||||
|
||||
LOCAL_CFLAGS := -D__EXPORT=""
|
||||
LOCAL_SHARED_LIBRARIES := liblincrypto liblinssl
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(LOCAL_PATH)/src/ \
|
||||
$(LOCAL_EXTERNALS)/openssl \
|
||||
$(LOCAL_EXTERNALS)/openssl/include
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
53
submodules/externals/build/srtp/Android.mk
vendored
Normal file
53
submodules/externals/build/srtp/Android.mk
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
|
||||
LOCAL_PATH:= $(call my-dir)/../../srtp
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE:= libsrtp
|
||||
LOCAL_SRC_FILES := \
|
||||
srtp/srtp.c \
|
||||
crypto/ae_xfm/xfm.c \
|
||||
crypto/cipher/aes.c \
|
||||
crypto/cipher/aes_cbc.c \
|
||||
crypto/cipher/aes_icm.c \
|
||||
crypto/cipher/cipher.c \
|
||||
crypto/cipher/null_cipher.c \
|
||||
crypto/hash/auth.c \
|
||||
crypto/hash/hmac.c \
|
||||
crypto/hash/null_auth.c \
|
||||
crypto/hash/sha1.c \
|
||||
crypto/kernel/alloc.c \
|
||||
crypto/kernel/err.c \
|
||||
crypto/kernel/key.c \
|
||||
crypto/kernel/crypto_kernel.c \
|
||||
crypto/math/gf2_8.c \
|
||||
crypto/math/stat.c \
|
||||
crypto/replay/rdb.c \
|
||||
crypto/replay/rdbx.c \
|
||||
crypto/replay/ut_sim.c \
|
||||
crypto/rng/ctr_prng.c \
|
||||
crypto/rng/prng.c
|
||||
|
||||
LOCAL_CFLAGS := -Wall -O4 -fexpensive-optimizations -funroll-loops -DCPU_CISC
|
||||
|
||||
ifeq ($(SRTP_USES_LINUX_KERNEL), 1)
|
||||
LOCAL_SRC_FILES += \
|
||||
crypto/rng/rand_linux_kernel.c
|
||||
LOCAL_CFLAGS += -DSRTP_KERNEL -DSRTP_KERNEL_LINUX
|
||||
else
|
||||
LOCAL_SRC_FILES += \
|
||||
crypto/rng/rand_source.c
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(SRTP_USES_MATH),1)
|
||||
LOCAL_SRC_FILES += crypto/math/math.c
|
||||
else
|
||||
LOCAL_SRC_FILES += crypto/math/datatypes.c
|
||||
endif
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(LOCAL_PATH)/include \
|
||||
$(LOCAL_PATH)/crypto/include
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 999e7c141076fea1ed2ddc2444273ef37c426096
|
||||
Subproject commit ce1326043817b304724337005a34faed7d26c27e
|
Loading…
Reference in a new issue