linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Joey Pabalinas <joeypabalinas@gmail.com>,
	linux-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	Tadeusz Struk <tadeusz.struk@intel.com>,
	Shuah Khan <shuah@kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH] selftests: add TPM 2.0 tests
Date: Tue, 27 Nov 2018 15:13:48 -0800	[thread overview]
Message-ID: <20181127231348.GB26051@linux.intel.com> (raw)
In-Reply-To: <20181127225307.3wc3gd7zmfauie6i@gmail.com>

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 <joeypabalinas@gmail.com>

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

  reply	other threads:[~2018-11-27 23:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-27 22:10 [PATCH] selftests: add TPM 2.0 tests Jarkko Sakkinen
2018-11-27 22:13 ` Jarkko Sakkinen
2018-11-27 22:34 ` Tadeusz Struk
2018-11-27 23:15   ` Jarkko Sakkinen
2018-11-27 22:49 ` Joey Pabalinas
2018-11-27 22:53   ` Joey Pabalinas
2018-11-27 23:13     ` Jarkko Sakkinen [this message]
2018-12-05  0:33       ` Jarkko Sakkinen
2019-01-04 21:09         ` Jarkko Sakkinen
2019-02-01 17:50 Jarkko Sakkinen
2019-02-03 22:26 ` Petr Vorel
2019-02-04 12:01   ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181127231348.GB26051@linux.intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=joeypabalinas@gmail.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=tadeusz.struk@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).