| 7 | static void (*stashed_failed)(enum status_failreason, const char *fmt, ...); |
| 8 | |
| 9 | void ecdh(const struct pubkey *point, struct secret *ss) |
| 10 | { |
| 11 | const u8 *msg = towire_hsmd_ecdh_req(NULL, point); |
| 12 | |
| 13 | if (!wire_sync_write(stashed_hsm_fd, take(msg))) |
| 14 | stashed_failed(STATUS_FAIL_HSM_IO, "Write ECDH to hsmd failed"); |
| 15 | |
| 16 | msg = wire_sync_read(tmpctx, stashed_hsm_fd); |
| 17 | if (!msg) |
| 18 | stashed_failed(STATUS_FAIL_HSM_IO, "No hsmd ECDH response"); |
| 19 | |
| 20 | if (!fromwire_hsmd_ecdh_resp(msg, ss)) |
| 21 | stashed_failed(STATUS_FAIL_HSM_IO, "Invalid hsmd ECDH response"); |
| 22 | } |
| 23 | |
| 24 | void ecdh_hsmd_setup(int hsm_fd, |
| 25 | void (*failed)(enum status_failreason, |
no test coverage detected