From: Yu Watanabe Date: Sun, 11 Sep 2022 15:07:17 +0000 (+0900) Subject: tree-wide: drop unused reference to DecryptedImage X-Git-Tag: v252-rc1~149^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F24730%2Fhead;p=thirdparty%2Fsystemd.git tree-wide: drop unused reference to DecryptedImage --- diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c index 4968946963a..6215f50faca 100644 --- a/src/analyze/analyze.c +++ b/src/analyze/analyze.c @@ -539,7 +539,6 @@ static int parse_argv(int argc, char *argv[]) { static int run(int argc, char *argv[]) { _cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL; - _cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL; _cleanup_(umount_and_rmdir_and_freep) char *unlink_dir = NULL; static const Verb verbs[] = { @@ -598,8 +597,7 @@ static int run(int argc, char *argv[]) { DISSECT_IMAGE_RELAX_VAR_CHECK | DISSECT_IMAGE_READ_ONLY, &unlink_dir, - &loop_device, - &decrypted_image); + &loop_device); if (r < 0) return r; diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c index c59eb625552..b53df117644 100644 --- a/src/boot/bootctl.c +++ b/src/boot/bootctl.c @@ -2579,7 +2579,6 @@ static int bootctl_main(int argc, char *argv[]) { static int run(int argc, char *argv[]) { _cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL; - _cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL; _cleanup_(umount_and_rmdir_and_freep) char *unlink_dir = NULL; int r; @@ -2603,8 +2602,7 @@ static int run(int argc, char *argv[]) { DISSECT_IMAGE_GENERIC_ROOT | DISSECT_IMAGE_RELAX_VAR_CHECK, &unlink_dir, - &loop_device, - &decrypted_image); + &loop_device); if (r < 0) return r; diff --git a/src/core/namespace.c b/src/core/namespace.c index d377b44c041..1911c413917 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -2082,8 +2082,7 @@ int setup_namespace( dissected_image, NULL, &verity, - dissect_image_flags, - NULL); + dissect_image_flags); if (r < 0) return log_debug_errno(r, "Failed to decrypt dissected image: %m"); } diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c index a73d0f19056..eeba0183646 100644 --- a/src/dissect/dissect.c +++ b/src/dissect/dissect.c @@ -665,8 +665,7 @@ static int action_mount(DissectedImage *m, LoopDevice *d) { r = dissected_image_decrypt_interactively( m, NULL, &arg_verity_settings, - arg_flags, - NULL); + arg_flags); if (r < 0) return r; @@ -697,8 +696,7 @@ static int action_copy(DissectedImage *m, LoopDevice *d) { r = dissected_image_decrypt_interactively( m, NULL, &arg_verity_settings, - arg_flags, - NULL); + arg_flags); if (r < 0) return r; diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c index abeafacc387..74fd722e808 100644 --- a/src/firstboot/firstboot.c +++ b/src/firstboot/firstboot.c @@ -1311,7 +1311,6 @@ static int parse_argv(int argc, char *argv[]) { static int run(int argc, char *argv[]) { _cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL; - _cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL; _cleanup_(umount_and_rmdir_and_freep) char *unlink_dir = NULL; int r; @@ -1349,8 +1348,7 @@ static int run(int argc, char *argv[]) { DISSECT_IMAGE_FSCK | DISSECT_IMAGE_GROWFS, &unlink_dir, - &loop_device, - &decrypted_image); + &loop_device); if (r < 0) return r; diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 360e4edb3c0..f3d3e2eca3b 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -2095,7 +2095,6 @@ static int wait_for_change(sd_journal *j, int poll_fd) { int main(int argc, char *argv[]) { _cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL; - _cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL; _cleanup_(umount_and_rmdir_and_freep) char *unlink_dir = NULL; bool previous_boot_id_valid = false, first_line = true, ellipsized = false, need_seek = false; bool use_cursor = false, after_cursor = false; @@ -2125,8 +2124,7 @@ int main(int argc, char *argv[]) { DISSECT_IMAGE_RELAX_VAR_CHECK | (arg_action == ACTION_UPDATE_CATALOG ? DISSECT_IMAGE_FSCK|DISSECT_IMAGE_GROWFS : DISSECT_IMAGE_READ_ONLY), &unlink_dir, - &loop_device, - &decrypted_image); + &loop_device); if (r < 0) return r; diff --git a/src/machine-id-setup/machine-id-setup-main.c b/src/machine-id-setup/machine-id-setup-main.c index 44fcdaae819..8a3b1efb4ce 100644 --- a/src/machine-id-setup/machine-id-setup-main.c +++ b/src/machine-id-setup/machine-id-setup-main.c @@ -125,7 +125,6 @@ static int parse_argv(int argc, char *argv[]) { static int run(int argc, char *argv[]) { _cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL; - _cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL; _cleanup_(umount_and_rmdir_and_freep) char *unlink_dir = NULL; sd_id128_t id; int r; @@ -148,8 +147,7 @@ static int run(int argc, char *argv[]) { DISSECT_IMAGE_FSCK | DISSECT_IMAGE_GROWFS, &unlink_dir, - &loop_device, - &decrypted_image); + &loop_device); if (r < 0) return r; diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 2834a7fc8aa..056d4f1bc5d 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -5443,7 +5443,6 @@ static int run(int argc, char *argv[]) { _cleanup_(release_lock_file) LockFile tree_global_lock = LOCK_FILE_INIT, tree_local_lock = LOCK_FILE_INIT; char tmprootdir[] = "/tmp/nspawn-root-XXXXXX"; _cleanup_(loop_device_unrefp) LoopDevice *loop = NULL; - _cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL; _cleanup_(dissected_image_unrefp) DissectedImage *dissected_image = NULL; _cleanup_(fw_ctx_freep) FirewallContext *fw_ctx = NULL; pid_t pid = 0; @@ -5786,8 +5785,7 @@ static int run(int argc, char *argv[]) { dissected_image, NULL, &arg_verity_settings, - 0, - &decrypted_image); + 0); if (r < 0) goto finish; diff --git a/src/partition/repart.c b/src/partition/repart.c index 7a53b31c9f8..35b2c64b970 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -5257,7 +5257,6 @@ static int determine_auto_size(Context *c) { static int run(int argc, char *argv[]) { _cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL; - _cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL; _cleanup_(umount_and_rmdir_and_freep) char *mounted_dir = NULL; _cleanup_(context_freep) Context* context = NULL; _cleanup_free_ char *node = NULL; @@ -5299,8 +5298,7 @@ static int run(int argc, char *argv[]) { DISSECT_IMAGE_USR_NO_ROOT | DISSECT_IMAGE_REQUIRE_ROOT, &mounted_dir, - &loop_device, - &decrypted_image); + &loop_device); if (r < 0) return r; diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c index e103ad3d866..f9124ba09a0 100644 --- a/src/shared/dissect-image.c +++ b/src/shared/dissect-image.c @@ -2109,8 +2109,7 @@ int dissected_image_decrypt( DissectedImage *m, const char *passphrase, const VeritySettings *verity, - DissectImageFlags flags, - DecryptedImage **ret) { + DissectImageFlags flags) { #if HAVE_LIBCRYPTSETUP _cleanup_(decrypted_image_unrefp) DecryptedImage *d = NULL; @@ -2131,11 +2130,8 @@ int dissected_image_decrypt( if (verity && verity->root_hash && verity->root_hash_size < sizeof(sd_id128_t)) return -EINVAL; - if (!m->encrypted && !m->verity_ready) { - if (ret) - *ret = NULL; + if (!m->encrypted && !m->verity_ready) return 0; - } #if HAVE_LIBCRYPTSETUP r = decrypted_image_new(&d); @@ -2168,8 +2164,6 @@ int dissected_image_decrypt( } m->decrypted_image = TAKE_PTR(d); - if (ret) - *ret = decrypted_image_ref(m->decrypted_image); return 1; #else @@ -2181,8 +2175,7 @@ int dissected_image_decrypt_interactively( DissectedImage *m, const char *passphrase, const VeritySettings *verity, - DissectImageFlags flags, - DecryptedImage **ret) { + DissectImageFlags flags) { _cleanup_strv_free_erase_ char **z = NULL; int n = 3, r; @@ -2191,7 +2184,7 @@ int dissected_image_decrypt_interactively( n--; for (;;) { - r = dissected_image_decrypt(m, passphrase, verity, flags, ret); + r = dissected_image_decrypt(m, passphrase, verity, flags); if (r >= 0) return r; if (r == -EKEYREJECTED) @@ -2213,7 +2206,7 @@ int dissected_image_decrypt_interactively( } } -int decrypted_image_relinquish(DecryptedImage *d) { +static int decrypted_image_relinquish(DecryptedImage *d) { assert(d); /* Turns on automatic removal after the last use ended for all DM devices of this image, and sets a @@ -2996,12 +2989,10 @@ int mount_image_privately_interactively( const char *image, DissectImageFlags flags, char **ret_directory, - LoopDevice **ret_loop_device, - DecryptedImage **ret_decrypted_image) { + LoopDevice **ret_loop_device) { _cleanup_(verity_settings_done) VeritySettings verity = VERITY_SETTINGS_DEFAULT; _cleanup_(loop_device_unrefp) LoopDevice *d = NULL; - _cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL; _cleanup_(dissected_image_unrefp) DissectedImage *dissected_image = NULL; _cleanup_(rmdir_and_freep) char *created_dir = NULL; _cleanup_free_ char *temp = NULL; @@ -3014,7 +3005,6 @@ int mount_image_privately_interactively( assert(image); assert(ret_directory); assert(ret_loop_device); - assert(ret_decrypted_image); r = verity_settings_load(&verity, image, NULL, NULL); if (r < 0) @@ -3041,7 +3031,7 @@ int mount_image_privately_interactively( if (r < 0) return r; - r = dissected_image_decrypt_interactively(dissected_image, NULL, &verity, flags, &decrypted_image); + r = dissected_image_decrypt_interactively(dissected_image, NULL, &verity, flags); if (r < 0) return r; @@ -3069,7 +3059,6 @@ int mount_image_privately_interactively( *ret_directory = TAKE_PTR(created_dir); *ret_loop_device = TAKE_PTR(d); - *ret_decrypted_image = TAKE_PTR(decrypted_image); return 0; } @@ -3164,8 +3153,7 @@ int verity_dissect_and_mount( dissected_image, NULL, &verity, - dissect_image_flags, - NULL); + dissect_image_flags); if (r < 0) return log_debug_errno(r, "Failed to decrypt dissected image: %m"); diff --git a/src/shared/dissect-image.h b/src/shared/dissect-image.h index c385bb44d90..2a66d7adf9d 100644 --- a/src/shared/dissect-image.h +++ b/src/shared/dissect-image.h @@ -275,8 +275,8 @@ int dissect_loop_device_and_warn(LoopDevice *loop, const VeritySettings *verity, DissectedImage* dissected_image_unref(DissectedImage *m); DEFINE_TRIVIAL_CLEANUP_FUNC(DissectedImage*, dissected_image_unref); -int dissected_image_decrypt(DissectedImage *m, const char *passphrase, const VeritySettings *verity, DissectImageFlags flags, DecryptedImage **ret); -int dissected_image_decrypt_interactively(DissectedImage *m, const char *passphrase, const VeritySettings *verity, DissectImageFlags flags, DecryptedImage **ret); +int dissected_image_decrypt(DissectedImage *m, const char *passphrase, const VeritySettings *verity, DissectImageFlags flags); +int dissected_image_decrypt_interactively(DissectedImage *m, const char *passphrase, const VeritySettings *verity, DissectImageFlags flags); int dissected_image_mount(DissectedImage *m, const char *dest, uid_t uid_shift, uid_t uid_range, DissectImageFlags flags); int dissected_image_mount_and_warn(DissectedImage *m, const char *where, uid_t uid_shift, uid_t uid_range, DissectImageFlags flags); @@ -286,7 +286,6 @@ DecryptedImage* decrypted_image_ref(DecryptedImage *p); DecryptedImage* decrypted_image_unref(DecryptedImage *p); DEFINE_TRIVIAL_CLEANUP_FUNC(DecryptedImage*, decrypted_image_unref); -int decrypted_image_relinquish(DecryptedImage *d); int dissected_image_relinquish(DissectedImage *m); const char* partition_designator_to_string(PartitionDesignator d) _const_; @@ -301,6 +300,6 @@ bool dissected_image_verity_candidate(const DissectedImage *image, PartitionDesi bool dissected_image_verity_ready(const DissectedImage *image, PartitionDesignator d); bool dissected_image_verity_sig_ready(const DissectedImage *image, PartitionDesignator d); -int mount_image_privately_interactively(const char *path, DissectImageFlags flags, char **ret_directory, LoopDevice **ret_loop_device, DecryptedImage **ret_decrypted_image); +int mount_image_privately_interactively(const char *path, DissectImageFlags flags, char **ret_directory, LoopDevice **ret_loop_device); int verity_dissect_and_mount(int src_fd, const char *src, const char *dest, const MountOptions *options, const char *required_host_os_release_id, const char *required_host_os_release_version_id, const char *required_host_os_release_sysext_level, const char *required_sysext_scope); diff --git a/src/sysext/sysext.c b/src/sysext/sysext.c index b2578315540..e0f1fa7f17e 100644 --- a/src/sysext/sysext.c +++ b/src/sysext/sysext.c @@ -557,8 +557,7 @@ static int merge_subprocess(Hashmap *images, const char *workspace) { r = dissected_image_decrypt_interactively( m, NULL, &verity_settings, - flags, - NULL); + flags); if (r < 0) return r; diff --git a/src/sysupdate/sysupdate.c b/src/sysupdate/sysupdate.c index 7dcfac12618..c24ae532dd9 100644 --- a/src/sysupdate/sysupdate.c +++ b/src/sysupdate/sysupdate.c @@ -855,17 +855,14 @@ static int reboot_now(void) { static int process_image( bool ro, char **ret_mounted_dir, - LoopDevice **ret_loop_device, - DecryptedImage **ret_decrypted_image) { + LoopDevice **ret_loop_device) { _cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL; - _cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL; _cleanup_(umount_and_rmdir_and_freep) char *mounted_dir = NULL; int r; assert(ret_mounted_dir); assert(ret_loop_device); - assert(ret_decrypted_image); if (!arg_image) return 0; @@ -883,8 +880,7 @@ static int process_image( DISSECT_IMAGE_GENERIC_ROOT | DISSECT_IMAGE_REQUIRE_ROOT, &mounted_dir, - &loop_device, - &decrypted_image); + &loop_device); if (r < 0) return r; @@ -894,14 +890,12 @@ static int process_image( *ret_mounted_dir = TAKE_PTR(mounted_dir); *ret_loop_device = TAKE_PTR(loop_device); - *ret_decrypted_image = TAKE_PTR(decrypted_image); return 0; } static int verb_list(int argc, char **argv, void *userdata) { _cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL; - _cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL; _cleanup_(umount_and_rmdir_and_freep) char *mounted_dir = NULL; _cleanup_(context_freep) Context* context = NULL; const char *version; @@ -910,7 +904,7 @@ static int verb_list(int argc, char **argv, void *userdata) { assert(argc <= 2); version = argc >= 2 ? argv[1] : NULL; - r = process_image(/* ro= */ true, &mounted_dir, &loop_device, &decrypted_image); + r = process_image(/* ro= */ true, &mounted_dir, &loop_device); if (r < 0) return r; @@ -926,14 +920,13 @@ static int verb_list(int argc, char **argv, void *userdata) { static int verb_check_new(int argc, char **argv, void *userdata) { _cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL; - _cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL; _cleanup_(umount_and_rmdir_and_freep) char *mounted_dir = NULL; _cleanup_(context_freep) Context* context = NULL; int r; assert(argc <= 1); - r = process_image(/* ro= */ true, &mounted_dir, &loop_device, &decrypted_image); + r = process_image(/* ro= */ true, &mounted_dir, &loop_device); if (r < 0) return r; @@ -952,14 +945,13 @@ static int verb_check_new(int argc, char **argv, void *userdata) { static int verb_vacuum(int argc, char **argv, void *userdata) { _cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL; - _cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL; _cleanup_(umount_and_rmdir_and_freep) char *mounted_dir = NULL; _cleanup_(context_freep) Context* context = NULL; int r; assert(argc <= 1); - r = process_image(/* ro= */ false, &mounted_dir, &loop_device, &decrypted_image); + r = process_image(/* ro= */ false, &mounted_dir, &loop_device); if (r < 0) return r; @@ -972,7 +964,6 @@ static int verb_vacuum(int argc, char **argv, void *userdata) { static int verb_update(int argc, char **argv, void *userdata) { _cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL; - _cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL; _cleanup_(umount_and_rmdir_and_freep) char *mounted_dir = NULL; _cleanup_(context_freep) Context* context = NULL; _cleanup_free_ char *booted_version = NULL; @@ -993,7 +984,7 @@ static int verb_update(int argc, char **argv, void *userdata) { return log_error_errno(SYNTHETIC_ERRNO(ENODATA), "/etc/os-release lacks IMAGE_VERSION field."); } - r = process_image(/* ro= */ false, &mounted_dir, &loop_device, &decrypted_image); + r = process_image(/* ro= */ false, &mounted_dir, &loop_device); if (r < 0) return r; @@ -1096,7 +1087,6 @@ static int component_name_valid(const char *c) { static int verb_components(int argc, char **argv, void *userdata) { _cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL; - _cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL; _cleanup_(umount_and_rmdir_and_freep) char *mounted_dir = NULL; _cleanup_(set_freep) Set *names = NULL; _cleanup_free_ char **z = NULL; /* We use simple free() rather than strv_free() here, since set_free() will free the strings for us */ @@ -1106,7 +1096,7 @@ static int verb_components(int argc, char **argv, void *userdata) { assert(argc <= 1); - r = process_image(/* ro= */ false, &mounted_dir, &loop_device, &decrypted_image); + r = process_image(/* ro= */ false, &mounted_dir, &loop_device); if (r < 0) return r; diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c index 6f66f087cbe..08b005e6bed 100644 --- a/src/sysusers/sysusers.c +++ b/src/sysusers/sysusers.c @@ -2081,7 +2081,6 @@ static int read_credential_lines(void) { static int run(int argc, char *argv[]) { #ifndef STANDALONE _cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL; - _cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL; _cleanup_(umount_and_rmdir_and_freep) char *unlink_dir = NULL; #endif _cleanup_close_ int lock = -1; @@ -2116,8 +2115,7 @@ static int run(int argc, char *argv[]) { DISSECT_IMAGE_FSCK | DISSECT_IMAGE_GROWFS, &unlink_dir, - &loop_device, - &decrypted_image); + &loop_device); if (r < 0) return r; diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index d27dc39a1cb..7e99921db92 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -3838,7 +3838,6 @@ DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(item_array_hash_ops, char, string_ static int run(int argc, char *argv[]) { #ifndef STANDALONE _cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL; - _cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL; _cleanup_(umount_and_rmdir_and_freep) char *unlink_dir = NULL; #endif _cleanup_strv_free_ char **config_dirs = NULL; @@ -3922,8 +3921,7 @@ static int run(int argc, char *argv[]) { DISSECT_IMAGE_FSCK | DISSECT_IMAGE_GROWFS, &unlink_dir, - &loop_device, - &decrypted_image); + &loop_device); if (r < 0) return r;