hsm_encryption: delete hsm_encryption
What changed, and why it matters
This commit simply removes an old set of source files and test data for HSM (Hardware Security Module) encryption. The code being deleted is described by the developer as having been replaced by a newer 'hsm_secret' implementation. There is no indication in the commit that this fixes a security vulnerability; it appears to be routine cleanup of replaced code.
Verify that the replacement hsm_secret implementation provides equivalent or stronger protection, that encrypted secrets from the old module can still be decrypted or safely migrated, and that no other code still references the deleted symbols. No immediate security action is indicated by this commit alone.
Security signals we found
Deletion of cryptographic code (key derivation and authenticated encryption)
No commit-level description of a vulnerability or security fix
No replacement code shown in the diff to verify secure migration
Evidence from the diff
The commit deletes common/hsm_encryption.c, common/hsm_encryption.h, tests/fuzz/fuzz-hsm_encryption.c, and a fuzz corpus directory. The deleted code implemented Argon2id-based key derivation and XChaCha20-Poly1305 encryption/decryption for the hsm_secret. The commit message and changelog frame this as a removal because the functionality has been replaced by hsm_secret. No replacement implementation is shown in this diff, and no security bug is described.
Changed components
common/hsm_encryption.ccommon/hsm_encryption.htests/fuzz/fuzz-hsm_encryption.ctests/fuzz/corpora/fuzz-hsm_encryption/*Inspect captured patch +0 / −312
diff --git a/common/Makefile b/common/Makefile
index 5b853857..8ab2b635 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -45,7 +45,6 @@ COMMON_SRC_NOGEN := \
common/hash_u5.c \
common/hmac.c \
common/hsm_capable.c \
- common/hsm_encryption.c \
common/hsm_secret.c \
common/htlc_state.c \
common/htlc_trim.c \
diff --git a/common/hsm_encryption.c b/common/hsm_encryption.c
deleted file mode 100644
index 3486773d..00000000
--- a/common/hsm_encryption.c
+++ /dev/null
@@ -1,158 +0,0 @@
-#include "config.h"
-#include <common/errcode.h>
-#include <common/hsm_encryption.h>
-#include <sys/stat.h>
-#include <termios.h>
-#include <unistd.h>
-
-int hsm_secret_encryption_key_with_exitcode(const char *pass, struct secret *key,
- const char **err_msg)
-{
- u8 salt[16] = "c-lightning\0\0\0\0\0";
-
- /* Don't swap the encryption key ! */
- if (sodium_mlock(key->data, sizeof(key->data)) != 0) {
- if (err_msg)
- *err_msg = "Could not lock hsm_secret encryption key memory.";
- return EXITCODE_HSM_GENERIC_ERROR;
- }
-
- /* Check bounds. */
- if (strlen(pass) < crypto_pwhash_argon2id_PASSWD_MIN) {
- if (err_msg)
- *err_msg = "Password too short to be able to derive a key from it.";
- return EXITCODE_HSM_BAD_PASSWORD;
- } else if (strlen(pass) > crypto_pwhash_argon2id_PASSWD_MAX) {
- if (err_msg)
- *err_msg = "Password too long to be able to derive a key from it.";
- return EXITCODE_HSM_BAD_PASSWORD;
- }
-
- /* Now derive the key. */
- if (crypto_pwhash(key->data, sizeof(key->data), pass, strlen(pass), salt,
- /* INTERACTIVE needs 64 MiB of RAM, MODERATE needs 256,
- * and SENSITIVE needs 1024. */
- crypto_pwhash_argon2id_OPSLIMIT_MODERATE,
- crypto_pwhash_argon2id_MEMLIMIT_MODERATE,
- crypto_pwhash_ALG_ARGON2ID13) != 0) {
- if (err_msg)
- *err_msg = "Could not derive a key from the password.";
- return EXITCODE_HSM_BAD_PASSWORD;
- }
-
- return 0;
-}
-
-bool encrypt_hsm_secret(const struct secret *encryption_key,
- const struct secret *hsm_secret,
- struct encrypted_hsm_secret *output)
-{
- crypto_secretstream_xchacha20poly1305_state crypto_state;
-
- if (crypto_secretstream_xchacha20poly1305_init_push(&crypto_state, output->data,
- encryption_key->data) != 0)
- return false;
- if (crypto_secretstream_xchacha20poly1305_push(&crypto_state,
- output->data + HS_HEADER_LEN,
- NULL, hsm_secret->data,
- sizeof(hsm_secret->data),
- /* Additional data and tag */
- NULL, 0, 0))
- return false;
-
- return true;
-}
-
-bool decrypt_hsm_secret(const struct secret *encryption_key,
- const struct encrypted_hsm_secret *cipher,
- struct secret *output)
-{
- crypto_secretstream_xchacha20poly1305_state crypto_state;
-
- /* The header part */
- if (crypto_secretstream_xchacha20poly1305_init_pull(&crypto_state, cipher->data,
- encryption_key->data) != 0)
- return false;
- /* The ciphertext part */
- if (crypto_secretstream_xchacha20poly1305_pull(&crypto_state, output->data,
- NULL, 0,
- cipher->data + HS_HEADER_LEN,
- HS_CIPHERTEXT_LEN,
- NULL, 0) != 0)
- return false;
-
- return true;
-}
-
-/* Returns -1 on error (and sets errno), 0 if not encrypted, 1 if it is */
-int is_hsm_secret_encrypted(const char *path)
-{
- struct stat st;
-
- if (stat(path, &st) != 0)
- return -1;
-
- return st.st_size == ENCRYPTED_HSM_SECRET_LEN;
-}
-
-void discard_key(struct secret *key TAKES)
-{
- /* sodium_munlock() also zeroes the memory. */
- sodium_munlock(key->data, sizeof(key->data));
- if (taken(key))
- tal_free(key);
-}
-
-/* Read a line from stdin, do not take the newline character into account. */
-static bool getline_stdin_pass(char **passwd, size_t *passwd_size)
-{
- if (getline(passwd, passwd_size, stdin) < 0)
- return false;
-
- if ((*passwd)[strlen(*passwd) - 1] == '\n')
- (*passwd)[strlen(*passwd) - 1] = '\0';
-
- return true;
-}
-
-char *read_stdin_pass_with_exit_code(const char **reason, int *exit_code)
-{
- struct termios current_term, temp_term;
- char *passwd = NULL;
- size_t passwd_size = 0;
-
- if (isatty(fileno(stdin))) {
- /* Set a temporary term, same as current but with ECHO disabled. */
- if (tcgetattr(fileno(stdin), ¤t_term) != 0) {
- *reason = "Could not get current terminal options.";
- *exit_code = EXITCODE_HSM_PASSWORD_INPUT_ERR;
- return NULL;
- }
- temp_term = current_term;
- temp_term.c_lflag &= ~ECHO;
- if (tcsetattr(fileno(stdin), TCSANOW, &temp_term) != 0) {
- *reason = "Could not disable pass echoing.";
- *exit_code = EXITCODE_HSM_PASSWORD_INPUT_ERR;
- return NULL;
- }
-
- if (!getline_stdin_pass(&passwd, &passwd_size)) {
- *reason = "Could not read pass from stdin.";
- *exit_code = EXITCODE_HSM_PASSWORD_INPUT_ERR;
- return NULL;
- }
-
- /* Restore the original terminal */
- if (tcsetattr(fileno(stdin), TCSANOW, ¤t_term) != 0) {
- *reason = "Could not restore terminal options.";
- free(passwd);
- *exit_code = EXITCODE_HSM_PASSWORD_INPUT_ERR;
- return NULL;
- }
- } else if (!getline_stdin_pass(&passwd, &passwd_size)) {
- *reason = "Could not read pass from stdin.";
- *exit_code = EXITCODE_HSM_PASSWORD_INPUT_ERR;
- return NULL;
- }
- return passwd;
-}
diff --git a/common/hsm_encryption.h b/common/hsm_encryption.h
deleted file mode 100644
index af67701a..00000000
--- a/common/hsm_encryption.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef LIGHTNING_COMMON_HSM_ENCRYPTION_H
-#define LIGHTNING_COMMON_HSM_ENCRYPTION_H
-#include "config.h"
-#include <bitcoin/privkey.h>
-#include <sodium.h>
-
-/* Length of the encrypted hsm secret header. */
-#define HS_HEADER_LEN crypto_secretstream_xchacha20poly1305_HEADERBYTES
-/* From libsodium: "The ciphertext length is guaranteed to always be message
- * length + ABYTES" */
-#define HS_CIPHERTEXT_LEN \
- (sizeof(struct secret) + crypto_secretstream_xchacha20poly1305_ABYTES)
-/* Total length of an encrypted hsm_secret */
-#define ENCRYPTED_HSM_SECRET_LEN (HS_HEADER_LEN + HS_CIPHERTEXT_LEN)
-
-struct encrypted_hsm_secret {
- u8 data[ENCRYPTED_HSM_SECRET_LEN];
-};
-
-/** Derive the hsm_secret encryption key from a passphrase.
- * @pass: the passphrase string.
- * @encryption_key: the output key derived from the passphrase.
- * @err_msg: if not NULL the error message contains the reason of the failure.
- *
- * On success, 0 is returned, on error a value > 0 is returned and it can be used as exit code.
- */
-int hsm_secret_encryption_key_with_exitcode(const char *pass, struct secret *key,
- const char **err_msg);
-
-/** Encrypt the hsm_secret using a previously derived encryption key.
- * @encryption_key: the key derived from the passphrase.
- * @hsm_secret: the plaintext hsm_secret to encrypt.
- * @output: the resulting encrypted hsm_secret.
- *
- * Return false on encryption failure.
- */
-bool encrypt_hsm_secret(const struct secret *encryption_key,
- const struct secret *hsm_secret,
- struct encrypted_hsm_secret *output);
-
-/** Decrypt the hsm_secret using a previously derived encryption key.
- * @encryption_key: the key derived from the passphrase.
- * @cipher: the encrypted hsm_secret to decrypt.
- * @output: the resulting hsm_secret.
- *
- * Return false on decryption failure.
- */
-bool decrypt_hsm_secret(const struct secret *encryption_key,
- const struct encrypted_hsm_secret *cipher,
- struct secret *output);
-
-/** Unlock and zeroize the encryption key memory after use.
- * @key: the encryption key. If taken, it will be tal_free'd
- */
-void discard_key(struct secret *key TAKES);
-
-/** Read hsm_secret encryption pass from stdin, disabling echoing.
- * @reason: if NULL is returned, will point to the human-readable error,
- * and the correct exit code is returned by the exit_code parameter.
- *
- * Caller must free the string as it does tal-reallocate getline's output.
- */
-char *read_stdin_pass_with_exit_code(const char **reason, int *exit_code);
-
-/** Returns -1 on error (and sets errno), 0 if not encrypted, 1 if it is */
-int is_hsm_secret_encrypted(const char *path);
-#endif /* LIGHTNING_COMMON_HSM_ENCRYPTION_H */
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/010a57daa7433703ddc639f51f53d01a74afdba8 b/tests/fuzz/corpora/fuzz-hsm_encryption/010a57daa7433703ddc639f51f53d01a74afdba8
deleted file mode 100644
index 86652eac..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/010a57daa7433703ddc639f51f53d01a74afdba8
+++ /dev/null
@@ -1,3 +0,0 @@
--�������;��������!;���������
-��
-2
\ No newline at end of file
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/010a7169be4dc57b1df48a71f8292af8a692b2b3 b/tests/fuzz/corpora/fuzz-hsm_encryption/010a7169be4dc57b1df48a71f8292af8a692b2b3
deleted file mode 100644
index 66995784..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/010a7169be4dc57b1df48a71f8292af8a692b2b3 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/019f9573207b9765047f660f11cd19bbd48309e2 b/tests/fuzz/corpora/fuzz-hsm_encryption/019f9573207b9765047f660f11cd19bbd48309e2
deleted file mode 100644
index 18a2c231..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/019f9573207b9765047f660f11cd19bbd48309e2 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/086d57f3fa5ff9c9b7eb765ff8b88a2d797ca946 b/tests/fuzz/corpora/fuzz-hsm_encryption/086d57f3fa5ff9c9b7eb765ff8b88a2d797ca946
deleted file mode 100644
index 602ed3f8..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/086d57f3fa5ff9c9b7eb765ff8b88a2d797ca946
+++ /dev/null
@@ -1,2 +0,0 @@
--����������������������������
-QQQQQQQQQQ�����QQQQQQQQ��
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/11daf937510fff8519d131daf36160fb39cfba15 b/tests/fuzz/corpora/fuzz-hsm_encryption/11daf937510fff8519d131daf36160fb39cfba15
deleted file mode 100644
index a335e4b4..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/11daf937510fff8519d131daf36160fb39cfba15 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/11f4de6b8b45cf8051b1d17fa4cde9ad935cea41 b/tests/fuzz/corpora/fuzz-hsm_encryption/11f4de6b8b45cf8051b1d17fa4cde9ad935cea41
deleted file mode 100644
index 67c32976..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/11f4de6b8b45cf8051b1d17fa4cde9ad935cea41
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/176cbd4490560d179030137a21c904027fea3935 b/tests/fuzz/corpora/fuzz-hsm_encryption/176cbd4490560d179030137a21c904027fea3935
deleted file mode 100644
index 22ad235a..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/176cbd4490560d179030137a21c904027fea3935 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/24c823bc3c38d3de37f789f5ecafaa8408c93757 b/tests/fuzz/corpora/fuzz-hsm_encryption/24c823bc3c38d3de37f789f5ecafaa8408c93757
deleted file mode 100644
index 0a282f9b..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/24c823bc3c38d3de37f789f5ecafaa8408c93757 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/260031bd67c9814ad538fb29634fa783c82ccfe3 b/tests/fuzz/corpora/fuzz-hsm_encryption/260031bd67c9814ad538fb29634fa783c82ccfe3
deleted file mode 100644
index 67ce86d6..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/260031bd67c9814ad538fb29634fa783c82ccfe3 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/26dfa419dd7a4e2049feff895b829dda48f425ac b/tests/fuzz/corpora/fuzz-hsm_encryption/26dfa419dd7a4e2049feff895b829dda48f425ac
deleted file mode 100644
index 76204898..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/26dfa419dd7a4e2049feff895b829dda48f425ac
+++ /dev/null
@@ -1,2 +0,0 @@
--�������������������������������������������
-���
\ No newline at end of file
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/2756db15a535e07f2ac3498d97d7bb2be248a172 b/tests/fuzz/corpora/fuzz-hsm_encryption/2756db15a535e07f2ac3498d97d7bb2be248a172
deleted file mode 100644
index 490e942b..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/2756db15a535e07f2ac3498d97d7bb2be248a172
+++ /dev/null
@@ -1,2 +0,0 @@
--���������������������������
-�����������������������
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/29d842a6375afe12348b81f1742c708169f6796b b/tests/fuzz/corpora/fuzz-hsm_encryption/29d842a6375afe12348b81f1742c708169f6796b
deleted file mode 100644
index 7aeae87f..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/29d842a6375afe12348b81f1742c708169f6796b
+++ /dev/null
@@ -1,2 +0,0 @@
--��������������������������
-��
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/3bc15c8aae3e4124dd409035f32ea2fd6835efc9 b/tests/fuzz/corpora/fuzz-hsm_encryption/3bc15c8aae3e4124dd409035f32ea2fd6835efc9
deleted file mode 100644
index 3cf20d57..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/3bc15c8aae3e4124dd409035f32ea2fd6835efc9
+++ /dev/null
@@ -1 +0,0 @@
--
\ No newline at end of file
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/44fdfd93ea706488b4817f55435dde2bf0048eb5 b/tests/fuzz/corpora/fuzz-hsm_encryption/44fdfd93ea706488b4817f55435dde2bf0048eb5
deleted file mode 100644
index f811ff67..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/44fdfd93ea706488b4817f55435dde2bf0048eb5 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/48748e3a570fbe79b28fa52b048ecc9d73b6d3b1 b/tests/fuzz/corpora/fuzz-hsm_encryption/48748e3a570fbe79b28fa52b048ecc9d73b6d3b1
deleted file mode 100644
index babeeded..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/48748e3a570fbe79b28fa52b048ecc9d73b6d3b1
+++ /dev/null
@@ -1,2 +0,0 @@
--����������������������������
-YYY��
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/4d9636304829eca44744fa3f960c076fa247d875 b/tests/fuzz/corpora/fuzz-hsm_encryption/4d9636304829eca44744fa3f960c076fa247d875
deleted file mode 100644
index a3d76e4d..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/4d9636304829eca44744fa3f960c076fa247d875
+++ /dev/null
@@ -1,2 +0,0 @@
--��-���������;���������;���������
-��iiiiiiiii���
\ No newline at end of file
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/59d2945e40bfcbb2ac91ce0334a06689abe21fb7 b/tests/fuzz/corpora/fuzz-hsm_encryption/59d2945e40bfcbb2ac91ce0334a06689abe21fb7
deleted file mode 100644
index 77ac414b..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/59d2945e40bfcbb2ac91ce0334a06689abe21fb7 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/5dbe749bb6c6027a0022430f2514824f47097269 b/tests/fuzz/corpora/fuzz-hsm_encryption/5dbe749bb6c6027a0022430f2514824f47097269
deleted file mode 100644
index a039fea5..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/5dbe749bb6c6027a0022430f2514824f47097269 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/712bad91ff51f19b892122cbba365a0f4b3147fb b/tests/fuzz/corpora/fuzz-hsm_encryption/712bad91ff51f19b892122cbba365a0f4b3147fb
deleted file mode 100644
index b39b745d..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/712bad91ff51f19b892122cbba365a0f4b3147fb and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/7618428f8d106024bd6e27dfada6d9dbb2f05a9b b/tests/fuzz/corpora/fuzz-hsm_encryption/7618428f8d106024bd6e27dfada6d9dbb2f05a9b
deleted file mode 100644
index 721f8eff..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/7618428f8d106024bd6e27dfada6d9dbb2f05a9b and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/7c191aae1d3d9a8a8a9c70959f8ac14ba22e7c83 b/tests/fuzz/corpora/fuzz-hsm_encryption/7c191aae1d3d9a8a8a9c70959f8ac14ba22e7c83
deleted file mode 100644
index a5bffea4..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/7c191aae1d3d9a8a8a9c70959f8ac14ba22e7c83 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/82db6048fae4a5953f671f416b59afe4004380ec b/tests/fuzz/corpora/fuzz-hsm_encryption/82db6048fae4a5953f671f416b59afe4004380ec
deleted file mode 100644
index f75f77eb..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/82db6048fae4a5953f671f416b59afe4004380ec and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/85b3c5e8a553adee68f94a2c5770f59acf41308f b/tests/fuzz/corpora/fuzz-hsm_encryption/85b3c5e8a553adee68f94a2c5770f59acf41308f
deleted file mode 100644
index 5ee21ebe..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/85b3c5e8a553adee68f94a2c5770f59acf41308f and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/85e53271e14006f0265921d02d4d736cdc580b0b b/tests/fuzz/corpora/fuzz-hsm_encryption/85e53271e14006f0265921d02d4d736cdc580b0b
deleted file mode 100644
index ce542efa..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/85e53271e14006f0265921d02d4d736cdc580b0b
+++ /dev/null
@@ -1 +0,0 @@
-�
\ No newline at end of file
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/878e4439b591edc28ebb2691979661037bc5cde1 b/tests/fuzz/corpora/fuzz-hsm_encryption/878e4439b591edc28ebb2691979661037bc5cde1
deleted file mode 100644
index 104add0c..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/878e4439b591edc28ebb2691979661037bc5cde1 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/8efd4d04bba8942cef9293af1a778e66fe6d0e7d b/tests/fuzz/corpora/fuzz-hsm_encryption/8efd4d04bba8942cef9293af1a778e66fe6d0e7d
deleted file mode 100644
index 0fd06ea8..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/8efd4d04bba8942cef9293af1a778e66fe6d0e7d
+++ /dev/null
@@ -1 +0,0 @@
--��������������������������-���������������������
\ No newline at end of file
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/922d91b16cc923561d58979900554de2af4762d8 b/tests/fuzz/corpora/fuzz-hsm_encryption/922d91b16cc923561d58979900554de2af4762d8
deleted file mode 100644
index 891a3ef2..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/922d91b16cc923561d58979900554de2af4762d8 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/92b6e6612209872ccc8bb6b45b617558125e092a b/tests/fuzz/corpora/fuzz-hsm_encryption/92b6e6612209872ccc8bb6b45b617558125e092a
deleted file mode 100644
index 1581ba2b..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/92b6e6612209872ccc8bb6b45b617558125e092a and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/974098cfbcc636d36e3a8e64dd8018fc8b83ec89 b/tests/fuzz/corpora/fuzz-hsm_encryption/974098cfbcc636d36e3a8e64dd8018fc8b83ec89
deleted file mode 100644
index 5d99ffec..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/974098cfbcc636d36e3a8e64dd8018fc8b83ec89 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/9842926af7ca0a8cca12604f945414f07b01e13d b/tests/fuzz/corpora/fuzz-hsm_encryption/9842926af7ca0a8cca12604f945414f07b01e13d
deleted file mode 100644
index fc2b5693..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/9842926af7ca0a8cca12604f945414f07b01e13d
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/9ca6d4b8e2b357f4996c432067304c1f626720eb b/tests/fuzz/corpora/fuzz-hsm_encryption/9ca6d4b8e2b357f4996c432067304c1f626720eb
deleted file mode 100644
index 1ac09885..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/9ca6d4b8e2b357f4996c432067304c1f626720eb and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/9e350e370dc6f75a337009f44ef5d0ecf5ed610e b/tests/fuzz/corpora/fuzz-hsm_encryption/9e350e370dc6f75a337009f44ef5d0ecf5ed610e
deleted file mode 100644
index 9fbf5f88..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/9e350e370dc6f75a337009f44ef5d0ecf5ed610e and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/a4921de93678886f2666fe9240f55356038ac16e b/tests/fuzz/corpora/fuzz-hsm_encryption/a4921de93678886f2666fe9240f55356038ac16e
deleted file mode 100644
index 0d4475d0..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/a4921de93678886f2666fe9240f55356038ac16e and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/a71b3c25b54d5c8eb084084f1ef9f9b27931d5ff b/tests/fuzz/corpora/fuzz-hsm_encryption/a71b3c25b54d5c8eb084084f1ef9f9b27931d5ff
deleted file mode 100644
index aadd4413..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/a71b3c25b54d5c8eb084084f1ef9f9b27931d5ff
+++ /dev/null
@@ -1 +0,0 @@
-�
z-
\ No newline at end of file
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/af030542a4125d670351df40131a4265e29b7447 b/tests/fuzz/corpora/fuzz-hsm_encryption/af030542a4125d670351df40131a4265e29b7447
deleted file mode 100644
index 4011feca..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/af030542a4125d670351df40131a4265e29b7447 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/b0adf074d207869cad9d349b0bf943d532c5e765 b/tests/fuzz/corpora/fuzz-hsm_encryption/b0adf074d207869cad9d349b0bf943d532c5e765
deleted file mode 100644
index 9f24745f..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/b0adf074d207869cad9d349b0bf943d532c5e765 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/b166167155f161a697affe07e3a018901bf00c7f b/tests/fuzz/corpora/fuzz-hsm_encryption/b166167155f161a697affe07e3a018901bf00c7f
deleted file mode 100644
index b5cc5944..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/b166167155f161a697affe07e3a018901bf00c7f
+++ /dev/null
@@ -1,2 +0,0 @@
--������������������8��������������������������������
-��
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/b6a060bc39f6f35a41d503cf5c32adae7540e2d4 b/tests/fuzz/corpora/fuzz-hsm_encryption/b6a060bc39f6f35a41d503cf5c32adae7540e2d4
deleted file mode 100644
index 15848673..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/b6a060bc39f6f35a41d503cf5c32adae7540e2d4
+++ /dev/null
@@ -1 +0,0 @@
--����������������������������������&�������������
\ No newline at end of file
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/b714e28e82cb02857771f0ef8a3a1fc91f7d578c b/tests/fuzz/corpora/fuzz-hsm_encryption/b714e28e82cb02857771f0ef8a3a1fc91f7d578c
deleted file mode 100644
index cc7c26f9..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/b714e28e82cb02857771f0ef8a3a1fc91f7d578c
+++ /dev/null
@@ -1 +0,0 @@
--��������;���������!;�����������
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/c1554cfd9efc6515e42d6ea45c85131217dc48c6 b/tests/fuzz/corpora/fuzz-hsm_encryption/c1554cfd9efc6515e42d6ea45c85131217dc48c6
deleted file mode 100644
index 944ef808..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/c1554cfd9efc6515e42d6ea45c85131217dc48c6 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/ca06da040976f32f8453a8737c15ea1b800d0255 b/tests/fuzz/corpora/fuzz-hsm_encryption/ca06da040976f32f8453a8737c15ea1b800d0255
deleted file mode 100644
index 322cde80..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/ca06da040976f32f8453a8737c15ea1b800d0255 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/d2c778022a38b46327e74b61341dc384402580ec b/tests/fuzz/corpora/fuzz-hsm_encryption/d2c778022a38b46327e74b61341dc384402580ec
deleted file mode 100644
index fe7303c7..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/d2c778022a38b46327e74b61341dc384402580ec and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/d5fc363735dc945c877052ef2b7ebe383208afe1 b/tests/fuzz/corpora/fuzz-hsm_encryption/d5fc363735dc945c877052ef2b7ebe383208afe1
deleted file mode 100644
index 7aea70c0..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/d5fc363735dc945c877052ef2b7ebe383208afe1 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/d7d64e916ef78eb838273ae25a308aaf217980d8 b/tests/fuzz/corpora/fuzz-hsm_encryption/d7d64e916ef78eb838273ae25a308aaf217980d8
deleted file mode 100644
index 050e845e..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/d7d64e916ef78eb838273ae25a308aaf217980d8
+++ /dev/null
@@ -1 +0,0 @@
--��������;�
\ No newline at end of file
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/d9a56f6dabaf3b4cc0776f9ee65b1d64a69aa7e4 b/tests/fuzz/corpora/fuzz-hsm_encryption/d9a56f6dabaf3b4cc0776f9ee65b1d64a69aa7e4
deleted file mode 100644
index 8157ef3a..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/d9a56f6dabaf3b4cc0776f9ee65b1d64a69aa7e4
+++ /dev/null
@@ -1 +0,0 @@
-`������
\ No newline at end of file
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/da424c425994ded6390738b342cf7c853c6aa51f b/tests/fuzz/corpora/fuzz-hsm_encryption/da424c425994ded6390738b342cf7c853c6aa51f
deleted file mode 100644
index fc5204d8..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/da424c425994ded6390738b342cf7c853c6aa51f
+++ /dev/null
@@ -1 +0,0 @@
-��
\ No newline at end of file
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/dd4c2e570f6c9506840c00001570479aff75fe09 b/tests/fuzz/corpora/fuzz-hsm_encryption/dd4c2e570f6c9506840c00001570479aff75fe09
deleted file mode 100644
index bd734bcf..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/dd4c2e570f6c9506840c00001570479aff75fe09 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/de48b44d9fdbb12c895bc256198d61caf24eacbe b/tests/fuzz/corpora/fuzz-hsm_encryption/de48b44d9fdbb12c895bc256198d61caf24eacbe
deleted file mode 100644
index a3db6a0a..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/de48b44d9fdbb12c895bc256198d61caf24eacbe and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/ded4d55b7202b767c7bd76edf6dfd6f15d2a7592 b/tests/fuzz/corpora/fuzz-hsm_encryption/ded4d55b7202b767c7bd76edf6dfd6f15d2a7592
deleted file mode 100644
index af8186d9..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/ded4d55b7202b767c7bd76edf6dfd6f15d2a7592 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/df58248c414f342c81e056b40bee12d17a08bf61 b/tests/fuzz/corpora/fuzz-hsm_encryption/df58248c414f342c81e056b40bee12d17a08bf61
deleted file mode 100644
index f59ec20a..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/df58248c414f342c81e056b40bee12d17a08bf61
+++ /dev/null
@@ -1 +0,0 @@
-*
\ No newline at end of file
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/e31d31820dd73683cc2858c3fe3deb567b469c36 b/tests/fuzz/corpora/fuzz-hsm_encryption/e31d31820dd73683cc2858c3fe3deb567b469c36
deleted file mode 100644
index bec1f158..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/e31d31820dd73683cc2858c3fe3deb567b469c36 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/e3a039a6cfc87ae1503145a859bd03ea0a675524 b/tests/fuzz/corpora/fuzz-hsm_encryption/e3a039a6cfc87ae1503145a859bd03ea0a675524
deleted file mode 100644
index 586d539f..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/e3a039a6cfc87ae1503145a859bd03ea0a675524 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/ead8514f2be42cdd84c9dd7aee05c3e378f9d8e8 b/tests/fuzz/corpora/fuzz-hsm_encryption/ead8514f2be42cdd84c9dd7aee05c3e378f9d8e8
deleted file mode 100644
index 96521d33..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/ead8514f2be42cdd84c9dd7aee05c3e378f9d8e8 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/eb408af63c99aa3224d25ff6c74990e56635d5ef b/tests/fuzz/corpora/fuzz-hsm_encryption/eb408af63c99aa3224d25ff6c74990e56635d5ef
deleted file mode 100644
index 552c7ccf..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/eb408af63c99aa3224d25ff6c74990e56635d5ef
+++ /dev/null
@@ -1,2 +0,0 @@
--���������;���������!;���������
-��
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/eb6a2e7996ecfbca0aad0988a7c36d11bf0884d2 b/tests/fuzz/corpora/fuzz-hsm_encryption/eb6a2e7996ecfbca0aad0988a7c36d11bf0884d2
deleted file mode 100644
index 19362ffa..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/eb6a2e7996ecfbca0aad0988a7c36d11bf0884d2
+++ /dev/null
@@ -1,2 +0,0 @@
--��������������������������������������������
-���
\ No newline at end of file
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/ee129cbcf727b0afd5a7f3b79a4fa333417033d9 b/tests/fuzz/corpora/fuzz-hsm_encryption/ee129cbcf727b0afd5a7f3b79a4fa333417033d9
deleted file mode 100644
index f608f326..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/ee129cbcf727b0afd5a7f3b79a4fa333417033d9 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/f0054c92049c5e3706f7c45082065e67f9ea8ea0 b/tests/fuzz/corpora/fuzz-hsm_encryption/f0054c92049c5e3706f7c45082065e67f9ea8ea0
deleted file mode 100644
index 356d5548..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/f0054c92049c5e3706f7c45082065e67f9ea8ea0 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/f44634b586d683d6c27e5997fa674574683e267a b/tests/fuzz/corpora/fuzz-hsm_encryption/f44634b586d683d6c27e5997fa674574683e267a
deleted file mode 100644
index 1b316d11..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/f44634b586d683d6c27e5997fa674574683e267a and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/f4cb666c221192e9a9a2010e114ec8847f038051 b/tests/fuzz/corpora/fuzz-hsm_encryption/f4cb666c221192e9a9a2010e114ec8847f038051
deleted file mode 100644
index 58c9354f..00000000
Binary files a/tests/fuzz/corpora/fuzz-hsm_encryption/f4cb666c221192e9a9a2010e114ec8847f038051 and /dev/null differ
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/f98aef5540e4bcf21b7292adb1b9de01669d7e7b b/tests/fuzz/corpora/fuzz-hsm_encryption/f98aef5540e4bcf21b7292adb1b9de01669d7e7b
deleted file mode 100644
index 32e83d5c..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/f98aef5540e4bcf21b7292adb1b9de01669d7e7b
+++ /dev/null
@@ -1 +0,0 @@
--��
\ No newline at end of file
diff --git a/tests/fuzz/corpora/fuzz-hsm_encryption/fe7b328bfc4adc6daa6d5de3eba6273832803783 b/tests/fuzz/corpora/fuzz-hsm_encryption/fe7b328bfc4adc6daa6d5de3eba6273832803783
deleted file mode 100644
index f9ff64d1..00000000
--- a/tests/fuzz/corpora/fuzz-hsm_encryption/fe7b328bfc4adc6daa6d5de3eba6273832803783
+++ /dev/null
@@ -1,2 +0,0 @@
-����������;���������!;���������
-��
diff --git a/tests/fuzz/fuzz-hsm_encryption.c b/tests/fuzz/fuzz-hsm_encryption.c
deleted file mode 100644
index 39f92fa7..00000000
--- a/tests/fuzz/fuzz-hsm_encryption.c
+++ /dev/null
@@ -1,50 +0,0 @@
-#include "config.h"
-#include <assert.h>
-
-#include <ccan/mem/mem.h>
-#include <common/hsm_encryption.h>
-#include <common/setup.h>
-#include <stdlib.h>
-#include <tests/fuzz/libfuzz.h>
-
-void init(int *argc, char ***argv)
-{
- /* Don't run as a unit test under valgrind: too slow! */
-#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
- if (getenv("VALGRIND") && strcmp(getenv("VALGRIND"), "1") == 0) {
- common_shutdown();
- exit(0);
- }
-#endif
-}
-
-void run(const uint8_t *data, size_t size)
-{
- /* 4294967295 is crypto_pwhash_argon2id_PASSWD_MAX. libfuzzer won't
- * generate inputs that large in practice, but hey. */
- if (size > 32 && size < 4294967295) {
- struct secret *hsm_secret, decrypted_hsm_secret, encryption_key;
- char *passphrase;
- struct encrypted_hsm_secret encrypted_secret;
- const char *emsg;
-
- /* Take the first 32 bytes as the plaintext hsm_secret seed,
- * and the remaining ones as the passphrase. */
- hsm_secret = (struct secret *)tal_dup_arr(NULL, u8, data, 32, 0);
- passphrase = to_string(NULL, data + 32, size - 32);
-
- /* A valid seed, a valid passphrase. This should not fail. */
- assert(!hsm_secret_encryption_key_with_exitcode(passphrase, &encryption_key, &emsg));
- /* Roundtrip */
- assert(encrypt_hsm_secret(&encryption_key, hsm_secret,
- &encrypted_secret));
- assert(decrypt_hsm_secret(&encryption_key, &encrypted_secret,
- &decrypted_hsm_secret));
- assert(memeq(hsm_secret->data, sizeof(hsm_secret->data),
- decrypted_hsm_secret.data,
- sizeof(decrypted_hsm_secret.data)));
-
- tal_free(hsm_secret);
- tal_free(passphrase);
- }
-}
Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.