diff --git a/min-bindings/csharp/ckzg.c b/min-bindings/csharp/ckzg.c index ecb2a94..da79f13 100644 --- a/min-bindings/csharp/ckzg.c +++ b/min-bindings/csharp/ckzg.c @@ -78,3 +78,20 @@ C_KZG_RET compute_aggregate_kzg_proof_wrap(uint8_t out[48], const uint8_t blobs[ bytes_from_g1(out, &f); return C_KZG_OK; } + +int verify_kzg_proof_wrap(const uint8_t c[48], const uint8_t x[32], const uint8_t y[32], const uint8_t p[48], KZGSettings *s) { + KZGCommitment commitment; + KZGProof proof; + BLSFieldElement fx, fy; + bool out; + + bytes_to_bls_field(&fx, x); + bytes_to_bls_field(&fy, y); + if (bytes_to_g1(&commitment, c) != C_KZG_OK) return -1; + if (bytes_to_g1(&proof, p) != C_KZG_OK) return -1; + + if (verify_kzg_proof(&out, &commitment, &fx, &fy, &proof, s) != C_KZG_OK) + return -2; + + return out ? 0 : 1; +} diff --git a/min-bindings/csharp/tests.cs b/min-bindings/csharp/tests.cs index d39104b..96d3d62 100644 --- a/min-bindings/csharp/tests.cs +++ b/min-bindings/csharp/tests.cs @@ -15,6 +15,9 @@ class ckzg [DllImport("ckzg.dll", EntryPoint = "verify_aggregate_kzg_proof_wrap")] // returns 0 on success public static extern int verify_aggregate_kzg_proof(byte[] blobs, byte[] commitments, int n, byte[/*48*/] proof, IntPtr ts); + [DllImport("ckzg.dll", EntryPoint = "verify_kzg_proof_wrap")] // returns 0 on success + public static extern int verify_kzg_proof(byte[/*48*/] c, byte[/*32*/] x, byte[/*32*/] y, byte[/*48*/] p, IntPtr ts); + [DllImport("ckzg.dll", EntryPoint = "load_trusted_setup_wrap")] // free result with free_trusted_setup() public static extern IntPtr load_trusted_setup(string filename);