Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2907174lqo; Tue, 21 May 2024 00:14:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXNqgMRwisDu296dhJF6Exwxne5htJN8GAJVGhO2c3He2+3Ca0R57MpdhEefL/+e671ON0LIom1bAMKkAMcVNxAg9zZ66n7biXkEaXB2w== X-Google-Smtp-Source: AGHT+IHACMVkbC8PD9E8R1GwxaT97OSeJjs3B9V3Ho/lQbk7BtQa1J8xoQTC29q8l2Mkl1Z/E2Yl X-Received: by 2002:a92:c56a:0:b0:36d:b851:c529 with SMTP id e9e14a558f8ab-36db851c717mr206683925ab.2.1716275649711; Tue, 21 May 2024 00:14:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716275649; cv=pass; d=google.com; s=arc-20160816; b=Uf4LO3/oO0dnHefiqXVv2XVlD+IFrohA3wZ6zCOP72Yq6bNYo9phYmPw3UWqrYaIrk lcKbmLUQr53z6ticwFO6WdL9Xj7HJ0v8S7GwHQ/BF3sSeqc9xGqLdpdNvIUJDdMSJP3Z Y98HAQQGgsG2VVmQrv//8b0DcCUa4UBwhFEi6FkIFXFySYktal19dToZ+Q6fVu5TjqRC FerpYJv+3UautYxWRZT/9oRq2qpcSOha6OMEDm6YYdjQ0xIV4pQ5OhCJ7q87OjVDTJ6v VwHijCLvopI18QHxhZlmw7UYnwvnBHNGQJKyR0pLZHjf296EYyJPwmcrehvrq4O1ntOR BkcA== 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=JQLtWrCexKO8y8ukF+vbWmg1WGz/4ql7TnqkWdxz+0I=; fh=5XhCyutG6PrPSmYofLSYSpwVDcQfEOhxOXeKC7rJWwI=; b=GmuK/JK7PpbVP98HpPy5Hd3KOB9d2zRefCxMfDJp/3rWlcEJwurxaPaFDk+1fO90o1 qx3mHD59LCi1D+zFxVCgiUr3gvifYh3yS9FrgkNfKN2ooRIgmU1gKGewQ16FhMGHBYwn idiegbxZh+htGt5zVDdTmzb2wbZkqPSegak8ZQlfgfk3NnWIGUny4w2ItZOGPmGevHvz 7tgizoYrCgC8QX8xeZk2W8OmOOUZnWGI4KNd8UM7lGDCdttexgFIUMUJan3fAHDnPo2l CYdnCmXETGMO1XqyP5mDWtILzlrhuTq7IXWvPj598wGx7xcd1ojSmSWHrsen7nBLYOGH 3c2w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=roUriWhA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4296-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4296-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f4d2a72786si23580479b3a.21.2024.05.21.00.14.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:14:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4296-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=roUriWhA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4296-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4296-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 54E3C281F08 for ; Tue, 21 May 2024 07:14:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 593194D5BF; Tue, 21 May 2024 07:14:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="roUriWhA" 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 06B3E4B5CD; Tue, 21 May 2024 07:14:02 +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=1716275643; cv=none; b=onrg7oI5seM80nlps25LsOQ+KD5cWbNCcPjWZbK51rq/6wS/7MsnlDRS51iB+PTjwejcAAyIbrpxMkPeZH0boZlkUu539fw/BHY+Idpx/+vQiZhQYdBZq4mUGDKPHZ/cqNV8MdK8NYye/RQ4hnbAp1AyWVrTK36zfGsxW623SE8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716275643; c=relaxed/simple; bh=GBp6YlGoBVoT9sV+NoIDXHp6U9g6yyUiX/O/7sbq4K4=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=DKDs0rdp71awPacf8sZKWg9qUsEJaaYnlReTuOzpVyjdQkzTZ8klhIuqj3uYEN6vVnEtNqnwvrG6SY9B8evp/5tQvUVcKpqiCiXUYOgD1xY0dvETCKcbz8p4ulCpifJIyF0skHq4PyqtpQEVA9RjMKZUl/eq2kv/lI4MHKf/jQk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=roUriWhA; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 763BBC2BD11; Tue, 21 May 2024 07:13:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716275642; bh=GBp6YlGoBVoT9sV+NoIDXHp6U9g6yyUiX/O/7sbq4K4=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=roUriWhAqPsmDa786hb8CpeIX0pzbH45YDWNFSKt+Ta85xrCQDfOtMnEW5uYLi5Q2 eTMFltKqN/Sw1ZVWzxe442fHdgRwvK6zbFkUZIvmedNniU5jS64y2K7Mryesxf5F95 CaRZz2m8js1GUUzrev2NpA+4oXNtxMXz6OKwJLqkfRAzNK77KiUnnXFBN/9JvNZ+K4 R58O9A3IrbkFN28uzd9bz+B2vMZpOhuPRceC9O6kqnV6tivZ6g+IOM9AEpnyKd6Mh7 pInvTPEr1XsNrnzLuGN6CPOEeIRenIYIAmzN9ExjgkYn8SvhPO5Ngx1WqihcvUheHn gbT8zpqlgnrAw== 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: Tue, 21 May 2024 10:13:56 +0300 Message-Id: Cc: "linux-integrity@vger.kernel.org" , "keyrings@vger.kernel.org" , "Andreas.Fuchs@infineon.com" , "James Prestwood" , "David Woodhouse" , "Eric Biggers" , "James Bottomley" , "David S. Miller" , "open list:CRYPTO API" , "open list" , "Peter Huewe" , "Jason Gunthorpe" , "James Bottomley" , "Mimi Zohar" , "David Howells" , "Paul Moore" , "James Morris" , "Serge E. Hallyn" , "open list:SECURITY SUBSYSTEM" Subject: Re: [EXTERNAL] [PATCH v2 5/6] tpm: tpm2_key: Extend parser to TPM_LoadableKey From: "Jarkko Sakkinen" To: "Bharat Bhushan" , "Herbert Xu" X-Mailer: aerc 0.17.0 References: <20240521031645.17008-1-jarkko@kernel.org> <20240521031645.17008-6-jarkko@kernel.org> In-Reply-To: < On Tue May 21, 2024 at 8:47 AM EEST, Bharat Bhushan wrote: > > > > -----Original Message----- > > From: Jarkko Sakkinen > > Sent: Tuesday, May 21, 2024 8:47 AM > > To: Herbert Xu > > Cc: linux-integrity@vger.kernel.org; keyrings@vger.kernel.org; > > Andreas.Fuchs@infineon.com; James Prestwood ; > > David Woodhouse ; Eric Biggers > > ; James Bottomley > > ; Jarkko Sakkinen > > ; David S. Miller ; open > > list:CRYPTO API ; open list > kernel@vger.kernel.org>; Peter Huewe ; Jason > > Gunthorpe ; James Bottomley > > ; Mimi Zohar > > ; David Howells ; Paul Moore > > ; James Morris ; Serge E. Hally= n > > ; open list:SECURITY SUBSYSTEM > module@vger.kernel.org> > > Subject: [EXTERNAL] [PATCH v2 5/6] tpm: tpm2_key: Extend parser to > > TPM_LoadableKey > >=20 > > ---------------------------------------------------------------------- > > Extend parser to TPM_LoadableKey. Add field for oid to struct tpm2_key > > so that callers can differentiate different key types. > >=20 > > Signed-off-by: Jarkko Sakkinen > > --- > > drivers/char/tpm/tpm2_key.c | 14 +++++++++++--- > > include/crypto/tpm2_key.h | 2 ++ > > security/keys/trusted-keys/trusted_tpm2.c | 4 ++++ > > 3 files changed, 17 insertions(+), 3 deletions(-) > >=20 > > diff --git a/drivers/char/tpm/tpm2_key.c b/drivers/char/tpm/tpm2_key.c > > index 0112362e432e..59797dc232f1 100644 > > --- a/drivers/char/tpm/tpm2_key.c > > +++ b/drivers/char/tpm/tpm2_key.c > > @@ -32,16 +32,24 @@ int tpm2_key_type(void *context, size_t hdrlen, > > const void *value, size_t vlen) > > { > > enum OID oid =3D look_up_OID(value, vlen); > > - > > - if (oid !=3D OID_TPMSealedData) { > > + struct tpm2_key *key =3D context; > > + > > + switch (oid) { > > + case OID_TPMSealedData: > > + pr_info("TPMSealedData\n"); > > + break; > > + case OID_TPMLoadableKey: > > + pr_info("TPMLodableKey\n"); These should be pr_debug() (forgot to change). > > + break; > > + default: > > char buffer[50]; > > - > > sprint_oid(value, vlen, buffer, sizeof(buffer)); > > pr_debug("OID is \"%s\" which is not TPMSealedData\n", > > buffer); > > Maybe extend this print to say "neither TPMSealedData nor TPMLodableKey" Right, I tried to apply minimal delta to patches where existing code needs to be carved to a new form :-) I think it could be just "OID \"%s\" is unknown"? BR, Jarkko