MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_decrypt

Function test_decrypt

common/test/run-blindedpath_enctlv.c:101–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101static void test_decrypt(const struct pubkey *path_key,
102 const u8 *enctlv,
103 const struct privkey *me,
104 const struct pubkey *expected_next_node,
105 const struct privkey *expected_next_path_key_priv)
106{
107 struct pubkey expected_next_path_key, dummy, next_path_key;
108 struct secret ss;
109 struct tlv_encrypted_data_tlv *enc;
110
111 /* We don't actually have an onion, so we put some dummy */
112 pubkey_from_privkey(me, &dummy);
113
114 mykey = me;
115 assert(unblind_onion(path_key, test_ecdh, &dummy, &ss));
116 enc = decrypt_encrypted_data(tmpctx, &ss, enctlv);
117 assert(enc);
118
119 pubkey_from_privkey(expected_next_path_key_priv, &expected_next_path_key);
120 blindedpath_next_path_key(enc, path_key, &ss, &next_path_key);
121 assert(pubkey_eq(&next_path_key, &expected_next_path_key));
122 assert(pubkey_eq(enc->next_node_id, expected_next_node));
123}
124
125static void test_final_decrypt(const struct pubkey *path_key,
126 const u8 *enctlv,

Callers 1

mainFunction · 0.85

Calls 4

pubkey_from_privkeyFunction · 0.85
unblind_onionFunction · 0.85
decrypt_encrypted_dataFunction · 0.70

Tested by

no test coverage detected