Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp625849pxv; Thu, 1 Jul 2021 06:02:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOuz9IIhXJsfOC0u0dPCShObRuvgEZGE43purHxPDUxnHbobQ/laQBo3DN7CaXH4VKfaGQ X-Received: by 2002:a05:6402:6d3:: with SMTP id n19mr55085906edy.248.1625144552532; Thu, 01 Jul 2021 06:02:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625144552; cv=none; d=google.com; s=arc-20160816; b=PnthbmNzaHU0MseJmK6WWHmd0g4CQXLx+2NWXCbwbQ0lWblG+ekbiE+hCO5GPg8TPy v84RzeT6z7QrZc2/XgW3mUIAVC3HGue5HFVBG/5vBwD9jt4y+9b25iRWIVb4/DVy0Eyh a2LEwYS2is0NZChAsNpNlaDFvUFPKrgLRc7UO140yLx8gQzEn7aVPzqsDr1gReHe0D9B KJuoI/yBEsoZNdCJOsw/Yiofw4mnqaaB2FTDUa5rxacySozajLcmbq8ZWJ0/5l4PW0wG 5aXBZi1L9NTN3ckd6Lkjm66yZhDNZ+c5CaEQyMRp5BYfsKhYkmdy0ib4NnHR2UKlfANh cRBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=xVzjtaGOfYfDqVc+z0IBpDSvbWpCXd9+2pOUUxSS+tg=; b=TlfR2XoaGun3SCSrX9OI+Ru7i50b7zfraAUVZ+3mXQyPZje4M0pl6e2TCey05BN4qu Sv9DxEFJky7ng5xs73r6IuJaQFSKqLxVjrEgR016H94SoMnqA62YHOscAMLb2pr2TjFg oC4KmE1ygFucmJlNemLTxqdXkZr/+6B5oAIMKBR4rEH7IO0DJIODVUCGofwA7zC+EGeU Q4+4sWE8Bh8Un9AF/tlt5h/YYhTvMntYnD4AGIc8rd5vCGMbdR1ASrJKiBZYed9JEF2L 9+4uWJI656pz7ZzjwUaJnyFnCiYf77kZjbtvjTzRtbAdDVNBD73ri+YL0dc/3OyjNGlr 5uXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 4si23040140ejr.126.2021.07.01.06.01.37; Thu, 01 Jul 2021 06:02:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236471AbhGAM7a (ORCPT + 99 others); Thu, 1 Jul 2021 08:59:30 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3338 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236535AbhGAM6o (ORCPT ); Thu, 1 Jul 2021 08:58:44 -0400 Received: from fraeml714-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4GFycR2XlZz6L7Vn; Thu, 1 Jul 2021 20:45:43 +0800 (CST) Received: from roberto-ThinkStation-P620.huawei.com (10.204.63.22) by fraeml714-chm.china.huawei.com (10.206.15.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 1 Jul 2021 14:56:10 +0200 From: Roberto Sassu To: , CC: , , , , , , , , Roberto Sassu Subject: [PATCH v2 0/3] ima: Provide more info about buffer measurement Date: Thu, 1 Jul 2021 14:55:49 +0200 Message-ID: <20210701125552.2958008-1-roberto.sassu@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.204.63.22] X-ClientProxiedBy: lhreml749-chm.china.huawei.com (10.201.108.199) To fraeml714-chm.china.huawei.com (10.206.15.33) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch set provides more information about buffer measurement. First, it introduces the new function ima_get_current_hash_algo(), to obtain the algorithm used to calculate the buffer digest (patch 1). Second, it changes the type of return value of ima_measure_critical_data() and process_buffer_measurement() from void to int, to signal to the callers whether or not the buffer has been measured, or just the digest has been calculated and written to the supplied location (patch 2). Lastly, it adds two new parameters to the functions above ('digest' and 'digest_len'), so that those functions can write the buffer digest to the location supplied by the callers (patch 3). This patch set replaces the patch 'ima: Add digest, algo, measured parameters to ima_measure_critical_data()' in: https://lore.kernel.org/linux-integrity/20210625165614.2284243-1-roberto.sassu@huawei.com/ Changelog v1: - add digest_len parameter to ima_measure_critical_data() and process_buffer_measurement() (suggested by Lakshmi) - fix doc formatting issues Huawei Digest Lists patch set: - introduce ima_get_current_hash_algo() (suggested by Mimi) - remove algo and measured parameters from ima_measure_critical_data() and process_buffer_measurement() (suggested by Mimi) - return an integer from ima_measure_critical_data() and process_buffer_measurement() (suggested by Mimi) - correctly check when process_buffer_measurement() should return earlier Roberto Sassu (3): ima: Introduce ima_get_current_hash_algo() ima: Return int in the functions to measure a buffer ima: Add digest and digest_len params to the functions to measure a buffer include/linux/ima.h | 23 ++++-- security/integrity/ima/ima.h | 10 +-- security/integrity/ima/ima_appraise.c | 6 +- security/integrity/ima/ima_asymmetric_keys.c | 6 +- security/integrity/ima/ima_init.c | 6 +- security/integrity/ima/ima_main.c | 73 ++++++++++++++------ security/integrity/ima/ima_queue_keys.c | 15 ++-- security/selinux/ima.c | 11 +-- 8 files changed, 100 insertions(+), 50 deletions(-) -- 2.25.1