Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4634498pxf; Tue, 30 Mar 2021 12:47:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8Ognl6e5gmWs84pnSxccwYKFU+nfh3cL/1IWtrbDqFO+TC4pb/7ioo2onHvMDT5fiMzoR X-Received: by 2002:a17:906:4015:: with SMTP id v21mr36345172ejj.433.1617133650263; Tue, 30 Mar 2021 12:47:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617133650; cv=none; d=google.com; s=arc-20160816; b=he7/wY/JtJAhTEZKVuy4w2v+iqlVzT/QmW9CiCiQRLj1d0H2UWEBEEcetXdjSWA69s mt/m/YybIjCAL48qAi750Q2w7gaRx79p6/FUBHsz3X3DOdGrmkPAAss0RNG5dHrzdSsx sTFbr5K0RHpzGwUPIJ5VKcWxBo8LcJtT/pyC7B2m8i4YCNvw1v9uR2Rg9/PzGO4NvByP dKgmJYC2GKiZ7s86tJLV+iWiu3HZo1gzl3GqRtLyzBJTEKxMkO0JIJj75b8WsHHLBqHY puDPdXFSn/ioBFnQbNaXIvW+TU5OlcmYdj86+W6JEaSCiPOxQ4VhBYM0chupyBJmYX7W aC7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=u6vjZz4oDPFjlMjSlG8IJVQP899H5kLIGVQLMArI6Cc=; b=Pmd68SkxMDfILewYwcMTxkX4Bmdn9/f0E5gBEywV93blEP1582M6jx1cYH93xUhZkr znAeZVjYcp/I0aHdB9n7qd5ctEinoYGKjNgBDddTRJbvBeVyPhkmkXmZesZE+U0UMfq8 Ya82xH97NOT8Dxoq1YwFOnKqD1VW5KqwnKHoSq1YzD6wK7ZxlLtnqUeE29F9HUw79PXC /loyR4WNn4hTwmN2kggQfyJC1I0+o5sKBdiKYbgLUcw+xFEmVTt3Q8my9FK4L1E80kuJ dBFKCZfVs8Tgo9y82QbB4ZsANvju6nm7aKxWn2Y2gGgRWNMm78z/Qn+fsZ1IC/9GeSzg MZFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iqt3eYMX; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t23si16159478ejf.231.2021.03.30.12.47.06; Tue, 30 Mar 2021 12:47:30 -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=@kernel.org header.s=k20201202 header.b=iqt3eYMX; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233135AbhC3Tpn (ORCPT + 99 others); Tue, 30 Mar 2021 15:45:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:56538 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233179AbhC3Tpa (ORCPT ); Tue, 30 Mar 2021 15:45:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 39797619C2; Tue, 30 Mar 2021 19:45:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617133530; bh=u6vjZz4oDPFjlMjSlG8IJVQP899H5kLIGVQLMArI6Cc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=iqt3eYMX+Ja0Ta1xuaATVHuAcqS2ni0JcM/ULtxrbl0clxM5ej+FGvxvwrr3ny6Uf 1wr9XhxphUnVQlKB3ftip0iAScOX1N9icLKet2VHKmmvKwUa4XtrT/Aykbxp65sSrE HI8x5ZRxZNiPbti1LvGahvko7l+nvA3jTyZiGk0+QKRJfApFRVaA43TqK5kfNCBBa2 TmAIXjhmXpOe4ZsQbl/FEqG9SZqMEPHC4u/CbOoAtElxJXnnX27vlDuVs9KKyAp78d 2wtWijRe9iG23ivVP9yi1IAKV+JVtiJOSuYmSdDsnItOTTnHAGFZ1K/KUXT1G/CUaR f2Tbrf/AtA7fQ== Received: by mail-ot1-f45.google.com with SMTP id 31-20020a9d00220000b02901b64b9b50b1so16683149ota.9; Tue, 30 Mar 2021 12:45:30 -0700 (PDT) X-Gm-Message-State: AOAM530DDgxXGAdddmys3ZsxFoCBQxKCLzWnMjKp6l+l8I3R9dTjMDzX Br84j9iG8VPUIMhrgTclJB0e9/B5BtZaKHlc4eE= X-Received: by 2002:a9d:12cb:: with SMTP id g69mr27883972otg.77.1617133529596; Tue, 30 Mar 2021 12:45:29 -0700 (PDT) MIME-Version: 1.0 References: <4e95307db43e2f7cc8516e645b81db7db0dd8ad4.camel@redhat.com> In-Reply-To: <4e95307db43e2f7cc8516e645b81db7db0dd8ad4.camel@redhat.com> From: Ard Biesheuvel Date: Tue, 30 Mar 2021 21:45:18 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Fix hibernation in FIPS mode? To: Simo Sorce Cc: "Rafael J. Wysocki" , Dexuan Cui , "linux-pm@vger.kernel.org" , "crecklin@redhat.com" , "linux-crypto@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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