-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
14 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,14 @@ | ||
#include "wrapper.h" | ||
#include "verifier.hpp" | ||
|
||
extern "C" { | ||
ByteArray validate_proof(const uint8_t* seed, uint8_t k, const uint8_t* challenge, const uint8_t* proof, uint16_t proof_len) { | ||
bool validate_proof(uint8_t* seed, uint8_t k, uint8_t* challenge, uint8_t* proof, uint16_t proof_len, uint8_t* quality_buf) { | ||
Verifier v; | ||
auto quality = v.ValidateProof(seed, k, challenge, proof, proof_len); | ||
if (quality.GetSize() == 0) { | ||
return ByteArray { nullptr, 0 }; | ||
return false; | ||
} | ||
uint8_t *quality_buf = new uint8_t[32]; | ||
quality.ToBytes(quality_buf); | ||
delete[] quality_buf; | ||
return ByteArray { quality_buf, 32 }; | ||
} | ||
|
||
void delete_byte_array(ByteArray array) { | ||
delete[] array.data; | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,5 @@ | ||
#include "picosha2.hpp" | ||
#include "../src/verifier.hpp" | ||
|
||
extern "C" { | ||
typedef struct { | ||
uint8_t* data; | ||
size_t length; | ||
} ByteArray; | ||
|
||
ByteArray validate_proof(const uint8_t* seed, uint8_t k, const uint8_t* challenge, const uint8_t* proof, uint16_t proof_len); | ||
|
||
void delete_byte_array(ByteArray array); | ||
bool validate_proof(uint8_t* seed, uint8_t k, uint8_t* challenge, uint8_t* proof, uint16_t proof_len, uint8_t* quality_buf); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters