Focus signature test logs on lifecycle and failure stages
This commit is contained in:
1 parent
44acb5aecf
commit
7d57b484d8
1 file changed
+12
-2
@@ -239,6 +239,7 @@ int main(void) {
|
||||
debug_set_level(DEBUG_LEVEL_INFO);
|
||||
debug_set_categories(DEBUG_CATEGORY_CRYPTO);
|
||||
debug_set_category_level(DEBUG_CATEGORY_DEBUG, DEBUG_LEVEL_DEBUG);
|
||||
debug_set_category_level(DEBUG_CATEGORY_CRYPTO, DEBUG_LEVEL_DEBUG);
|
||||
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CRYPTO, "=== Streaming Sign Test ===");
|
||||
|
||||
@@ -268,6 +269,7 @@ int main(void) {
|
||||
if (test_failed) return 1;
|
||||
test_short_buffer(&ctx_a, message, sizeof(message), reference_sig);
|
||||
if (test_failed) return 1;
|
||||
debug_set_category_level(DEBUG_CATEGORY_CRYPTO, DEBUG_LEVEL_INFO);
|
||||
|
||||
// ==========================================
|
||||
// Test 1: basic sign/verify — single chunk
|
||||
@@ -302,11 +304,19 @@ int main(void) {
|
||||
CHECK(sc_stream_sign_init(&ctx_a, &signer) == SC_OK, "inc: sign_init");
|
||||
CHECK(sc_stream_sign_verify_init(&verifier, ed25519_pubkey_a) == SC_OK, "inc: verify_init");
|
||||
|
||||
int chunks_ok = 1;
|
||||
for (int i = 0; i < (int)sizeof(data); i += 7) {
|
||||
int chunk = ((int)sizeof(data) - i < 7) ? ((int)sizeof(data) - i) : 7;
|
||||
CHECK(sc_stream_sign_update(&signer, data + i, chunk) == SC_OK, "inc: sign_update");
|
||||
CHECK(sc_stream_sign_update(&verifier, data + i, chunk) == SC_OK, "inc: verify_update");
|
||||
int sign_rc = sc_stream_sign_update(&signer, data + i, chunk);
|
||||
int verify_rc = sc_stream_sign_update(&verifier, data + i, chunk);
|
||||
if (sign_rc != SC_OK || verify_rc != SC_OK) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CRYPTO, "incremental update failed: offset=%d len=%d sign=%d verify=%d",
|
||||
i, chunk, sign_rc, verify_rc);
|
||||
chunks_ok = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
CHECK(chunks_ok, "inc: every 7-byte fragment hashed by signer and verifier");
|
||||
|
||||
uint8_t sig[SC_SIGN_SIZE];
|
||||
size_t sig_len = sizeof(sig);
|
||||
|
||||
Reference in new issue
Block a user