From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1kOqSD-0007jY-S0 for mharc-grub-devel@gnu.org; Sat, 03 Oct 2020 18:56:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54782) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOqRy-0007eV-Nf for grub-devel@gnu.org; Sat, 03 Oct 2020 18:56:25 -0400 Received: from mail-oi1-x243.google.com ([2607:f8b0:4864:20::243]:32904) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kOqRn-0000G6-Qd for grub-devel@gnu.org; Sat, 03 Oct 2020 18:56:22 -0400 Received: by mail-oi1-x243.google.com with SMTP id m7so5064259oie.0 for ; Sat, 03 Oct 2020 15:56:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5iko5Cd6rkgkWBal/WtJiFu7/l3LopNQtf7qkq+v8U4=; b=cGPQpV4OXzoltc9tD7sae6mcSswzJD31maVi9UJUDT9Pb1hkaNKExdbP9yNbkWmQlT +Y259f4ynTaE2Cm0zTyG8Nq77uRqbcFAYVQhx4O94bAGl29vmZGvZpUK8IJGz6eUd337 yLZ5E5U7qi5E9B3Job28S+MQ6ztGshnlgT3GZxW9XtzzcAAeuysSgtSKD+j0xg4ePg8j 0aR+PZK9hfQi3Bs7H9mJBcbaAp4/mC4heuvcXi9k0bBF97ZBTnIqfj3+yPDol+dwPnbS Nb37tBSkLfKPgdETRs2fJ9hozf3NZYjjkXxh87YiYe7uEpVgTxvNZ7eO5paHKT2anMw/ IDkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5iko5Cd6rkgkWBal/WtJiFu7/l3LopNQtf7qkq+v8U4=; b=n6QU5YwEGVH7tUppuCsLVnVu2K2QubcUNn/+Ft+aKl+VRWymFPQn1Sl6qy2k74ANNo uZGRN8C4t+al2POIw4k2GTsJLMXXDPuohFoE20YUrA6a0mjUDJDIts4zNLgW7t6Quvxq RqXcRzwITE/HRiFkBEcJBDvXrnuL4GYEyl1rY1UNfub/zi/1eXQGzolPQxpbAP/JLjOX IES5gMm7K3oskTkzmyM1C1SXnzAYrSL5wikODIcbRf4IL360WZsAtLqrQ5lWkL3V+xAB yd7Gub31SjHh21MjaQ4hkBRzCrrN/eXRUIl83oCqGQJ8DPS/F3OJmk3C2GqcNyc2dukC XSag== X-Gm-Message-State: AOAM530qKgixibu86YkP4FF9aJwmfRzhebSZ4C3gt9VkqdEQOWPUcxAY Zdnkqi2BiaEqjBSSAOoTt6Rnu8xr+yVhfw== X-Google-Smtp-Source: ABdhPJxM/Qt0S5VYFJK8/dWEK5O27F3GsGozSI2ykgggK1EzpctSXFzqq9J3jSefQPJTYT+cnVSLYg== X-Received: by 2002:a05:6808:8f3:: with SMTP id d19mr4635011oic.36.1601765769833; Sat, 03 Oct 2020 15:56:09 -0700 (PDT) Received: from crass-HP-ZBook-15-G2.lan ([136.49.44.103]) by smtp.gmail.com with ESMTPSA id d17sm1524580oth.73.2020.10.03.15.56.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 15:56:09 -0700 (PDT) From: Glenn Washburn To: grub-devel@gnu.org Cc: Daniel Kiper , Patrick Steinhardt , Glenn Washburn Subject: [PATCH v2 10/10] luks2: Rename source disk variabled named 'disk' to 'source' as in luks.c. Date: Sat, 3 Oct 2020 17:55:34 -0500 Message-Id: <86beb5be81a77d201f1b4151f2c0ec26b2c63fd5.1601765266.git.development@efficientek.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::243; envelope-from=development@efficientek.com; helo=mail-oi1-x243.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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: Sat, 03 Oct 2020 22:56:25 -0000 This makes it more obvious to the reader that the disk referred to is the source disk, as opposed to say the disk holding the cryptodisk. Signed-off-by: Glenn Washburn --- grub-core/disk/luks2.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c index 46abc96ef..f918f5a52 100644 --- a/grub-core/disk/luks2.c +++ b/grub-core/disk/luks2.c @@ -416,7 +416,7 @@ luks2_verify_key (grub_luks2_digest_t *d, grub_uint8_t *candidate_key, static grub_err_t luks2_decrypt_key (grub_uint8_t *out_key, - grub_disk_t disk, grub_cryptodisk_t crypt, + grub_disk_t source, grub_cryptodisk_t crypt, grub_luks2_keyslot_t *k, const grub_uint8_t *passphrase, grub_size_t passphraselen) { @@ -492,7 +492,7 @@ luks2_decrypt_key (grub_uint8_t *out_key, } grub_errno = GRUB_ERR_NONE; - ret = grub_disk_read (disk, 0, k->area.offset, k->area.size, split_key); + ret = grub_disk_read (source, 0, k->area.offset, k->area.size, split_key); if (ret) { grub_error (GRUB_ERR_IO, "Read error: %s\n", grub_errmsg); @@ -536,7 +536,7 @@ luks2_decrypt_key (grub_uint8_t *out_key, } static grub_err_t -luks2_recover_key (grub_disk_t disk, +luks2_recover_key (grub_disk_t source, grub_cryptodisk_t crypt) { grub_uint8_t candidate_key[GRUB_CRYPTODISK_MAX_KEYLEN]; @@ -551,7 +551,7 @@ luks2_recover_key (grub_disk_t disk, grub_json_t *json = NULL, keyslots; grub_err_t ret; - ret = luks2_read_header (disk, &header); + ret = luks2_read_header (source, &header); if (ret) return ret; @@ -560,7 +560,7 @@ luks2_recover_key (grub_disk_t disk, return GRUB_ERR_OUT_OF_MEMORY; /* Read the JSON area. */ - ret = grub_disk_read (disk, 0, grub_be_to_cpu64 (header.hdr_offset) + sizeof (header), + ret = grub_disk_read (source, 0, grub_be_to_cpu64 (header.hdr_offset) + sizeof (header), grub_be_to_cpu64 (header.hdr_size) - sizeof (header), json_header); if (ret) goto err; @@ -577,10 +577,10 @@ luks2_recover_key (grub_disk_t disk, } /* Get the passphrase from the user. */ - if (disk->partition) - part = grub_partition_get_name (disk->partition); - grub_printf_ (N_("Enter passphrase for %s%s%s (%s): "), disk->name, - disk->partition ? "," : "", part ? : "", + if (source->partition) + part = grub_partition_get_name (source->partition); + grub_printf_ (N_("Enter passphrase for %s%s%s (%s): "), source->name, + source->partition ? "," : "", part ? : "", crypt->uuid); if (!grub_password_get (passphrase, MAX_PASSPHRASE)) { @@ -616,12 +616,12 @@ luks2_recover_key (grub_disk_t disk, crypt->log_sector_size = sizeof (unsigned int) * 8 - __builtin_clz ((unsigned int) segment.sector_size) - 1; if (grub_strcmp (segment.size, "dynamic") == 0) - crypt->total_sectors = (grub_disk_get_size (disk) >> (crypt->log_sector_size - disk->log_sector_size)) + crypt->total_sectors = (grub_disk_get_size (source) >> (crypt->log_sector_size - source->log_sector_size)) - crypt->offset_sectors; else crypt->total_sectors = grub_strtoull (segment.size, NULL, 10) >> crypt->log_sector_size; - ret = luks2_decrypt_key (candidate_key, disk, crypt, &keyslot, + ret = luks2_decrypt_key (candidate_key, source, crypt, &keyslot, (const grub_uint8_t *) passphrase, grub_strlen (passphrase)); if (ret) { -- 2.27.0