Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp361319pxv; Wed, 30 Jun 2021 07:17:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjfwEc0HkJ7jl11/4GvGJdTaYFvrKNC10i0LQ+2pxP8Jfj9uymeEWI6XukgUlkzHBPMcKk X-Received: by 2002:a02:820f:: with SMTP id o15mr8809495jag.139.1625062666686; Wed, 30 Jun 2021 07:17:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625062666; cv=none; d=google.com; s=arc-20160816; b=VdB8zD+KNrC5rLGJle6Ram3FjgMCBvs8Ta5+A3sp8sWc91lMtrz2nVi7bGh6ut35v7 ejlcvfSV6W/kMa3VaFGFmqHdGG+19xY9703I5hENPSOU11Tm7EI395hSimTy4Anj0C+a Vl5AnXEf/wvRes/KrKviMRLDjKaW7i3GbyJ8dn9jSYC3nxeZtlLA8Kr0q6Wj+je5cB83 YqqQi1OXrpHPvj0RxLtQJM9bVzIydAYvC3OSMctiiMIKBiw4g/9YEiGsK1ctBgD4slF/ Qxhs5C0uaBj5ZH9PjA3WiA/5ixYS4+YbWG80PvueCIainqXGdxLlDt+ugAxbg9u/fIs9 RUIg== 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=ASNNsILraRE4pwi9xqsHN92LNbf/n1vsHSLMgkxpW+g=; b=gNXm16WV71nKh31ZO2pCSWL3Pu5BfNQ3MTTTmKEb2M/FL+aRyOLukYvhoaWgqIEOFS L7t5g4db7DFKmEFzZPAoX5zwm+8H9N9lKtAdQCsMAVcTZpH6FGydZz91pc+NJlTK6qvQ 4tCfvgYQyIGVU90byMSlOisOWP+FYO6UWWm4tep3tajePjoF05YbfuVdrWPuw3SbGLA1 Zgdb2ayvSi1aAdf5vXPGp6OEhln0NfZMml83oRJSx8ajPvCpDcGbBa+HMGFf0/ZaJglm NSosF4RP9dJH5nJDgLx0zza0Gw2h2Zx6+REmj7yxQuXbQMTo24v5JWluTkYf3tpY3X2E FhRA== 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 n14si5004356ili.18.2021.06.30.07.17.34; Wed, 30 Jun 2021 07:17:46 -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 S235027AbhF3OTV (ORCPT + 99 others); Wed, 30 Jun 2021 10:19:21 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3332 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234851AbhF3OTU (ORCPT ); Wed, 30 Jun 2021 10:19:20 -0400 Received: from fraeml714-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4GFNW35R5Fz6H6nB; Wed, 30 Jun 2021 22:09:03 +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; Wed, 30 Jun 2021 16:16:49 +0200 From: Roberto Sassu To: , CC: , , , , , , , , Roberto Sassu Subject: [PATCH 0/3] ima: Provide more info about buffer measurement Date: Wed, 30 Jun 2021 16:16:32 +0200 Message-ID: <20210630141635.2862222-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: lhreml754-chm.china.huawei.com (10.201.108.204) 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 a new parameter to the functions above, 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 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 parameter to the functions to measure a buffer include/linux/ima.h | 22 +++++-- 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 | 66 +++++++++++++------- security/integrity/ima/ima_queue_keys.c | 15 ++--- security/selinux/ima.c | 10 +-- 8 files changed, 92 insertions(+), 49 deletions(-) -- 2.25.1