From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1kQpCr-00044T-DH for mharc-grub-devel@gnu.org; Fri, 09 Oct 2020 06:00:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQpCj-0003yO-96 for grub-devel@gnu.org; Fri, 09 Oct 2020 06:00:49 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:53847) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQpCh-0007mb-5I for grub-devel@gnu.org; Fri, 09 Oct 2020 06:00:48 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 7C9AC5C019D; Fri, 9 Oct 2020 06:00:46 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 09 Oct 2020 06:00:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=4Xbir2GNg39BqnAmBMgHFB4rFKF vjVRpSp4m7/pbGVU=; b=YL4farjy9Kb1QiJZb/5C7ybNpQR92MZhWHymIBJRyle KDxIjxjf8wZvZJd5oB1JkHSXHBqk41D4f88++h4tayLWWX0hq4FSnB9H3l4pyFNs 85gcwOYJbxCZ99ryhwnfxFbRnhpULB9o+kyEtuLQsr/TjqrTHQpUYFBwQaPziukI asw52mZH8cvVqYMlSJaQl40EA5Tb1MIFEujR3FbdoaYKps+mTYf0cp+d+6Z/CiHi D1NQSRPg9+/q0rQhVKcQ4SYO6KRUnA6ve92LyXvC1njjnSPykhC7IFMQW718Bmla 2eQYD1rkOWY/0WtGxis6PRm2byET9PJHaDSNu9rI0Zg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=4Xbir2 GNg39BqnAmBMgHFB4rFKFvjVRpSp4m7/pbGVU=; b=bTlR7tPOaKMcclmIsh3s9+ bfSqTKxUMvKTUzOP30Ty1DdzT8qlSPIsfvSC0VCoz6D3an1i2NB+QHruQp2FAjWR dHnHeBoz9jl3TZcRfJSc2iMBmuiFqcUDUMT5hTZzEHY5SEEhvBXk5P8dFxWmk7Ws u/zW5/T+j/HZfaDgbcR9fb8RfTP1KgSYA+X2G4yqGOVgrrMpGKDCrfGvs6la/LgN CzlUq/MRJW6bGzAhavAw5ZY1GwXf8Zi9JW9WUkHEROn+bVeVTvMwEUxUjtQxn81a iaIh3KkTwbZ/RgDA/dXuAgmP6xP5yW9OvojpflF1J4a53InUbhSL2Vivt2gZXYig == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrhedugddvfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomheprfgrthhrihgt khcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnh epheeghfdtfeeuffehkefgffduleffjedthfdvjeektdfhhedvlefgtefgvdettdfhnecu kfhppeejkedrheegrdefvddrudefgeenucevlhhushhtvghrufhiiigvpedunecurfgrrh grmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhm X-ME-Proxy: Received: from vm-mail.pks.im (dynamic-078-054-032-134.78.54.pool.telefonica.de [78.54.32.134]) by mail.messagingengine.com (Postfix) with ESMTPA id 6269B3064674; Fri, 9 Oct 2020 06:00:45 -0400 (EDT) Received: from localhost (tanuki [10.192.0.23]) by vm-mail.pks.im (OpenSMTPD) with ESMTPSA id 9f750393 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 9 Oct 2020 10:00:43 +0000 (UTC) Date: Fri, 9 Oct 2020 12:00:47 +0200 From: Patrick Steinhardt To: Glenn Washburn Cc: grub-devel@gnu.org, Daniel Kiper Subject: Re: [PATCH v2 10/10] luks2: Rename source disk variabled named 'disk' to 'source' as in luks.c. Message-ID: <20201009100047.GG2088@tanuki> References: <86beb5be81a77d201f1b4151f2c0ec26b2c63fd5.1601765266.git.development@efficientek.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Fnm8lRGFTVS/3GuM" Content-Disposition: inline In-Reply-To: <86beb5be81a77d201f1b4151f2c0ec26b2c63fd5.1601765266.git.development@efficientek.com> Received-SPF: pass client-ip=66.111.4.26; envelope-from=ps@pks.im; helo=out2-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/09 05:22:33 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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, 09 Oct 2020 10:00:49 -0000 --Fnm8lRGFTVS/3GuM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Oct 03, 2020 at 05:55:34PM -0500, Glenn Washburn wrote: > 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. Hum. I'm not sure this actually helps readability, mostly because I think that the distinction here is not that helpful in the context of encryption or decryption of the device. In the end we are trying to encrypt or decrypt the disk in order to create the new cryptodisk. Anyway, I don't particularly care, so take this just as my two cents. The patch itself looks good to me. Patrick > Signed-off-by: Glenn Washburn > --- > grub-core/disk/luks2.c | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) >=20 > 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, > =20 > 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, > } > =20 > grub_errno =3D GRUB_ERR_NONE; > - ret =3D grub_disk_read (disk, 0, k->area.offset, k->area.size, split_k= ey); > + ret =3D 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, > } > =20 > 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 =3D NULL, keyslots; > grub_err_t ret; > =20 > - ret =3D luks2_read_header (disk, &header); > + ret =3D luks2_read_header (source, &header); > if (ret) > return ret; > =20 > @@ -560,7 +560,7 @@ luks2_recover_key (grub_disk_t disk, > return GRUB_ERR_OUT_OF_MEMORY; > =20 > /* Read the JSON area. */ > - ret =3D grub_disk_read (disk, 0, grub_be_to_cpu64 (header.hdr_offset) = + sizeof (header), > + ret =3D 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, > } > =20 > /* Get the passphrase from the user. */ > - if (disk->partition) > - part =3D 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 =3D 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 =3D sizeof (unsigned int) * 8 > - __builtin_clz ((unsigned int) segment.sector_size) - 1; > if (grub_strcmp (segment.size, "dynamic") =3D=3D 0) > - crypt->total_sectors =3D (grub_disk_get_size (disk) >> (crypt->log_sect= or_size - disk->log_sector_size)) > + crypt->total_sectors =3D (grub_disk_get_size (source) >> (crypt->log_se= ctor_size - source->log_sector_size)) > - crypt->offset_sectors; > else > crypt->total_sectors =3D grub_strtoull (segment.size, NULL, 10) >> cryp= t->log_sector_size; > =20 > - ret =3D luks2_decrypt_key (candidate_key, disk, crypt, &keyslot, > + ret =3D luks2_decrypt_key (candidate_key, source, crypt, &keyslot, > (const grub_uint8_t *) passphrase, grub_strlen (passphrase)); > if (ret) > { > --=20 > 2.27.0 >=20 --Fnm8lRGFTVS/3GuM Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEF9hrgiFbCdvenl/rVbJhu7ckPpQFAl+ANM4ACgkQVbJhu7ck PpQzjw//UU2LOBxOm+Ijhvg6wR5NVpvrpHgP5Xgwq3aWK+P+I9ZHW7PgJX5eplQd th40lp0ETh5DEOAGx0OKjsPTjQtdXksDbdrsLhn8jh1ujyGWGeqPATsY5fmC1v20 v3WM3hNJezqHL/D7WKnhmvs0HD2wxlQavNlko7T9WyninmLMogFrESUQDq97nFKI pHWbuwh9QjFvz9hFLDuI0kXRgerQ5jj62cXLPjLlV02fHmAxzdt/VAke8cRtVzoJ 4NqNWqYAYa37xOJw9oKC3NssYql80FXCx+tyJHQIjtRxgogE3YGwWryhvTYtBTSJ Ol1SHxytX6j3ktUfAat+OCXNqYlDJP6EKvBfQRlwHEavpqzc2ukqgwM4Bp7QMYc9 CqKxK6W/g3qxrtaVaREFF6HB2T2fCZorBplfga5T2JkHaG2Cn34bpxQ4VeleZHe0 tKzBRGUk/XC+R8tuCD54hu5NT11XKRhPSMSD7+bEPrNaOm30XIDGCz8i3U5qrZNB HSBcGeMbIDw4nA19fpopn6kIaux7I0hw4mJ3uJLkxqEGDBd+iRhQpXaA2JW3j0cn vUH+tBqByJUM4S1NwTYwmyJBQTi21BZEGVgO22EleKxEyumDNTK1y3fuOS9fycZI f/RGIL8lDp9zsdRFNBOs2cTrO9TeZN4vd2Puy0QlE54swz+fbrQ= =3z5O -----END PGP SIGNATURE----- --Fnm8lRGFTVS/3GuM--