Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3639614pxv; Mon, 5 Jul 2021 02:11:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOlE/6He3v0SstNeSo2YkzhrLim4Tho9r1cZPEferVSKRL6CjcvbzFELM4ZVap/zNckUEZ X-Received: by 2002:a05:6402:101a:: with SMTP id c26mr15045716edu.317.1625476276454; Mon, 05 Jul 2021 02:11:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625476276; cv=none; d=google.com; s=arc-20160816; b=Qu3baF+FcT8+q10+TKGUo/f7dYaxIzgSjBj5dMwcdBPK/28s3I2g3dJDiiOCHgq3Sh dTkm9jstbK5ALOCBq6VdDwnMx9bT365R41AjaJkKxCIuPHFx2SubGYTRJ3eRbSuqnaJo axW/dvi78zh2+Bcj0KWlahbm4OaY7saR2oSQC9y2BdTc/cp2VXmuwWsvI20eUi4/gvNy GuXlfRBA1SZeRKi7jJaxt8iEshGrkAZcHyg6aoI9HD5sNdhnZkAx3aBBZ1rPyZPHn4EF VHEL4zuDBR55IF98P/uDf0o7HWcBZs6CC8nQg/0THIBhbsc3lER1qjKBFuoTTzfowCpP c6NA== 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=9jagbckr/Yu5vIxIp/PXfGNfZ1mZ+MK1FR2mjetwB7Q=; b=NpmErYyEcTyTn5SaUz9//eQjDYHW1B1wCazrCSjW2ZbJMksqnUWDgdPmOb41Fg4Ft2 2dX6o7w/kXr7j90cOigBNA+NHKJ1zBc3/5ZXCvjeu938vxuUKJV7DrJvMEfWpj9FkUBH YlMiBOKhkqpZbY15MssO4SeyHcnFfajxvR9ODB2dwLg7MGN3n7ZxcfuXTJz+YAqynXlz cuOAAeSjYwFXdsWYaEcV/hpzXM/BaUK6SQJLlpeLL88FhDLcSwGo9S/zqAcDnDTGemNA cZEhRr2gsO3DPX6JtUifYD1lpwTcj60u9MOp/y8pRTyX7umuy+RzgCfqSG1TD9WlJ6st 4FNA== 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 bz6si11572054ejc.610.2021.07.05.02.10.52; Mon, 05 Jul 2021 02:11:16 -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 S230335AbhGEJMb (ORCPT + 99 others); Mon, 5 Jul 2021 05:12:31 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3356 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbhGEJMb (ORCPT ); Mon, 5 Jul 2021 05:12:31 -0400 Received: from fraeml714-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4GJKKM5zNPz6H8Ls; Mon, 5 Jul 2021 16:55:51 +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; Mon, 5 Jul 2021 11:09:51 +0200 From: Roberto Sassu To: , CC: , , , , , , , , Roberto Sassu Subject: [PATCH v3 0/3] ima: Provide more info about buffer measurement Date: Mon, 5 Jul 2021 11:09:19 +0200 Message-ID: <20210705090922.3321178-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: lhreml752-chm.china.huawei.com (10.201.108.202) 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 v2: - remove assignments of ima_measure_critical_data() and process_buffer_measurement() return values (suggested by Lakshmi) 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 | 2 +- security/integrity/ima/ima_asymmetric_keys.c | 2 +- security/integrity/ima/ima_init.c | 3 +- security/integrity/ima/ima_main.c | 67 ++++++++++++++------ security/integrity/ima/ima_queue_keys.c | 2 +- security/selinux/ima.c | 6 +- 8 files changed, 78 insertions(+), 37 deletions(-) -- 2.25.1