From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968629AbdEXITm (ORCPT ); Wed, 24 May 2017 04:19:42 -0400 Received: from lhrrgout.huawei.com ([194.213.3.17]:27545 "EHLO lhrrgout.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966899AbdEXITO (ORCPT ); Wed, 24 May 2017 04:19:14 -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> <42b629dd-0d1f-b066-03e4-c013d0891ba7@huawei.com> <4b536b04-0e61-aea4-fc27-8dd12f2e3a1b@linux.vnet.ibm.com> <3b204e09-c1c0-b3bc-90fe-a8dfb86baadc@huawei.com> <08bd9fcb-d3ba-e76e-928e-f569e8a4be74@linux.vnet.ibm.com> CC: , From: Roberto Sassu Message-ID: Date: Wed, 24 May 2017 10:18:46 +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: <08bd9fcb-d3ba-e76e-928e-f569e8a4be74@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.0A020205.592541F0.019D,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: 48f15ed68de5230bfa06af1e9ae82dbc Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/23/2017 10:48 PM, Ken Goldman wrote: > On 5/18/2017 5:38 AM, Roberto Sassu wrote: >> On 5/17/2017 6:28 PM, Ken Goldman wrote: >>> On 5/17/2017 3:25 AM, Roberto Sassu wrote: >>>> >>>> The format of digestN is: :\0, the same used >>>> for the file digest. >>> >>> Since the format is changing from the SHA-1 log format anyway ... >>> >>> How do people feel about the colon and null terminated string format for >>> algorithm identifiers? >>> >>> The TCG standard enumerations are uint16_t, and there is a registry of >>> hash algorithms. >>> >>> As a consuming parser, it feels nice to know it's always 2 bytes and not >>> have to worry about a missing colon or a missing nul terminator risking >>> a buffer overflow. >> >> There cannot be buffer overflow, because the length of each digest >> field is known. >> >> Roberto >> > > I was not referring to the digest, but the digest algorithm. > > I wanted opinions on the colon and null terminated string format for > algorithm identifiers. > > The TCG standard log uses the TCG standard enumerations. They're always > exactly 2 bytes. Parsing is trivial. I have two concerns regarding this: is there a standard way to convert TPM_ALG_ to strings, like a function exposed by the TSS? If not, suppose that a parser uses openssl to verify the integrity of event data, by calculating the digest. Then, the parser should maintain an association table between TPM_ALG_ and a string (the string will be passed to EVP_get_digestbyname()). When a new TPM algorithm is added to the TCG registry, all parsers should be modified to update the association table. If IMA sends a string, only the crypto subsystem has to be updated. The format I'm proposing for event data digests would be the same of that used for file digests. Should IMA provide a list with two different formats? Roberto > If IMA uses strings, the attacker can send, e.g., sha1: and not null > terminate it. A careful parser can go a byte at a time until it reaches > a maximum length - if you specify a maximum length. But it is an attack > surface. Is there a corresponding advantage? > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Linux-ima-devel mailing list > Linux-ima-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linux-ima-devel >