TrouSerS expects a bitmask field length of at least 3 bytes
authorSansar Choinyambuu <schoinya@hsr.ch>
Sun, 18 Dec 2011 17:36:36 +0000 (18:36 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Sun, 18 Dec 2011 17:36:36 +0000 (18:36 +0100)
src/libpts/pts/pts.c

index 2f13ffc..6469f7c 100644 (file)
@@ -1155,7 +1155,11 @@ METHOD(pts_t, get_quote_info, bool,
                return FALSE;
        }
        
-       size_of_select = 1 + this->pcr_max / 8; 
+       /**
+        * A TPM v1.2 has 24 PCR Registers
+        * so the bitmask field length used by TrouSerS is at least 3 bytes
+        */
+       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);