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

Function encrypt_hsm_secret

common/hsm_encryption.c:43–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43bool encrypt_hsm_secret(const struct secret *encryption_key,
44 const struct secret *hsm_secret,
45 struct encrypted_hsm_secret *output)
46{
47 crypto_secretstream_xchacha20poly1305_state crypto_state;
48
49 if (crypto_secretstream_xchacha20poly1305_init_push(&crypto_state, output->data,
50 encryption_key->data) != 0)
51 return false;
52 if (crypto_secretstream_xchacha20poly1305_push(&crypto_state,
53 output->data + HS_HEADER_LEN,
54 NULL, hsm_secret->data,
55 sizeof(hsm_secret->data),
56 /* Additional data and tag */
57 NULL, 0, 0))
58 return false;
59
60 return true;
61}
62
63bool decrypt_hsm_secret(const struct secret *encryption_key,
64 const struct encrypted_hsm_secret *cipher,

Callers 3

encrypt_hsmFunction · 0.85
create_encrypted_hsmFunction · 0.85
runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected