Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1094414pxm; Wed, 23 Feb 2022 18:00:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxtS+98h9D8mlI9QG0E3kqpTL//QcG43aApJS+ADtsOyGiZKmqQAwrm3tz0vKI7NzUE0aht X-Received: by 2002:a05:6a00:1312:b0:4e1:58c4:ddfd with SMTP id j18-20020a056a00131200b004e158c4ddfdmr574619pfu.65.1645668032000; Wed, 23 Feb 2022 18:00:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645668031; cv=none; d=google.com; s=arc-20160816; b=EmZtjKVSbQRa53iWpkVwkUOObnnyz0YmaXsD9V5/C0R/0Uo6ZS9XsmKceurcTSugN5 alqoDcze+4rRiaoZTCUln2RTowBgg2iuyAKhKEaTMGXgvwvHfL4cqIaYmTi6Uqa6TjPH idJe4cHWlP8QensbQznkIbbRjU52SzBU4BEPQ0lqRn5PinM6i5F9MUWYtmUx0rxbrrlB R1QSpEl1NCEsxX6MI4x6ZAyVIcHdhH22nCrjbcGR99WlaH9xJEtcq7AkW5rsDKPJKwJy LEM5MLZJ1aDdWvd/IdCFyEkNMndxmYT5NJF/bSs/jCSwK0MrqAlqai1UtqnBYRNkhepf RdeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1m84jwaP3C9AJ+r0C2t5UuWAkSF6uh3Tnb1fFy1vGWg=; b=NFUCNebpuqK7HmoSVMHDWppiP7nhYG3WWTdtmaQCyTqDFfTIxCcV13SRr0VwfayE0Y 2hHP2qAvI2049iWNaqv1Bmob24tkY/huoDomWglXzG7+DziwAIEvyBVp6o7Eg1vnTUDm 9TkxZ8xlDdsTaOA6EobkIYeXTwqnx4hLvPdDsUuEfvBSk8CQW/ZUJ20JfNqx4aoP7ywT CCTRbfaBxZNIEMHlB9BqoiCQvHFn8DVWXA7n+IMiPoxvdF8lDi3UMDTkIOjC+bbQ+VFV bcFEbxyyDwkyocVXLteNBIto25bJq4VoKcECYjlrFdtCrwkfoBohuheXc/NwcK5cDLFl T2hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=i5wkIRMO; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s16si1259493plk.172.2022.02.23.18.00.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 18:00:31 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=i5wkIRMO; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E2835119412; Wed, 23 Feb 2022 17:28:56 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229538AbiBXAdD (ORCPT + 99 others); Wed, 23 Feb 2022 19:33:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229617AbiBXAcx (ORCPT ); Wed, 23 Feb 2022 19:32:53 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BD6C83002; Wed, 23 Feb 2022 16:32:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E1732B82285; Thu, 24 Feb 2022 00:32:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 510E8C340E7; Thu, 24 Feb 2022 00:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645662741; bh=3xhiKUuBO/ryIwyB50Q0hQEcWFfrZ0Emh0O02qSTEMU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=i5wkIRMOyyVvPD3+fM5IBNwt4clMFh0hZf35VQl6Iiz8a4IwBBUhXOPJK7fHuff4a k7ueAeRuV9vyD4M0rwnp2MIIjslqqcMBg1cTUXUo3CT4+iC0by2I/3RvZGxcwN0p4Z H6tQPRNssU9kBpy23l0zk0tboR/EkNEIUtGdwZLCY2BiozFiIFXerYnIv6kxa9XMzI NkICB4tQpRACKKbG/evS8MAR+uet6jbqGAUaEBxhoQG8b/8SmZ0zT5FMTeN+qiiUgY 7siTbLF4/dGfG+3Y5koaYXDEknZXYy1Kcsa1/aloim3dcbRUehEB6VUX6yA3r37Evl jLKHbB4Luz7lA== Date: Wed, 23 Feb 2022 16:32:19 -0800 From: Eric Biggers To: Mimi Zohar Cc: linux-integrity@vger.kernel.org, Stefan Berger , linux-fscrypt@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 4/8] ima: define a new template field 'd-type' and a new template 'ima-ngv2' Message-ID: References: <20220211214310.119257-1-zohar@linux.ibm.com> <20220211214310.119257-5-zohar@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220211214310.119257-5-zohar@linux.ibm.com> X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 11, 2022 at 04:43:06PM -0500, Mimi Zohar wrote: > In preparation to differentiate between regular IMA file hashes and > fs-verity's file digests, define a new template field named 'd-type'. > Define a new template named 'ima-ngv2', which includes the new 'd-type' > field. > > Signed-off-by: Mimi Zohar > --- > security/integrity/ima/ima_template.c | 3 +++ > security/integrity/ima/ima_template_lib.c | 13 +++++++++++++ > security/integrity/ima/ima_template_lib.h | 2 ++ > 3 files changed, 18 insertions(+) > > diff --git a/security/integrity/ima/ima_template.c b/security/integrity/ima/ima_template.c > index db1ad6d7a57f..b321342e5bee 100644 > --- a/security/integrity/ima/ima_template.c > +++ b/security/integrity/ima/ima_template.c > @@ -19,6 +19,7 @@ enum header_fields { HDR_PCR, HDR_DIGEST, HDR_TEMPLATE_NAME, > static struct ima_template_desc builtin_templates[] = { > {.name = IMA_TEMPLATE_IMA_NAME, .fmt = IMA_TEMPLATE_IMA_FMT}, > {.name = "ima-ng", .fmt = "d-ng|n-ng"}, > + {.name = "ima-ngv2", .fmt = "d-ng|n-ng|d-type"}, > {.name = "ima-sig", .fmt = "d-ng|n-ng|sig"}, > {.name = "ima-buf", .fmt = "d-ng|n-ng|buf"}, > {.name = "ima-modsig", .fmt = "d-ng|n-ng|sig|d-modsig|modsig"}, > @@ -40,6 +41,8 @@ static const struct ima_template_field supported_fields[] = { > .field_show = ima_show_template_digest_ng}, > {.field_id = "n-ng", .field_init = ima_eventname_ng_init, > .field_show = ima_show_template_string}, > + {.field_id = "d-type", .field_init = ima_eventdigest_type_init, > + .field_show = ima_show_template_string}, > {.field_id = "sig", .field_init = ima_eventsig_init, > .field_show = ima_show_template_sig}, > {.field_id = "buf", .field_init = ima_eventbuf_init, I notice that the "d-ng" field already contains both the hash algorithm and the hash itself, in the form :. Wouldn't it make more sense to define a "d-ngv2" field that contains ::? After all, both the type and algorithm are required to interpret the hash. Or in other words, what about the hash type is different from the hash algorithm that would result in them needing different handling here? - Eric