summaryrefslogtreecommitdiff
path: root/jni
diff options
context:
space:
mode:
Diffstat (limited to 'jni')
-rw-r--r--jni/Android.mk44
-rw-r--r--jni/Application.mk9
-rw-r--r--jni/dummy.cpp8
-rw-r--r--jni/jbcrypto.cpp95
-rw-r--r--jni/jniglue.c21
-rw-r--r--jni/jniglue.h12
-rw-r--r--jni/minivpn.c0
7 files changed, 0 insertions, 189 deletions
diff --git a/jni/Android.mk b/jni/Android.mk
deleted file mode 100644
index fc2158d2..00000000
--- a/jni/Android.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-# Path of the sources
-JNI_DIR := $(call my-dir)
-
-#USE_POLAR=1
-
-include lzo/Android.mk
-include snappy/Android.mk
-
-include openssl/Android.mk
-
-ifneq ($(TARGET_ARCH),mips)
-WITH_BREAKPAD=1
-include google-breakpad/android/google_breakpad/Android.mk
-else
-WITH_BREAKPAD=0
-endif
-
-
-ifeq ($(USE_POLAR),1)
- include polarssl/Android.mk
-endif
-
-include openvpn/Android.mk
-
-
-LOCAL_PATH := $(JNI_DIR)
-
-# The only real JNI library
-include $(CLEAR_VARS)
-LOCAL_LDLIBS := -llog -lz
-LOCAL_C_INCLUDES := openssl/include openssl/crypto openssl
-LOCAL_SRC_FILES:= jniglue.c jbcrypto.cpp
-LOCAL_MODULE = opvpnutil
-LOCAL_SHARED_LIBRARIES := libcrypto
-include $(BUILD_SHARED_LIBRARY)
-
-
-include $(CLEAR_VARS)
-LOCAL_LDLIBS := -lz -lc
-LOCAL_SHARED_LIBRARIES := libssl libcrypto openvpn
-LOCAL_SRC_FILES:= minivpn.c dummy.cpp
-LOCAL_MODULE = minivpn
-include $(BUILD_EXECUTABLE)
-
diff --git a/jni/Application.mk b/jni/Application.mk
deleted file mode 100644
index b69669ac..00000000
--- a/jni/Application.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-APP_ABI := all
-APP_PLATFORM := android-14
-
-APP_STL:=stlport_shared
-#APP_STL:=gnustl_shared
-
-#APP_OPTIM := release
-
-#LOCAL_ARM_MODE := arm
diff --git a/jni/dummy.cpp b/jni/dummy.cpp
deleted file mode 100644
index 58466656..00000000
--- a/jni/dummy.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-/*#include <string>
-#include <iostream>
-
-void dummy()
-{
- std::cout << "I am a dummy function to help compile on Android NDK r9" << std::endl;
-}
-*/
diff --git a/jni/jbcrypto.cpp b/jni/jbcrypto.cpp
deleted file mode 100644
index 2fd1262a..00000000
--- a/jni/jbcrypto.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-//
-// JBCyrpto.cpp
-// xcopenvpn
-//
-// Created by Arne Schwabe on 12.07.12.
-// Copyright (c) 2012 Universität Paderborn. All rights reserved.
-//
-
-#include <jni.h>
-
-#include <openssl/ssl.h>
-#include <openssl/rsa.h>
-#include <openssl/objects.h>
-#include <openssl/md5.h>
-#include <android/log.h>
-#include <openssl/err.h>
-
-
-extern "C" {
-jbyteArray Java_de_blinkt_openvpn_core_NativeUtils_rsasign(JNIEnv* env, jclass, jbyteArray from, jint pkeyRef);
-}
-
-int jniThrowException(JNIEnv* env, const char* className, const char* msg) {
-
- jclass exceptionClass = env->FindClass(className);
-
- if (exceptionClass == NULL) {
- __android_log_print(ANDROID_LOG_DEBUG,"openvpn","Unable to find exception class %s", className);
- /* ClassNotFoundException now pending */
- return -1;
- }
-
- if (env->ThrowNew( exceptionClass, msg) != JNI_OK) {
- __android_log_print(ANDROID_LOG_DEBUG,"openvpn","Failed throwing '%s' '%s'", className, msg);
- /* an exception, most likely OOM, will now be pending */
- return -1;
- }
-
- env->DeleteLocalRef(exceptionClass);
- return 0;
-}
-
-static char opensslerr[1024];
-jbyteArray Java_de_blinkt_openvpn_core_NativeUtils_rsasign (JNIEnv* env, jclass, jbyteArray from, jint pkeyRef) {
-
- // EVP_MD_CTX* ctx = reinterpret_cast<EVP_MD_CTX*>(ctxRef);
- EVP_PKEY* pkey = reinterpret_cast<EVP_PKEY*>(pkeyRef);
-
-
- if (pkey == NULL || from == NULL) {
- jniThrowException(env, "java/lang/NullPointerException", "EVP_KEY is null");
- return NULL;
- }
-
- jbyte* data = env-> GetByteArrayElements (from, NULL);
- int datalen = env-> GetArrayLength(from);
-
- if(data==NULL )
- jniThrowException(env, "java/lang/NullPointerException", "data is null");
-
- int siglen;
- unsigned char* sigret = (unsigned char*)malloc(RSA_size(pkey->pkey.rsa));
-
-
- //int RSA_sign(int type, const unsigned char *m, unsigned int m_len,
- // unsigned char *sigret, unsigned int *siglen, RSA *rsa);
-
- // adapted from s3_clnt.c
- /* if (RSA_sign(NID_md5_sha1, (unsigned char*) data, datalen,
- sigret, &siglen, pkey->pkey.rsa) <= 0 ) */
-
- siglen = RSA_private_encrypt(datalen,(unsigned char*) data,sigret,pkey->pkey.rsa,RSA_PKCS1_PADDING);
-
- if (siglen < 0)
- {
-
- ERR_error_string_n(ERR_get_error(), opensslerr ,1024);
- jniThrowException(env, "java/security/InvalidKeyException", opensslerr);
-
- ERR_print_errors_fp(stderr);
- return NULL;
-
-
- }
-
-
- jbyteArray jb;
-
- jb =env->NewByteArray(siglen);
-
- env->SetByteArrayRegion(jb, 0, siglen, (jbyte *) sigret);
- free(sigret);
- return jb;
-
-}
diff --git a/jni/jniglue.c b/jni/jniglue.c
deleted file mode 100644
index 36ad8fe7..00000000
--- a/jni/jniglue.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <jni.h>
-#include <android/log.h>
-#include <stdlib.h>
-#include <setjmp.h>
-
-#include "jniglue.h"
-
-jint JNI_OnLoad(JavaVM *vm, void *reserved) {
- __android_log_write(ANDROID_LOG_DEBUG,"openvpn", "Loading openvpn native library $id$ compiled on " __DATE__ " " __TIME__ );
- return JNI_VERSION_1_2;
-}
-
-
-void android_openvpn_log(int level,const char* prefix,const char* prefix_sep,const char* m1)
-{
- __android_log_print(ANDROID_LOG_DEBUG,"openvpn","%s%s%s",prefix,prefix_sep,m1);
-}
-
-void Java_de_blinkt_openvpn_core_NativeUtils_jniclose(JNIEnv *env,jclass jo, jint fd) {
- int ret = close(fd);
-}
diff --git a/jni/jniglue.h b/jni/jniglue.h
deleted file mode 100644
index a86d52da..00000000
--- a/jni/jniglue.h
+++ /dev/null
@@ -1,12 +0,0 @@
-//
-// jniglue.h
-// xcopenvpn
-//
-// Created by Arne Schwabe on 29.03.12.
-// Copyright (c) 2012 Universität Paderborn. All rights reserved.
-//
-
-#ifndef xcopenvpn_jniglue_h
-#define xcopenvpn_jniglue_h
-void android_openvpn_log(int level,const char* prefix,const char* prefix_sep,const char* m1);
-#endif
diff --git a/jni/minivpn.c b/jni/minivpn.c
deleted file mode 100644
index e69de29b..00000000
--- a/jni/minivpn.c
+++ /dev/null