From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1kbG8h-0008Rq-Pk for mharc-grub-devel@gnu.org; Fri, 06 Nov 2020 23:47:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kbG8Z-0008KO-7C for grub-devel@gnu.org; Fri, 06 Nov 2020 23:47:39 -0500 Received: from mail-ot1-x342.google.com ([2607:f8b0:4864:20::342]:42056) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kbG8V-0002o7-NZ for grub-devel@gnu.org; Fri, 06 Nov 2020 23:47:37 -0500 Received: by mail-ot1-x342.google.com with SMTP id h62so3312695oth.9 for ; Fri, 06 Nov 2020 20:47:33 -0800 (PST) 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=by5e5v5wY6XjbnVoh57v37TzljJMetiC9JD9SFbztaQ=; b=H171CCpZhAv1SiB5FU3HUqlFzfy1Jlqa1NgwcCB46NcggU/l9SYV8P9c8CGG7/o1cI dL/J5bsDLLThp2NzDpgNjh1LL+c/K+ikAgaX596s0DwFodw7DWu2Ilh9GE34+TCiTVlM OmQln1rIGpkkwpw1Iob812FLfCu7pRahyZICzNNnjfuSGzs3RXKm/9Gj6xchhP5qbLaG DwJZG8/xRapgex4KUkhUESFuEMnX+klPUTpBAG+8nqiMNWdaVI8BA9Y5oI/qGceVOKLl NfDuTUjfVgywuicw+Wo6UYiXNvVwuUSCr11XHJaAk4Ol9vvFw2sGfasRmyNc86WUltC0 Obxg== 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=by5e5v5wY6XjbnVoh57v37TzljJMetiC9JD9SFbztaQ=; b=QW4QXMuPYGU0x1hWVUEvOXXkR48tLpCERhgjJc0pqmFx9y4ffiU0YFzhzvNWh1QKC1 PxtNVtLfNo7aA6wcAE01Q/lQl5fKpb8CE7Qs3FoLycEmKY5ed34OQfffQnDZnEEUdwy7 mngmqcL3WYnIQwHjPkfOjWr3/dT40C/hAGw/SdPogNegZ9rVAYm9ADPmStRfSBi3JhEe 0SfhgdkDnQ1NYg72Evxi1DS/CSEDgisoTiyIqf8mf/++6hmrM54FYQe6VYQpQC+051id +R6+kR2ll77Vs8HpQUQi8nWXpol68Y2VYl9RngfDO1AhKOExwhvMSL31S06YSpQAOS6s q7pA== X-Gm-Message-State: AOAM533NCGPSgjLrA3rQpCy7CwhVhmklYVRnTYKO6NeYZvP/6vplbRFQ AzM+k2Rv8D/UxpWZpfjBgrzigniotkUESxBT X-Google-Smtp-Source: ABdhPJzRhwTTG2dJUUizBZ3ippOBRD90yW22KGAXWXWWE6Uym60+4F7p5RXG/Hl1L9G10sd4nS2xYw== X-Received: by 2002:a05:6830:8f:: with SMTP id a15mr3151144oto.362.1604724452973; Fri, 06 Nov 2020 20:47:32 -0800 (PST) Received: from localhost.localdomain ([136.49.44.103]) by smtp.gmail.com with ESMTPSA id x25sm836888oie.17.2020.11.06.20.47.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Nov 2020 20:47:32 -0800 (PST) From: Glenn Washburn To: grub-devel@gnu.org Cc: Patrick Steinhardt , Daniel Kiper , Glenn Washburn Subject: [PATCH v4 01/15] cryptodisk: Rename total_length field in grub_cryptodisk_t to total_sectors. Date: Fri, 6 Nov 2020 22:44:21 -0600 Message-Id: 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::342; envelope-from=development@efficientek.com; helo=mail-ot1-x342.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, 07 Nov 2020 04:47:39 -0000 This creates an alignment with grub_disk_t naming of the same field and is more intuitive as to how it should be used. Signed-off-by: Glenn Washburn --- grub-core/disk/cryptodisk.c | 2 +- grub-core/disk/geli.c | 2 +- grub-core/disk/luks.c | 2 +- grub-core/disk/luks2.c | 4 ++-- include/grub/cryptodisk.h | 3 ++- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c index a3d672f68..3703da221 100644 --- a/grub-core/disk/cryptodisk.c +++ b/grub-core/disk/cryptodisk.c @@ -699,7 +699,7 @@ grub_cryptodisk_open (const char *name, grub_disk_t disk) } disk->data = dev; - disk->total_sectors = dev->total_length; + disk->total_sectors = dev->total_sectors; disk->max_agglomerate = GRUB_DISK_MAX_MAX_AGGLOMERATE; disk->id = dev->id; dev->ref++; diff --git a/grub-core/disk/geli.c b/grub-core/disk/geli.c index e9d23299a..4ec875821 100644 --- a/grub-core/disk/geli.c +++ b/grub-core/disk/geli.c @@ -391,7 +391,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, newdev->modname = "geli"; - newdev->total_length = grub_disk_get_size (disk) - 1; + newdev->total_sectors = grub_disk_get_size (disk) - 1; grub_memcpy (newdev->uuid, uuid, sizeof (newdev->uuid)); COMPILE_TIME_ASSERT (sizeof (newdev->uuid) >= 32 * 2 + 1); return newdev; diff --git a/grub-core/disk/luks.c b/grub-core/disk/luks.c index 59702067a..429db4ad8 100644 --- a/grub-core/disk/luks.c +++ b/grub-core/disk/luks.c @@ -125,7 +125,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid, newdev->offset = grub_be_to_cpu32 (header.payloadOffset); newdev->source_disk = NULL; newdev->log_sector_size = 9; - newdev->total_length = grub_disk_get_size (disk) - newdev->offset; + newdev->total_sectors = grub_disk_get_size (disk) - newdev->offset; grub_memcpy (newdev->uuid, uuid, sizeof (uuid)); newdev->modname = "luks"; diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c index 31d7166fc..3173a098d 100644 --- a/grub-core/disk/luks2.c +++ b/grub-core/disk/luks2.c @@ -609,9 +609,9 @@ 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_length = grub_disk_get_size (disk) - crypt->offset; + crypt->total_sectors = grub_disk_get_size (disk) - crypt->offset; else - crypt->total_length = grub_strtoull (segment.size, NULL, 10); + crypt->total_sectors = grub_strtoull (segment.size, NULL, 10); ret = luks2_decrypt_key (candidate_key, disk, crypt, &keyslot, (const grub_uint8_t *) passphrase, grub_strlen (passphrase)); diff --git a/include/grub/cryptodisk.h b/include/grub/cryptodisk.h index e1b21e785..21dc69501 100644 --- a/include/grub/cryptodisk.h +++ b/include/grub/cryptodisk.h @@ -67,7 +67,8 @@ struct grub_cryptodisk char *source; grub_disk_addr_t offset; - grub_disk_addr_t total_length; + /* Total number of encrypted sectors of size (1<