What changed, and why it matters
This commit only adds a new test that checks whether certain SHA-256 'tagged' hash initialization functions used in silent payments produce the correct internal hash state. It does not change any production code, cryptographic logic, or behavior visible to users. There is no security vulnerability here.
No action required. This is a benign test-only addition.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds silentpayments_sha256_tag_test() to src/modules/silentpayments/tests_impl.h. The test calls secp256k1_silentpayments_sha256_init_inputs, _init_sharedsecret, and _init_label, then verifies the resulting SHA-256 midstate against the expected tags ‘BIP0352/Inputs’, ‘BIP0352/SharedSecret’, and ‘BIP0352/Label’ using test_sha256_tag_midstate. The test is registered in tests_silentpayments[]. No implementation code is modified.
Changed components
src/modules/silentpayments/tests_impl.hInspect captured patch +24 / −0
diff --git a/src/modules/silentpayments/tests_impl.h b/src/modules/silentpayments/tests_impl.h
index b2d91d3..4cee6fd 100644
--- a/src/modules/silentpayments/tests_impl.h
+++ b/src/modules/silentpayments/tests_impl.h
@@ -820,6 +820,29 @@ void run_silentpayments_test_vector_receive(const struct bip352_test_vector *tes
CHECK(n_found == subtest->num_found_output_pubkeys);
}
+static void silentpayments_sha256_tag_test(void) {
+ secp256k1_sha256 sha;
+ {
+ /* "BIP0352/Inputs" */
+ static const unsigned char tag[] = {'B','I','P','0','3','5','2','/','I','n','p','u','t','s'};
+ secp256k1_silentpayments_sha256_init_inputs(&sha);
+ test_sha256_tag_midstate(&CTX->hash_ctx, &sha, tag, sizeof(tag));
+ }
+ {
+ /* "BIP0352/SharedSecret" */
+ static const unsigned char tag[] = {'B','I','P','0','3','5','2','/','S','h','a','r','e','d', 'S','e','c','r','e','t'};
+ secp256k1_silentpayments_sha256_init_sharedsecret(&sha);
+ test_sha256_tag_midstate(&CTX->hash_ctx, &sha, tag, sizeof(tag));
+ }
+ {
+ /* "BIP0352/Label" */
+ static const unsigned char tag[] = {'B','I','P','0','3','5','2','/','L','a','b','e','l'};
+ secp256k1_silentpayments_sha256_init_label(&sha);
+ test_sha256_tag_midstate(&CTX->hash_ctx, &sha, tag, sizeof(tag));
+ }
+}
+
+
void run_silentpayments_test_vectors(void) {
size_t i, j;
@@ -839,6 +862,7 @@ static const struct tf_test_entry tests_silentpayments[] = {
CASE1(test_label_api),
CASE1(test_recipient_api),
CASE1(run_silentpayments_test_vectors),
+ CASE1(silentpayments_sha256_tag_test),
};
#endif
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.