From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1klu8R-0006y3-KZ for mharc-grub-devel@gnu.org; Sun, 06 Dec 2020 08:31:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50580) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1klu8L-0006wj-Uu for grub-devel@gnu.org; Sun, 06 Dec 2020 08:31:30 -0500 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:40409) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1klu8H-0003oo-C3 for grub-devel@gnu.org; Sun, 06 Dec 2020 08:31:25 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id CE117333; Sun, 6 Dec 2020 08:31:19 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sun, 06 Dec 2020 08:31:20 -0500 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=DH0+rzqc4+xxYuNvDvxRROoUTiU /PlDrhKnPWg63gGQ=; b=vZzUCgfUfGctlKEvFM0OBlWYPiC+ClXVOC487KH88te cqHrSfzYI7OjtbTLLrrAhGZcRsA/GxhowoVdN2H9Xoo6iuD+dSEnilfJEBtnIkbA eycdRE8KyWDdy2kHWlfcSGHcNzR9jd2py+yxLR2ulmx2tSLTmjliafSNNkcXrkit M6Lm2mhI2qlhJypYHGNg++P8W9G2p4LS5G9h2oPa63BEuPfp+PSuU0TizFyK+LUy nHixXTLIn6hfI4lBLHfFSF66J9EOVxCZr8ZxmKk47NA7eCGvVw2QS7tBnSnwOKM7 PUioOSjh2+3YUv1Fcfalt9N8Ol+vpGSNDrxOULOwZfQ== 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=DH0+rz qc4+xxYuNvDvxRROoUTiU/PlDrhKnPWg63gGQ=; b=pHwcX0LXRsoBiqGxMlW64f klI/vJELHy0ThigQUWdlMZ3TVSi0Lfa9gLhypP9dGn175gR8r/zTYgV7WabEBOZM eqcA3JJ1AgZJfj4DTKn7dFJ+IpFFIwq2IFFF5ktaL9epyn9boxnGOVyxATY7G2bt 3yYhVP2JM93ah+m+wSAcnRCQc1GRwr844FVlCqyb+NJqhvLdS58/pV08GjY4pvXB PyqoYCpMXEFjnT2DCPG8ju/ruswkcVYsFc7OnknY4cEYMfvUT06JXCJ1ypM9mz1c vHM8PWzQ1o3kIHLzQ3JD2fir6JfiJ/Jye7CLaO1giCHIdvtKZZ/kTC66wHgm6a0w == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudejvddgheegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefrrghtrhhi tghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrh hnpeehgefhtdefueffheekgfffudelffejtdfhvdejkedthfehvdelgfetgfdvtedthfen ucfkphepjeejrddukeefrddujedruddutdenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhm X-ME-Proxy: Received: from vm-mail (x4db7116e.dyn.telefonica.de [77.183.17.110]) by mail.messagingengine.com (Postfix) with ESMTPA id 064AF24005A; Sun, 6 Dec 2020 08:31:17 -0500 (EST) Received: from localhost (ncase [10.192.0.11]) by vm-mail (OpenSMTPD) with ESMTPSA id f9a7f786 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 6 Dec 2020 13:31:16 +0000 (UTC) Date: Sun, 6 Dec 2020 14:31:15 +0100 From: Patrick Steinhardt To: Glenn Washburn Cc: grub-devel@gnu.org, Daniel Kiper Subject: Re: [PATCH v7 06/17] luks2: Use more intuitive slot key instead of index in user messages Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="PSZ4TRPmYiL6DTCs" Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=64.147.123.24; envelope-from=ps@pks.im; helo=wout1-smtp.messagingengine.com 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_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: Sun, 06 Dec 2020 13:31:30 -0000 --PSZ4TRPmYiL6DTCs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 04, 2020 at 10:43:35AM -0600, Glenn Washburn wrote: > Use the slot key name in the json array rather than the 0 based index in = the > json array for keyslots, segments, and digests. This is less confusing for > the end user. For example, say you have a LUKS2 device with a key in slot= 1 > and slot 4. When using the password for slot 4 to unlock the device, the > messages using the index of the keyslot will mention keyslot 1 (its a > zero-based index). Furthermore, with this change the keyslot number will > align with the number used to reference the keyslot when using the > --key-slot argument to cryptsetup. >=20 > Signed-off-by: Glenn Washburn Reviewed-by: Patrick Steinhardt Oops. I just realized I gave SOBs on the previous patches. Naturally, these should've been Reviewed-by's :( > --- > grub-core/disk/luks2.c | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) >=20 > diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c > index 437c1da07..ea1065bcf 100644 > --- a/grub-core/disk/luks2.c > +++ b/grub-core/disk/luks2.c > @@ -284,13 +284,13 @@ luks2_get_keyslot (grub_luks2_keyslot_t *k, grub_lu= ks2_digest_t *d, grub_luks2_s > grub_json_getuint64 (&d->json_slot_key, &digest, NULL) || > grub_json_getchild (&digest, &digest, 0) || > luks2_parse_digest (d, &digest)) > - return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse digest %"PRI= uGRUB_SIZE, i); > + return grub_error (GRUB_ERR_BAD_ARGUMENT, "Could not parse digest index= %"PRIuGRUB_SIZE, i); > =20 > if ((d->keyslots & (1 << k->json_slot_key))) > break; > } > if (i =3D=3D size) > - return grub_error (GRUB_ERR_FILE_NOT_FOUND, "No digest for keyslot= %"PRIuGRUB_SIZE, keyslot_idx); > + return grub_error (GRUB_ERR_FILE_NOT_FOUND, "No digest for keyslot= \"%"PRIuGRUB_UINT64_T"\"", k->slot_key); > =20 > /* Get segment that matches the digest. */ > if (grub_json_getvalue (&segments, root, "segments") || > @@ -308,7 +308,7 @@ luks2_get_keyslot (grub_luks2_keyslot_t *k, grub_luks= 2_digest_t *d, grub_luks2_s > break; > } > if (i =3D=3D size) > - return grub_error (GRUB_ERR_FILE_NOT_FOUND, "No segment for digest %= "PRIuGRUB_SIZE); > + return grub_error (GRUB_ERR_FILE_NOT_FOUND, "No segment for digest \= "%"PRIuGRUB_UINT64_T"\"", d->slot_key); > =20 > return GRUB_ERR_NONE; > } > @@ -604,11 +604,11 @@ luks2_recover_key (grub_disk_t source, > =20 > if (keyslot.priority =3D=3D 0) > { > - grub_dprintf ("luks2", "Ignoring keyslot %"PRIuGRUB_SIZE" due to prio= rity\n", i); > + grub_dprintf ("luks2", "Ignoring keyslot \"%"PRIuGRUB_UINT64_T"\" due= to priority\n", keyslot.slot_key); > continue; > } > =20 > - grub_dprintf ("luks2", "Trying keyslot %"PRIuGRUB_SIZE"\n", i); > + grub_dprintf ("luks2", "Trying keyslot \"%"PRIuGRUB_UINT64_T"\"\n"= , keyslot.slot_key); > =20 > /* Set up disk according to keyslot's segment. */ > crypt->offset_sectors =3D grub_divmod64 (segment.offset, segment.s= ector_size, NULL); > @@ -623,16 +623,16 @@ luks2_recover_key (grub_disk_t source, > (const grub_uint8_t *) passphrase, grub_strlen (passphrase)); > if (ret) > { > - grub_dprintf ("luks2", "Decryption with keyslot %"PRIuGRUB_SIZE" fail= ed: %s\n", > - i, grub_errmsg); > + grub_dprintf ("luks2", "Decryption with keyslot \"%"PRIuGRUB_UINT64_T= "\" failed: %s\n", > + keyslot.slot_key, grub_errmsg); > continue; > } > =20 > ret =3D luks2_verify_key (&digest, candidate_key, keyslot.key_size= ); > if (ret) > { > - grub_dprintf ("luks2", "Could not open keyslot %"PRIuGRUB_SIZE": %s\n= ", > - i, grub_errmsg); > + grub_dprintf ("luks2", "Could not open keyslot \"%"PRIuGRUB_UINT64_T"= \": %s\n", > + keyslot.slot_key, grub_errmsg); > continue; > } > =20 > @@ -640,7 +640,7 @@ luks2_recover_key (grub_disk_t source, > * TRANSLATORS: It's a cryptographic key slot: one element of an a= rray > * where each element is either empty or holds a key. > */ > - grub_printf_ (N_("Slot %"PRIuGRUB_SIZE" opened\n"), i); > + grub_printf_ (N_("Slot \"%"PRIuGRUB_UINT64_T"\" opened\n"), keyslo= t.slot_key); > =20 > candidate_key_len =3D keyslot.key_size; > break; > --=20 > 2.27.0 >=20 --PSZ4TRPmYiL6DTCs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEF9hrgiFbCdvenl/rVbJhu7ckPpQFAl/M3SIACgkQVbJhu7ck PpQzuA/6Aw6cV5m9bg0qmb9iO0ODrPfkf813R5pmLMgeHMbG1iDJjMljM+DjihFf 3Bhtt2rKLJd6H92z+vfYeblOHNWvCYxNUlSrTkpGvKZsFbRdQwMW9xkUql+epaVw BHORMcQEOx6nS8m6sVHoGPf5rigxLCJuRrwjKT5sXlVCJCtGabcMEruMxanZXQrw vwNGOuhkSlgCgBR6SZYAOKg7Twq3baWZLBCNrpkMxMb2NLBFhln0YwF73+EnSTHw SOqaqFcNAH/NjDptlY6QuWYpj91dX14iXzb0zEM+uvPkZSLa0xq3eRG3S5qp8S/4 aoV0QBV6Hge52T1EjZmuhXSoQnCPZ5Wr2oSa9lKsSLMkqPOpPUtDPejybfXUtQKn 72aXdbh/Rl6bJoH7jhMGRCkFqkKA1feECjRW/jQD9MVAPzdgqpmh2PIcxXNNFu6I ZRsC8jsQFiFozRZvuyNe2JbCuIQyu4vCi4VM2WdTSKuSh2IWy1DfBjalnJj/dczV KGDDtfOW12gndzOsDIPgAuQOGtUtIZZ+r+4txY5hCz4Nsv6RZtgIToGnsyCYL/Wz rEcPH7tJe4J2BA/TqKatTu4RbjZhZ77OIvfQvJG1cKMkSUFLF5oL2ziLsw6F8gOK yFaK8bAIbntcE6WxZJUF8JUhSNucPt8wDV/X2mQCdIvQnwI8UQE= =ftbI -----END PGP SIGNATURE----- --PSZ4TRPmYiL6DTCs--