From mboxrd@z Thu Jan 1 00:00:00 1970 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.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 B2D5FC4338F for ; Mon, 16 Aug 2021 20:58:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 901EA60F46 for ; Mon, 16 Aug 2021 20:58:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231726AbhHPU7T (ORCPT ); Mon, 16 Aug 2021 16:59:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52975 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231698AbhHPU7T (ORCPT ); Mon, 16 Aug 2021 16:59:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629147527; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=aKa4JIFgo1QMF+TVxmFpAttHSTW5o7TPLh5pO66X7QI=; b=TZ28Bbsoy237vt73SgAhSorSfRMLmvbc5RMYGdddmm4ItH/FmbK3bztgfW/WiPPJxTnNqy pn2rra5v967fp8vKUoeBF+iILfLltTnV0WpooVHse4rOK/0lbn3OAWhSihyM+IOAWShmJQ Lhnb/Bphle1EsyZw5qAXyAfWmAPTglE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-171-aJg9jsAYMeC_9ABGziTxfg-1; Mon, 16 Aug 2021 16:58:45 -0400 X-MC-Unique: aJg9jsAYMeC_9ABGziTxfg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A42BA192CC41; Mon, 16 Aug 2021 20:58:44 +0000 (UTC) Received: from localhost (unknown [10.22.8.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id 54E16620DE; Mon, 16 Aug 2021 20:58:39 +0000 (UTC) From: Bruno Meneguele To: zohar@linux.ibm.com Cc: linux-integrity@vger.kernel.org, kgold@linux.ibm.com, Bruno Meneguele Subject: [PATCH v2 ima-evm-utils] libimaevm: make SHA-256 the default hash algorithm Date: Mon, 16 Aug 2021 17:58:35 -0300 Message-Id: <20210816205835.76183-1-bmeneg@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org The SHA-1 algorithm is considered a weak hash algorithm and there has been some movement within certain distros to drop its support completely or at least drop it from the default behavior. ima-evm-utils uses it as the default algorithm in case the user doesn't explicitly ask for another through the --hashalgo/-a option. With that, make SHA-256 the default hash algorithm instead. Signed-off-by: Bruno Meneguele --- Changelog: v1: add ima-evm-utils to the [PATCH] part of the subject README | 2 +- src/evmctl.c | 2 +- src/libimaevm.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README b/README index 87cd3b5cd7da..0dc02f551673 100644 --- a/README +++ b/README @@ -41,7 +41,7 @@ COMMANDS OPTIONS ------- - -a, --hashalgo sha1 (default), sha224, sha256, sha384, sha512 + -a, --hashalgo sha1, sha224, sha256 (default), sha384, sha512 -s, --imasig make IMA signature -d, --imahash make IMA hash -f, --sigfile store IMA signature in .sig file instead of xattr diff --git a/src/evmctl.c b/src/evmctl.c index a8065bbe124a..e0e55bc0b122 100644 --- a/src/evmctl.c +++ b/src/evmctl.c @@ -2496,7 +2496,7 @@ static void usage(void) printf( "\n" - " -a, --hashalgo sha1 (default), sha224, sha256, sha384, sha512, streebog256, streebog512\n" + " -a, --hashalgo sha1, sha224, sha256 (default), sha384, sha512, streebog256, streebog512\n" " -s, --imasig make IMA signature\n" " -d, --imahash make IMA hash\n" " -f, --sigfile store IMA signature in .sig file instead of xattr\n" diff --git a/src/libimaevm.c b/src/libimaevm.c index 8e9615796153..f6c72b878d88 100644 --- a/src/libimaevm.c +++ b/src/libimaevm.c @@ -88,7 +88,7 @@ static const char *const pkey_hash_algo_kern[PKEY_HASH__LAST] = { struct libimaevm_params imaevm_params = { .verbose = LOG_INFO, .x509 = 1, - .hash_algo = "sha1", + .hash_algo = "sha256", }; static void __attribute__ ((constructor)) libinit(void); -- 2.31.1