Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1k1AGj-0005sj-HS for mharc-grub-devel@gnu.org; Thu, 30 Jul 2020 11:14:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k1AGh-0005sF-BU for grub-devel@gnu.org; Thu, 30 Jul 2020 11:14:51 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:53697) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k1AGf-0006WI-7w for grub-devel@gnu.org; Thu, 30 Jul 2020 11:14:51 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 206869E6; Thu, 30 Jul 2020 11:14:46 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 30 Jul 2020 11:14: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=fm1; bh=yHmTJsEFVVfSBtgtgVORFsxHizj ZnYEh/54bPYopOm4=; b=Roi8zhIuewlH0bHr3kSJwf5yU/vlrYPxZlQJw+ARqhM LX4Yet4WSH5+sHxWlEIBk+neJ8r2CgH/lXh9PTToXCGsXBxTmqu+5ZKmznokO+gG ubI+AH26c3szhqgD8sUGKQjcPENzUjtP17iTweOhYFJnoFwAC2jBQ5ERccFmbn77 P4WioJfuF3bm+h8BI0gEjZtWPtWZ55cGZKVW2mzQ+im3dlBi+0HUoKYSEZyIGCJq mIjdimEa7dNxaQNWB1sp/SbAT6iEVP+M1KKKbbaEb7KczZOCBQ7USQ51qanBdmgF LIkCSbTn2swG2VZ8pm3AOoD3XP+8iKabYKoX/RVWqXw== 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=fm3; bh=yHmTJs EFVVfSBtgtgVORFsxHizjZnYEh/54bPYopOm4=; b=eJibUFuJ6p/Aj6cwh72jaV beQxsIjNxTWtgJtMQbQvaB9vhvLnO0eHCh1a+qzDg3bb3TKha9hgd4HXrUzVPgbj Hn/OaLsktobChpmQWtIKAfeMbWyRwrci0YlkVCYPQ/JPlYNZj+RduW1obaazZbWr l38kiVHf8eplRwb7x/YCh6Ybyphuhc7DBIH0r6k+KqCdDoq6KdyuTs0/jTxJ9NjT 4p6wCPdDMQcTRY1pVUCB1veHrPhx1vbyG6Q4Xuvb7lfYu3Be/zFZ+jpElI5P88rf mgHe/R+JiGxMf1AEwTcwzlqXM/DNTst3GSOysAahMZXug0zjWrWcjgssu/SBTuDg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrieeigdekjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomheprfgrthhrihgt khcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnh epheeghfdtfeeuffehkefgffduleffjedthfdvjeektdfhhedvlefgtefgvdettdfhnecu kfhppeekledrudegrdeffedrtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehpshesphhkshdrihhm X-ME-Proxy: Received: from vm-mail.pks.im (x590e2100.dyn.telefonica.de [89.14.33.0]) by mail.messagingengine.com (Postfix) with ESMTPA id E16A730600A6; Thu, 30 Jul 2020 11:14:44 -0400 (EDT) Received: from localhost (tanuki [10.192.0.23]) by vm-mail.pks.im (OpenSMTPD) with ESMTPSA id cd7aad4e (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 30 Jul 2020 15:14:38 +0000 (UTC) Date: Thu, 30 Jul 2020 17:14:54 +0200 From: Patrick Steinhardt To: development@efficientek.com Cc: grub-devel@gnu.org, Daniel Kiper Subject: Re: [PATCH 05/17] luks: Add support for LUKS2 in (proc)/luks_script Message-ID: <20200730151454.GA39309@tanuki.pks.im> References: <9eab0e91e2287186914c0d187162673565af592d.1596056714.git.development@efficientek.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="vtzGhvizbBRQ85DL" Content-Disposition: inline In-Reply-To: <9eab0e91e2287186914c0d187162673565af592d.1596056714.git.development@efficientek.com> Received-SPF: pass client-ip=64.147.123.25; envelope-from=ps@pks.im; helo=wout2-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/30 11:14:46 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.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=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: Thu, 30 Jul 2020 15:14:51 -0000 --vtzGhvizbBRQ85DL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 29, 2020 at 04:50:10PM -0500, development@efficientek.com wrote: > From: Glenn Washburn >=20 > Signed-off-by: Glenn Washburn > --- > grub-core/disk/cryptodisk.c | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) >=20 > diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c > index c21be7d52..f6b6302e1 100644 > --- a/grub-core/disk/cryptodisk.c > +++ b/grub-core/disk/cryptodisk.c > @@ -1210,12 +1210,14 @@ luks_script_get (grub_size_t *sz) > *sz =3D 0; > =20 > for (i =3D cryptodisk_list; i !=3D NULL; i =3D i->next) > - if (grub_strcmp (i->modname, "luks") =3D=3D 0) > + if (grub_strncmp (i->modname, "luks", 4) =3D=3D 0) While it works, I think it's a bit too magical. I'd personally prefer to be a bit more verbose: if (grub_strcmp (i->modname, "luks") =3D=3D 0 || grub_strcmp (i->modname, "luks2") =3D=3D 0) { ... } > { > - size +=3D sizeof ("luks_mount "); > + size +=3D grub_strlen (i->modname); > + size +=3D sizeof ("_mount"); > size +=3D grub_strlen (i->uuid); > size +=3D grub_strlen (i->cipher->cipher->name); > - size +=3D 54; > + /* mode + mode_iv + spaces + offset + sector size + ??? + '\n' + NULL */ > + size +=3D 5 + 8 + 5 + 20 + 4 + 16 + 1 + 1; Is it expected that the `size` is now bigger than before? This adds up to `60` now. It's fine as it is more verbose than it previously has been, but a comment in the commit message explaining that the different size is intentional would've helped. > if (i->essiv_hash) > size +=3D grub_strlen (i->essiv_hash->name); > size +=3D i->keysize * 2; > @@ -1228,16 +1230,16 @@ luks_script_get (grub_size_t *sz) > ptr =3D ret; > =20 > for (i =3D cryptodisk_list; i !=3D NULL; i =3D i->next) > - if (grub_strcmp (i->modname, "luks") =3D=3D 0) > + if (grub_strncmp (i->modname, "luks", 4) =3D=3D 0) Same remark as above. > { > unsigned j; > const char *iptr; > - ptr =3D grub_stpcpy (ptr, "luks_mount "); > + ptr =3D grub_stpcpy (ptr, i->modname); > + ptr =3D grub_stpcpy (ptr, "_mount "); > ptr =3D grub_stpcpy (ptr, i->uuid); > *ptr++ =3D ' '; > - grub_snprintf (ptr, 21, "%" PRIuGRUB_UINT64_T " ", i->offset); > - while (*ptr) > - ptr++; > + ptr +=3D grub_snprintf (ptr, 21, "%" PRIuGRUB_UINT64_T " ", i->offset); > + ptr +=3D grub_snprintf (ptr, 6, "%d ", 1 << i->log_sector_size); > for (iptr =3D i->cipher->cipher->name; *iptr; iptr++) > *ptr++ =3D grub_tolower (*iptr); > switch (i->mode) > --=20 > 2.25.1 >=20 --vtzGhvizbBRQ85DL Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEF9hrgiFbCdvenl/rVbJhu7ckPpQFAl8i4+4ACgkQVbJhu7ck PpQE+w/5AW1ztBABuXtg5spCDBKTemrrTADYAvWVCM358nFL6I58FI9Kybz3GqXr +jV75P8WnUTUJqarCnzOE432Ohd+g51foJy1SGHD8mM1nzpSMFlO543odsGXsFbe A1fmAiM6Vyel9naclbPA9Xu+som7YlQuqfdVX7R6JLnxnUSjLwTAaWz++bYNonaY YJLsw5qu+zgEl7zptxkscmNa4Xa7vdeJ3pFZK+64TBIlrZ14Aex7uKsqdOdXygxR W0+cZzbJCrSbciqV2Qn0+Wu+j8mhP9UEdrYB94uyhcF8x1Vae3UZg9FmkEmtbCrK 6wDdfzQE4+g/Y0PXFYLrsTeZtet4EhFGfUveM5mCBS7Zz79WIeF4GYae0qXkokIM lWGYa3G7eLQq7x5ACTXc2M1/KqKDXJXzEsX02smGtZc/aLAJ5bRAkM8tqyIclzKj 55FExSOMQkFYEg19Mih3Vy7Af53JZGyukOakFqjrg/sEUUYLiXMjkBK0q75vB1aw RcwYUqBDJecB9d3EAcUjqrwpeSrBl5tPLgzowKOoAxmB8TRZw0WnqU/lv9TpHce/ bhu/1hHCe030Y4T0O9j5zMLzq4f7gqprdKadgGg0zCCJDgAhJ43GHw0mG1tE/ufH 34hQCID99GQIiy0RId3orjZRAgDw0FN9NZNxoxm2rwkPlyvfSFM= =+UVN -----END PGP SIGNATURE----- --vtzGhvizbBRQ85DL--