From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTP id 500425D5 for ; Fri, 13 Apr 2018 03:01:19 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.48,444,1517871600"; d="scan'208,217";a="322636584" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 13 Apr 2018 05:01:18 +0200 Received: by sympa.inria.fr (Postfix, from userid 20132) id F193D82438; Fri, 13 Apr 2018 05:01:17 +0200 (CEST) Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 030CA8240C for ; Fri, 13 Apr 2018 05:01:09 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=mukeshtiwari.iiitm@gmail.com; spf=Pass smtp.mailfrom=mukeshtiwari.iiitm@gmail.com; spf=None smtp.helo=postmaster@mail-wm0-f47.google.com IronPort-PHdr: =?us-ascii?q?9a23=3AQV466xc8TsTsWg1fKPSbVzAMlGMj4u6mDksu8pMi?= =?us-ascii?q?zoh2WeGdxcS4YB7h7PlgxGXEQZ/co6odzbaO6Oa4ASQp2tWoiDg6aptCVhsI24?= =?us-ascii?q?09vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6nK94iQPFRrhKAF7?= =?us-ascii?q?Ovr6GpLIj8Swyuu+54Dfbx9HiTahb75+Ngm6oRnMvcQKnIVuLbo8xAHUqXVSYe?= =?us-ascii?q?RWwm1oJVOXnxni48q74YBu/SdNtf8/7sBMSar1cbg2QrxeFzQmLns65Nb3uhnZ?= =?us-ascii?q?TAuA/WUTX2MLmRdVGQfF7RX6XpDssivms+d2xSeXMdHqQb0yRD+v6bpgRh31hy?= =?us-ascii?q?cdLzM28m/XhMx+gqxYvRyvuQBwzpXOb42JLvdzZL/Rcc8YSGdHQ81fVzZBAoS5?= =?us-ascii?q?b4YXCuoBIOVYoJfmp1sOsBC+GQisBe31xT9Sh3/9wKo30+E8EQHFwgMgBNIOsG?= =?us-ascii?q?jVrNT7LqgSS+G1wLPJzTXCbvNWxTL95ZPHchAku/6MXLZwfdDNxkkoEgPIl1Od?= =?us-ascii?q?opHrMTOS0+QCqWmb7+x4WOKplW4nrB1xrSa0xss2lobJgYcVxkjL9SV43IY1Jc?= =?us-ascii?q?C4R1VhbdG4F5tQsieXPJZ1TMM6W2xluik3xqcbtZKlfCUG0pcqywDFZ/GIcYWF?= =?us-ascii?q?5A/oWvyLLjdinn1lfaqyhxas/kikze3xTsy030xLripBi9XNuHUN2wDK5siJRf?= =?us-ascii?q?Zw/F2t2TmI1wDU5eFEJV47mbDHJJ4mx748jpsTsULdES/qgEj7jqCbel859uS2?= =?us-ascii?q?6+nreLbrqoGGO4J7iAzyKqEulda+AeQ8PAgORW+b+eGk2b3m4E35Q6tFjuY2kq?= =?us-ascii?q?nFsZDbK94UprS4AwNP04Yj6he/Dyuj0NkDknkHKUhKeBODj4TzJ17OJ/X4Ae+l?= =?us-ascii?q?g1uwiDdr2+zGPrr5D5rRNHfDlbPhca95605d0woz0ctS54lUC7EEOPL8QFX9tN?= =?us-ascii?q?3eDh8jMgy72fzrCNtn1tBWZWXaSKGeKr7XmU/Z7aQhOaPEMIESoiv4A+h07Ljg?= =?us-ascii?q?lyl90VQUeK3s2ZoMdFi5GO5nKgOXeynCmNAERGIXvQclTKT2iUKLSz8bM3OvXK?= =?us-ascii?q?8n5i06F4u8DMHCR4GxhZSO2S66GttdYWUQWQPEKmvha4jRA6REUymVOMI0ymVV?= =?us-ascii?q?B4jkcJco0FSVjCG/zrNmKuTO/ShB7MDs0dF046vYkhRgrGUoXfTY6HmESiRPpk?= =?us-ascii?q?1NXyU/hfktrkl0y1PF2q990aQBSI5joshRWwJ/Dqbyiux3D9eoB1DEd9aNDUmj?= =?us-ascii?q?GpCoXW53QdU2zNsDJU16Hof6gw=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0ADBADYHNBafy9SfUpcg0iBDG8oCoNag?= =?us-ascii?q?R2CUJEogXSBD419hGeBewslhF4CghoHGQcBBDIWAQIBAQEBAQEBAQETAQEJCws?= =?us-ascii?q?IJiUMgjUigksBAQEBAgEjHQEbDw8DDAYFCzcCAiEBAREBBQEcBgESFIRgAQMNC?= =?us-ascii?q?A+bQDyLBYF/BQEXgm8Fg1AKGSYNVFeCJwIBBRKHTh2CE4NsLoJPQgICgguCU4J?= =?us-ascii?q?UApBfhlIsCIVXhWWCfYEzg1qHOYklPYYjDwMegQQjDlaBH3BPMYISgzEBCIJCi?= =?us-ascii?q?mQtMI9NAQE?= X-IPAS-Result: =?us-ascii?q?A0ADBADYHNBafy9SfUpcg0iBDG8oCoNagR2CUJEogXSBD41?= =?us-ascii?q?9hGeBewslhF4CghoHGQcBBDIWAQIBAQEBAQEBAQETAQEJCwsIJiUMgjUigksBA?= =?us-ascii?q?QEBAgEjHQEbDw8DDAYFCzcCAiEBAREBBQEcBgESFIRgAQMNCA+bQDyLBYF/BQE?= =?us-ascii?q?Xgm8Fg1AKGSYNVFeCJwIBBRKHTh2CE4NsLoJPQgICgguCU4JUApBfhlIsCIVXh?= =?us-ascii?q?WWCfYEzg1qHOYklPYYjDwMegQQjDlaBH3BPMYISgzEBCIJCimQtMI9NAQE?= X-IronPort-AV: E=Sophos;i="5.48,444,1517871600"; d="scan'208,217";a="261892080" Received: from mail-wm0-f47.google.com ([74.125.82.47]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 13 Apr 2018 05:01:08 +0200 Received: by mail-wm0-f47.google.com with SMTP id t67so2229221wmt.0 for ; Thu, 12 Apr 2018 20:01:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=0gw2L1XKKouuYdzxbZoHvjiQaFS7uW5Kkr0Irn/kuiw=; b=IIPr7MGIQF8P/gDyfVGGswMf7E45tghOMoaIyTXY/uDoakBnhL2aOTSzpe3Og4BESX Wari3Y959Zvp3axczOuWQoDtcm647h7RPdTOmBZsB/S9l3a0guhtwmXMsTsFLRRWSwow gEO7qJ2Qpv+DCDyPcHPgCGs0VQAgEuhlyKBWs8FrrIHVgx4+JxG+o3N41hxTOeV91xGd TL6oMmLTHKp3ljU8ajKJacyeyaMWJas+yOD/xVZJMFFNjj9pTfCa0rU3a/2g92oPakqT Yihwsk/Bt1sHI6xro04oh8YDFeChxXDsdSpw69b/UO5aUqG5K5/SV8G06Vs0oHEvLaqh 1ezg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=0gw2L1XKKouuYdzxbZoHvjiQaFS7uW5Kkr0Irn/kuiw=; b=uLvPme0+V/3cwpT0CtUGe3NkYGbN1csceKYceA0VLq2vAr4gqGMrXX/ZL5L8RPuC7i DzT61JTJMiL9WuHUNcPhNaOV/jDqDtObOFtqqb+7COPa+Z0EWn8sV0/RDjgahsRzPPjk YitkHRVXlDzt6poKD3q0E8YGTliY3aadQ41GsPZqRVqcNXmqz9eXGO8B+c9OgpiZsbqo A8BW76sdfFEtTrgNsoq/xEOJ61a9DqGVhsONA+ofQPn7aDoNb/8tCARqzOBWZ3U9Y9EG saHl9yfoSCljOEURah4dTNDxNCt1YkFgKd95NkLrex2whfoqQiU6gLRYpxk9mxB/jVhH GsoQ== X-Gm-Message-State: ALQs6tCwRd1DUbjtNp9r7gqHvOxQDJlmP/quKBPdZ4ym3e4UqlbYDu7e TquuEGGqfDnWwhhS3cvEMFi22Vb/bpp3HURvCBahJw== X-Google-Smtp-Source: AIpwx48DHo4NKnFRX2pdCtjoTy1CqY4JNKxlk1JUyVuigYV+jSe76e/imQvuqJx5QuewZ3A1S0gpX9twVBzVesMJUpc= X-Received: by 10.28.197.205 with SMTP id v196mr2416038wmf.39.1523588468061; Thu, 12 Apr 2018 20:01:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.190.14 with HTTP; Thu, 12 Apr 2018 20:01:07 -0700 (PDT) In-Reply-To: <6AE89499-0C31-4798-BC90-B5712709E405@x9c.fr> References: <6AE89499-0C31-4798-BC90-B5712709E405@x9c.fr> From: mukesh tiwari Date: Fri, 13 Apr 2018 13:01:07 +1000 Message-ID: To: "forum@x9c.fr" , caml-list@inria.fr Content-Type: multipart/alternative; boundary="94eb2c0d4c026c3ba90569b21558" Subject: Re: [Caml-list] Calling Java function from OCaml Reply-To: mukesh tiwari X-Loop: caml-list@inria.fr X-Sequence: 16806 Errors-to: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --94eb2c0d4c026c3ba90569b21558 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Xavier, and Gabriel, Thank you very much for reply. Let me give me general understanding of my project. I am trying to count encrypted ballots (Additive Elgamal) which is matrix of ciphertext. We multiply these ballots (matrices) point wise and decrypt it to get additive final value in plaintext [2]. For encryption, decryption and zero knowledge proof, we are using unicrypt library [3]. You can see the encryption part in Coq as Axiom [4] and will be realized by java functions from unicrypt library in extracted OCaml code [5]. We will replace the Z [6] with big_int in OCaml. I am also wondering if these things (unicrypt functionality of encryption, decryption and zero knowledge proof) can be realized by CertiCrypt [7] ? Best regards, Mukesh Tiwari [1] https://github.com/mukeshtiwari/EncryptionSchulze/blob/master/code/ballot_m= at.txt [2] https://nvotes.com/multiplicative-vs-additive-homomorphic-elgamal/ [3] https://github.com/bfh-evg/unicrypt [4] https://github.com/mukeshtiwari/EncryptionSchulze/blob/master/code/Encrypti= onSchulze.v#L713 [5] https://github.com/mukeshtiwari/EncryptionSchulze/blob/master/code/lib.ml [6] https://github.com/mukeshtiwari/EncryptionSchulze/blob/master/code/lib.ml#L= 74 [7] https://github.com/EasyCrypt On Fri, Apr 13, 2018 at 4:57 AM, forum@x9c.fr wrote: > > Le 12 avr. 2018 =C3=A0 10:40, mukesh tiwari a > =C3=A9crit : > > Hi Everyone, > I am trying to call some Java functions from OCaml (Extracted from Coq if > it matters). I am familiar with ocamljava [1], but it says that "*The > generated code usually runs faster than OCaml bytecode but slower than > native code. Memory consumption and startup time are also higher, but > leveraging the multiple cores of a machine can help reaching the > performance level of native code.*", and I don't want to leave the OCaml > native code. One suggestion I got on #ocaml channel is using RPC and a > quick Google search leads to ocaml-rpc [2]. I am wondering if experts fr= om > OCaml community could please give me some suggestions. > > > For the record, the performance of ocamljava-compiled code > heavily depends on the programming style. Numerical imperative > or i/o-bound code can be on par with ocamlopt-compiled code, > while code based on exceptions for control flow or abundant indirect > calls can be slower than ocamlc-compiled code. I am afraid > extracted code is likely to fall in the second category. > > It is also noteworthy that you can run into problems with extracted > code. I suspect extracted code might contain call to "Obj.magic", > as the type system of Coq is slightly more powerful than the one > of OCaml. The issue is that that OCaml-Java uses a different > memory layout, so that "Obj.magic" might not yield the same result > as in vanilla OCaml. > > > Best regards, > > Xavier Clerc > > PS: if you are able to share your code, I might be able to give you > a less generic assessment. > --=20 Caml-list mailing list. Subscription management and archives: https://sympa.inria.fr/sympa/arc/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs= --94eb2c0d4c026c3ba90569b21558 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Xavier, and Gabriel,
Thank y= ou very much for reply. Let me give me general understanding of my project.= I am trying to count encrypted ballots (Additive Elgamal) which is matrix = of ciphertext. We multiply these ballots (matrices) point wise and decrypt = it to get additive final value in plaintext [2]. For encryption, decryption= and zero knowledge proof, we are using unicrypt library [3]. You can see t= he encryption part in Coq as Axiom [4] and will be realized by java functio= ns from unicrypt library in extracted OCaml code [5].=C2=A0 We will replace= the Z [6] with big_int in OCaml.

I am also wondering if= these things (unicrypt functionality of encryption, decryption and zero kn= owledge proof) can be realized by CertiCrypt [7] ?

Best regar= ds,
Mukesh Tiwari

On Fri, Apr 13, 2018 at 4:57 AM, forum@x9= c.fr <forum@x9c.fr> wrote:
=

Le 12 avr. 2018 =C3=A0 10:40, mukesh tiwari <mukeshtiwari.iii= tm@gmail.com> a =C3=A9crit :

Hi Everyone= ,
I am trying to call some Java functions from OCaml (Extracted f= rom Coq if it matters). I am familiar with ocamljava [1], but it says that = "The generated code usually runs faster than OCaml bytecode but slo= wer=20 than native code. Memory consumption and startup time are also higher,=20 but leveraging the multiple cores of a machine can help reaching the=20 performance level of native code.", and I don't want to leave = the OCaml native code. One suggestion I got on #ocaml channel is using RPC = and a quick Google search leads to ocaml-rpc [2].=C2=A0 I am wondering if e= xperts from OCaml community could please give me some suggestions.

For the record,= the performance of ocamljava-compiled code
heavily depends on th= e programming style. Numerical imperative
or i/o-bound code can b= e on par with ocamlopt-compiled code,
while code based on excepti= ons for control flow or abundant indirect
calls can be slower tha= n ocamlc-compiled code. I am afraid
extracted code is likely to f= all in the second category.

It is also noteworthy = that you can run into problems with extracted
code. I suspect ext= racted code might contain call to "Obj.magic",
as the t= ype system of Coq is slightly more powerful than the one
of OCaml= . The issue is that that OCaml-Java uses a different
memory layou= t, so that "Obj.magic" might not yield the same result
= as in vanilla OCaml.


Best regards,<= /div>

Xavier Clerc

PS: if you a= re able to share your code, I might be able to give you
a less ge= neric assessment.

--94eb2c0d4c026c3ba90569b21558--