diff --git a/ffi/java/Makefile b/ffi/java/Makefile index 9d2c656..98dbe63 100644 --- a/ffi/java/Makefile +++ b/ffi/java/Makefile @@ -1,9 +1,9 @@ TOP_DIR=../.. include $(TOP_DIR)/common.mk ifeq ($(UNAME_S),Darwin) - JAVA_INC=-I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/ + JAVA_INC?=-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/JavaVM.framework/Headers/ else - JAVA_INC=-I/usr/lib/jvm/default-java/include + JAVA_INC?=-I/usr/lib/jvm/default-java/include #JAVA_INC=-I/usr/lib/jvm/java-7-openjdk-amd64/include CFLAGS+=-z noexecstack LDFLAGS+=-lrt diff --git a/ffi/java/com/herumi/mcl/Mcl.java b/ffi/java/com/herumi/mcl/Mcl.java index c33e046..0088f1c 100644 --- a/ffi/java/com/herumi/mcl/Mcl.java +++ b/ffi/java/com/herumi/mcl/Mcl.java @@ -42,7 +42,7 @@ public class Mcl implements MclConstants { } public static void pow(GT z, GT x, Fr y) { - MclJNI.pow__SWIG_0(GT.getCPtr(z), z, GT.getCPtr(x), x, Fr.getCPtr(y), y); + MclJNI.pow(GT.getCPtr(z), z, GT.getCPtr(x), x, Fr.getCPtr(y), y); } public static void neg(Fp y, Fp x) { @@ -61,22 +61,10 @@ public class Mcl implements MclConstants { MclJNI.mul__SWIG_3(Fp.getCPtr(z), z, Fp.getCPtr(x), x, Fp.getCPtr(y), y); } - public static void mul(G1 z, G1 x, Fp y) { - MclJNI.mul__SWIG_4(G1.getCPtr(z), z, G1.getCPtr(x), x, Fp.getCPtr(y), y); - } - - public static void mul(G2 z, G2 x, Fp y) { - MclJNI.mul__SWIG_5(G2.getCPtr(z), z, G2.getCPtr(x), x, Fp.getCPtr(y), y); - } - public static void div(Fp z, Fp x, Fp y) { MclJNI.div__SWIG_1(Fp.getCPtr(z), z, Fp.getCPtr(x), x, Fp.getCPtr(y), y); } - public static void pow(GT z, GT x, Fp y) { - MclJNI.pow__SWIG_1(GT.getCPtr(z), z, GT.getCPtr(x), x, Fp.getCPtr(y), y); - } - public static void neg(G1 y, G1 x) { MclJNI.neg__SWIG_2(G1.getCPtr(y), y, G1.getCPtr(x), x); } @@ -122,7 +110,7 @@ public class Mcl implements MclConstants { } public static void mul(GT z, GT x, GT y) { - MclJNI.mul__SWIG_6(GT.getCPtr(z), z, GT.getCPtr(x), x, GT.getCPtr(y), y); + MclJNI.mul__SWIG_4(GT.getCPtr(z), z, GT.getCPtr(x), x, GT.getCPtr(y), y); } } diff --git a/ffi/java/com/herumi/mcl/MclJNI.java b/ffi/java/com/herumi/mcl/MclJNI.java index 9e7c008..515cba0 100644 --- a/ffi/java/com/herumi/mcl/MclJNI.java +++ b/ffi/java/com/herumi/mcl/MclJNI.java @@ -17,7 +17,7 @@ public class MclJNI { public final static native void mul__SWIG_1(long jarg1, G1 jarg1_, long jarg2, G1 jarg2_, long jarg3, Fr jarg3_); public final static native void mul__SWIG_2(long jarg1, G2 jarg1_, long jarg2, G2 jarg2_, long jarg3, Fr jarg3_); public final static native void div__SWIG_0(long jarg1, Fr jarg1_, long jarg2, Fr jarg2_, long jarg3, Fr jarg3_); - public final static native void pow__SWIG_0(long jarg1, GT jarg1_, long jarg2, GT jarg2_, long jarg3, Fr jarg3_); + public final static native void pow(long jarg1, GT jarg1_, long jarg2, GT jarg2_, long jarg3, Fr jarg3_); public final static native long new_Fr__SWIG_0(); public final static native long new_Fr__SWIG_1(long jarg1, Fr jarg1_); public final static native long new_Fr__SWIG_2(int jarg1); @@ -38,10 +38,7 @@ public class MclJNI { public final static native void add__SWIG_1(long jarg1, Fp jarg1_, long jarg2, Fp jarg2_, long jarg3, Fp jarg3_); public final static native void sub__SWIG_1(long jarg1, Fp jarg1_, long jarg2, Fp jarg2_, long jarg3, Fp jarg3_); public final static native void mul__SWIG_3(long jarg1, Fp jarg1_, long jarg2, Fp jarg2_, long jarg3, Fp jarg3_); - public final static native void mul__SWIG_4(long jarg1, G1 jarg1_, long jarg2, G1 jarg2_, long jarg3, Fp jarg3_); - public final static native void mul__SWIG_5(long jarg1, G2 jarg1_, long jarg2, G2 jarg2_, long jarg3, Fp jarg3_); public final static native void div__SWIG_1(long jarg1, Fp jarg1_, long jarg2, Fp jarg2_, long jarg3, Fp jarg3_); - public final static native void pow__SWIG_1(long jarg1, GT jarg1_, long jarg2, GT jarg2_, long jarg3, Fp jarg3_); public final static native long new_Fp__SWIG_0(); public final static native long new_Fp__SWIG_1(long jarg1, Fp jarg1_); public final static native long new_Fp__SWIG_2(int jarg1); @@ -95,7 +92,7 @@ public class MclJNI { public final static native void G2_deserialize(long jarg1, G2 jarg1_, byte[] jarg2); public final static native byte[] G2_serialize(long jarg1, G2 jarg1_); public final static native void delete_G2(long jarg1); - public final static native void mul__SWIG_6(long jarg1, GT jarg1_, long jarg2, GT jarg2_, long jarg3, GT jarg3_); + public final static native void mul__SWIG_4(long jarg1, GT jarg1_, long jarg2, GT jarg2_, long jarg3, GT jarg3_); public final static native long new_GT__SWIG_0(); public final static native long new_GT__SWIG_1(long jarg1, GT jarg1_); public final static native boolean GT_equals(long jarg1, GT jarg1_, long jarg2, GT jarg2_); diff --git a/ffi/java/mcl_impl.hpp b/ffi/java/mcl_impl.hpp index 76f4ff9..ed9fb07 100644 --- a/ffi/java/mcl_impl.hpp +++ b/ffi/java/mcl_impl.hpp @@ -122,10 +122,7 @@ class Fp { friend void add(Fp& z, const Fp& x, const Fp& y); friend void sub(Fp& z, const Fp& x, const Fp& y); friend void mul(Fp& z, const Fp& x, const Fp& y); - friend void mul(G1& z, const G1& x, const Fp& y); - friend void mul(G2& z, const G2& x, const Fp& y); friend void div(Fp& z, const Fp& x, const Fp& y); - friend void pow(GT& z, const GT& x, const Fp& y); public: Fp() {} Fp(const Fp& rhs) : self_(rhs.self_) {} diff --git a/ffi/java/mcl_wrap.cxx b/ffi/java/mcl_wrap.cxx index 4999bca..c4ea085 100644 --- a/ffi/java/mcl_wrap.cxx +++ b/ffi/java/mcl_wrap.cxx @@ -460,7 +460,7 @@ SWIGEXPORT void JNICALL Java_com_herumi_mcl_MclJNI_div_1_1SWIG_10(JNIEnv *jenv, } -SWIGEXPORT void JNICALL Java_com_herumi_mcl_MclJNI_pow_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { +SWIGEXPORT void JNICALL Java_com_herumi_mcl_MclJNI_pow(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { GT *arg1 = 0 ; GT *arg2 = 0 ; Fr *arg3 = 0 ; @@ -934,64 +934,6 @@ SWIGEXPORT void JNICALL Java_com_herumi_mcl_MclJNI_mul_1_1SWIG_13(JNIEnv *jenv, } -SWIGEXPORT void JNICALL Java_com_herumi_mcl_MclJNI_mul_1_1SWIG_14(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - G1 *arg1 = 0 ; - G1 *arg2 = 0 ; - Fp *arg3 = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(G1 **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "G1 & reference is null"); - return ; - } - arg2 = *(G1 **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "G1 const & reference is null"); - return ; - } - arg3 = *(Fp **)&jarg3; - if (!arg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Fp const & reference is null"); - return ; - } - mul(*arg1,(G1 const &)*arg2,(Fp const &)*arg3); -} - - -SWIGEXPORT void JNICALL Java_com_herumi_mcl_MclJNI_mul_1_1SWIG_15(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - G2 *arg1 = 0 ; - G2 *arg2 = 0 ; - Fp *arg3 = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(G2 **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "G2 & reference is null"); - return ; - } - arg2 = *(G2 **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "G2 const & reference is null"); - return ; - } - arg3 = *(Fp **)&jarg3; - if (!arg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Fp const & reference is null"); - return ; - } - mul(*arg1,(G2 const &)*arg2,(Fp const &)*arg3); -} - - SWIGEXPORT void JNICALL Java_com_herumi_mcl_MclJNI_div_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { Fp *arg1 = 0 ; Fp *arg2 = 0 ; @@ -1021,35 +963,6 @@ SWIGEXPORT void JNICALL Java_com_herumi_mcl_MclJNI_div_1_1SWIG_11(JNIEnv *jenv, } -SWIGEXPORT void JNICALL Java_com_herumi_mcl_MclJNI_pow_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - GT *arg1 = 0 ; - GT *arg2 = 0 ; - Fp *arg3 = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(GT **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "GT & reference is null"); - return ; - } - arg2 = *(GT **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "GT const & reference is null"); - return ; - } - arg3 = *(Fp **)&jarg3; - if (!arg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Fp const & reference is null"); - return ; - } - pow(*arg1,(GT const &)*arg2,(Fp const &)*arg3); -} - - SWIGEXPORT jlong JNICALL Java_com_herumi_mcl_MclJNI_new_1Fp_1_1SWIG_10(JNIEnv *jenv, jclass jcls) { jlong jresult = 0 ; Fp *result = 0 ; @@ -2327,7 +2240,7 @@ SWIGEXPORT void JNICALL Java_com_herumi_mcl_MclJNI_delete_1G2(JNIEnv *jenv, jcla } -SWIGEXPORT void JNICALL Java_com_herumi_mcl_MclJNI_mul_1_1SWIG_16(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { +SWIGEXPORT void JNICALL Java_com_herumi_mcl_MclJNI_mul_1_1SWIG_14(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { GT *arg1 = 0 ; GT *arg2 = 0 ; GT *arg3 = 0 ;