| 198 | } |
| 199 | |
| 200 | struct tlv_encrypted_data_tlv *decrypt_encrypted_data(const tal_t *ctx, |
| 201 | const struct secret *ss, |
| 202 | const u8 *enctlv) |
| 203 | { |
| 204 | const u8 *cursor = decrypt_encmsg_raw(tmpctx, ss, enctlv); |
| 205 | size_t maxlen = tal_bytelen(cursor); |
| 206 | |
| 207 | /* BOLT #4: |
| 208 | * - If the `encrypted_recipient_data` field is missing, cannot be |
| 209 | * decrypted into an `encrypted_data_tlv` or contains unknown even |
| 210 | * fields: |
| 211 | * - MUST return an error |
| 212 | */ |
| 213 | /* Note: our parser consider nothing is a valid TLV, but decrypt_encmsg_raw |
| 214 | * returns NULL if it couldn't decrypt. */ |
| 215 | if (!cursor) |
| 216 | return NULL; |
| 217 | return fromwire_tlv_encrypted_data_tlv(ctx, &cursor, &maxlen); |
| 218 | } |
| 219 | |
| 220 | bool blindedpath_get_alias(const struct secret *ss, |
| 221 | const struct pubkey *my_id, |
no test coverage detected