From patchwork Wed Jun 30 19:33:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Berger X-Patchwork-Id: 12352769 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F497C11F65 for ; Wed, 30 Jun 2021 19:33:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 189B0613ED for ; Wed, 30 Jun 2021 19:33:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233690AbhF3Tfm (ORCPT ); Wed, 30 Jun 2021 15:35:42 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:8616 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233710AbhF3Tfl (ORCPT ); Wed, 30 Jun 2021 15:35:41 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15UJ41HN168133 for ; Wed, 30 Jun 2021 15:33:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=fxS56ljeNGJwUux/KMplix2jCVgsS04XSDDCpwLP4F4=; b=TbIouh85Bh1YuvdHO+Katk/mPl10/vsn8ZkZxuL4HYLUNhv+cADSOgFXGN/90j0mOY6c bpd5WOOaOh2L2ab1TYYZOImWCRrkJvRBTsZSIdXk7bDpUA/1v6i8NmRBmuoq1tJslJVB q/p0DFkXjFK0dHNt3XZJ2ErsYy/ueZyuhUFHmXQhV3EycmwQY3SYgzYBD1jVXrZP0/Wm lj4jvtCd/nKoSWzOJv5ryz3BjvH326No+bQ2uUOdMJ9s0xJ2F57AN2doW7/4r0N+d2sK /Gtv/FA5dTPICKxRPLy05VmqU4d7ZRYi4uU9yz7hKJTfmPz77gtMwTpjLVW6muPERI0l eQ== Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0b-001b2d01.pphosted.com with ESMTP id 39gvnuc0kw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 30 Jun 2021 15:33:12 -0400 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15UJVY9Y024288 for ; Wed, 30 Jun 2021 19:33:11 GMT Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by ppma04wdc.us.ibm.com with ESMTP id 39duvd9bkq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 30 Jun 2021 19:33:11 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15UJXBvt30081296 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Jun 2021 19:33:11 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0BC85AC059; Wed, 30 Jun 2021 19:33:11 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F33C4AC066; Wed, 30 Jun 2021 19:33:10 +0000 (GMT) Received: from localhost.localdomain (unknown [9.47.158.155]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 30 Jun 2021 19:33:10 +0000 (GMT) From: Stefan Berger To: linux-integrity@vger.kernel.org Cc: zohar@linux.ibm.com, Stefan Berger Subject: [PATCH ima-evm-utils 1/3] libimaevm: Remove calculation of a digest over a device file Date: Wed, 30 Jun 2021 15:33:01 -0400 Message-Id: <20210630193303.2531284-2-stefanb@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210630193303.2531284-1-stefanb@linux.ibm.com> References: <20210630193303.2531284-1-stefanb@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: GaRnBb5zltYOIURIb3yFlapSsK62HHYo X-Proofpoint-GUID: GaRnBb5zltYOIURIb3yFlapSsK62HHYo X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-06-30_08:2021-06-30,2021-06-30 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 mlxlogscore=999 clxscore=1015 bulkscore=0 priorityscore=1501 spamscore=0 phishscore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106300106 Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org Signature verification on device files is not supported by IMA in the kernel, so remove calculation of digests over devices files. Signed-off-by: Stefan Berger --- src/libimaevm.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/libimaevm.c b/src/libimaevm.c index 2856270..4d51901 100644 --- a/src/libimaevm.c +++ b/src/libimaevm.c @@ -225,16 +225,6 @@ static int add_link_hash(const char *path, EVP_MD_CTX *ctx) return !EVP_DigestUpdate(ctx, buf, len); } -static int add_dev_hash(struct stat *st, EVP_MD_CTX *ctx) -{ - uint32_t dev = st->st_rdev; - unsigned major = (dev & 0xfff00) >> 8; - unsigned minor = (dev & 0xff) | ((dev >> 12) & 0xfff00); - - log_info("device: %u:%u\n", major, minor); - return !EVP_DigestUpdate(ctx, &dev, sizeof(dev)); -} - int ima_calc_hash(const char *file, uint8_t *hash) { const EVP_MD *md; @@ -281,10 +271,6 @@ int ima_calc_hash(const char *file, uint8_t *hash) case S_IFLNK: err = add_link_hash(file, pctx); break; - case S_IFIFO: case S_IFSOCK: - case S_IFCHR: case S_IFBLK: - err = add_dev_hash(&st, pctx); - break; default: log_err("Unsupported file type (0x%x)", st.st_mode & S_IFMT); err = -1; From patchwork Wed Jun 30 19:33:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Berger X-Patchwork-Id: 12352767 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 471C1C11F66 for ; Wed, 30 Jun 2021 19:33:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 25BDF61469 for ; Wed, 30 Jun 2021 19:33:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233710AbhF3Tfm (ORCPT ); Wed, 30 Jun 2021 15:35:42 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:10134 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233736AbhF3Tfm (ORCPT ); Wed, 30 Jun 2021 15:35:42 -0400 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15UJ7JA4088844 for ; Wed, 30 Jun 2021 15:33:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=wL2YBPmhWFwT8ih7bGaUaLwKyQyRBtvtcpn+S62YIl8=; b=YMfuL7ll8L7ILtShRQ1VbLIoMcakZIMNJkQlDs1ZOu/vWd88zPruef3f8w+oNGuGfMje BIbpzU/BFiv9fAxp+45u7eL91bbl0kc0AxKR52lV0CyITyFfxrZIEjGMMdHjX/VtHQVI pcLSOKcL3ywKYCHGyYzyTFc+tzf2GtMw8ykp+NTJ5vF99TgwIbHvSi2rc9g4n4KzIOgo ZfsywAs9yArIY2H7l4NC3JS2iFQGtACvktLImOvXy1q6lQPfsgvh7cOHswzk/g6sP3Lr jNRSRHQbC1A9qf5hdqN+xVEyBl+7oAdofITIqMUi/Zy/uhAaZJuoxV9KyN4MxHV/eYb9 ew== Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0a-001b2d01.pphosted.com with ESMTP id 39gtqmr0ks-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 30 Jun 2021 15:33:12 -0400 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15UJVfS7029224 for ; Wed, 30 Jun 2021 19:33:11 GMT Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by ppma02wdc.us.ibm.com with ESMTP id 39duvd9e58-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 30 Jun 2021 19:33:11 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15UJXBvf35914166 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Jun 2021 19:33:11 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1B0C6AC068; Wed, 30 Jun 2021 19:33:11 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 16127AC067; Wed, 30 Jun 2021 19:33:11 +0000 (GMT) Received: from localhost.localdomain (unknown [9.47.158.155]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 30 Jun 2021 19:33:11 +0000 (GMT) From: Stefan Berger To: linux-integrity@vger.kernel.org Cc: zohar@linux.ibm.com, Stefan Berger Subject: [PATCH ima-evm-utils 2/3] libimaevm: Remove calculation of a digest over a directory Date: Wed, 30 Jun 2021 15:33:02 -0400 Message-Id: <20210630193303.2531284-3-stefanb@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210630193303.2531284-1-stefanb@linux.ibm.com> References: <20210630193303.2531284-1-stefanb@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: yJL0FkO7l0UJI4lom18JtNoKWF5UHIOl X-Proofpoint-ORIG-GUID: yJL0FkO7l0UJI4lom18JtNoKWF5UHIOl X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-06-30_11:2021-06-30,2021-06-30 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 bulkscore=0 spamscore=0 suspectscore=0 phishscore=0 malwarescore=0 clxscore=1015 mlxscore=0 impostorscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106300106 Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org Signature verification on directories is not supported by IMA in the kernel, so remove the calculation of digests over directories. Signed-off-by: Stefan Berger --- src/libimaevm.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/src/libimaevm.c b/src/libimaevm.c index 4d51901..07a25c9 100644 --- a/src/libimaevm.c +++ b/src/libimaevm.c @@ -177,40 +177,6 @@ out: return err; } -static int add_dir_hash(const char *file, EVP_MD_CTX *ctx) -{ - struct dirent *de; - DIR *dir; - unsigned long long ino; - unsigned int type; - int result = 0; - - dir = opendir(file); - if (!dir) { - log_err("Failed to open: %s\n", file); - return -1; - } - - while ((de = readdir(dir))) { - ino = de->d_ino; - type = de->d_type; - log_debug("entry: %s, ino: %llu, type: %u, reclen: %hu\n", - de->d_name, ino, type, de->d_reclen); - if (EVP_DigestUpdate(ctx, de->d_name, strlen(de->d_name)) != 1 || - EVP_DigestUpdate(ctx, &ino, sizeof(ino)) != 1|| - EVP_DigestUpdate(ctx, &type, sizeof(type)) != 1) { - log_err("EVP_DigestUpdate() failed\n"); - output_openssl_errors(); - result = 1; - break; - } - } - - closedir(dir); - - return result; -} - static int add_link_hash(const char *path, EVP_MD_CTX *ctx) { int len; @@ -265,9 +231,6 @@ int ima_calc_hash(const char *file, uint8_t *hash) case S_IFREG: err = add_file_hash(file, pctx); break; - case S_IFDIR: - err = add_dir_hash(file, pctx); - break; case S_IFLNK: err = add_link_hash(file, pctx); break; From patchwork Wed Jun 30 19:33:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Berger X-Patchwork-Id: 12352771 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D88E9C11F66 for ; Wed, 30 Jun 2021 19:33:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B9ED761463 for ; Wed, 30 Jun 2021 19:33:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233736AbhF3TgW (ORCPT ); Wed, 30 Jun 2021 15:36:22 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:17408 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229700AbhF3TgV (ORCPT ); Wed, 30 Jun 2021 15:36:21 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15UJ4gXo145693 for ; Wed, 30 Jun 2021 15:33:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=tzy77037ZlAGIXkqRF+GSNbJUEzOW9Kgtss26fOzVgM=; b=n8Kj4Wygt7LHIIMnHqdyXZeZytAMNOBaHsYZjZCao/9AlhOxGgA3OLSSkQwYNnkKf6JM KXW41JyCU03cEyYZMO36J22+EdED39VbxG8esJs0KF+3LW5MdP95XgvxoarrZNRbOrYL 3T7ffJYK9BJwMWcAnmI2FG+fWatyR5YnDUOzDoIbkUsQaYQf+38Li/A032m5cyYw8YPN 0WX25uTCDm2rI3PZ60ICm647+TE2e1kOjr+5prkgj12lYMT3Prmv5LbAk7EbMtPsCiY3 VjWGrB7kuIFb8t3ztzfbTx0UnK4roepySz55608hvK2IWoAgtyjioL9+pWxce80AlLb4 6Q== Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com with ESMTP id 39gtd00tjg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 30 Jun 2021 15:33:52 -0400 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15UJXn7s030476 for ; Wed, 30 Jun 2021 19:33:52 GMT Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by ppma03dal.us.ibm.com with ESMTP id 39duve1d0w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 30 Jun 2021 19:33:52 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15UJXBSm33685998 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Jun 2021 19:33:11 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 326CEAC05F; Wed, 30 Jun 2021 19:33:11 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 25BDBAC060; Wed, 30 Jun 2021 19:33:11 +0000 (GMT) Received: from localhost.localdomain (unknown [9.47.158.155]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 30 Jun 2021 19:33:11 +0000 (GMT) From: Stefan Berger To: linux-integrity@vger.kernel.org Cc: zohar@linux.ibm.com, Stefan Berger Subject: [PATCH ima-evm-utils 3/3] libimaevm: Remove calculation of a digest over a symbolic link Date: Wed, 30 Jun 2021 15:33:03 -0400 Message-Id: <20210630193303.2531284-4-stefanb@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210630193303.2531284-1-stefanb@linux.ibm.com> References: <20210630193303.2531284-1-stefanb@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 80H8oCRBukQRuepNRGIhPQe1-PUfmwfn X-Proofpoint-GUID: 80H8oCRBukQRuepNRGIhPQe1-PUfmwfn X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-06-30_11:2021-06-30,2021-06-30 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106300106 Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org Signature verification on symbolic links is not supported by IMA in the kernel, so remove the calculation of digests over symbolic links. Signed-off-by: Stefan Berger --- src/libimaevm.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/libimaevm.c b/src/libimaevm.c index 07a25c9..6591d20 100644 --- a/src/libimaevm.c +++ b/src/libimaevm.c @@ -177,20 +177,6 @@ out: return err; } -static int add_link_hash(const char *path, EVP_MD_CTX *ctx) -{ - int len; - char buf[1024]; - - len = readlink(path, buf, sizeof(buf)); - /* 0-length links are also an error */ - if (len <= 0) - return -1; - - log_info("link: %s -> %.*s\n", path, len, buf); - return !EVP_DigestUpdate(ctx, buf, len); -} - int ima_calc_hash(const char *file, uint8_t *hash) { const EVP_MD *md; @@ -231,9 +217,6 @@ int ima_calc_hash(const char *file, uint8_t *hash) case S_IFREG: err = add_file_hash(file, pctx); break; - case S_IFLNK: - err = add_link_hash(file, pctx); - break; default: log_err("Unsupported file type (0x%x)", st.st_mode & S_IFMT); err = -1;