Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4639433pxf; Tue, 30 Mar 2021 12:58:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzP6OXX9lGh6OY3ojIFJfiyHYApKj9Bzvs5gF9AxvmD6eXfbFJ1RKzUdvsugGQEcCzi5kBX X-Received: by 2002:a17:907:20e4:: with SMTP id rh4mr35571449ejb.369.1617134306758; Tue, 30 Mar 2021 12:58:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617134306; cv=none; d=google.com; s=arc-20160816; b=nT4J9feW8QqrPMvSw7O9ffEfrREQsaBntIy1q9bhaE6sLtBonbGjDTJiUB4a4Q4381 yDwvhs29mb5TSKyZGI2TdV3ihp2AhOpaubaldk/ht1h79bIAsdmhVIcpcg9GykcPIEe1 wLbLgebWxRxdU2qEbpFDDPFNFPMcdhpmXZbWcSjwdz+swwkOxMdLTs9YfgPsO/exEj+x rIRqEGKnjDjzDCEm3A0aPvFjOaZsSOPWlsB144WzfEcd8EOrZR2KFB7Ro29zZzcyLljs qWVKULgZUv8Tboy6MK0s6ySJvoYphCfrMV897cJBS71ZoPinGKxw2YItGD+uq6JCZl6n RRtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=iDpCsr20mdBOULwkGJuXRLZb9kndT3CLNs3zWssy9e0=; b=NV3oyldJamsoEVK87SCZcuYd0QwegLBntCldh471AatoLOTyUnXg+N+Fg8q3Kc/In3 n+1g8709htlwzP6xStv/GMhcSZ5vXGSD5N/NBreE0ImG929NS7Kgr2nEGlnwG66YXKdY jw7k0+U/RUJX4JdA75SScDLpKJqEHyavTO+Oq12AtBSKg8ecR777WIiGsxXfvQ6l6SGb G65KTL4ROQHX+BAZQjy2tYS1genAjcrOpoQbMCueosRBuCNJToiDy7hX7RusI6wKefsw UpDwptnoOF1wAAQUmez020R6KTYd/BCxH76ghkdkWDVxToZY0OLMHQKEZYtaB5mMQyMs wK2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S1k5uNeT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b17si15772397eds.443.2021.03.30.12.57.39; Tue, 30 Mar 2021 12:58:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S1k5uNeT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233252AbhC3T4W (ORCPT + 99 others); Tue, 30 Mar 2021 15:56:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:38346 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233239AbhC3T4H (ORCPT ); Tue, 30 Mar 2021 15:56:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617134167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iDpCsr20mdBOULwkGJuXRLZb9kndT3CLNs3zWssy9e0=; b=S1k5uNeT3AVMm8n1iy1vSSeXSCXBKAxmysAI82QEoSkcR2t85VnUY3Sv5paWRrlJWzpnZ0 Dl765S2RUBeaW8En/Qe8b2rU5J9G0KJVAiHjNZZFPicLV0d9fo8hQ8vUThWZFU6Lem6PUQ IbLt84GlhR+OwnACB3XWknCZIUq4qqE= 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-493-BcwzNrlrMEOtUCuak3ZFrA-1; Tue, 30 Mar 2021 15:56:02 -0400 X-MC-Unique: BcwzNrlrMEOtUCuak3ZFrA-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 0C1E01009E2D; Tue, 30 Mar 2021 19:56:01 +0000 (UTC) Received: from ovpn-113-84.phx2.redhat.com (ovpn-113-84.phx2.redhat.com [10.3.113.84]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 540071349A; Tue, 30 Mar 2021 19:56:00 +0000 (UTC) Message-ID: <504652e70f0a4e42e4927583b9ed47cd78590329.camel@redhat.com> Subject: Re: Fix hibernation in FIPS mode? From: Simo Sorce To: Ard Biesheuvel Cc: "Rafael J. Wysocki" , Dexuan Cui , "linux-pm@vger.kernel.org" , "crecklin@redhat.com" , "linux-crypto@vger.kernel.org" , "linux-kernel@vger.kernel.org" Date: Tue, 30 Mar 2021 15:55:59 -0400 In-Reply-To: References: <4e95307db43e2f7cc8516e645b81db7db0dd8ad4.camel@redhat.com> Organization: Red Hat, Inc. Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2021-03-30 at 21:45 +0200, Ard Biesheuvel wrote: > On Tue, 30 Mar 2021 at 20:05, Simo Sorce wrote: > > On Tue, 2021-03-30 at 16:46 +0200, Rafael J. Wysocki wrote: > > > On Tue, Mar 30, 2021 at 12:14 AM Dexuan Cui wrote: > > > > Hi, > > > > MD5 was marked incompliant with FIPS in 2009: > > > > a3bef3a31a19 ("crypto: testmgr - Skip algs not flagged fips_allowed in fips mode") > > > > a1915d51e8e7 ("crypto: testmgr - Mark algs allowed in fips mode") > > > > > > > > But hibernation_e820_save() is still using MD5, and fails in FIPS mode > > > > due to the 2018 patch: > > > > 749fa17093ff ("PM / hibernate: Check the success of generating md5 digest before hibernation") > > > > > > > > As a result, hibernation doesn't work when FIPS is on. > > > > > > > > Do you think if hibernation_e820_save() should be changed to use a > > > > FIPS-compliant algorithm like SHA-1? > > > > > > I would say yes, it should. > > > > > > > PS, currently it looks like FIPS mode is broken in the mainline: > > > > https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg49414.html > > > > FYI, SHA-1 is not a good choice, it is only permitted in HMAC > > constructions and only for specified uses. If you need to change > > algorithm you should go straight to SHA-2 or SHA-3 based hashes. > > > > What is the reason for using a [broken] cryptographic hash here? if > this is just an integrity check, better use CRC32 If the integrity check is used exclusively to verify there were no accidental changes and is not used as a security measure, by all means I agree that using crc32 is a better idea. Simo. -- Simo Sorce RHEL Crypto Team Red Hat, Inc