Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp693831pxf; Thu, 1 Apr 2021 11:04:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKvugp9Azw6mrw/FdNGvdiCywF6106ctQII7/HkAx0CL64lnZwKIiWprV6/8v4fKRynO0L X-Received: by 2002:a17:906:aac5:: with SMTP id kt5mr10707548ejb.548.1617300299210; Thu, 01 Apr 2021 11:04:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617300299; cv=none; d=google.com; s=arc-20160816; b=sh7O2eelDAqg7n5WdqYMfqGrTDv+Ld+BCcxRbiYoOZ4zXsYui3oqPv2DJeFrNTTxmm 4pr2TVj5s8JW5lEH8VijmBRznasA/ispREXs1NUssiRJzxzg0f1INmk4r7NH4B0izlnN j3bswntAaGFVD3PnQIqISU4YYCfagSKR2/Vjox30gW2eTSib5AkANAm6pv75W9n9SgSa 3ISxyvPTNEXsMC8TlcYjk0s0IHsQyblP+4MCE2yhgsCj5CpvFRuniT6r1H0xlyVlpJfx OBxc3bplCbEHfvpyVIJILnlap9qsFLzC1rNGh/AtWObt1kd481s50ApGkb/UUrcPh4RJ nM1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:reply-to:dkim-signature; bh=a0Q1VkfOZIavvpczXjt7TZjbwwjRT1qxWEncvyA0WC8=; b=DSfPcp8noA9/OhN1/5Y6UK52CETOpNH41sG1XRpQCH2/ABvAQEdGKVDSJBRKYojXyR fbSjPOCpLdQsxTGBA+EDnXxE1HYCSOZdw5GzV2VmraNhlFTnXHT3hRab0XR866yF2LSg Iecvs9FS82e6iD+UzwkIQmL4ZJ7KrzCKPJcuRqZ7oNIsKGwMxd7a3phGXZlhWC2kna2j Mn0zP11aIoLjGlGiIRnrpQ5Hx3Ppo/8qKK5XnOOW2Af21jDP6NHy9VxxnJ0fROmH+V4z tL8izoZlq6xBLDparkKLpG4hxBmIMTVltjBRFFKkMCKrEoWLweKRB2hbyX1cE0rbENWt QE5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NDMaGp3M; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-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 bt5si4676410edb.506.2021.04.01.11.04.33; Thu, 01 Apr 2021 11:04:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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=NDMaGp3M; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-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 S236107AbhDASC4 (ORCPT + 99 others); Thu, 1 Apr 2021 14:02:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:45517 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234729AbhDAR4S (ORCPT ); Thu, 1 Apr 2021 13:56:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617299776; h=from:from:reply-to: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=a0Q1VkfOZIavvpczXjt7TZjbwwjRT1qxWEncvyA0WC8=; b=NDMaGp3Mj1AzVqhj6dk2OE8BIStjC+yAYFSxc5Lhp4xNg/4EaxYYmS9YRQEjoJPv4KKBZB oMNCJJkk6E5AfaBRrFqhbYFdbrD4AQVp2G72pEezeLfFMOFkRhbEpO8+BUP8ih2CyQEYaw 8n3bRqibmYYE9+TmO+Af1bqvULDpzgs= 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-384-bTpy2vqsPHWKDQ6nxtplsw-1; Thu, 01 Apr 2021 09:54:45 -0400 X-MC-Unique: bTpy2vqsPHWKDQ6nxtplsw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DC44A1018F95; Thu, 1 Apr 2021 13:54:23 +0000 (UTC) Received: from crecklin.bos.csb (unknown [10.22.8.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FA865D9CC; Thu, 1 Apr 2021 13:54:21 +0000 (UTC) Reply-To: crecklin@redhat.com Subject: Re: Fix hibernation in FIPS mode? To: "Rafael J. Wysocki" , Ard Biesheuvel Cc: Simo Sorce , Dexuan Cui , "linux-pm@vger.kernel.org" , "linux-crypto@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <4e95307db43e2f7cc8516e645b81db7db0dd8ad4.camel@redhat.com> <504652e70f0a4e42e4927583b9ed47cd78590329.camel@redhat.com> From: Chris von Recklinghausen Organization: Red Hat Message-ID: <2b452865-ca6c-892d-f04e-3e6e2a74b598@redhat.com> Date: Thu, 1 Apr 2021 09:54:21 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 4/1/21 9:38 AM, Rafael J. Wysocki wrote: > On Thu, Apr 1, 2021 at 10:47 AM Ard Biesheuvel wrote: >> On Tue, 30 Mar 2021 at 21:56, Simo Sorce wrote: >>> 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 > Not really. > > CRC32 is not really sufficient for integrity checking here AFAICS. It > might be made a fallback option if MD5 is not available, but making it > the default would be somewhat over the top IMO. Would ghash be a better choice? It produces the same size digest as md5. Does anyone have any other suggestions of algorithms to try? Thanks, Chris > >>> 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. >>> >> Looking at 62a03defeabd58f74e07ca030d6c21e069d4d88e which introduced >> this, it is only a best effort check which is simply omitted if md5 >> happens to be unavailable, so there is definitely no need for crypto >> here. > Yes, it is about integrity checking only. No, CRC32 is not equivalent > to MD5 in that respect AFAICS. > > Thanks! >