-
Notifications
You must be signed in to change notification settings - Fork 527
cgo: Properly manage memory passing from cgo to go on Batch Verifiers #5700
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f4628b4
prepare a contiguous memory block for messages, without additional co…
algonautshant ce83edd
Merge remote-tracking branch 'upstream/master' into shant/cgo-fix
algonautshant 7ab3c27
use wrapper C function without using byte arrays for signatures
algonautshant a4a5d31
add C wrapper from the POC
algonautshant 2f16ab9
Merge remote-tracking branch 'upstream/master' into shant/cgo-fix
algonautshant dc241bb
keep the keepAlive until it is replaced by Pin
algonautshant b40b126
add a test and simplify HashRepToBuff
algonautshant 56a5154
CR: suggested make it more readable
algonautshant 4f04839
fix
algonautshant a95de53
add partition to test
algonautshant 607da07
CR: do not copy mesg lengths to C.ulonglong
algonautshant 2dde9bc
CR update and slice allocation runtime check for #5700
cce a50dc52
allocate space for 2D arrays in Go, rather than C
cce File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #include "sodium.h" | ||
| int ed25519_batch_wrapper(const unsigned char **messages2D, | ||
| const unsigned char **publicKeys2D, | ||
| const unsigned char **signatures2D, | ||
| const unsigned char *messages1D, | ||
| const unsigned long long *mlen, | ||
| const unsigned char *publicKeys1D, | ||
| const unsigned char *signatures1D, | ||
| size_t num, | ||
| int *valid) { | ||
| // fill 2-D arrays for messages, pks, sigs from provided 1-D arrays | ||
| unsigned long long mpos = 0; | ||
| for (size_t i = 0; i < num; i++) { | ||
| messages2D[i] = &messages1D[mpos]; | ||
| mpos += mlen[i]; | ||
| publicKeys2D[i] = &publicKeys1D[i*crypto_sign_ed25519_PUBLICKEYBYTES]; | ||
| signatures2D[i] = &signatures1D[i*crypto_sign_ed25519_BYTES]; | ||
| } | ||
| return crypto_sign_ed25519_open_batch(messages2D, mlen, publicKeys2D, signatures2D, num, valid); | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.