From 4471452105078f57a0044a2a0f87135ed5674b54 Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Fri, 5 Feb 2021 12:27:39 +0100 Subject: [PATCH] Remove some stale FIXME markings. --- lib/crypto_backend/cipher_generic.c | 1 - lib/crypto_backend/crypto_gcrypt.c | 2 +- lib/crypto_backend/crypto_kernel.c | 1 - lib/crypto_backend/pbkdf_check.c | 3 +-- lib/integrity/integrity.c | 2 +- lib/libdevmapper.c | 6 +----- lib/luks2/luks2_digest.c | 2 -- lib/luks2/luks2_disk_metadata.c | 2 -- lib/luks2/luks2_json_format.c | 3 +-- lib/luks2/luks2_keyslot.c | 1 - lib/luks2/luks2_reencrypt.c | 2 +- lib/luks2/luks2_token.c | 1 - lib/setup.c | 6 +----- lib/utils_crypt.c | 2 -- lib/utils_device_locking.c | 2 +- lib/utils_wipe.c | 2 +- src/utils_tools.c | 1 - 17 files changed, 9 insertions(+), 30 deletions(-) diff --git a/lib/crypto_backend/cipher_generic.c b/lib/crypto_backend/cipher_generic.c index bce36e01..6c8e84c3 100644 --- a/lib/crypto_backend/cipher_generic.c +++ b/lib/crypto_backend/cipher_generic.c @@ -31,7 +31,6 @@ struct cipher_alg { bool wrapped_key; }; -/* FIXME: Getting block size should be dynamic from cipher backend. */ static const struct cipher_alg cipher_algs[] = { { "cipher_null", NULL, 16, false }, { "aes", NULL, 16, false }, diff --git a/lib/crypto_backend/crypto_gcrypt.c b/lib/crypto_backend/crypto_gcrypt.c index 08de773c..0388bacf 100644 --- a/lib/crypto_backend/crypto_gcrypt.c +++ b/lib/crypto_backend/crypto_gcrypt.c @@ -99,7 +99,7 @@ int crypt_backend_init(void) return -ENOSYS; } -/* FIXME: If gcrypt compiled to support POSIX 1003.1e capabilities, +/* If gcrypt compiled to support POSIX 1003.1e capabilities, * it drops all privileges during secure memory initialisation. * For now, the only workaround is to disable secure memory in gcrypt. * cryptsetup always need at least cap_sys_admin privilege for dm-ioctl diff --git a/lib/crypto_backend/crypto_kernel.c b/lib/crypto_backend/crypto_kernel.c index cc19d198..e304e38f 100644 --- a/lib/crypto_backend/crypto_kernel.c +++ b/lib/crypto_backend/crypto_kernel.c @@ -29,7 +29,6 @@ #include #include "crypto_backend_internal.h" -/* FIXME: remove later */ #ifndef AF_ALG #define AF_ALG 38 #endif diff --git a/lib/crypto_backend/pbkdf_check.c b/lib/crypto_backend/pbkdf_check.c index b4c52a92..31f5ce31 100644 --- a/lib/crypto_backend/pbkdf_check.c +++ b/lib/crypto_backend/pbkdf_check.c @@ -74,7 +74,7 @@ static long time_ms(struct rusage *start, struct rusage *end) count_kernel_time = 1; /* - * FIXME: if there is no self usage info, count system time. + * If there is no self usage info, count system time. * This seem like getrusage() bug in some hypervisors... */ if (!end->ru_utime.tv_sec && !start->ru_utime.tv_sec && @@ -412,7 +412,6 @@ int crypt_pbkdf_perf(const char *kdf, const char *hash, if (!kdf || !iterations_out || !memory_out) return -EINVAL; - /* FIXME: whole limits propagation should be more clear here */ r = crypt_pbkdf_get_limits(kdf, &pbkdf_limits); if (r < 0) return r; diff --git a/lib/integrity/integrity.c b/lib/integrity/integrity.c index 79829395..7bf954da 100644 --- a/lib/integrity/integrity.c +++ b/lib/integrity/integrity.c @@ -189,7 +189,7 @@ int INTEGRITY_tag_size(struct crypt_device *cd __attribute__((unused)), if (!integrity || !strcmp(integrity, "none")) auth_tag_size = 0; else if (!strcmp(integrity, "aead")) - auth_tag_size = 16; //FIXME gcm- mode only + auth_tag_size = 16; /* gcm- mode only */ else if (!strcmp(integrity, "cmac(aes)")) auth_tag_size = 16; else if (!strcmp(integrity, "hmac(sha1)")) diff --git a/lib/libdevmapper.c b/lib/libdevmapper.c index 3e4f0719..767be6d3 100644 --- a/lib/libdevmapper.c +++ b/lib/libdevmapper.c @@ -298,7 +298,6 @@ static int _dm_check_versions(struct crypt_device *cd, dm_target_type target_typ _dm_check_target(target_type); - /* FIXME: add support to DM so it forces crypt target module load here */ if (!(dmt = dm_task_create(DM_DEVICE_LIST_VERSIONS))) goto out; @@ -396,10 +395,7 @@ void dm_backend_exit(struct crypt_device *cd) } } -/* - * libdevmapper is not context friendly, switch context on every DM call. - * FIXME: this is not safe if called in parallel but neither is DM lib. - */ +/* libdevmapper is not context friendly, switch context on every DM call. */ static int dm_init_context(struct crypt_device *cd, dm_target_type target) { _context = cd; diff --git a/lib/luks2/luks2_digest.c b/lib/luks2/luks2_digest.c index 93848a4c..7e273fb0 100644 --- a/lib/luks2/luks2_digest.c +++ b/lib/luks2/luks2_digest.c @@ -254,7 +254,6 @@ int LUKS2_digest_assign(struct crypt_device *cd, struct luks2_hdr *hdr, if (r < 0) return r; - // FIXME: do not write header in nothing changed return commit ? LUKS2_hdr_write(cd, hdr) : 0; } @@ -349,7 +348,6 @@ int LUKS2_digest_segment_assign(struct crypt_device *cd, struct luks2_hdr *hdr, if (r < 0) return r; - // FIXME: do not write header in nothing changed return commit ? LUKS2_hdr_write(cd, hdr) : 0; } diff --git a/lib/luks2/luks2_disk_metadata.c b/lib/luks2/luks2_disk_metadata.c index 3f6b3aeb..e26db059 100644 --- a/lib/luks2/luks2_disk_metadata.c +++ b/lib/luks2/luks2_disk_metadata.c @@ -301,8 +301,6 @@ static int hdr_write_disk(struct crypt_device *cd, log_dbg(cd, "Trying to write LUKS2 header (%zu bytes) at offset %" PRIu64 ".", hdr->hdr_size, offset); - /* FIXME: read-only device silent fail? */ - devfd = device_open_locked(cd, device, O_RDWR); if (devfd < 0) return devfd == -1 ? -EINVAL : devfd; diff --git a/lib/luks2/luks2_json_format.c b/lib/luks2/luks2_json_format.c index 219fc27d..bba29a35 100644 --- a/lib/luks2/luks2_json_format.c +++ b/lib/luks2/luks2_json_format.c @@ -30,7 +30,7 @@ struct area { static size_t get_area_size(size_t keylength) { - //FIXME: calculate this properly, for now it is AF_split_sectors + /* for now it is AF_split_sectors */ return size_round_up(keylength * 4000, 4096); } @@ -380,7 +380,6 @@ int LUKS2_wipe_header_areas(struct crypt_device *cd, offset, length, wipe_block, NULL, NULL); } -/* FIXME: what if user wanted to keep original keyslots size? */ int LUKS2_set_keyslots_size(struct crypt_device *cd __attribute__((unused)), struct luks2_hdr *hdr, uint64_t data_offset) diff --git a/lib/luks2/luks2_keyslot.c b/lib/luks2/luks2_keyslot.c index 40746e0d..ed51e24a 100644 --- a/lib/luks2/luks2_keyslot.c +++ b/lib/luks2/luks2_keyslot.c @@ -607,7 +607,6 @@ int LUKS2_keyslot_reencrypt_create(struct crypt_device *cd, if (keyslot == CRYPT_ANY_SLOT) return -EINVAL; - /* FIXME: find keyslot by type */ h = LUKS2_keyslot_handler_type(cd, "reencrypt"); if (!h) return -EINVAL; diff --git a/lib/luks2/luks2_reencrypt.c b/lib/luks2/luks2_reencrypt.c index 5b40b455..480a8a24 100644 --- a/lib/luks2/luks2_reencrypt.c +++ b/lib/luks2/luks2_reencrypt.c @@ -2882,7 +2882,7 @@ static int reencrypt_load_by_passphrase(struct crypt_device *cd, } device_release_excl(cd, crypt_data_device(cd)); - /* FIXME: There's a race for dm device activation not managed by cryptsetup. + /* There's a race for dm device activation not managed by cryptsetup. * * 1) excl close * 2) rogue dm device activation diff --git a/lib/luks2/luks2_token.c b/lib/luks2/luks2_token.c index 40874d12..8f82e352 100644 --- a/lib/luks2/luks2_token.c +++ b/lib/luks2/luks2_token.c @@ -663,7 +663,6 @@ int LUKS2_token_assign(struct crypt_device *cd, struct luks2_hdr *hdr, if (r < 0) return r; - // FIXME: do not write header in nothing changed if (commit) return LUKS2_hdr_write(cd, hdr) ?: token; diff --git a/lib/setup.c b/lib/setup.c index 0a43a231..25281726 100644 --- a/lib/setup.c +++ b/lib/setup.c @@ -64,9 +64,6 @@ struct crypt_device { bool memory_hard_pbkdf_lock_enabled; struct crypt_lock_handle *pbkdf_memory_hard_lock; - // FIXME: private binary headers and access it properly - // through sub-library (LUKS1, TCRYPT) - union { struct { /* used in CRYPT_LUKS1 */ struct luks_phdr hdr; @@ -888,7 +885,6 @@ static int _crypt_load_verity(struct crypt_device *cd, struct crypt_params_verit if (r < 0) return r; - //FIXME: use crypt_free if (!cd->type && !(cd->type = strdup(CRYPT_VERITY))) { free(CONST_CAST(void*)cd->u.verity.hdr.hash_name); free(CONST_CAST(void*)cd->u.verity.hdr.salt); @@ -4644,7 +4640,7 @@ uint64_t crypt_get_active_integrity_failures(struct crypt_device *cd, const char if (!name) return 0; - /* FIXME: LUKS2 / dm-crypt does not provide this count. */ + /* LUKS2 / dm-crypt does not provide this count. */ if (dm_query_device(cd, name, 0, &dmd) < 0) return 0; diff --git a/lib/utils_crypt.c b/lib/utils_crypt.c index 7dff02e0..8c522ecd 100644 --- a/lib/utils_crypt.c +++ b/lib/utils_crypt.c @@ -100,8 +100,6 @@ int crypt_parse_integrity_mode(const char *s, char *integrity, if (!s || !integrity) return -EINVAL; - // FIXME: do not hardcode it here - /* AEAD modes */ if (!strcmp(s, "aead") || !strcmp(s, "poly1305") || diff --git a/lib/utils_device_locking.c b/lib/utils_device_locking.c index b8bbcd9f..2aad634f 100644 --- a/lib/utils_device_locking.c +++ b/lib/utils_device_locking.c @@ -173,7 +173,7 @@ static int acquire_lock_handle(struct crypt_device *cd, struct device *device, s h->u.bdev.devno = st.st_rdev; h->mode = DEV_LOCK_BDEV; } else if (S_ISREG(st.st_mode)) { - // FIXME: workaround for nfsv4 + /* workaround for nfsv4 */ fd = open(device_path(device), O_RDWR | O_NONBLOCK | O_CLOEXEC); if (fd < 0) h->flock_fd = dev_fd; diff --git a/lib/utils_wipe.c b/lib/utils_wipe.c index 2d84fc0f..b148a8a6 100644 --- a/lib/utils_wipe.c +++ b/lib/utils_wipe.c @@ -150,7 +150,7 @@ int crypt_wipe_device(struct crypt_device *cd, if (!bsize || !alignment || !wipe_block_size) return -EINVAL; - /* FIXME: if wipe_block_size < bsize, then a wipe is highly ineffective */ + /* if wipe_block_size < bsize, then a wipe is highly ineffective */ /* Everything must be aligned to SECTOR_SIZE */ if (MISALIGNED_512(offset) || MISALIGNED_512(length) || MISALIGNED_512(wipe_block_size)) diff --git a/src/utils_tools.c b/src/utils_tools.c index 76bbcb24..2f254687 100644 --- a/src/utils_tools.c +++ b/src/utils_tools.c @@ -387,7 +387,6 @@ static void tools_time_progress(uint64_t device_size, uint64_t bytes, struct too mbytes = bytes / 1024 / 1024; uib = (double)(bytes - parms->start_offset) / tdiff; - /* FIXME: calculate this from last minute only. */ eta = (unsigned long long)(device_size / uib - tdiff); if (uib > 1073741824.0f) {