Change API to allow fixed effective ptrs

This commit is contained in:
Alexey Osipov 2022-11-09 22:16:00 +03:00
parent 68897b375c
commit fb0d03ff25
4 changed files with 53 additions and 31 deletions

View File

@ -5,13 +5,13 @@
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Ckzg</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10</LangVersion>
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>Ckzg</Title>
<Title>Ckzg.Bindings</Title>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Version>0.1.0.1</Version>
</PropertyGroup>
<ItemGroup>

View File

@ -1,3 +1,4 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Loader;
@ -24,21 +25,21 @@ public class Ckzg
}
[DllImport("ckzg", EntryPoint = "blob_to_kzg_commitment_wrap", CallingConvention = CallingConvention.Cdecl)]
public static unsafe extern void blob_to_kzg_commitment(byte[] retval, byte[] blob, IntPtr ts);
public unsafe static extern void BlobToKzgCommitment(byte* retval, byte* blob, IntPtr ts);
[DllImport("ckzg", EntryPoint = "compute_aggregate_kzg_proof_wrap", CallingConvention = CallingConvention.Cdecl)] // returns 0 on success
public static unsafe extern int compute_aggregate_kzg_proof(byte[] retval, byte[] blobs, int n, IntPtr ts);
public unsafe static extern int ComputeAggregateKzgProof(byte* retval, byte* blobs, int n, IntPtr ts);
[DllImport("ckzg", EntryPoint = "verify_aggregate_kzg_proof_wrap", CallingConvention = CallingConvention.Cdecl)] // returns 0 on success
public static unsafe extern int verify_aggregate_kzg_proof(byte[] blobs, byte[] commitments, int blobCount, byte[] proof, IntPtr ts);
public unsafe static extern int VerifyAggregateKzgProof(byte* blobs, byte* commitments, int blobCount, byte* proof, IntPtr ts);
[DllImport("ckzg", EntryPoint = "verify_kzg_proof_wrap", CallingConvention = CallingConvention.Cdecl)] // returns 0 on success
public static extern int verify_kzg_proof(byte[/*48*/] commitment, byte[/*32*/] x, byte[/*32*/] y, byte[/*48*/] proof, IntPtr ts);
public unsafe static extern int VerifyKzgProof(byte* commitment, byte* x, byte* y, byte* proof, IntPtr ts);
[DllImport("ckzg", EntryPoint = "load_trusted_setup_wrap")] // free result with free_trusted_setup()
public static extern IntPtr load_trusted_setup(string filename);
public static extern IntPtr LoadTrustedSetup(string filename);
[DllImport("ckzg", EntryPoint = "free_trusted_setup_wrap", CallingConvention = CallingConvention.Cdecl)]
public static extern void free_trusted_setup(IntPtr ts);
public static extern void FreeTrustedSetup(IntPtr ts);
}

View File

@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<IsPackable>false</IsPackable>
</PropertyGroup>

File diff suppressed because one or more lines are too long