From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1kOpN2-0003aW-B2 for mharc-grub-devel@gnu.org; Sat, 03 Oct 2020 17:47:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOpMy-0003We-Ei for grub-devel@gnu.org; Sat, 03 Oct 2020 17:47:08 -0400 Received: from mail-ot1-x342.google.com ([2607:f8b0:4864:20::342]:37115) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kOpMv-0002Km-T2 for grub-devel@gnu.org; Sat, 03 Oct 2020 17:47:08 -0400 Received: by mail-ot1-x342.google.com with SMTP id o8so5008421otl.4 for ; Sat, 03 Oct 2020 14:47:05 -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=vY6M4A99Xytnsbl73ZlKbNNBHNIDy/8OARE85gLEFFA=; b=mV2VaUCYVeNZ71VSAuRX0bTpaKuc1X0jHlbqbUtca8Bh8kwdrfsIM9vKh4DZrQSbwr 7ePx9dDGKL4p4o5SscCLaztD0yedtgJO76UQtv0D+iAjYuSH5WTvw7XOS5y84Pyv4Wnj gNGXoVr80/Ipr6yiaNOG/U2dN3vdNkfj4tBiKpc2jolgG4PEty7lvV3QtdZsIvNLa1tj y9kHil2UYgZ+Z4IZRYQFXCTj/Qiyv8OWtWEtvmYydqoqtqpynzFNvzNX55pmtHWFhb+x u/z8OKrgDVRrakOoUVCef3yjbccHmipPhPJQAbWPusvglsUBmmc9B+SjDqSAv70YTtd5 FG/g== 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=vY6M4A99Xytnsbl73ZlKbNNBHNIDy/8OARE85gLEFFA=; b=pVPKH92iSMZGb8MNKPiZ5CqEUUSzKyr2Sl35q2++5zKo4pACGEo6WrS44Rv5V0//Jc A62u3pLZlNxIUr4qosRQdR621DYvLk9+c5hzXyazqp4pfXKEHdXqHCD+2tBSPIhlgQrz Kne7beRzA60BteiHQV0EZnBFAoPCg7wcGQF/kNxm0K5lASBz6VF3tVCX6FuhPysNiYuo OgSKVFc4Ut0ScSA9KMkBy/cdpLonWcsZyDBUdxdGZuojWqSKYlga3xhwdrnD6EvmtDmC SkHQWa6wd9pPtmRDkb0Qe5JKM3/DiqK42zu/x7GCqx1WVTj+a8n7QUq+jkCqskgOmKks sc5g== X-Gm-Message-State: AOAM532perz5GwNz2RLL0v4nq36e9hvXODfmV5BN1WP7xKIH82mur5Os vOEl3UapP4K5GZzBqnxXQHg0IEDIoAZ1PA== X-Google-Smtp-Source: ABdhPJxntlO9xh6xKBOsP1gdW9KITrcyioVgdh2fGzQ1+msOW1eZYleetKV9M43ru/bTx6WkaHTDqg== X-Received: by 2002:a9d:7987:: with SMTP id h7mr6190363otm.319.1601761624559; Sat, 03 Oct 2020 14:47:04 -0700 (PDT) Received: from crass-HP-ZBook-15-G2.lan ([136.49.44.103]) by smtp.gmail.com with ESMTPSA id f26sm1495415otq.50.2020.10.03.14.47.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 14:47:04 -0700 (PDT) From: Glenn Washburn To: grub-devel@gnu.org Cc: Daniel Kiper , Patrick Steinhardt , Glenn Washburn Subject: [PATCH 08/10] cryptodisk: Rename total_length field in grub_cryptodisk_t to total_sectors. Date: Sat, 3 Oct 2020 16:46:01 -0500 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, 03 Oct 2020 21:47:09 -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 | 3 ++- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c index 1a91c2d55..f5d098f65 100644 --- a/grub-core/disk/cryptodisk.c +++ b/grub-core/disk/cryptodisk.c @@ -711,7 +711,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 20cc20b9b..545734342 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 = LUKS1_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, uuid, sizeof (uuid)); newdev->modname = "luks"; diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c index 054d5455d..995b413cd 100644 --- a/grub-core/disk/luks2.c +++ b/grub-core/disk/luks2.c @@ -616,10 +616,10 @@ 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->log_sector_size - disk->log_sector_size)) + crypt->total_sectors = (grub_disk_get_size (disk) >> (crypt->log_sector_size - disk->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, disk, crypt, &keyslot, (const grub_uint8_t *) passphrase, grub_strlen (passphrase)); diff --git a/include/grub/cryptodisk.h b/include/grub/cryptodisk.h index 006f3ec49..9e10ae927 100644 --- a/include/grub/cryptodisk.h +++ b/include/grub/cryptodisk.h @@ -73,7 +73,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<