-
Notifications
You must be signed in to change notification settings - Fork 0
feat(integration): wrappers, adapters, bench, tests, docs #5
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
12 commits
Select commit
Hold shift + click to select a range
c1dc8a8
build(third_party): remove iaik merkle dependency
cherninkiy e33f1c5
test(tests): rename smoke source file
cherninkiy 52e88e3
refactor(merkle): normalize style and proof handling
cherninkiy 7d3bd09
test(streebog): add direct hash core checks
cherninkiy 2a37c93
feat(batch): add merkle batch signing core
cherninkiy 32ae57c
test(batch): add merkle and batch signing tests
cherninkiy 1aef680
docs(readme): fix src structure entries
cherninkiy 815efda
refactor(batch): rename batch signing adapters module
cherninkiy 495461d
docs(readme): align batch adapters naming
cherninkiy dcb9875
docs(readme): fix openssl prerequisite wording
cherninkiy 16ae7cb
fix(batch): harden serialization and ci checks
cherninkiy 8a7eb81
fix(batch): address copilot review round 2
cherninkiy 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| #include "batch_adapters.h" | ||
|
|
||
| int batch_bb_adapter_init(batch_bb_adapter_ctx* ctx, | ||
| const bb_algorithm* algorithm, | ||
| const uint8_t* sk, | ||
| size_t sk_len, | ||
| const uint8_t* pk, | ||
| size_t pk_len) { | ||
| if (ctx == NULL || algorithm == NULL || algorithm->sign == NULL || algorithm->verify == NULL) { | ||
| return -1; | ||
| } | ||
| if (sk == NULL || pk == NULL) { | ||
| return -1; | ||
| } | ||
|
|
||
| ctx->algorithm = algorithm; | ||
| ctx->sk = sk; | ||
| ctx->sk_len = sk_len; | ||
| ctx->pk = pk; | ||
| ctx->pk_len = pk_len; | ||
| return 0; | ||
| } | ||
|
|
||
| size_t batch_bb_signature_capacity(const batch_bb_adapter_ctx* ctx) { | ||
| if (ctx == NULL || ctx->algorithm == NULL) { | ||
| return 0; | ||
| } | ||
| return ctx->algorithm->signature_bytes; | ||
| } | ||
|
|
||
| int batch_bb_sign_callback(void* user_ctx, | ||
| const uint8_t* msg, | ||
| size_t msg_len, | ||
| uint8_t* sig, | ||
| size_t sig_capacity, | ||
| size_t* sig_len) { | ||
| batch_bb_adapter_ctx* ctx = (batch_bb_adapter_ctx*)user_ctx; | ||
| bb_status status; | ||
|
|
||
| if (ctx == NULL || ctx->algorithm == NULL || ctx->algorithm->sign == NULL || | ||
| msg == NULL || sig == NULL || sig_len == NULL) { | ||
| return 0; | ||
| } | ||
|
|
||
| status = ctx->algorithm->sign(ctx->sk, | ||
| ctx->sk_len, | ||
| ctx->pk, | ||
| ctx->pk_len, | ||
| msg, | ||
| msg_len, | ||
| sig, | ||
| sig_capacity, | ||
| sig_len); | ||
| return status == BB_OK ? 1 : 0; | ||
| } | ||
|
|
||
| int batch_bb_verify_callback(void* user_ctx, | ||
| const uint8_t* msg, | ||
| size_t msg_len, | ||
| const uint8_t* sig, | ||
| size_t sig_len) { | ||
| batch_bb_adapter_ctx* ctx = (batch_bb_adapter_ctx*)user_ctx; | ||
| bb_status status; | ||
|
|
||
| if (ctx == NULL || ctx->algorithm == NULL || ctx->algorithm->verify == NULL || | ||
| msg == NULL || sig == NULL) { | ||
| return 0; | ||
| } | ||
|
|
||
| status = ctx->algorithm->verify(ctx->pk, ctx->pk_len, msg, msg_len, sig, sig_len); | ||
| return status == BB_OK ? 1 : 0; | ||
| } |
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,40 @@ | ||
| #ifndef BATCH_ADAPTERS_H | ||
| #define BATCH_ADAPTERS_H | ||
|
|
||
| #include "batch_bench.h" | ||
| #include "batch_signing.h" | ||
|
|
||
| #include <stddef.h> | ||
| #include <stdint.h> | ||
|
|
||
| typedef struct batch_bb_adapter_ctx { | ||
| const bb_algorithm* algorithm; | ||
| const uint8_t* sk; | ||
| size_t sk_len; | ||
| const uint8_t* pk; | ||
| size_t pk_len; | ||
| } batch_bb_adapter_ctx; | ||
|
|
||
| int batch_bb_adapter_init(batch_bb_adapter_ctx* ctx, | ||
| const bb_algorithm* algorithm, | ||
| const uint8_t* sk, | ||
| size_t sk_len, | ||
| const uint8_t* pk, | ||
| size_t pk_len); | ||
|
|
||
| size_t batch_bb_signature_capacity(const batch_bb_adapter_ctx* ctx); | ||
|
|
||
| int batch_bb_sign_callback(void* user_ctx, | ||
| const uint8_t* msg, | ||
| size_t msg_len, | ||
| uint8_t* sig, | ||
| size_t sig_capacity, | ||
| size_t* sig_len); | ||
|
|
||
| int batch_bb_verify_callback(void* user_ctx, | ||
| const uint8_t* msg, | ||
| size_t msg_len, | ||
| const uint8_t* sig, | ||
| size_t sig_len); | ||
|
|
||
| #endif |
Oops, something went wrong.
Oops, something went wrong.
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.