Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp410532lqb; Tue, 4 Jun 2024 15:33:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUWpJGLDRsZaQU5CiJSKO+LqXQIwtWIeyJt4rqSraISS6G6RvaQvjRMlOxD/4gC1eCCL/+qOKZdhQV8SaPsE8ThmUxZByIyw7gy/2o43w== X-Google-Smtp-Source: AGHT+IHG/KCiIqB40zHQIRVTrkWGxoZneVvGfBMhGgTn7sSSdWAHG5fIXhi7OAJeNK0LxXu35wnf X-Received: by 2002:a17:902:d2c5:b0:1f6:782e:da40 with SMTP id d9443c01a7336-1f6a5a838e2mr10325885ad.62.1717540424508; Tue, 04 Jun 2024 15:33:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717540424; cv=pass; d=google.com; s=arc-20160816; b=gc46KEbSCvi4xjaEJ2ttRFGYWiBiRuG/6hTtQ+jtUeH7DwVoiY/L0oZWXxuCZkNZBW JCT/PRIDiRdQp3Skob8OtNDMhnKyH7rTUFWxRX4lk01fXiI3uNTxYpJzNK9SQrqAZkPp 7b+lc1yMs0aLXjR7YuEb9c+82dT2XAsRVgbSrITF7AC8vPHHZic6/fM9EchqL/cnYuGS Kms+olBzSNc9GvkHlsLmKMflue/MsTf1UnBfDe+hGxULRgSWmipH6tgIi8G7iC4AmhZI 3Zqz37UjpOvVASlHB3TY2jvEkBDbbUrsdYV1uSXpfUBKsjp9/C98RGBmH/gq3UIRt0md GzUA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=0sfLIeZxViER4o+8MEbHOA0TOKGqdaio8UveuqNI3YM=; fh=1WI8ZAptLdQqet3jYr6RmFCy2UkBrJft5QkkXD+V39s=; b=gUOQqfdq0QEseH9yyokGbeKTwulD5o9THTDI9Dwo0lWzosIddbXw46jE7MBosQrCe2 jjDME173OnrLhfbkf5U1LPdL8ub+GJzqckwQRTWAZTYy47wVM0CM0kiuNuhG2ETdsxxs +aLhkvTAr8K3z9InN3b5ZuCBdGw0Ts/SVOC7CibYu46+ICFZZiFUNKM53iHA42kWzXQt nURcqNFLmRoyog1kfQYJsBwWG0YvnC3Pa7UZx3wE584TJ6CXLthVkJtV4OqABD8uxzxY BPEa4F7ZHoG6z+9RNA6O1GV6+mKR6TVvY71ivc/F31wHFJfdmjd9RsaugbZr8WR8IDEa I06Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="G/nfl/5c"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4735-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4735-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f66451d69bsi56023135ad.526.2024.06.04.15.33.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 15:33:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4735-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="G/nfl/5c"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4735-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4735-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 26A2728662A for ; Tue, 4 Jun 2024 22:33:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D8EC214830E; Tue, 4 Jun 2024 22:33:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="G/nfl/5c" X-Original-To: linux-crypto@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8341A28DC7; Tue, 4 Jun 2024 22:33:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717540418; cv=none; b=DfyDTsi0Ae7lRUVb8UPmYBZlqJ4N+2jWRYGTEcYory4V/6DW93mZVPOrVeUBdY9AodqHMkEz1PohM7hLzP17tF/NDM+5OueDnOp1YyH8SX18MJMMk5iWPkIkOo6mx6iYniunVpp3yZMFYSba2nOncHb34R4IWa4+uM3MQ1DWScM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717540418; c=relaxed/simple; bh=vKk54H5hajLqoyQvgP+yXe9n5V6epR2sgSb7GL/pKD0=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=JhbobHZ4nsJ+vulHff510SYYrkLuQuRNhPdmxR5BeWa9z+ZrYL6081UVOQVOPl4/QWHG76+fTwj4DbsnswDRk8rAzn+OwO8f6k+Yf1LqBS76EdX5a4pT5jmGyRKJ0BjHJHO0fbcBKyxoGs/6BR43uSI70iBqPm1TPO4jSBDqA0Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=G/nfl/5c; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AD4AC3277B; Tue, 4 Jun 2024 22:33:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717540417; bh=vKk54H5hajLqoyQvgP+yXe9n5V6epR2sgSb7GL/pKD0=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=G/nfl/5cR0PwMZa8J22uWo0KSFIzBt74P8cN/OEhgB/00aKhX9xMV9qd8jZhHm//G teAehz1lQgqYECpI7jnVW/ck4etFZDkML6JfvX0Py2zN5rt8amp2VC1/cG5MGHCGlq 2hojjdMPUs+seAOX6ZZvyAKv+vOXSbj+WIOqZ10Uhf4PWrzmnTGr+7KvmoPvcDdxqV 7AxsIxMbgqtXMSNHPZ5mlHYXIYYPAtvp8uPjBjmTgZl6P7gMDUPHztTT4BJmgasNko KEBdo7wgfp6PWKv/P3yqQ6I3UyhVdjviylkfGi4XEzuMxN+BqIisBrKAVC7rOpnDwD /6PeY1X9SDS5A== Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 05 Jun 2024 01:33:32 +0300 Message-Id: Cc: , , , "James Prestwood" , "David Woodhouse" , "Eric Biggers" , "James Bottomley" , , "Lennart Poettering" , "David S. Miller" , "open list" , "Mimi Zohar" , "David Howells" , "Paul Moore" , "James Morris" , "Serge E. Hallyn" , "open list:SECURITY SUBSYSTEM" Subject: Re: [PATCH v7 3/5] crypto: tpm2_key: Introduce a TPM2 key type From: "Jarkko Sakkinen" To: "Stefan Berger" , "Herbert Xu" X-Mailer: aerc 0.17.0 References: <20240528210823.28798-1-jarkko@kernel.org> <20240528210823.28798-4-jarkko@kernel.org> <97dd7485-51bf-4e47-83ab-957710fc2182@linux.ibm.com> <6f0e04c2-4602-4407-9af5-f72610021a6a@linux.ibm.com> In-Reply-To: <6f0e04c2-4602-4407-9af5-f72610021a6a@linux.ibm.com> On Tue Jun 4, 2024 at 9:41 PM EEST, Stefan Berger wrote: > > > On 6/4/24 13:23, Jarkko Sakkinen wrote: > > On Fri May 31, 2024 at 3:35 AM EEST, Stefan Berger wrote: > >> > > >>> =20 > >>> - rc =3D tpm2_key_decode(payload, options, &blob); > >>> - if (rc) { > >>> - /* old form */ > >>> + key =3D tpm2_key_decode(payload->blob, payload->blob_len); > >>> + if (IS_ERR(key)) { > >>> + /* Get the error code and reset the pointer to the key: */ > >>> + rc =3D PTR_ERR(key); > >>> + key =3D NULL; > >>> + > >>> + if (rc =3D=3D -ENOMEM) > >>> + return -ENOMEM; > >>> + > >>> + /* A sanity check, as only -EBADMSG or -ENOMEM are expected: */ > >>> + if (rc !=3D -EBADMSG) > >>> + pr_err("tpm2_key_decode(): spurious error code %d\n", rc); > >> > >> tpm2_key_decode seems simple enough that it only returns key, -ENOMEM = or > >> EBADMSG. > >=20 > > So what is your suggestion here? > > You can remove the check resuling in pr_err(). OK, I think so too. Just had to (sanity) check. > > >=20 > > The reasoning here is that asymmetric keys use -EBADMSG not only as > > error but also iterator, when probing which can load a specific key. > >=20 BR, Jarkko