Browse Source

Switch to sequoia and update from pEp.* to foundation.*

ENGINE-524
Hussein Kasem 3 years ago
parent
commit
02e975e6a8
13 changed files with 194 additions and 413 deletions
  1. +1
    -1
      android/AndroidManifest.xml
  2. +12
    -11
      android/build.gradle
  3. +93
    -312
      android/external/Makefile
  4. +1
    -0
      android/external/gmp-6.1.2.tar.bz2.md5
  5. +1
    -0
      android/external/nettle-3.4.1.tar.gz.md5
  6. +1
    -0
      android/external/openssl-1.1.1b.tar.gz.md5
  7. +24
    -38
      android/jni/Android.mk
  8. +2
    -2
      android/jni/Application.mk
  9. +20
    -0
      android/jni/foundation_pEp_jniadapter_AndroidHelper.cc
  10. +1
    -1
      android/jni/foundation_pEp_jniadapter_AndroidHelper.h
  11. +0
    -34
      android/jni/org_pEp_jniadapter_AndroidHelper.cc
  12. +36
    -13
      android/src/foundation/pEp/jniadapter/AndroidHelper.java
  13. +2
    -1
      src/foundation/pEp/jniadapter/AbstractEngine.java

+ 1
- 1
android/AndroidManifest.xml View File

@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="org.pEp.jniadapter" />
<manifest package="foundation.pEp.jniadapter" />

+ 12
- 11
android/build.gradle View File

@ -10,38 +10,38 @@ def pEpEngineDB = new File(new File(pEpEngineSrc), 'db')
buildscript {
repositories {
jcenter()
//maven {url 'https://maven.google.com'}
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
//classpath 'com.android.tools.build:gradle:2.2.0'
}
}
allprojects {
repositories {
jcenter()
google()
jcenter()
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
compileSdkVersion 27
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 18
targetSdkVersion 21
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
externalNativeBuild {
ndkBuild {
abiFilters "armeabi-v7a"
//abiFilters ["armeabi-v7a"]
//abiFilters ["arm64-v8a, armeabi-v7a"]
}
}
}
@ -53,10 +53,11 @@ android {
// where to find generated Java source
java.srcDirs = ['../src', 'src']
//jniLibs.srcDirs = ['../libpEpAdapter/src',
// '../pEpEngine/build-android/include/pEp',
//s 'external/data/data/security.pEp/app_opt/lib']
jniLibs.srcDirs = ['libs',
// 'external/data/data/security.pEp/app_opt/lib'
]
assets.srcDirs = ['assets', 'external/assets']
resources.srcDirs = ['res']
}
}
@ -79,7 +80,7 @@ android {
jniDebuggable true
externalNativeBuild {
ndkBuild {
arguments '-B', 'NDK_DEBUG=1', 'NDEBUG=null', 'NDK_LOG=1'
// arguments '-B', 'NDK_DEBUG=1', 'NDEBUG=null', 'NDK_LOG=1'
}
}
}


+ 93
- 312
android/external/Makefile View File

@ -1,5 +1,5 @@
#------------------------------------------------------------------------------#
# Makefile to build GPGME, GnuPG and deps for use with pEpEngine
# Makefile to build deps for use with pEpEngine
# based on gnupg-for-android/external/Makefile
#------------------------------------------------------------------------------#
@ -16,7 +16,7 @@ PEP_PACKAGE_NAME ?= security.pEp
all: build assets
build: showsetup libetpan-build gnupg-install gpgme-install uuid-install uuid-prebuild sequoia-build
build: showsetup uuid-install uuid-prebuild sequoia-deps-build sequoia-ffi-install libetpan-build
#------------------------------------------------------------------------------#
# Manage paths for PREFIX, DESTDIR, LOCAL and PATH
@ -25,7 +25,7 @@ EXTERNAL_ROOT := $(shell pwd)
# install root for built files
DESTDIR = $(EXTERNAL_ROOT)
prefix = /data/data/$(PEP_PACKAGE_NAME)/app_opt
prefix = /data/data/$(PEP_PACKAGE_NAME)/$(APP_ABI)/app_opt
LOCAL := $(DESTDIR)$(prefix)
PATH := ${PATH}:$(NDK_TOOLCHAIN)/bin:$(LOCAL)/bin
@ -102,209 +102,6 @@ showsetup:
@echo "CFLAGS: $(CFLAGS)"
@echo "LDFLAGS: $(LDFLAGS)"
#------------------------------------------------------------------------------#
# libgpg-error
EXTERNAL_GIT_REPOS += libgpg-error|git://git.gnupg.org/libgpg-error.git?libgpg-error-1.20
libgpg-error/configure: libgpg-error.src.stamp libgpg-error/configure.ac
cd libgpg-error && ./autogen.sh
libgpg-error/Makefile: libgpg-error/configure
cd libgpg-error && \
./configure \
CC="$(CC)" \
AR=$(AR) \
RANLIB=$(RANLIB) \
CFLAGS="$(CFLAGS)" \
LDFLAGS="$(LDFLAGS)" \
--disable-doc \
--disable-languages \
--host=$(HOST) \
--prefix=$(LOCAL)
ls -l libgpg-error/libtool
# brute force and ignorance to make libtool comply with android style
sed -i 's,^fast_install=.*,fast_install=needless,' libgpg-error/libtool
sed -i 's,^version_type=.*,version_type=none,' libgpg-error/libtool
sed -i 's,^shlibpath_overrides_runpath=.*,shlibpath_overrides_runpath=yes,' libgpg-error/libtool
sed -i 's,^library_names_spec=.*,library_names_spec="\\$$libname\\$$release\\$$shared_ext",' libgpg-error/libtool
sed -i 's,^soname_spec=.*,soname_spec="\\$$libname\\$$release\\$$shared_ext",' libgpg-error/libtool
sed -i 's,^finish_cmds=.*,finish_cmds="",' libgpg-error/libtool
sed -i 's,^sys_lib_dlsearch_path_spec=.*,sys_lib_dlsearch_path_spec="/lib /usr/lib",' libgpg-error/libtool
libgpg-error/src/.libs/libgpg-error.so: libgpg-error/Makefile
$(MAKE) -C libgpg-error
libgpg-error-build: libgpg-error/src/.libs/libgpg-error.so
$(LOCAL)/lib/libgpg-error.so: libgpg-error/src/.libs/libgpg-error.so
$(MAKE) -C libgpg-error prefix=$(LOCAL) install
ls -l $(LOCAL)/lib/libgpg-error.so*
libgpg-error-install: $(LOCAL)/lib/libgpg-error.so
#------------------------------------------------------------------------------#
# libgcrypt
EXTERNAL_GIT_REPOS += libgcrypt|git://git.gnupg.org/libgcrypt.git?libgcrypt-1.6.4
libgcrypt/configure: libgcrypt.src.stamp libgcrypt/configure.ac
cd libgcrypt && ./autogen.sh
libgcrypt/Makefile: libgcrypt/configure
-patch -N -p1 --reject-file=- libgcrypt/Makefile.am libgcrypt-disable-docs.patch
cd libgcrypt && \
CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
./configure \
--enable-maintainer-mode \
--host=$(HOST) \
--with-gpg-error-prefix=$(LOCAL) \
--prefix=$(LOCAL)
-patch -N -p1 --reject-file=- libgcrypt/tests/random.c libgcrypt-disable-hanging-random-test.patch
# force use of /dev/urandom
-sed -i 's/NAME_OF_DEV_RANDOM/NAME_OF_DEV_URANDOM/' libgcrypt/random/rndlinux.c
libgcrypt/src/.libs/libgcrypt.so: $(LOCAL)/lib/libgpg-error.so libgcrypt/Makefile
$(MAKE) -C libgcrypt
$(LOCAL)/lib/libgcrypt.so: libgcrypt/src/.libs/libgcrypt.so
$(MAKE) -C libgcrypt prefix=$(LOCAL) install
ls -l $(LOCAL)/lib/libgcrypt.so
libgcrypt-build: libgcrypt/src/.libs/libgcrypt.so
libgcrypt-install: $(LOCAL)/lib/libgcrypt.so
#------------------------------------------------------------------------------#
# libassuan
EXTERNAL_GIT_REPOS += libassuan|git://git.gnupg.org/libassuan.git?libassuan-2.3.0
libassuan/configure: libassuan.src.stamp libassuan/configure.ac
cd libassuan && ./autogen.sh && autoreconf --install --force --verbose
libassuan/Makefile: libassuan/configure
-patch -N -p1 --reject-file=- libassuan/m4/libtool.m4 libtool-Add-Android-Linux-support.patch
cd libassuan && \
CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
./configure \
--enable-maintainer-mode \
--disable-largefile \
--host=$(HOST) \
--with-gpg-error-prefix=$(LOCAL) \
--prefix=$(LOCAL)
libassuan/src/.libs/libassuan.so: $(LOCAL)/lib/libgpg-error.so libassuan/Makefile
$(MAKE) -C libassuan
$(LOCAL)/lib/libassuan.so: libassuan/src/.libs/libassuan.so
$(MAKE) -C libassuan prefix=$(LOCAL) install
ls -l $(LOCAL)/lib/libassuan.so
libassuan-build: libassuan/src/.libs/libassuan.so
libassuan-install: $(LOCAL)/lib/libassuan.so
#------------------------------------------------------------------------------#
# libksba
EXTERNAL_GIT_REPOS += libksba|git://git.gnupg.org/libksba.git?libksba-1.3.4
libksba/configure: libksba.src.stamp libksba/configure.ac
cd libksba && ./autogen.sh
libksba/Makefile: $(LOCAL)/lib/libgpg-error.so libksba/configure
-patch -N -p1 --reject-file=- libksba/m4/libtool.m4 libtool-Add-Android-Linux-support.patch
cd libksba && \
CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
./configure \
--enable-maintainer-mode \
--host=$(HOST) \
--with-gpg-error-prefix=$(LOCAL) \
--prefix=$(LOCAL)
libksba/src/.libs/libksba.so: libksba/Makefile
$(MAKE) -C libksba
$(LOCAL)/lib/libksba.so: libksba/src/.libs/libksba.so
$(MAKE) -C libksba prefix=$(LOCAL) install
ls -l $(LOCAL)/lib/libksba.so
libksba-build: libksba/src/.libs/libksba.so
libksba-install: $(LOCAL)/lib/libksba.so
#------------------------------------------------------------------------------#
# npth
EXTERNAL_GIT_REPOS += npth|git://git.gnupg.org/npth.git?npth-1.2
npth/configure: npth.src.stamp npth/configure.ac
cd npth && ./autogen.sh
npth/Makefile: $(LOCAL)/lib/libgpg-error.so npth/configure
cd npth && \
CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
./configure $(CONFIGURE_ARGS) \
--enable-maintainer-mode \
--host=$(HOST) \
--with-gpg-error-prefix=$(LOCAL) \
--prefix=$(LOCAL)
npth/src/.libs/libnpth.so: npth/Makefile
$(MAKE) -C npth
$(LOCAL)/lib/libnpth.so: npth/src/.libs/libnpth.so
$(MAKE) -C npth prefix=$(LOCAL) install
ls -l $(LOCAL)/lib/libnpth.so
npth-build: npth/src/.libs/libnpth.so
npth-install: $(LOCAL)/lib/libnpth.so
#------------------------------------------------------------------------------#
# curl
EXTERNAL_GIT_REPOS += curl|https://github.com/bagder/curl?curl-7_45_0
curl/configure: curl.src.stamp curl/configure.ac
cd curl && ./buildconf
curl/Makefile: curl/configure
-patch -N -p1 --reject-file=- curl/m4/libtool.m4 libtool-Add-Android-Linux-support.patch
cd curl && \
CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
./configure \
--host=$(HOST) \
--prefix=$(prefix) \
--with-gnu-ld \
--disable-imap \
--disable-ldap \
--disable-pop3 \
--disable-rtsp \
--disable-smtp
# brute force and ignorance to make libtool comply with android style
sed -i 's,^fast_install=.*,fast_install=needless,' curl/libtool
sed -i 's,^version_type=.*,version_type=none,' curl/libtool
sed -i 's,^shlibpath_overrides_runpath=.*,shlibpath_overrides_runpath=yes,' curl/libtool
sed -i 's,^library_names_spec=.*,library_names_spec="\\$$libname\\$$release\\$$shared_ext",' curl/libtool
sed -i 's,^soname_spec=.*,soname_spec="\\$$libname\\$$release\\$$shared_ext",' curl/libtool
sed -i 's,^finish_cmds=.*,finish_cmds="",' curl/libtool
sed -i 's,^sys_lib_dlsearch_path_spec=.*,sys_lib_dlsearch_path_spec="/lib /usr/lib",' curl/libtool
curl/lib/.libs/libcurl.so: curl/Makefile
$(MAKE) -C curl
$(LOCAL)/lib/libcurl.so: curl/lib/.libs/libcurl.so
$(MAKE) -C curl DESTDIR=$(DESTDIR) prefix=$(prefix) install
ls -l $(LOCAL)/lib/libcurl.so
curl-build: curl/lib/.libs/libcurl.so
curl-install: $(LOCAL)/lib/libcurl.so
#------------------------------------------------------------------------------#
# libiconv
@ -336,12 +133,11 @@ libiconv/Makefile: libiconv.src.stamp
cp config.sub libiconv/libcharset/build-aux
cp config.guess libiconv/libcharset/build-aux
cd libiconv && \
CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
CC="$(CC)" LD="$(LD)" AR="$(AR)" AS="$(AS)" RANLIB=$(RANLIB) STRIP="$(STRIP)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
./configure \
--enable-static \
--enable-maintainer-mode \
--with-lib-path=$(LOCAL)/lib \
--with-include-path=$(LOCAL)/include \
--host=$(HOST) \
--with-gnu-ld \
--prefix=$(LOCAL)
libiconv/lib/.libs/libiconv.so: libiconv/Makefile
@ -355,101 +151,18 @@ libiconv-build: libiconv/lib/.libs/libiconv.so
libiconv-install: $(LOCAL)/lib/libiconv.so
#------------------------------------------------------------------------------#
# gnupg
EXTERNAL_GIT_REPOS += gnupg|git://git.gnupg.org/gnupg.git?gnupg-2.0.30
gnupg/configure: gnupg.src.stamp gnupg/configure.ac
cd gnupg && ./autogen.sh
gnupg/Makefile: gnupg/configure
-patch -N -p1 --reject-file=- gnupg/gl/stdint_.h gnupg_fix_gmulib_stdint_with_bionic.patch
-patch -N -p1 --reject-file=- gnupg/jnlib/dotlock.c gnupg_use_rename_for_dotlock.patch
cd gnupg && \
CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
./configure \
--enable-maintainer-mode \
--host=$(HOST) \
--with-gpg-error-prefix=$(LOCAL) \
--with-libgcrypt-prefix=$(LOCAL) \
--with-libassuan-prefix=$(LOCAL) \
--with-ksba-prefix=$(LOCAL) \
--with-libcurl=$(LOCAL) \
--disable-agent \
--disable-scdaemon \
--disable-ldap \
--disable-doc \
--disable-gpgsm \
--prefix=$(prefix)
gnupg/g10/gpg2: $(LOCAL)/lib/libgpg-error.so $(LOCAL)/lib/libgcrypt.so $(LOCAL)/lib/libksba.so $(LOCAL)/lib/libnpth.so $(LOCAL)/lib/libassuan.so $(LOCAL)/lib/libcurl.so $(LOCAL)/lib/libiconv.so gnupg/Makefile
$(MAKE) -C gnupg
$(LOCAL)/bin/gpg2: gnupg/g10/gpg2 gnupg/configure
$(MAKE) -C gnupg prefix=$(LOCAL) install
ls -l $(LOCAL)/bin/gpg2
gnupg-build: gnupg/g10/gpg2
gnupg-install: $(LOCAL)/bin/gpg2
install -d $(LOCAL)/etc/gnupg
install -d $(LOCAL)/var/run/gnupg
install -d $(LOCAL)/var/cache/gnupg
#------------------------------------------------------------------------------#
# gpgme
EXTERNAL_GIT_REPOS += gpgme|git://git.gnupg.org/gpgme.git?gpgme-1.8.0
gpgme/configure: gpgme.src.stamp gpgme/configure.ac
cd gpgme && ./autogen.sh
ifneq ("x$(findstring '64',$(HOST))x","xx")
gpgme_32b_force_no_largefile =
else
gpgme_32b_force_no_largefile = --disable-largefile
endif
gpgme/Makefile: gpgme/configure
-patch -N -p1 --reject-file=- gpgme/m4/libtool.m4 libtool-Add-Android-Linux-support.patch
cd gpgme && \
CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
./configure \
--host=$(HOST) \
$(gpgme_32b_force_no_largefile) \
--enable-maintainer-mode \
--with-gpg-error-prefix=$(LOCAL) \
--with-libassuan-prefix=$(LOCAL) \
--enable-fixed-path=$(prefix)/bin \
--disable-glibtest \
--disable-gpg-test \
--disable-gpgsm-test \
--disable-gpgconf-test \
--disable-g13-test \
--prefix=$(prefix) \
--enable-languages=cl
gpgme/src/.libs/libgpgme.so: gpgme/Makefile
$(MAKE) -C gpgme
$(LOCAL)/lib/libgpgme.so: gpgme/src/.libs/libgpgme.so
$(MAKE) -C gpgme DESTDIR=$(DESTDIR) prefix=$(prefix) install
gpgme-build: gpgme/src/.libs/libgpgme.so
gpgme-install: $(LOCAL)/bin/gpg2 $(LOCAL)/lib/libgpgme.so
#------------------------------------------------------------------------------#
# libetpan
EXTERNAL_GIT_REPOS += libetpan|https://github.com/fdik/libetpan.git?HEAD
libetpan/build-android/libetpan-android-1.zip: libiconv-install libetpan.src.stamp
libetpan/Makefile: libetpan.src.stamp libiconv-install
cd libetpan/build-android; ICONV_PREFIX=$(LOCAL) bash ./build.sh
touch libetpan.src.stamp
touch libicon-install
touch libetpan/Makefile
libetpan-build: libetpan/build-android/libetpan-android-1.zip
libetpan-build: libetpan/Makefile
libetpan-cleanzip:
rm -f libetpan/build-android/libetpan-android-1.zip
@ -512,11 +225,50 @@ uuid/jni/Android.mk: uuid.src.stamp
#------------------------------------------------------------------------------#
# Sequoia
OPENSSL_VERSION=1.1.1a
OPENSSL_VERSION=1.1.1b
GMP_VERSION=6.1.2
NETTLE_VERSION=3.4.1
sequoia-build: gmp-install nettle-install
sequoia-deps-build: gmp-install nettle-install openssl-install
#------------------------------------------------------------------------------#
# OpenSSL
openssl-$(OPENSSL_VERSION).tar.gz:
wget -nc https://www.openssl.org/source/openssl-$(OPENSSL_VERSION).tar.gz
md5sum -c openssl-$(OPENSSL_VERSION).tar.gz.md5
openssl.src.stamp: openssl-$(OPENSSL_VERSION).tar.gz
tar xvf openssl-$(OPENSSL_VERSION).tar.gz
mv openssl-$(OPENSSL_VERSION) openssl
touch $@
openssl-src: openssl.src.stamp
openssl-clean:
rm -rf openssl
rm -rf openssl.src.stamp
EXTERNAL_SRCS += openssl-src
EXTERNAL_SRCS_CLEAN += openssl-clean
openssl/Makefile: openssl.src.stamp
cd openssl && \
PATH="$(ANDROID_NDK_HOME)/bin:$(PATH)" ./Configure android-arm --prefix=$(prefix)
openssl/libssl.so: openssl/Makefile
PATH="$(ANDROID_NDK_HOME)/bin:$(PATH)" $(MAKE) -C openssl
$(LOCAL)/lib/libssl.so: openssl/libssl.so
PATH="$(ANDROID_NDK_HOME)/bin:$(PATH)" $(MAKE) -C openssl DESTDIR=$(DESTDIR) prefix=$(prefix) install
pwd
ls -l $(LOCAL)/lib/libssl.so
openssl-build: openssl/libssl.so
openssl-install: $(LOCAL)/lib/libssl.so
#------------------------------------------------------------------------------#
# GMP
@ -550,6 +302,7 @@ gmp/.libs/libgmp.so: gmp/Makefile
$(LOCAL)/lib/libgmp.so: gmp/.libs/libgmp.so
$(MAKE) -C gmp DESTDIR=$(DESTDIR) prefix=$(prefix) install
#gmp/libtool --finish $(LOCAL)/lib/
ls -l $(LOCAL)/lib/libgmp.so
gmp-build: gmp/.libs/libgmp.so
@ -560,7 +313,7 @@ gmp-install: $(LOCAL)/lib/libgmp.so
#------------------------------------------------------------------------------#
# NETTLE
nettle-$(NETTLE_VERSION).tar.bz2: $(LOCAL)/lib/libgmp.so
nettle-$(NETTLE_VERSION).tar.gz: $(LOCAL)/lib/libgmp.so
wget -nc https://ftp.gnu.org/gnu/nettle/nettle-$(NETTLE_VERSION).tar.gz
md5sum -c nettle-$(NETTLE_VERSION).tar.gz.md5
@ -598,6 +351,41 @@ nettle-build: nettle/libnettle.so
nettle-install: $(LOCAL)/lib/libnettle.so
#------------------------------------------------------------------------------#
# Sequoia-ffi
EXTERNAL_GIT_REPOS += sequoia|https://gitlab.com/husspEp/sequoia.git?master
CARGO_TARGET_DIR=$(EXTERNAL_ROOT)/sequoia/build/$(APP_ABI)
sequoia-ffi-clean:
rm -rf sequoia
rm -rf sequoia.src.stamp
EXTERNAL_SRCS_CLEAN += sequoia-ffi-clean
$(CARGO_TARGET_DIR)/armv7-linux-androideabi/release/libsequoia_openpgp_ffi.so: sequoia.src.stamp nettle-install
cd sequoia && PATH="$(ANDROID_NDK_HOME)/bin:$(PATH)" \
LD_LIBRARY_PATH=$(LOCAL)/lib/ \
PKG_CONFIG_PATH=$(LOCAL)/lib/pkgconfig \
PKG_CONFIG_ALLOW_CROSS=1 \
ARMV7_LINUX_ANDROIDEABI_OPENSSL_LIB_DIR="$(LOCAL)/lib" \
ARMV7_LINUX_ANDROIDEABI_OPENSSL_INCLUDE_DIR="$(LOCAL)/include" \
ARMV7_LINUX_ANDROIDEABI_OPENSSL_DIR="$(LOCAL)/bin" \
CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) cargo build --target armv7-linux-androideabi -p sequoia-openpgp-ffi --release
$(LOCAL)/lib/libsequoia_openpgp_ffi.so: $(CARGO_TARGET_DIR)/armv7-linux-androideabi/release/libsequoia_openpgp_ffi.so
cp $(CARGO_TARGET_DIR)/armv7-linux-androideabi/release/libsequoia_openpgp_ffi.* $(LOCAL)/lib/
ls -l $(LOCAL)/lib/libsequoia_openpgp_ffi.so
sequoia-ffi-build: $(CARGO_TARGET_DIR)/armv7-linux-androideabi/release/libsequoia_openpgp_ffi.so
sequoia-ffi-install: sequoia-deps-build $(LOCAL)/lib/libsequoia_openpgp_ffi.so
#------------------------------------------------------------------------------#
# assets for Android app
@ -687,20 +475,13 @@ clean-all: clean
#------------------------------------------------------------------------------#
.PHONY = clean clean-install clean-assets libetpan-cleanzip\
libgpg-error-build libgpg-error-install \
libgcrypt-build libgcrypt-install \
libassuan-build libassuan-install \
libksba-build libksba-install \
libnpth-build libnpth-install \
libiconv-build libiconv-install \
uuid-build uuid-prebuild uuid-install \
gnupg-build gnupg-install\
gmp-build gmp-install \
sequoia-build \
sequoia-deps-build \
openssl-build openssl-install \
nettle-build nettle-install \
gpgme-build gpgme-install\
curl-build curl-install \
sequoia-ffi-build sequoia-ffi-install\
assets \
$(EXTERNAL_LOCAL_GITS_UPDATE) $(EXTERNAL_SRCS) \
$(EXTERNAL_LOCAL_GITS_UPDATE) $(EXTERNAL_SRCS) $(EXTERNAL_SRCS_CLEAN)\
showsetup

+ 1
- 0
android/external/gmp-6.1.2.tar.bz2.md5 View File

@ -0,0 +1 @@
8ddbb26dc3bd4e2302984debba1406a5 gmp-6.1.2.tar.bz2

+ 1
- 0
android/external/nettle-3.4.1.tar.gz.md5 View File

@ -0,0 +1 @@
9bdebb0e2f638d3b9d91f7fc264b70c1 nettle-3.4.1.tar.gz

+ 1
- 0
android/external/openssl-1.1.1b.tar.gz.md5 View File

@ -0,0 +1 @@
4532712e7bcc9414f5bce995e4e13930 openssl-1.1.1b.tar.gz

+ 24
- 38
android/jni/Android.mk View File

@ -1,49 +1,33 @@
LOCAL_PATH:= $(call my-dir)
SRC_PATH := $(LOCAL_PATH)/../../../
ENGINE_PATH := $(LOCAL_PATH)/../../../pEpEngine
GPGBUILD:= $(LOCAL_PATH)/../external/data/data/security.pEp/app_opt
GPGBUILD:= $(LOCAL_PATH)/../external/data/data/security.pEp
include $(CLEAR_VARS)
LOCAL_MODULE := libassuan
LOCAL_SRC_FILES := $(GPGBUILD)/lib/libassuan.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libcurl
LOCAL_SRC_FILES := $(GPGBUILD)/lib/libcurl.so
LOCAL_MODULE := libiconv
LOCAL_SRC_FILES := $(GPGBUILD)/$(TARGET_ARCH_ABI)/app_opt/lib/libiconv.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libgcrypt
LOCAL_SRC_FILES := $(GPGBUILD)/lib/libgcrypt.so
include $(PREBUILT_SHARED_LIBRARY)
LOCAL_MODULE := libsequoia_openpgp_ffi
LOCAL_SRC_FILES := $(GPGBUILD)/$(TARGET_ARCH_ABI)/app_opt/lib/libsequoia_openpgp_ffi.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libgpg-error
LOCAL_SRC_FILES := $(GPGBUILD)/lib/libgpg-error.so
LOCAL_MODULE := libhogweed
LOCAL_SRC_FILES := $(GPGBUILD)/$(TARGET_ARCH_ABI)/app_opt/lib/libhogweed.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libgpgme
LOCAL_SRC_FILES := $(GPGBUILD)/lib/libgpgme.so
LOCAL_EXPORT_C_INCLUDES := $(GPGBUILD)/include
LOCAL_MODULE := libgmp
LOCAL_SRC_FILES := $(GPGBUILD)/$(TARGET_ARCH_ABI)/app_opt/lib/libgmp.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libksba
LOCAL_SRC_FILES := $(GPGBUILD)/lib/libksba.so
LOCAL_MODULE := libnettle
LOCAL_SRC_FILES := $(GPGBUILD)/$(TARGET_ARCH_ABI)/app_opt/lib/libnettle.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libiconv
LOCAL_SRC_FILES := $(GPGBUILD)/lib/libiconv.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libuuid
LOCAL_SRC_FILES := $(GPGBUILD)/lib/libuuid.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libetpan
@ -57,28 +41,29 @@ $(shell sh $(ENGINE_PATH)/build-android/takeOutHeaderFiles.sh $(ENGINE_PATH))
include $(CLEAR_VARS)
LOCAL_MODULE := pEpJNI
LOCAL_SHARED_LIBRARIES := libgpgme libassuan libcurl libgcrypt libgpg-error
LOCAL_STATIC_LIBRARIES := pEpEngine libetpan libiconv libuuid pEpAdapter
LOCAL_SHARED_LIBRARIES := libnettle libhogweed libgmp
LOCAL_STATIC_LIBRARIES := pEpEngine libetpan libiconv libuuid pEpAdapter libsequoia_openpgp_ffi
LOCAL_CPP_FEATURES += exceptions
LOCAL_CPPFLAGS += -std=c++14 -DANDROID_STL=c++_shared -DHAVE_PTHREADS -DDISABLE_SYNC
LOCAL_CPPFLAGS += -std=c++14 -DANDROID_STL=c++_shared -DHAVE_PTHREADS -DDISABLE_SYNC -fuse-ld=lld
LOCAL_SRC_FILES := \
../../src/org_pEp_jniadapter_AbstractEngine.cc \
../../src/org_pEp_jniadapter_Engine.cc \
../../src/org_pEp_jniadapter_Message.cc \
../../src/foundation_pEp_jniadapter_AbstractEngine.cc \
../../src/foundation_pEp_jniadapter_Engine.cc \
../../src/foundation_pEp_jniadapter_Message.cc \
../../src/throw_pEp_exception.cc \
../../src/basic_api.cc \
../../src/jniutils.cc
LOCAL_C_INCLUDES += $(GPGBUILD)/include
LOCAL_C_INCLUDES += $(LIB_PEP_ADAPTER_PATH)/build-android/include $(SRC_PATH)/libpEpAdapter
LOCAL_C_INCLUDES += $(GPGBUILD)/$(TARGET_ARCH_ABI)/app_opt/include
LOCAL_C_INCLUDES += $(LIB_PEP_ADAPTER_PATH)/build-android/include $(SRC_PATH)/libpEpAdapter $(SRC_PATH)/test/sequoia/openpgp-ffi/include
LOCAL_LDFLAGS = -Wl,--allow-multiple-definition
LOCAL_LDLIBS += -llog
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := pEpJNIAndroidHelper
LOCAL_SHARED_LIBRARIES := libgpgme
LOCAL_CFLAGS += -DANDROID_STL=c++_shared
LOCAL_SRC_FILES := org_pEp_jniadapter_AndroidHelper.cc
LOCAL_SRC_FILES := foundation_pEp_jniadapter_AndroidHelper.cc
include $(BUILD_SHARED_LIBRARY)
$(call import-add-path,$(SRC_PATH))
@ -86,3 +71,4 @@ $(call import-module, pEpEngine/build-android/jni/)
$(info $(LOCAL_PATH))
$(call import-module, libpEpAdapter/build-android/jni/)
$(info $(LOCAL_PATH))
$(call import-module, pEpJNIAdapter/android/external/uuid/jni)

+ 2
- 2
android/jni/Application.mk View File

@ -1,6 +1,6 @@
APP_STL := c++_shared
APP_OPTIM := debug
APP_PLATFORM=android-18
#APP_OPTIM := debug
#APP_PLATFORM=android-18
APP_ABI := armeabi-v7a
NDK_TOOLCHAIN_VERSION = clang
APP_UNIFIED_HEADERS=true

+ 20
- 0
android/jni/foundation_pEp_jniadapter_AndroidHelper.cc View File

@ -0,0 +1,20 @@
#include "foundation_pEp_jniadapter_AndroidHelper.h"
#include <stdlib.h>
extern "C" {
JNIEXPORT jint JNICALL Java_foundation_pEp_jniadapter_AndroidHelper_setenv
(JNIEnv* env, jclass clazz, jstring key, jstring value, jboolean overwrite)
{
char* k = (char *) env->GetStringUTFChars(key, NULL);
char* v = (char *) env->GetStringUTFChars(value, NULL);
int err = setenv(k, v, overwrite);
env->ReleaseStringUTFChars(key, k);
env->ReleaseStringUTFChars(value, v);
return err;
}
} // extern "C"

android/jni/org_pEp_jniadapter_AndroidHelper.h → android/jni/foundation_pEp_jniadapter_AndroidHelper.h View File


+ 0
- 34
android/jni/org_pEp_jniadapter_AndroidHelper.cc View File

@ -1,34 +0,0 @@
#include "org_pEp_jniadapter_AndroidHelper.h"
#include <stdlib.h>
#include <gpgme.h>
extern "C" {
JNIEXPORT jint JNICALL Java_org_pEp_jniadapter_AndroidHelper_setenv
(JNIEnv* env, jclass clazz, jstring key, jstring value, jboolean overwrite)
{
char* k = (char *) env->GetStringUTFChars(key, NULL);
char* v = (char *) env->GetStringUTFChars(value, NULL);
int err = setenv(k, v, overwrite);
env->ReleaseStringUTFChars(key, k);
env->ReleaseStringUTFChars(value, v);
return err;
}
JNIEXPORT jint JNICALL Java_org_pEp_jniadapter_AndroidHelper_nativeSetup
(JNIEnv* env, jclass clazz, jstring debugflag)
{
char* cdebugflag = (char *) env->GetStringUTFChars(debugflag, NULL);
gpgme_set_global_flag("debug", cdebugflag);
env->ReleaseStringUTFChars(debugflag, cdebugflag);
gpgme_set_global_flag ("disable-gpgconf", "");
gpgme_set_global_flag ("gpg-name", "gpg2");
return 0;
}
} // extern "C"

android/src/org/pEp/jniadapter/AndroidHelper.java → android/src/foundation/pEp/jniadapter/AndroidHelper.java View File


+ 2
- 1
src/foundation/pEp/jniadapter/AbstractEngine.java View File

@ -175,7 +175,7 @@ abstract class AbstractEngine implements AutoCloseable {
public int notifyHandshakeCallFromC(_Identity _myself, _Identity _partner, SyncHandshakeSignal _signal) {
Identity myself = new Identity(_myself);
Identity partner = new Identity(_partner);
System.out.println("pEpSync" +"notifyHandshakeCallFromC: " + notifyHandshakeCallback);
if (notifyHandshakeCallback != null) {
notifyHandshakeCallback.notifyHandshake(myself, partner, _signal);
} else {
@ -185,6 +185,7 @@ abstract class AbstractEngine implements AutoCloseable {
}
public int messageToSendCallFromC (Message message) {
System.out.println("pEpSync" + "messageToSendCallFromC: " + messageToSendCallback );
if (messageToSendCallback != null) {
messageToSendCallback.messageToSend(message);
} else {


Loading…
Cancel
Save