From patchwork Fri Jul 26 22:23:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Chikunov X-Patchwork-Id: 11061869 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 02E7B6C5 for ; Fri, 26 Jul 2019 22:23:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EAAEB28B0C for ; Fri, 26 Jul 2019 22:23:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCAB928B1F; Fri, 26 Jul 2019 22:23:16 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 4B60128B0C for ; Fri, 26 Jul 2019 22:23:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727941AbfGZWXO (ORCPT ); Fri, 26 Jul 2019 18:23:14 -0400 Received: from vmicros1.altlinux.org ([194.107.17.57]:58704 "EHLO vmicros1.altlinux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727111AbfGZWXO (ORCPT ); Fri, 26 Jul 2019 18:23:14 -0400 Received: from imap.altlinux.org (imap.altlinux.org [194.107.17.38]) by vmicros1.altlinux.org (Postfix) with ESMTP id 9950672CC6C; Sat, 27 Jul 2019 01:23:12 +0300 (MSK) Received: from beacon.altlinux.org (unknown [185.6.174.98]) by imap.altlinux.org (Postfix) with ESMTPSA id 6C3F24A4AE8; Sat, 27 Jul 2019 01:23:12 +0300 (MSK) From: Vitaly Chikunov To: Mimi Zohar , Dmitry Kasatkin , linux-integrity@vger.kernel.org Subject: [PATCH] ima-evm-utils: Fix ima_verify for v1 signatures Date: Sat, 27 Jul 2019 01:23:09 +0300 Message-Id: <20190726222309.8106-1-vt@altlinux.org> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use user supplied key in verify_hash for DIGSIG_VERSION_1. Otherwise v1 signatures don't pass verification. Signed-off-by: Vitaly Chikunov --- src/libimaevm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libimaevm.c b/src/libimaevm.c index a582872..97f193e 100644 --- a/src/libimaevm.c +++ b/src/libimaevm.c @@ -612,6 +612,8 @@ int verify_hash(const char *file, const unsigned char *hash, int size, unsigned /* Read pubkey from RSA key */ if (!imaevm_params.keyfile) key = "/etc/keys/pubkey_evm.pem"; + else + key = imaevm_params.keyfile; return verify_hash_v1(file, hash, size, sig, siglen, key); } else if (sig[0] == DIGSIG_VERSION_2) { return verify_hash_v2(file, hash, size, sig, siglen);