mirror of
https://github.com/logos-storage/nim-circom-compat.git
synced 2026-01-05 23:23:07 +00:00
rework ffi
This commit is contained in:
parent
d8d8bfaec7
commit
4f9b09afa8
@ -37,6 +37,23 @@ type Buffer* = object
|
||||
data*: pointer
|
||||
len*: uint
|
||||
|
||||
type G1* = object
|
||||
x*: array[byte, 32]
|
||||
y*: array[byte, 32]
|
||||
|
||||
type G2* = object
|
||||
x*: array[array[byte, 32], 2]
|
||||
y*: array[array[byte, 32], 2]
|
||||
|
||||
type Proof* = object
|
||||
a*: G1
|
||||
b*: G2
|
||||
c*: G1
|
||||
|
||||
type Inputs* = object
|
||||
elms*: ptr array[byte, 32]
|
||||
len*: uint
|
||||
|
||||
## # Safety
|
||||
#
|
||||
proc init_circom_compat*(r1cs_path: pointer,
|
||||
@ -51,16 +68,15 @@ proc release_buffer*(buff_ptr: ptr ptr Buffer): void {.importc: "release_buffer"
|
||||
## # Safety
|
||||
#
|
||||
proc prove_circuit*(ctx_ptr: ptr CircomCompatCtx,
|
||||
compress: bool,
|
||||
proof_bytes_ptr: ptr ptr Buffer,
|
||||
inputs_bytes_ptr: ptr ptr Buffer): int32 {.importc: "prove_circuit".}
|
||||
proof_ptr: ptr ptr Proof,
|
||||
inputs_ptr: ptr ptr Inputs): int32 {.importc: "prove_circuit".}
|
||||
|
||||
## # Safety
|
||||
#
|
||||
proc verify_circuit*(ctx_ptr: ptr CircomCompatCtx,
|
||||
compress: bool,
|
||||
proof_bytes_ptr: ptr Buffer,
|
||||
inputs_bytes_ptr: ptr Buffer): int32 {.importc: "verify_circuit".}
|
||||
proof: ptr Proof,
|
||||
inputs: ptr Inputs): int32 {.importc: "verify_circuit".}
|
||||
|
||||
## # Safety
|
||||
#
|
||||
|
||||
2
vendor/circom-compat-ffi
vendored
2
vendor/circom-compat-ffi
vendored
@ -1 +1 @@
|
||||
Subproject commit aed402f6ee8a2dc225ec2db2eb36d1888aab7790
|
||||
Subproject commit d6bb7a6b309072b98ebc42fe8f07170477541f53
|
||||
Loading…
x
Reference in New Issue
Block a user