From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1m9U0C-0004ZV-MQ for mharc-grub-devel@gnu.org; Fri, 30 Jul 2021 11:00:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48338) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9U0B-0004Xy-3C for grub-devel@gnu.org; Fri, 30 Jul 2021 11:00:43 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:29536) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9U07-00063N-RG for grub-devel@gnu.org; Fri, 30 Jul 2021 11:00:42 -0400 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16UEYHo7103061; Fri, 30 Jul 2021 11:00:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=hbRto11i0pKgMXYvdB7dg/vkvFmGUyANNW6CiqCQPOQ=; b=BxajvaadnfilcQbZRJxbvLZChlhOqBYXV0ho3W7KCgRIDFPFqsWgmPfdIABiv28hiEQk NIYd/HBn4YJYxjOKpO/qSKLnP5jm7YzkXL8sebWAJ4AT0VMvmimAaL1yF8LP7d8Tug26 ppLC4gaveCe+Kwkv7y3aLEgGhE2nvWnLPpPYDI03itRXHOSJib7lh1Y/f4SjBWcGZHjG evSmoMZBY1Wo1Wrelk9eAL7uLqe3Jm68SQPxPbA0g9WIJX+5E+S8hExNgsdSOhaC+Ixb o4Yw3N/BwA1CGtCt43Dmmnci97RcmAIHGpWvfvyopFJzILBmLehBthNgXY7mrXZ0qPKZ mA== Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com with ESMTP id 3a4hcbcdbq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 30 Jul 2021 11:00:36 -0400 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 16UEqwag030866; Fri, 30 Jul 2021 15:00:35 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma01dal.us.ibm.com with ESMTP id 3a3w9hmupn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 30 Jul 2021 15:00:34 +0000 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 16UExvY27602914 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 30 Jul 2021 14:59:57 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BD99FBE054; Fri, 30 Jul 2021 14:59:57 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 71654BE05F; Fri, 30 Jul 2021 14:59:57 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 30 Jul 2021 14:59:57 +0000 (GMT) Subject: Re: [PATCH v2 4/4] ibmvtpm: Add support for trusted boot using a vTPM 2.0 To: Daniel Kiper Cc: Stefan Berger , grub-devel@gnu.org, Eric Snowberg References: <20210720211449.572356-1-stefanb@linux.vnet.ibm.com> <20210720211449.572356-5-stefanb@linux.vnet.ibm.com> <20210728132556.xxcu5ua3w6jekcro@tomti.i.net-space.pl> <7c83a897-0694-e70c-f210-c70d9c81cbf5@linux.ibm.com> <20210730124453.4nepuusimrfofsuw@tomti.i.net-space.pl> From: Stefan Berger Message-ID: <41544c24-ba04-6320-a8e1-f82ac115d1ff@linux.ibm.com> Date: Fri, 30 Jul 2021 10:59:57 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 In-Reply-To: <20210730124453.4nepuusimrfofsuw@tomti.i.net-space.pl> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-GUID: nbHrtB8dLxy-JB4xYYlrv2YyjP37gv4R X-Proofpoint-ORIG-GUID: nbHrtB8dLxy-JB4xYYlrv2YyjP37gv4R Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-30_08:2021-07-30, 2021-07-30 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 malwarescore=0 lowpriorityscore=0 phishscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 impostorscore=0 bulkscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2107300095 Received-SPF: pass client-ip=148.163.158.5; envelope-from=stefanb@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.125, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 15:00:43 -0000 On 7/30/21 8:44 AM, Daniel Kiper wrote: > On Thu, Jul 29, 2021 at 09:30:49AM -0400, Stefan Berger wrote: >> On 7/28/21 9:25 AM, Daniel Kiper wrote: >>> On Tue, Jul 20, 2021 at 05:14:49PM -0400, Stefan Berger wrote: >>> >>>> +#define IEEE1275_CELL_TRUE ((grub_ieee1275_cell_t) -1) >>> This smells like global constant. Does not it? If yes could you define it >>> in a global header and use it? Maybe even replace existing comparisons >>> in the IEEE1275 code with IEEE1275_CELL_TRUE. But probably then >>> s/IEEE1275_CELL_TRUE/GRUB_IEEE1275_CELL_TRUE/... >> I wasn't sure and also had found local #defines in another .c file. >> >> #define IEEE1275_PHANDLE_INVALID  ((grub_ieee1275_cell_t) -1) >> #define IEEE1275_IHANDLE_INVALID  ((grub_ieee1275_cell_t) 0) >> #define IEEE1275_CELL_INVALID     ((grub_ieee1275_cell_t) -1) >> >> https://git.savannah.gnu.org/cgit/grub.git/tree/grub-core/kern/ieee1275/ieee1275.c#n24 >> >> I haven't seen the usage of -1 as TRUE in other grub files. So I could move >> it to a global header file assuming this is commonly used on this platform. >> I have only seen usage of -1 as TRUE in the SLOF firmware in this file here: >> >> https://github.com/aik/SLOF/blob/master/lib/libnvram/libnvram.code#L66 >> >> but then of course also here: >> https://github.com/aik/SLOF/blob/master/lib/libtpm/tcgbios.c#L965 > I think we should use IEEE1275_CELL_INVALID in your code. IMO the TRUE > sounds a bit confusing in this context. So, I would move all these TRUE doesn't sound like CELL_INVALID and vice versa. FALSE is defined as 0, so I think that's a better comparison (and as a value more 'common') after introducing GRUB_IEEE1275_CELL_FALSE. > three constants to a global IEEE1275 header and add "GRUB_" prefix. I'll move those three in a separate patch. > Daniel    stefan