123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124(*****************************************************************************)(* *)(* Copyright (c) 2020-2021 Danny Willems <be.danny.willems@gmail.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)modulePairing_stubs=Rustc_bls12_381_bindings.Pairing(Rustc_bls12_381_stubs)(* The pairing goes in a finite field, not a group. We strengthen the signature *)moduleRaw_Stubs=structletmiller_loop_simple(g1:Bytes.t)(g2:Bytes.t):Bytes.t=letbuffer=Bytes.makeFq12.size_in_bytes'\000'inPairing_stubs.miller_loop_simple(Ctypes.ocaml_bytes_startbuffer)(Ctypes.ocaml_bytes_startg1)(Ctypes.ocaml_bytes_startg2);bufferletpairing(g1:Bytes.t)(g2:Bytes.t):Bytes.t=letbuffer=Bytes.makeFq12.size_in_bytes'\000'inPairing_stubs.pairing(Ctypes.ocaml_bytes_startbuffer)(Ctypes.ocaml_bytes_startg1)(Ctypes.ocaml_bytes_startg2);bufferletfinal_exponentiation(e:Bytes.t):Bytes.t=letbuffer=Bytes.makeFq12.size_in_bytes'\000'inPairing_stubs.final_exponentiation(Ctypes.ocaml_bytes_startbuffer)(Ctypes.ocaml_bytes_starte);bufferletmiller_loop_2g1_1g1_2g2_1g2_2=letbuffer=Bytes.makeFq12.size_in_bytes'\000'inPairing_stubs.miller_loop_2(Ctypes.ocaml_bytes_startbuffer)(Ctypes.ocaml_bytes_startg1_1)(Ctypes.ocaml_bytes_startg1_2)(Ctypes.ocaml_bytes_startg2_1)(Ctypes.ocaml_bytes_startg2_2);bufferletmiller_loop_3g1_1g1_2g1_3g2_1g2_2g2_3=letbuffer=Bytes.makeFq12.size_in_bytes'\000'inPairing_stubs.miller_loop_3(Ctypes.ocaml_bytes_startbuffer)(Ctypes.ocaml_bytes_startg1_1)(Ctypes.ocaml_bytes_startg1_2)(Ctypes.ocaml_bytes_startg1_3)(Ctypes.ocaml_bytes_startg2_1)(Ctypes.ocaml_bytes_startg2_2)(Ctypes.ocaml_bytes_startg2_3);bufferletmiller_loop_4g1_1g1_2g1_3g1_4g2_1g2_2g2_3g2_4=letbuffer=Bytes.makeFq12.size_in_bytes'\000'inPairing_stubs.miller_loop_4(Ctypes.ocaml_bytes_startbuffer)(Ctypes.ocaml_bytes_startg1_1)(Ctypes.ocaml_bytes_startg1_2)(Ctypes.ocaml_bytes_startg1_3)(Ctypes.ocaml_bytes_startg1_4)(Ctypes.ocaml_bytes_startg2_1)(Ctypes.ocaml_bytes_startg2_2)(Ctypes.ocaml_bytes_startg2_3)(Ctypes.ocaml_bytes_startg2_4);bufferletmiller_loop_5g1_1g1_2g1_3g1_4g1_5g2_1g2_2g2_3g2_4g2_5=letbuffer=Bytes.makeFq12.size_in_bytes'\000'inPairing_stubs.miller_loop_5(Ctypes.ocaml_bytes_startbuffer)(Ctypes.ocaml_bytes_startg1_1)(Ctypes.ocaml_bytes_startg1_2)(Ctypes.ocaml_bytes_startg1_3)(Ctypes.ocaml_bytes_startg1_4)(Ctypes.ocaml_bytes_startg1_5)(Ctypes.ocaml_bytes_startg2_1)(Ctypes.ocaml_bytes_startg2_2)(Ctypes.ocaml_bytes_startg2_3)(Ctypes.ocaml_bytes_startg2_4)(Ctypes.ocaml_bytes_startg2_5);bufferletmiller_loop_6g1_1g1_2g1_3g1_4g1_5g1_6g2_1g2_2g2_3g2_4g2_5g2_6=letbuffer=Bytes.makeFq12.size_in_bytes'\000'inPairing_stubs.miller_loop_6(Ctypes.ocaml_bytes_startbuffer)(Ctypes.ocaml_bytes_startg1_1)(Ctypes.ocaml_bytes_startg1_2)(Ctypes.ocaml_bytes_startg1_3)(Ctypes.ocaml_bytes_startg1_4)(Ctypes.ocaml_bytes_startg1_5)(Ctypes.ocaml_bytes_startg1_6)(Ctypes.ocaml_bytes_startg2_1)(Ctypes.ocaml_bytes_startg2_2)(Ctypes.ocaml_bytes_startg2_3)(Ctypes.ocaml_bytes_startg2_4)(Ctypes.ocaml_bytes_startg2_5)(Ctypes.ocaml_bytes_startg2_6);bufferendincludeBls12_381_gen.Pairing.Make(G1)(G2)(Fq12)(Raw_Stubs)