From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1mUzpv-0005am-BG for mharc-grub-devel@gnu.org; Mon, 27 Sep 2021 19:15:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37280) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUzpp-0005Xu-5F for grub-devel@gnu.org; Mon, 27 Sep 2021 19:14:57 -0400 Received: from mail-qv1-xf34.google.com ([2607:f8b0:4864:20::f34]:43929) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mUzpn-0004qZ-IA for grub-devel@gnu.org; Mon, 27 Sep 2021 19:14:56 -0400 Received: by mail-qv1-xf34.google.com with SMTP id et16so3009556qvb.10 for ; Mon, 27 Sep 2021 16:14:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Qpoj2PhB5U0PaGcQjqMFTk6mCdew5uWhagfdktabDJY=; b=RyyBlEpn3oA1lVkidA4NNP5j0gLV6Io38ykdoUkr5eWISHN2tx5G7ZxH2fM/L7AH2O OGORLZbrQFPOP/m4MVpetOdBuUUa2KQLXJabz9tvlFglQl0Rz4h8hl5NrWltvyZu6IT6 Y8gW/+XvLxs82JtWH5MeKDlVBhbGCchPaHo0qdd70BmOB1CSE1qZb6/nUKSaWKIy9aOa GEiGo77wRUj/bvMu+ohuq8e6P2FCUAQiGVr7eVfn0qBeEw416JCzyHhU+bojTwpGDYae 2hhldTERKNnHjqNsoM8qSaD+VGIfllDPZ2SwSdwSGgNfslwbzwkH121z/o43C4rLwYm2 Aafw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Qpoj2PhB5U0PaGcQjqMFTk6mCdew5uWhagfdktabDJY=; b=eVdYhKRTuQclWcSr7u5klTbHr94NtHoIj4djpX5A2pyY4KF+jKMZPLQebkgtjuZ1fF 4wzhLtrbIwdFm9iCO/Au3rR3oOPgXfZEAQ1LLJTVUGRtvAAydw7q+p0o5whXafQD49Jx OfsPzBJX8C/juLZ+B8mCwHqOc3QdazKJqrXJ38+D6+8LIMkQg6MGqb9SEQ+7mtC5ieWU tE3dOB54Kdotl4IwzdQp+7+jwMuEMwP7x+MW3R/H2gChHYyUWzVIkZku0gbvJ5yil3g5 vpNmI2XBHut7rAKuiZ8Djb7vhrfr4ZqD8lF6Siz/bdws7oEWbryvbLOawTkFYAC4/SdY cEKw== X-Gm-Message-State: AOAM530DKAFMYw1OU6U541OgB3RxGfOtRW2A+wVm5E4IoPMY5Z03kibQ 9JLU/UrzX3TFFYe4/zu1zIvfPLUItPG7fg== X-Google-Smtp-Source: ABdhPJxhIZplOXP+DViPW5j1e30UHIuuq5H/dLnMrK3g2A1QBFmNi//7yCGKPA2nyPfijZRCsOFtmg== X-Received: by 2002:a05:6214:554:: with SMTP id ci20mr2443897qvb.24.1632784494473; Mon, 27 Sep 2021 16:14:54 -0700 (PDT) Received: from localhost.localdomain ([37.218.244.251]) by smtp.gmail.com with ESMTPSA id n16sm11671214qta.51.2021.09.27.16.14.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Sep 2021 16:14:54 -0700 (PDT) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper Cc: Denis 'GNUtoo' Carikli , Patrick Steinhardt , James Bottomley , Glenn Washburn Subject: [PATCH v2 4/4] cryptodisk: Remove unneeded found_uuid from cryptomount args Date: Mon, 27 Sep 2021 18:14:03 -0500 Message-Id: <20210927231403.642857-5-development@efficientek.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210927231403.642857-1-development@efficientek.com> References: <20210927231403.642857-1-development@efficientek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::f34; envelope-from=development@efficientek.com; helo=mail-qv1-xf34.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 23:14:57 -0000 The member found_uuid was never used by the crypto-backends, but was used to determine if a crypto-backend successfully mounted a cryptodisk with a given uuid. This is not needed however, because grub_device_iterate will return 1 iff grub_cryptodisk_scan_device returns 1. And grub_cryptodisk_scan_device will only return 1 if a search_uuid has been specified and a cryptodisk was successfully setup by a crypto-backend. So the return value of grub_cryptodisk_scan_device is equivalent to found_uuid. Signed-off-by: Glenn Washburn --- grub-core/disk/cryptodisk.c | 9 ++++----- include/grub/cryptodisk.h | 1 - 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c index 5e153ee0a..033894257 100644 --- a/grub-core/disk/cryptodisk.c +++ b/grub-core/disk/cryptodisk.c @@ -1046,8 +1046,6 @@ grub_cryptodisk_scan_device_real (const char *name, grub_cryptodisk_insert (dev, name, source); - cargs->found_uuid = 1; - goto cleanup; } goto cleanup; @@ -1132,7 +1130,7 @@ grub_cryptodisk_scan_device (const char *name, if (err) grub_print_error (); - return (cargs->found_uuid && cargs->search_uuid) ? 1 : 0; + return (!err && cargs->search_uuid) ? 1 : 0; } static grub_err_t @@ -1152,6 +1150,7 @@ grub_cmd_cryptomount (grub_extcmd_context_t ctxt, int argc, char **args) if (state[0].set) /* uuid */ { + int found_uuid = 0; grub_cryptodisk_t dev; dev = grub_cryptodisk_get_by_uuid (args[0]); @@ -1164,9 +1163,9 @@ grub_cmd_cryptomount (grub_extcmd_context_t ctxt, int argc, char **args) cargs.check_boot = state[2].set; cargs.search_uuid = args[0]; - grub_device_iterate (&grub_cryptodisk_scan_device, &cargs); + found_uuid = grub_device_iterate (&grub_cryptodisk_scan_device, &cargs); - if (!cargs.found_uuid) + if (!found_uuid) return grub_error (GRUB_ERR_BAD_ARGUMENT, "no such cryptodisk found"); return GRUB_ERR_NONE; } diff --git a/include/grub/cryptodisk.h b/include/grub/cryptodisk.h index 230167ab0..f4afb9cbd 100644 --- a/include/grub/cryptodisk.h +++ b/include/grub/cryptodisk.h @@ -70,7 +70,6 @@ typedef gcry_err_code_t struct grub_cryptomount_args { grub_uint32_t check_boot : 1; - grub_uint32_t found_uuid : 1; char *search_uuid; grub_uint8_t *key_data; grub_size_t key_len; -- 2.32.0