123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115(*****************************************************************************)(* *)(* 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. *)(* *)(*****************************************************************************)moduleG2_stubs=Rustc_bls12_381_bindings.G2(Rustc_bls12_381_stubs)moduleStubs=structletsize_in_bytes=192letempty()=Bytes.makesize_in_bytes'\000'letcheck_bytesbs=G2_stubs.uncompressed_check_bytes(Ctypes.ocaml_bytes_startbs)letcheck_compressed_bytesbs=G2_stubs.compressed_check_bytes(Ctypes.ocaml_bytes_startbs)letcompressed_of_uncompressedbs=letres=Bytes.make(size_in_bytes/2)'\000'inG2_stubs.compressed_of_uncompressed(Ctypes.ocaml_bytes_startres)(Ctypes.ocaml_bytes_startbs);resletuncompressed_of_compressed_unsafebs=letres=empty()inG2_stubs.uncompressed_of_compressed_unsafe(Ctypes.ocaml_bytes_startres)(Ctypes.ocaml_bytes_startbs);resletis_zerobs=G2_stubs.is_zero(Ctypes.ocaml_bytes_startbs)letzero()=letbs=empty()inG2_stubs.zero(Ctypes.ocaml_bytes_startbs);bsletone()=letbs=empty()inG2_stubs.one(Ctypes.ocaml_bytes_startbs);bsletrandom()=letbs=empty()inG2_stubs.random(Ctypes.ocaml_bytes_startbs);bsletaddxy=letbuffer=empty()inG2_stubs.add(Ctypes.ocaml_bytes_startbuffer)(Ctypes.ocaml_bytes_startx)(Ctypes.ocaml_bytes_starty);bufferletmulxy=letbuffer=empty()inG2_stubs.mul(Ctypes.ocaml_bytes_startbuffer)(Ctypes.ocaml_bytes_startx)(Ctypes.ocaml_bytes_starty);bufferleteqxy=G2_stubs.eq(Ctypes.ocaml_bytes_startx)(Ctypes.ocaml_bytes_starty)letnegatex=letbuffer=empty()inG2_stubs.negate(Ctypes.ocaml_bytes_startbuffer)(Ctypes.ocaml_bytes_startx);bufferletdoublex=letbuffer=empty()inG2_stubs.double(Ctypes.ocaml_bytes_startbuffer)(Ctypes.ocaml_bytes_startx);bufferletbuild_from_componentsx_1x_2y_1y_2=letbuffer=empty()inletres=G2_stubs.build_from_components(Ctypes.ocaml_bytes_startbuffer)(Ctypes.ocaml_bytes_startx_1)(Ctypes.ocaml_bytes_startx_2)(Ctypes.ocaml_bytes_starty_1)(Ctypes.ocaml_bytes_starty_2)inifres=falsethenNoneelseSomebufferendincludeBls12_381_gen.G2.Make(Fr)(Stubs)