diff --git a/ffi/java/com/herumi/mcl/Fp.java b/ffi/java/com/herumi/mcl/Fp.java index bac8b54..ea83f38 100644 --- a/ffi/java/com/herumi/mcl/Fp.java +++ b/ffi/java/com/herumi/mcl/Fp.java @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 4.0.0 + * Version 4.0.2 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. diff --git a/ffi/java/com/herumi/mcl/Fr.java b/ffi/java/com/herumi/mcl/Fr.java index 94656c6..5d1e00a 100644 --- a/ffi/java/com/herumi/mcl/Fr.java +++ b/ffi/java/com/herumi/mcl/Fr.java @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 4.0.0 + * Version 4.0.2 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. diff --git a/ffi/java/com/herumi/mcl/G1.java b/ffi/java/com/herumi/mcl/G1.java index 2492a3b..a101f51 100644 --- a/ffi/java/com/herumi/mcl/G1.java +++ b/ffi/java/com/herumi/mcl/G1.java @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 4.0.0 + * Version 4.0.2 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. diff --git a/ffi/java/com/herumi/mcl/G2.java b/ffi/java/com/herumi/mcl/G2.java index 5bd7e66..8ac8c48 100644 --- a/ffi/java/com/herumi/mcl/G2.java +++ b/ffi/java/com/herumi/mcl/G2.java @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 4.0.0 + * Version 4.0.2 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. diff --git a/ffi/java/com/herumi/mcl/GT.java b/ffi/java/com/herumi/mcl/GT.java index 3aefca6..06df6bb 100644 --- a/ffi/java/com/herumi/mcl/GT.java +++ b/ffi/java/com/herumi/mcl/GT.java @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 4.0.0 + * Version 4.0.2 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. diff --git a/ffi/java/com/herumi/mcl/Mcl.java b/ffi/java/com/herumi/mcl/Mcl.java index c292c1e..8074e39 100644 --- a/ffi/java/com/herumi/mcl/Mcl.java +++ b/ffi/java/com/herumi/mcl/Mcl.java @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 4.0.0 + * Version 4.0.2 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -113,4 +113,8 @@ public class Mcl implements MclConstants { MclJNI.mul__SWIG_4(GT.getCPtr(z), z, GT.getCPtr(x), x, GT.getCPtr(y), y); } + public static void inv(GT y, GT x) { + MclJNI.inv(GT.getCPtr(y), y, GT.getCPtr(x), x); + } + } diff --git a/ffi/java/com/herumi/mcl/MclConstants.java b/ffi/java/com/herumi/mcl/MclConstants.java index 6d31b20..8068eca 100644 --- a/ffi/java/com/herumi/mcl/MclConstants.java +++ b/ffi/java/com/herumi/mcl/MclConstants.java @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 4.0.0 + * Version 4.0.2 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. diff --git a/ffi/java/com/herumi/mcl/MclJNI.java b/ffi/java/com/herumi/mcl/MclJNI.java index ccb56a4..7d60c90 100644 --- a/ffi/java/com/herumi/mcl/MclJNI.java +++ b/ffi/java/com/herumi/mcl/MclJNI.java @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 4.0.0 + * Version 4.0.2 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -93,6 +93,7 @@ public class MclJNI { 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_4(long jarg1, GT jarg1_, long jarg2, GT jarg2_, long jarg3, GT jarg3_); + public final static native void inv(long jarg1, GT jarg1_, long jarg2, GT jarg2_); 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/java.md b/ffi/java/java.md index 0e6d3cb..3d23fc3 100644 --- a/ffi/java/java.md +++ b/ffi/java/java.md @@ -50,6 +50,7 @@ Mcl.SystemInit(curveType); // curveType = Mcl.BN254 or Mcl.BLS12_381 * `GT::setStr(String str)` ; set by the result of `toString()` method * `Mcl.mul(GT z, GT x, GT y)` ; `z = x * y` * `Mcl.pow(GT z, GT x, Fr y)` ; `z = x ^ y` +* `Mcl.inv(GT y, GT x)` ; `y = x^{-1}` ## pairing * `Mcl.pairing(GT e, G1 P, G2 Q)` ; e = e(P, Q) diff --git a/ffi/java/mcl_impl.hpp b/ffi/java/mcl_impl.hpp index 8eb2373..1859048 100644 --- a/ffi/java/mcl_impl.hpp +++ b/ffi/java/mcl_impl.hpp @@ -335,6 +335,7 @@ void mul(G2& z, const G2& x, const Fr& y) class GT { mcl::bn::Fp12 self_; friend void mul(GT& z, const GT& x, const GT& y); + friend void inv(GT& y, GT& x); friend void pow(GT& z, const GT& x, const Fr& y); friend void pairing(GT& e, const G1& P, const G2& Q); public: @@ -367,6 +368,10 @@ void mul(GT& z, const GT& x, const GT& y) { mcl::bn::Fp12::mul(z.self_, x.self_, y.self_); } +void inv(GT& y, GT& x) +{ + mcl::bn::Fp12::inv(y.self_, x.self_); +} void pow(GT& z, const GT& x, const Fr& y) { mcl::bn::Fp12::pow(z.self_, x.self_, y.self_); diff --git a/ffi/java/mcl_wrap.cxx b/ffi/java/mcl_wrap.cxx index 6446e7f..fbd267f 100644 --- a/ffi/java/mcl_wrap.cxx +++ b/ffi/java/mcl_wrap.cxx @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 4.0.0 + * Version 4.0.2 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -182,15 +182,16 @@ template T SwigValueInit() { /* Support for throwing Java exceptions */ typedef enum { - SWIG_JavaOutOfMemoryError = 1, - SWIG_JavaIOException, - SWIG_JavaRuntimeException, + SWIG_JavaOutOfMemoryError = 1, + SWIG_JavaIOException, + SWIG_JavaRuntimeException, SWIG_JavaIndexOutOfBoundsException, SWIG_JavaArithmeticException, SWIG_JavaIllegalArgumentException, SWIG_JavaNullPointerException, SWIG_JavaDirectorPureVirtual, - SWIG_JavaUnknownError + SWIG_JavaUnknownError, + SWIG_JavaIllegalStateException, } SWIG_JavaExceptionCodes; typedef struct { @@ -211,6 +212,7 @@ static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionC { SWIG_JavaNullPointerException, "java/lang/NullPointerException" }, { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" }, { SWIG_JavaUnknownError, "java/lang/UnknownError" }, + { SWIG_JavaIllegalStateException, "java/lang/IllegalStateException" }, { (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" } }; const SWIG_JavaExceptions_t *except_ptr = java_exceptions; @@ -2199,6 +2201,28 @@ SWIGEXPORT void JNICALL Java_com_herumi_mcl_MclJNI_mul_1_1SWIG_14(JNIEnv *jenv, } +SWIGEXPORT void JNICALL Java_com_herumi_mcl_MclJNI_inv(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + GT *arg1 = 0 ; + GT *arg2 = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + 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 & reference is null"); + return ; + } + inv(*arg1,*arg2); +} + + SWIGEXPORT jlong JNICALL Java_com_herumi_mcl_MclJNI_new_1GT_1_1SWIG_10(JNIEnv *jenv, jclass jcls) { jlong jresult = 0 ; GT *result = 0 ;