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 704F9C25B08 for ; Wed, 17 Aug 2022 18:54:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8276184A46; Wed, 17 Aug 2022 20:54:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="T1bMdGkN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D8D0784A44; Wed, 17 Aug 2022 20:54:02 +0200 (CEST) Received: from mail-yw1-x1134.google.com (mail-yw1-x1134.google.com [IPv6:2607:f8b0:4864:20::1134]) (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 8B77A84A46 for ; Wed, 17 Aug 2022 20:53:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-33387bf0c4aso150646177b3.11 for ; Wed, 17 Aug 2022 11:53:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=gOX366lQAuLaWnBPcDdkNJs95TVGGil7+MWwUxQX1n4=; b=T1bMdGkNEeJGRhcgi+U81A9c02XSjS2C7mkD/rEKW+NUl/10BoPbhHliQqLZT3EtQU IU6FfL9FTi/A5svAkxrEu4MeBfkok25uk/ILPavB/6Sl8tVtFgSB1L5/N4BTZ5QmF5We 5YFSy1G88xcERiyGsHffl4rbEZ5Z+2mt7cdMU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=gOX366lQAuLaWnBPcDdkNJs95TVGGil7+MWwUxQX1n4=; b=S2njXaF70p4Pti5b2nvmTI7HreTwD0sBofuKxGAkJRkhdf0t3lhpPaGirNNUluZU6I o2BgBR0PIXnOIpwied+jXzmrwuH3tlcOcSCerHuuVKD5bl0F1aRbcABD/H40DRkBVyQa TSz6hNyfWw7DOw5lbHHMr8G6TYMfqdrPcdzm10rDjEMdf8Q4NH3shrCPiteiSipDZHNa Mud8jWwYQna6yaZdl+crHVZa1HMItks4zhzsw7qzgJ23iHRM88eJ3hl+6YeCDGB/ZFTF /iYRazOQ2mlXc1ZNr1pNcWPMgcIuCDzNVu+uTDDdJuPW+59eI+5GXzRP6qOrSYRNXhFK 7lBg== X-Gm-Message-State: ACgBeo1crQgvHYYdXJNuiv2566oPc0PX/T2ZysQfudN6RFOd62fNhGQq Rzei8by1tiRQ7luftYEUM/1SMHn1THFA18YUrwHLNc5vMvH8mQ== X-Google-Smtp-Source: AA6agR7N6m7ZdMvky/uKIRZXG/V/OrmAMf+Kb2JfnoVhPr9zfhMJt0qu1BSM/KR7Hw4bdmE4WwXGuQZywVNzY0MvGlc= X-Received: by 2002:a5b:68c:0:b0:690:aa11:d7af with SMTP id j12-20020a5b068c000000b00690aa11d7afmr3447665ybq.253.1660762438879; Wed, 17 Aug 2022 11:53:58 -0700 (PDT) MIME-Version: 1.0 References: <20220813195639.1824765-1-sjg@chromium.org> <20220813195639.1824765-3-sjg@chromium.org> In-Reply-To: From: Simon Glass Date: Wed, 17 Aug 2022 12:53:47 -0600 Message-ID: Subject: Re: [PATCH v2 2/7] tpm: Correct the permissions command in TPMv1 To: Ilias Apalodimas Cc: U-Boot Mailing List , Mathew McBride Content-Type: text/plain; charset="UTF-8" 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.6 at phobos.denx.de X-Virus-Status: Clean Hi Ilias, On Tue, 16 Aug 2022 at 07:59, Ilias Apalodimas wrote: > > Hi Simon > > On Sat, 13 Aug 2022 at 22:56, Simon Glass wrote: > > > > The offset here is incorrect. Fix it. > > Since we got it wrong the first time, any chance you can give me a > link to the spec describing these offsets (both for this and the > subsequent patch) Yes I have been using this document: TPM Main Part 3 Commands Specification Version 1.2 Level 2 Revision 116 1 March 2011 TCG Published (TPM_ORD_GetCapability) Regards, Simon > > Thanks > /Ilias > > > > Signed-off-by: Simon Glass > > --- > > > > (no changes since v1) > > > > 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 22a769c5874..d0e3ab1b21d 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; > > 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.37.1.595.g718a3a8f04-goog > >