Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp452971imu; Tue, 27 Nov 2018 15:14:37 -0800 (PST) X-Google-Smtp-Source: AFSGD/V8ySP/kHRLVMxYT7HGKHlHjMBt5d1LLbfvx5nQV5btgOwcumkRc4AB10+W4cDsqr71BaH7 X-Received: by 2002:a63:344e:: with SMTP id b75mr29948838pga.184.1543360477875; Tue, 27 Nov 2018 15:14:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543360477; cv=none; d=google.com; s=arc-20160816; b=FvyuRU2VszgUf4sMzV8egPhVjqEfAOIUvnn0xb3GFwwNURGGkl20Kaj/XHEb/Uzeyj Qabm6pvefIPb/rHfSCqJ63JUFmznyVFDcGzK8icx+0MNvyMU/1hlNiPiFjvCj0GISu9r ST0gV/ieVHAR26NQxlRWiPLoufjq1utPqgu+MQUpMgTZceq0pCPNA7d6tfo88GMR7aJX v3CfRiMWB6Yq4oryJ13pScMPg4cqmBojbeWCXBrmjQIHNBvRPSDiOGQNg+eZ8TAC8esI uKaIaKWr8tXKYo8MxiR9dNoONiQb+fv64+2Nh1du8dJSIc+AvzGFT1pYWOD9gzUVGg/P M2KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:to :from:date; bh=+QEU7Qn4wjdruJ32eHOa7/6MKrygIoPVG49s/QoJ/YI=; b=V+6XGeFUrr9GmUhhLfrPKSEK1fKubR+u6hY31a3Lo8GSrxOcqTOb0Erc/y2cvvc8t/ q/QIFS5BP3XMR6XF5l+iOhVRIqFYwK3W/3o2GqUeqzPUgRbBwq8pj6tEQh1EUtDVc7KQ fIDyzmoA/OwK2r8cohQak+KPeD6JxTWsjsxLJP1xpqZQiVaqVOU0PlIEfTaQDiLJDW9I sCam/7hWlcpJqNHIYXqlBUIhw/cpMge0NDsosuphHO6wMCEA1K9idMhn7JmJV5cLFFhQ DHYR2wEcSiruz23YrQVzIIS50DO56mH5jTl0V3cfmFIFqpAWE8edI0dnFw4kDVDmfDiS /sjw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u129-v6si5445398pfb.201.2018.11.27.15.14.22; Tue, 27 Nov 2018 15:14:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726570AbeK1KNR (ORCPT + 99 others); Wed, 28 Nov 2018 05:13:17 -0500 Received: from mga05.intel.com ([192.55.52.43]:21205 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726299AbeK1KNR (ORCPT ); Wed, 28 Nov 2018 05:13:17 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Nov 2018 15:13:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,288,1539673200"; d="scan'208";a="93162206" Received: from jsakkine-mobl1.jf.intel.com (HELO localhost) ([10.24.8.96]) by orsmga007.jf.intel.com with ESMTP; 27 Nov 2018 15:13:48 -0800 Date: Tue, 27 Nov 2018 15:13:48 -0800 From: Jarkko Sakkinen To: Joey Pabalinas , linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, Tadeusz Struk , Shuah Khan , open list , "open list:KERNEL SELFTEST FRAMEWORK" Subject: Re: [PATCH] selftests: add TPM 2.0 tests Message-ID: <20181127231348.GB26051@linux.intel.com> References: <20181127221059.25966-1-jarkko.sakkinen@linux.intel.com> <20181127224900.fpbqujcsqwgxpwyq@gmail.com> <20181127225307.3wc3gd7zmfauie6i@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181127225307.3wc3gd7zmfauie6i@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 27, 2018 at 12:53:07PM -1000, Joey Pabalinas wrote: > On Tue, Nov 27, 2018 at 12:49:00PM -1000, Joey Pabalinas wrote: > > > + def start_auth_session(self, session_type, name_alg = TPM2_ALG_SHA1): > > > + fmt = '>HII IIH16sHBHH' > > > + cmd = struct.pack(fmt, > > > + TPM2_ST_NO_SESSIONS, > > > + struct.calcsize(fmt), > > > + TPM2_CC_START_AUTH_SESSION, > > > + TPM2_RH_NULL, > > > + TPM2_RH_NULL, > > > + 16, > > > + '\0' * 16, > > > + 0, > > > + session_type, > > > + TPM2_ALG_NULL, > > > + name_alg) > > > + > > > + return struct.unpack('>I', self.send_cmd(cmd)[10:14])[0] > > > + > > > + def __calc_pcr_digest(self, pcrs, bank_alg = TPM2_ALG_SHA1, > > > + digest_alg = TPM2_ALG_SHA1): > > > + x = [] > > > > Is there a reason for using `'\0' * 16` there instead of just 0? > > Nevermind, I keep forgetting that the * operator on strings performs > repetition. I've been programming too much C lately, it seems. > > Acked-By: Joey Pabalinas Thank you! Would be good to have these merged to the kernel tree so that one can include both functionality and test case when needed to the patch set. /Jarkko