From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753972AbdEEOZE (ORCPT ); Fri, 5 May 2017 10:25:04 -0400 Received: from lhrrgout.huawei.com ([194.213.3.17]:25877 "EHLO lhrrgout.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751899AbdEEOZC (ORCPT ); Fri, 5 May 2017 10:25:02 -0400 From: Roberto Sassu To: CC: , , , , Roberto Sassu Subject: [PATCH v2 5/5] ima: modify arguments of tpm_pcr_extend() Date: Fri, 5 May 2017 16:21:52 +0200 Message-ID: <20170505142152.29795-6-roberto.sassu@huawei.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170505142152.29795-1-roberto.sassu@huawei.com> References: <20170505142152.29795-1-roberto.sassu@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.204.66.1] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.590C8B3C.0254,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 32f5585a93279f5516aeea001e630717 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ima_pcr_extend() has been modified to pass the correct arguments to tpm_pcr_extend(): the pointer of a tpm2_digest structure containing the template digest and the size of the array (1). Signed-off-by: Roberto Sassu --- security/integrity/ima/ima_queue.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/security/integrity/ima/ima_queue.c b/security/integrity/ima/ima_queue.c index d9aa5ab..f628968 100644 --- a/security/integrity/ima/ima_queue.c +++ b/security/integrity/ima/ima_queue.c @@ -140,12 +140,14 @@ unsigned long ima_get_binary_runtime_size(void) static int ima_pcr_extend(const u8 *hash, int pcr) { + struct tpm2_digest digestarg = {.alg_id = TPM2_ALG_SHA1}; int result = 0; if (!ima_used_chip) return result; - result = tpm_pcr_extend(TPM_ANY_NUM, pcr, hash); + memcpy(digestarg.digest, hash, IMA_DIGEST_SIZE); + result = tpm_pcr_extend(TPM_ANY_NUM, pcr, 1, &digestarg); if (result != 0) pr_err("Error Communicating to TPM chip, result: %d\n", result); return result; -- 2.9.3