Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed proof generation. #422

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified android/src/main/jniLibs/arm64-v8a/librapidsnark.so
Binary file not shown.
Binary file modified android/src/main/jniLibs/x86_64/librapidsnark.so
Binary file not shown.
60 changes: 49 additions & 11 deletions ios/Classes/prover.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,61 @@ extern "C" {
#endif

//Error codes returned by the functions.
#define PRPOVER_OK 0x0
#define PPROVER_ERROR 0x1
#define PPROVER_ERROR_SHORT_BUFFER 0x2
#define PROVER_OK 0x0
#define PROVER_ERROR 0x1
#define PROVER_ERROR_SHORT_BUFFER 0x2
#define PROVER_INVALID_WITNESS_LENGTH 0x3

/**
* Calculates buffer size to output public signals as json string
* @returns PROVER_OK in case of success, and the size of public buffer is written to public_size
*/
int
groth16_public_size_for_zkey_buf(const void *zkey_buffer, unsigned long zkey_size,
size_t *public_size,
char *error_msg, unsigned long error_msg_maxsize);

/**
* groth16_public_size_for_zkey_file calculates minimum buffer size for
* JSON-formatted public signals. The calculated buffer size is written
* to the public_size variable.
*
* @return error code:
* PRPOVER_OK - in case of success.
* PPROVER_ERROR - in case of an error.
* PROVER_OK (0) - in case of success
* PROVER_ERROR - in case of an error, error_msg contains the error message
*/
int
groth16_public_size_for_zkey_file(const char *zkey_fname,
unsigned long *public_size,
char *error_msg, unsigned long error_msg_maxsize);

extern int
groth16_prover(const void *zkey_buffer, unsigned long zkey_size,
const void *wtns_buffer, unsigned long wtns_size,
char *proof_buffer, unsigned long *proof_size,
char *public_buffer, unsigned long *public_size,
char *error_msg, unsigned long error_msg_maxsize);
/**
* groth16_prover
* @return error code:
* PROVER_OK - in case of success
* PPOVER_ERROR - in case of an error
* PROVER_ERROR_SHORT_BUFFER - in case of a short buffer error, also updates proof_size and public_size with actual proof and public sizess
*/
int
groth16_prover(const void *zkey_buffer, unsigned long zkey_size,
const void *wtns_buffer, unsigned long wtns_size,
char *proof_buffer, unsigned long *proof_size,
char *public_buffer, unsigned long *public_size,
char *error_msg, unsigned long error_msg_maxsize);

/**
* groth16_prover
* @return error code:
* PROVER_OK - in case of success
* PPOVER_ERROR - in case of an error
* PROVER_ERROR_SHORT_BUFFER - in case of a short buffer error, also updates proof_size and public_size with actual proof and public sizess
*/
int
groth16_prover_zkey_file(const char *zkey_file_path,
const void *wtns_buffer, unsigned long wtns_size,
char *proof_buffer, unsigned long *proof_size,
char *public_buffer, unsigned long *public_size,
char *error_msg, unsigned long error_msg_maxsize);

#ifdef __cplusplus
}
Expand Down
Binary file modified ios/libfq.a
Binary file not shown.
Binary file modified ios/libfr.a
Binary file not shown.
Binary file modified ios/libgmp.a
Binary file not shown.
Binary file modified ios/librapidsnark.a
Binary file not shown.
Loading