From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B8C0AC43334 for ; Tue, 7 Jun 2022 08:44:43 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2F99384301; Tue, 7 Jun 2022 10:44:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="UNghfOcv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 20510842A6; Tue, 7 Jun 2022 10:44:31 +0200 (CEST) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 58B25842F8 for ; Tue, 7 Jun 2022 10:44:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wr1-x42a.google.com with SMTP id m26so11676660wrb.4 for ; Tue, 07 Jun 2022 01:44:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ZPurS+BMmTuv/24T1tW40niK+gg0z2F3GlYtCx2BYFI=; b=UNghfOcvTnDbvlShAuyrwbk9SVYtSwxtqaLu4jucB/zMErtOMSsbPUOaMih8xvGJMA o7yHdABatU8PnpeKyepfneiy49HjbPEP1qsdKiFanwJwr0a98Otg4SIq6WvgEkOkFteZ h84VHnP/5iL0Zko7ngY5m7zlZusvzODmpxQ7v8shs9s/aEAs62PzkOdgMrSSGHJ/qYYp dXY+O2xVtNzrg+9PnCjtod4JNb6jtG7lI+S0DxLLR46Y4o+hUxNm3JgIsyb8lKZxFByH F5gX2Mk9v7PrYlJaz0EyAEUSbd7s/gl+DoAUVNE85ML5XkljEgWBVl3+jkfEGgcRkQgW oMyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ZPurS+BMmTuv/24T1tW40niK+gg0z2F3GlYtCx2BYFI=; b=zi9AmdPfwGP1Rxctr6uYuHnGIRoU3z+B8KCrZe8gDGDRolL5L1besnEcxjQL4f2INo kye/PXZyIW+N7j01/QQtKSWElWtWNOhIsZbCgAUzmFypEKv94ALeQeEcOM7Hin5/paZQ l2GKYTOZvOMQVZm645Z2Qe/Obn8i/01zCyanCBMraXPcHF3jaLER7odbHWSGayObYkf7 4skDJISDLZUbHM524abINS3/MAYDeMekkVEZVmlMR/mnUjUCf6jMgwfRAFQ7yWsWDoxa SqIx3/jZffWxwFn20aHet2tHn7HO1r1Z8l6XPkF8LS1fh6U1QdrPPpQm5rme2BqmIl81 1Y1A== X-Gm-Message-State: AOAM533sIZUMzXJG/30SDwVPMPZKAFSJyIr8xYGunHW/HgeABD6eUsRS LQQvIrc5PjbFwvqjwmxxrayZu3UtpW5T1g== X-Google-Smtp-Source: ABdhPJydAAWjTuseXNSFd5T4nh/9LzKENA7vNSZAY7sCvvYJbc/2/VJIAcx+C/WSYMfacxIyEAIoqQ== X-Received: by 2002:a05:6000:1819:b0:210:2eb7:559f with SMTP id m25-20020a056000181900b002102eb7559fmr25852281wrh.386.1654591467803; Tue, 07 Jun 2022 01:44:27 -0700 (PDT) Received: from hera (ppp089210241233.access.hol.gr. [89.210.241.233]) by smtp.gmail.com with ESMTPSA id h1-20020a5d6e01000000b0020d03c14b9csm17394125wrz.1.2022.06.07.01.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 01:44:27 -0700 (PDT) Date: Tue, 7 Jun 2022 11:44:24 +0300 From: Ilias Apalodimas To: Simon Glass Cc: U-Boot Mailing List Subject: Re: [PATCH 3/8] tpm: Correct the permissions command in TPMv1 Message-ID: References: <20220301001125.1554442-1-sjg@chromium.org> <20220301001125.1554442-4-sjg@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220301001125.1554442-4-sjg@chromium.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Hi Simon, On Mon, Feb 28, 2022 at 05:11:20PM -0700, Simon Glass wrote: > The offset here is incorrect. Fix it. > > Signed-off-by: Simon Glass > --- > > lib/tpm-v1.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/lib/tpm-v1.c b/lib/tpm-v1.c > index 22a769c587..d0e3ab1b21 100644 > --- a/lib/tpm-v1.c > +++ b/lib/tpm-v1.c > @@ -456,12 +456,13 @@ u32 tpm1_get_permissions(struct udevice *dev, u32 index, u32 *perm) > 0x0, 0x0, 0x0, 0x4, > }; > const size_t index_offset = 18; > - const size_t perm_offset = 60; > + const size_t perm_offset = 74; This is fine, but I hate all these magic values sprinkled around the TPM APIs. Starting with this patch can we do the right thing and at lease have those in a #define with a names that makes some sense? > u8 buf[COMMAND_BUFFER_SIZE], response[COMMAND_BUFFER_SIZE]; > size_t response_length = sizeof(response); > u32 err; > > - if (pack_byte_string(buf, sizeof(buf), "d", 0, command, sizeof(command), > + if (pack_byte_string(buf, sizeof(buf), "sd", > + 0, command, sizeof(command), > index_offset, index)) > return TPM_LIB_ERROR; > err = tpm_sendrecv_command(dev, buf, response, &response_length); > -- > 2.35.1.574.g5d30c73bfb-goog > Thanks /Ilias