From patchwork Fri May 5 14:21:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roberto Sassu X-Patchwork-Id: 9713673 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4336C6034B for ; Fri, 5 May 2017 14:25:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FF9A28675 for ; Fri, 5 May 2017 14:25:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44B63286B8; Fri, 5 May 2017 14:25:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE1B528675 for ; Fri, 5 May 2017 14:25:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752741AbdEEOZD (ORCPT ); Fri, 5 May 2017 10:25:03 -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 Received: from 172.18.7.190 (EHLO LHREML712-CAH.china.huawei.com) ([172.18.7.190]) by lhrrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DGB13182; Fri, 05 May 2017 14:25:00 +0000 (GMT) Received: from roberto-HP-EliteDesk-800-G2-DM-65W.huawei.com (10.204.66.1) by smtpsuk.huawei.com (10.201.108.35) with Microsoft SMTP Server (TLS) id 14.3.301.0; Fri, 5 May 2017 15:24:54 +0100 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 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: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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;