lkml.org 
[lkml]   [2018]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] selftests: add TPM 2.0 tests
    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>

    --
    Cheers,
    Joey Pabalinas
    [unhandled content-type:application/pgp-signature]
    \
     
     \ /
      Last update: 2018-11-27 23:53    [W:2.682 / U:0.272 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site