From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752760AbdJ3Sfe (ORCPT ); Mon, 30 Oct 2017 14:35:34 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:54286 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751776AbdJ3Sfb (ORCPT ); Mon, 30 Oct 2017 14:35:31 -0400 Subject: Re: Proposal: rename tpm1_eventlog.c and tpm2_eventlog.c To: Jarkko Sakkinen , linux-integrity@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org References: <20171024222148.gwnkj5vqsyj43qer@linux.intel.com> From: Nayna Jain Date: Tue, 31 Oct 2017 00:04:59 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171024222148.gwnkj5vqsyj43qer@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 17103018-0044-0000-0000-000003A79FBF X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007982; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000239; SDB=6.00938740; UDB=6.00473214; IPR=6.00719001; BA=6.00005663; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017795; XFM=3.00000015; UTC=2017-10-30 18:35:28 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17103018-0045-0000-0000-000007D6B0CE Message-Id: <6d3c18e4-6033-be6f-5783-fa36e7bbbd86@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-10-30_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710300246 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/25/2017 03:51 AM, Jarkko Sakkinen wrote: > I noticed when making slides for KS that the naming for event log stuff > that the naming is so broken that it is hard to understand the code. > Here it really would make sense to have a patch set just to clean up the > cruft. > > Random examples of more senseful naming: > > * tpm2_bios_measurements_start() should be rather something like > tpm_eventlog_seq_agile_start(). > * tpm_bios_measurements_start() should be rather something like > tpm_eventlog_seq_sha1_start(). BIOS eventlog being exposed as securityfs files are named as ascii_bios_measurements and binary_bios_measurements. I thought that the function names were originally written corresponding to the files they write into. In that context, I didn't find them misleading. Still if we want to rename, I think having tpm_eventlog_seq_sha1_start() for TPM1.2 might be confusing as even TPM2.0 supports SHA1. And there might be systems which use only SHA1 even in the case of TPM2.0. I was thinking if we can just call them as tpm2_eventlog_seq_start() and tpm1_eventlog_seq_start(). > Corresponding structs would be tpm_eventlog_agile_seq_ops and > tpm_eventlog_sha1_seq_ops. > > Finally, I would place the file operations, being so complicated, in > separate files: > > * tpm_eventlog_seq_sha1.c > * tpm_eventlog_seq_eventlog.c > > And move all the management code that is right now illogically located > in tpm1_eventlog.c to tpm_eventlog.c that would be the entry point for > the event log. By management code, do you mean the functions common to both TPM1.2 and TPM2.0 as: tpm_bios_measurements_open() tpm_read_log() tpm_bios_log_setup() tpm_bios_log_teardown() So, do you mean to move these to tpm_eventlog.c and keep only specific functions in tpm1_eventlog.c and tpm2_eventlog.c ? If so, then yeah I also agree with this. Thanks & Regards,    - Nayna > The code is laid out so badly right now that I have really hard time > understanding it if I haven't looked at it within last couple of weeks. > It's really a trainwreck at the moment. We must clean up it up fast. > > Getting this done will help me to review patches to this area faster > so it would be a benefit for everyone. The current structure makes every > event log patch a pain to review. > > /Jarkko >