~ This encrypts the content of the `struct secret hsm_secret` and * stores it in hsm_secret, this is called instead of create_hsm() if * `lightningd` is started with --encrypted-hsm. */
| 281 | * `lightningd` is started with --encrypted-hsm. |
| 282 | */ |
| 283 | static void create_encrypted_hsm(int fd, const struct secret *encryption_key) |
| 284 | { |
| 285 | struct encrypted_hsm_secret cipher; |
| 286 | |
| 287 | if (!encrypt_hsm_secret(encryption_key, &hsm_secret, |
| 288 | &cipher)) |
| 289 | status_failed(STATUS_FAIL_INTERNAL_ERROR, |
| 290 | "Encrypting hsm_secret"); |
| 291 | if (!write_all(fd, cipher.data, ENCRYPTED_HSM_SECRET_LEN)) { |
| 292 | unlink_noerr("hsm_secret"); |
| 293 | status_failed(STATUS_FAIL_INTERNAL_ERROR, |
| 294 | "Writing encrypted hsm_secret: %s", strerror(errno)); |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | static void create_hsm(int fd) |
| 299 | { |
no test coverage detected