Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1k1TkS-0007Ec-FT for mharc-grub-devel@gnu.org; Fri, 31 Jul 2020 08:02:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k1TkQ-0007A0-Qz for grub-devel@gnu.org; Fri, 31 Jul 2020 08:02:50 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:46685) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k1TkO-0005X9-Vc for grub-devel@gnu.org; Fri, 31 Jul 2020 08:02:50 -0400 Received: by mail-pl1-x643.google.com with SMTP id k13so9367258plk.13 for ; Fri, 31 Jul 2020 05:02:48 -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=r+BOpzNRZcbhpaQqCQ8WEarQwyt0eSNoD0QV/divLPI=; b=I3gVMiMYiihJRFsr9c1DHTjZNavwOF72UNWcVrLmDff+9FMTpxup43xlQ8K9CgCs2N JKo8LiPcai043SJP2v4k/D5/oSwtZWQDVcN7aNFizTD9qbeoK/NY2pUtzGG4JhK1ior3 +WXdPNy0PgYgMo6vvGPGIHPJCWL4yBgywiQTS9GQvhP2Guc0u++48HHGT5uEm4dQ5/9i qHAY6EB4dMFNVzKoF8x+Zi/XyfFKn0zcmiDHWWfIwvIiB8139sKXQErWw1BXO4oBtG2l XZlO18PEEnxzCOUiXu9Fn6mD6/gXJPjwOpbSzVH68N+xxomNyw4E84teAXxKcG4lRUgk 13OA== 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=r+BOpzNRZcbhpaQqCQ8WEarQwyt0eSNoD0QV/divLPI=; b=PnJCMKMannQ66Ml/C/yw9pHvAb+bH4tcUJNNIC+c+HGQRkqdQnDeuidqCQ6fsvg1ak v/JCY6qsfdmSst5oy7+xUTghGNkaBok2+VbmcNxsIPJouPmMk6/32PIUNXSg/mtura9J XmGn6SxsA3dyc0TE9R+yPTBYn4Z07RkYGv5BJqYrSNbtmQoo2pjw5t658RbAYk5HoUha QtLDQKhuo+b0/aNpz75FXkxNH0Ec0/RZ/dIN7rNKXYiEhKPMnbHifk104AFz5MusfMyM Bdg1SZ4RW5rkO+R9pigSDhXNcId9PTumFwo8SV5ZA21beJXKUGapNMLCUZuH6hj/pUBM q/Cw== X-Gm-Message-State: AOAM533UYvpirdHDbLmzhA8Zvs9wSHWkSy0Y1oHU7huUej4x8n3KBSYB xekkqvpiOlsJqAkNO+nEW72XZwLpbkk= X-Google-Smtp-Source: ABdhPJxhBKHTZu+yB4hvZWT3RrfhoX7qXZD+AM+xbV3QFXme6tBaX+91WpS0cmP2l6xgk7jcih7c2Q== X-Received: by 2002:aa7:946e:: with SMTP id t14mr3290520pfq.85.1596196966873; Fri, 31 Jul 2020 05:02:46 -0700 (PDT) Received: from localhost.localdomain ([189.216.105.24]) by smtp.gmail.com with ESMTPSA id o4sm9781590pfd.25.2020.07.31.05.02.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2020 05:02:46 -0700 (PDT) From: Glenn Washburn To: grub-devel@gnu.org Cc: Glenn Washburn , Daniel Kiper , Patrick Steinhardt Subject: [CRYPTO-LUKS v1 12/19] cryptodisk: Rename total_length field in grub_cryptodisk_t to total_sectors. Date: Fri, 31 Jul 2020 07:01:53 -0500 Message-Id: <7001353db0f9e13254973fbdee3cf5ebcfc7da97.1596196383.git.development@efficientek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::643; envelope-from=development@efficientek.com; helo=mail-pl1-x643.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: Fri, 31 Jul 2020 12:02:51 -0000 This makes the 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 | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c index 014a8a95b..9399849b6 100644 --- a/grub-core/disk/cryptodisk.c +++ b/grub-core/disk/cryptodisk.c @@ -705,7 +705,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 a1ac078d1..b1db3d137 100644 --- a/grub-core/disk/luks.c +++ b/grub-core/disk/luks.c @@ -113,7 +113,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 = LOG_SECTOR_SIZE; - newdev->total_length = grub_disk_get_size (disk) - newdev->offset; + newdev->total_sectors = grub_disk_get_size (disk) - newdev->offset; grub_memcpy (newdev->uuid, header.uuid, sizeof (newdev->uuid)); newdev->modname = "luks"; diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c index 5e4ce858e..28d9fe0e0 100644 --- a/grub-core/disk/luks2.c +++ b/grub-core/disk/luks2.c @@ -610,10 +610,10 @@ luks2_recover_key (grub_disk_t source, * Convert to cryptodisk sized sectors from source disk sized sectors * before subtracting the offset, which is in cryptodisk sized sectors. */ - crypt->total_length = (grub_disk_get_size (source) >> (crypt->log_sector_size - source->log_sector_size)) + crypt->total_sectors = (grub_disk_get_size (source) >> (crypt->log_sector_size - source->log_sector_size)) - crypt->offset; else - crypt->total_length = grub_strtoull (segment.size, NULL, 10) >> crypt->log_sector_size; + crypt->total_sectors = grub_strtoull (segment.size, NULL, 10) >> crypt->log_sector_size; ret = luks2_decrypt_key (candidate_key, source, crypt, &keyslot, (const grub_uint8_t *) passphrase, grub_strlen (passphrase)); diff --git a/include/grub/cryptodisk.h b/include/grub/cryptodisk.h index 06653a622..f9e42796e 100644 --- a/include/grub/cryptodisk.h +++ b/include/grub/cryptodisk.h @@ -67,7 +67,7 @@ struct grub_cryptodisk char *source; grub_disk_addr_t offset; - grub_disk_addr_t total_length; + grub_disk_addr_t total_sectors; grub_disk_t source_disk; int ref; grub_crypto_cipher_handle_t cipher; -- 2.25.1