From: Sansar Choinyambuu Date: Wed, 7 Dec 2011 12:28:59 +0000 (+0100) Subject: PCR selection bitmask is 3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=53a50792a2211bd1333d52042f09f039e4b2e00e;p=thirdparty%2Fstrongswan.git PCR selection bitmask is 3 --- diff --git a/src/libpts/pts/pts.c b/src/libpts/pts/pts.c index dbd66be0d6..269e3bd458 100644 --- a/src/libpts/pts/pts.c +++ b/src/libpts/pts/pts.c @@ -956,7 +956,7 @@ METHOD(pts_t, quote_tpm, bool, { i++; f = 1; - } + } if (this->pcr_select[i] & f) { result = use_quote2 ? @@ -1154,8 +1154,9 @@ METHOD(pts_t, get_quote_info, bool, "unable to construct TPM Quote Info2"); return FALSE; } - - size_of_select = 1 + this->pcr_max / 8; + + /* TPM v1.2 24 PCR Registers, so bitmask field lenght is 3 */ + size_of_select = max(PCR_MAX_NUM / 8, 1 + this->pcr_max / 8); pcr_comp_len = 2 + size_of_select + 4 + this->pcr_count * this->pcr_len; writer = bio_writer_create(pcr_comp_len);