From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752596AbdEQHZb (ORCPT ); Wed, 17 May 2017 03:25:31 -0400 Received: from lhrrgout.huawei.com ([194.213.3.17]:26654 "EHLO lhrrgout.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752217AbdEQHZ3 (ORCPT ); Wed, 17 May 2017 03:25:29 -0400 Subject: Re: [Linux-ima-devel] [PATCH 0/7] IMA: new parser for ima_restore_measurement_list() To: Ken Goldman , References: <20170516125347.10574-1-roberto.sassu@huawei.com> <4f5bc289-92cb-1ce2-4496-387efbb11769@linux.vnet.ibm.com> CC: , From: Roberto Sassu Message-ID: <42b629dd-0d1f-b066-03e4-c013d0891ba7@huawei.com> Date: Wed, 17 May 2017 09:25:05 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <4f5bc289-92cb-1ce2-4496-387efbb11769@linux.vnet.ibm.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.220.96.113] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.591BFADB.00B9,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 6abf97a76eba173f1d63697363d9aa4d Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/16/2017 9:00 PM, Ken Goldman wrote: > On 5/16/2017 8:53 AM, Roberto Sassu wrote: >> A new IMA measurement list format, called Crypto Agile, will be introduced >> shortly to take full advantage of the algorithm flexibility of TPM 2.0. >> With the new format, it will be possible to provide for each list entry >> multiple digests, each calculated with an algorithm supported by the TPM. >> Those digests will be used by remote entities to verify the integrity of >> the measurements list. >> >> The current (SHA1) and the new (Crypto Agile) format definitions are: >> >> SHA1: pcr[4] digest[20] >> template_name_len[4] template_name[template_name_len] >> template_data_len[4] template_data[template_data_len] >> >> Crypto Agile: pcr[4] total_digest_len[4] >> digest1_len[4] digest1[digest1_len] ... >> digestN_len[4] digestN[digestN_len] >> template_name_len[4] template_name[template_name_len] >> template_data_len[4] template_data[template_data_len] > > 1 - In this proposed format, how does the parser or consumer of the log > know what algorithm is used for digestN. The format of digestN is: :\0, the same used for the file digest. > For example, the TCG standard format uses TPML_DIGEST_VALUES > uint32_t count - the number of digests TPMT_HA > TPMT_HA digests[] > > where a TPMT_HA is > algorithm identifier > digest byte array > > 2 - Not a criticism, just a question for understanding ... Would it be > true that the total_digest_length == the sum of all the digestN_len > values plus 4 bytes for each length. Yes. > Does it determine how many digests there are by when the total length is > consumed? Yes. Since the number of digests is unknown until the buffer is parsed, the parser consumes the data until the buffer end is reached. Then, it returns the number of digests to the caller. Roberto