What changed, and why it matters
This commit only changes a test file (testing/test_ccc.py). It moves a helper function inside another function and updates test assertions to handle two different warning scenarios. There is no change to the actual COLDCARD firmware or any user-facing security behavior.
No security action needed; this is a test-only cleanup. Reviewers may verify the updated assertions still cover intended CCC and SSSP policy violation behaviors.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff refactors testing/test_ccc.py: a local ECDH hash callback is moved from module scope into make_session_key() as a nested function, and the policy_sign test helper is updated to distinguish between CCC (with warnings) and SSSP (zero warnings) spending-policy violation cases. No firmware code, cryptographic implementation, or runtime logic is modified.
Changed components
testing/test_ccc.pyInspect captured patch +22 / −16
diff --git a/testing/test_ccc.py b/testing/test_ccc.py
index e6151d3..0b7698d 100644
--- a/testing/test_ccc.py
+++ b/testing/test_ccc.py
@@ -21,21 +21,8 @@ from psbt import BasicPSBT
# pubkey for production server.
SERVER_PUBKEY = '0231301ec4acec08c1c7d0181f4ffb8be70d693acccc86cccb8f00bf2e00fcabfd'
-def py_ckcc_hashfp(output, x, y, data=None):
- try:
- m = hashlib.sha256()
- m.update(x.contents.raw)
- m.update(y.contents.raw)
- output.contents.raw = m.digest()
- return 1
- except:
- return 0
-
-
-ckcc_hashfp = ECDH_HASHFP_CLS(py_ckcc_hashfp)
-
-
def make_session_key(his_pubkey=None):
+
# - second call: given the pubkey of far side, calculate the shared pt on curve
# - creates session key based on that
while True:
@@ -50,6 +37,19 @@ def make_session_key(his_pubkey=None):
his_pubkey = ec_pubkey_parse(bytes.fromhex(SERVER_PUBKEY))
# do the D-H thing
+
+ def _py_ckcc_hashfp(output, x, y, data=None):
+ try:
+ m = hashlib.sha256()
+ m.update(x.contents.raw)
+ m.update(y.contents.raw)
+ output.contents.raw = m.digest()
+ return 1
+ except:
+ return 0
+
+ ckcc_hashfp = ECDH_HASHFP_CLS(_py_ckcc_hashfp)
+
shared_key = ecdh(my_seckey, his_pubkey, hashfp=ckcc_hashfp)
return shared_key, ec_pubkey_serialize(my_pubkey)
@@ -578,13 +578,19 @@ def policy_sign(start_sign, end_sign, cap_story, get_last_violation):
time.sleep(.1)
title, story = cap_story()
assert 'OK TO SEND?' == title
- if violation:
+ if violation and num_warn:
+ # assume CCC cases
assert ("(%d warning%s below)"% (num_warn, "s" if num_warn > 1 else "")) in story
assert "CCC: Violates spending policy. Won't sign." in story
assert get_last_violation().startswith(violation)
if warn_list:
for w in warn_list:
assert w in story
+ elif violation and num_warn == 0:
+ # assume SSSP cases
+ assert 'warning' not in story
+ assert "Spending Policy violation." in story
+ assert ccc_disabled
else:
assert "warning" not in story
@@ -1236,4 +1242,4 @@ def test_ms_setup_cosigner_import(way, ftype, is_bbqr, N, goto_home, settings_se
for _, obj in keys:
assert f"[{obj['xfp'].lower()}/{obj['p2wsh_deriv'].replace('m/', '')}]{obj['p2wsh']}" in desc
-# EOF
\ No newline at end of file
+# EOF
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.