Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2410325iob; Sat, 30 Apr 2022 07:52:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyABdB2tVlByuTxLYvttZS36JpucpZZnXLtjWMuiH0q15Fj4UbceP3tfYwE2sGnB/FuJW2M X-Received: by 2002:a05:6a00:13a7:b0:50d:5ff5:4e94 with SMTP id t39-20020a056a0013a700b0050d5ff54e94mr3657567pfg.75.1651330344563; Sat, 30 Apr 2022 07:52:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651330344; cv=none; d=google.com; s=arc-20160816; b=KzzwIL+FC7NL64uf/Uvzw8EUEMgyka4oAiSb9pEASPAm6jKZxLbljQoDSfVlA6MYqQ YOMPFbW8yT+TZCtQ8lFCtETATd+JBHwI0g11TLfdOEI6BTFlpmetdTjPckPKxE76lAl2 fli9bm1V7Dow0cwEdcUCn8JV6vg0krt/EyWxONHa6HSH8bvI3p/E86N1f0u+fNXohzy1 RkuZ7JTEa4Wg+k0i9vv99f5LmrLd40zIxRd9Td+Mb641UECftEBhPUhZ+gGfJGX1xUgW qQ3FKw6JZskB1Si66YXErcdms+xK81YSHtgxG6JCIONJ1SL3RwN1CKVo7Qjhyek5WVfE GtNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=QwF7BRLgXcAp6rxGlvF1Bt9zQfFMAH6yUW5UlZkEXe8=; b=0HXN9O69qY1784ZtJuU8i1M/lnqEdgCF34EQ5Dsl98aGa0VGqqz8mfup7uQvh+VbKA HXXZVoh+l35AA3PLo6ff6h7b8hDryDk/a/vZk4aTGRIKzCm45/Qv6v02M20e748ES5QF CHa2XBoxG0lW+vHSHg1ABpwZdwcqPQonMPv5H2SE9wCtPW15+iNgAAV/zX0yUCsM2R4m alPP9MlEi+UW4kynvJKXjXdws728VLOjNZ5iFbSsZKbU1UUDmvDkQPcU2W8V5CfVB95e gnsKVcku3DR1c63m6FX1rg6R6ZPKjA6WRIyfi+YL27rJdE+5ClC9N+gOnPIdGj+/4N3V 1vHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=a655I37A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d17-20020aa78691000000b0050d5fed6283si9111021pfo.161.2022.04.30.07.52.07; Sat, 30 Apr 2022 07:52:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=a655I37A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379267AbiD2QsR (ORCPT + 99 others); Fri, 29 Apr 2022 12:48:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354902AbiD2QsQ (ORCPT ); Fri, 29 Apr 2022 12:48:16 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1FDAD5566; Fri, 29 Apr 2022 09:44:57 -0700 (PDT) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 23TESPen012627; Fri, 29 Apr 2022 16:44:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=QwF7BRLgXcAp6rxGlvF1Bt9zQfFMAH6yUW5UlZkEXe8=; b=a655I37ABdW5yJKoqotzKLKsGhwTXUgkb6LYZcwqFGJ1730sA02QdcnO+Ny34Skpik+T d175B721R1xEN+LEctibvlGq6Rxa5ulig7oQxBRNGZf4GDALZRqP/nua5ukRVOdOrODe pVXl0o4bh6NJv2kBFBRsAnN6oBU0/ujZkK2RAr4v8/rXdxdijjMov15zq2mNIjpKfzwA skRXJzaDLzQWvYTDv8sIF3bNkYi8LnSbiTpin0pQuDbYX/awIJoVuluJf7NmL4fOvhE2 iqH34ZnCcZPLwtfcSDBKGO35Hgg+9s6nNV3vY/JCYcBolBz+0UlRcJviTG2xZUYMmd/D XA== Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3fr27h501d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 Apr 2022 16:44:52 +0000 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 23TGYeNC030942; Fri, 29 Apr 2022 16:44:42 GMT Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by ppma04dal.us.ibm.com with ESMTP id 3fm93awkdk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 Apr 2022 16:44:42 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 23TGigsD34144694 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 Apr 2022 16:44:42 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0CE092805C; Fri, 29 Apr 2022 16:44:42 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CC8EE2805A; Fri, 29 Apr 2022 16:44:41 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 29 Apr 2022 16:44:41 +0000 (GMT) Message-ID: Date: Fri, 29 Apr 2022 12:44:41 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v8 1/7] ima: fix 'd-ng' comments and documentation Content-Language: en-US To: Mimi Zohar , linux-integrity@vger.kernel.org Cc: Eric Biggers , linux-fscrypt@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220429112601.1421947-1-zohar@linux.ibm.com> <20220429112601.1421947-2-zohar@linux.ibm.com> From: Stefan Berger In-Reply-To: <20220429112601.1421947-2-zohar@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 4dSa4AnNfA8xTzjFu8rIkue2jPV7Gv0r X-Proofpoint-GUID: 4dSa4AnNfA8xTzjFu8rIkue2jPV7Gv0r X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-29_08,2022-04-28_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 clxscore=1015 adultscore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204290086 X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 4/29/22 07:25, Mimi Zohar wrote: > Initially the 'd-ng' template field did not prefix the digest with either > "md5" or "sha1" hash algorithms. Prior to being upstreamed this changed, > but the comments and documentation were not updated. Fix the comments > and documentation. > > Fixes: 4d7aeee73f53 ("ima: define new template ima-ng and template fields d-ng and n-ng") > Reported-by: Eric Biggers > Signed-off-by: Mimi Zohar > --- > Documentation/security/IMA-templates.rst | 3 +-- > security/integrity/ima/ima_template_lib.c | 8 +++++--- > 2 files changed, 6 insertions(+), 5 deletions(-) > > diff --git a/Documentation/security/IMA-templates.rst b/Documentation/security/IMA-templates.rst > index 1a91d92950a7..cab97f49971d 100644 > --- a/Documentation/security/IMA-templates.rst > +++ b/Documentation/security/IMA-templates.rst > @@ -66,8 +66,7 @@ descriptors by adding their identifier to the format string > calculated with the SHA1 or MD5 hash algorithm; > - 'n': the name of the event (i.e. the file name), with size up to 255 bytes; > - 'd-ng': the digest of the event, calculated with an arbitrary hash > - algorithm (field format: [:]digest, where the digest > - prefix is shown only if the hash algorithm is not SHA1 or MD5); That seemed to be true for 'd' > + algorithm (field format: :digest); > - 'd-modsig': the digest of the event without the appended modsig; > - 'n-ng': the name of the event, without size limitations; > - 'sig': the file signature, or the EVM portable signature if the file > diff --git a/security/integrity/ima/ima_template_lib.c b/security/integrity/ima/ima_template_lib.c > index 7155d17a3b75..e9d65f6fe2ae 100644 > --- a/security/integrity/ima/ima_template_lib.c > +++ b/security/integrity/ima/ima_template_lib.c > @@ -271,9 +271,11 @@ static int ima_eventdigest_init_common(const u8 *digest, u32 digestsize, > /* > * digest formats: > * - DATA_FMT_DIGEST: digest > - * - DATA_FMT_DIGEST_WITH_ALGO: [] + ':' + '\0' + digest, > - * where is provided if the hash algorithm is not > - * SHA1 or MD5 > + * - DATA_FMT_DIGEST_WITH_ALGO: + ':' + '\0' + digest, > + * > + * where 'DATA_FMT_DIGEST' is the original digest format ('d') > + * with a hash size limitation of 20 bytes, > + * where is the hash_algo_name[] string. > */ > u8 buffer[CRYPTO_MAX_ALG_NAME + 2 + IMA_MAX_DIGEST_SIZE] = { 0 }; > enum data_formats fmt = DATA_FMT_DIGEST; Reviewed-by: Stefan Berger