mirror of
https://github.com/status-im/c-kzg-4844.git
synced 2025-01-12 03:04:11 +00:00
Add verify_kzg_proof back to csharp bindings
This commit is contained in:
parent
af895c8d2c
commit
54e01973cf
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user