Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6427199rwl; Thu, 29 Dec 2022 12:40:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXtTdW9DwQff4qApiWD97/qNpWzbpwcJL9FksMFu+1rmgJnM5zUdKUlTcBnnuwwSWQfUZ4qD X-Received: by 2002:a17:907:170a:b0:7c0:db53:c5ab with SMTP id le10-20020a170907170a00b007c0db53c5abmr26973167ejc.25.1672346421137; Thu, 29 Dec 2022 12:40:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672346421; cv=none; d=google.com; s=arc-20160816; b=FIjFR8BMSdFNHewTKnXY240a7hwh+dOpkR8SIq79KzSUnlWK34y57RQ80uXm4H6aLF G8hJcToa+7ltjnkccpxI1aw/+LAYysopO6quQosjukmJ2PnsFwow5agVVXlhPNvAaZ3g Pf5Rh3S4LEwYTxi7BJ7WKS3hDb6VPBFyfDA6ZR9D2ZwSIgjUTJRdr2fwv6K4+Je1G4YN jTmQzurswtxPTm9W9xX1YLk2p5XM6+q8bliL1CxSQ2mG11sN3ZizOXhSLaQeItBvU22E CTbGQHFJa39Ruq1zq5EsWS+skgA1emq0BXtS+FI/HxU9Hp8DV+Yw8kXGlHpLwv1T0fsE G8lQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tKf9f+QOlMAS3BoVwJkZB8zyX8Ws7eszIN1kwxfiCPs=; b=Pf+3TYI+MQc9WrVjHhpnJGVugXPKyJ+GaNBnPPqbV1/PKlIo10JMmZW8r4tUevRT2p sxY26eALL5PcaiPBkROGbIpK726HY06h/iLuJNFjoz7xlwXry6Do2smhIgfj2diiEjmO UO9JshLiIjraK5sqTzRDAeblmdr+xpWpOXamCLwlSg8A/wupHNjcHP7vCvcfOVss19KE Y0vC9jDs5p1g82PSuCLKPdtFanSO9zJyfjyoNZ3cBraulZ2QH3ce58tAnw2TTBjvC/rf SDr4kW7OGDgcNjvi2xLtv11dgQFmJUuFbx8mPNHhTFowl7+6huZV5uIcNUccDlyVZUHK 7VtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TDYnL3b8; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xj4-20020a170906db0400b007ac60b82ea5si16345916ejb.96.2022.12.29.12.39.55; Thu, 29 Dec 2022 12:40:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TDYnL3b8; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229957AbiL2Uj2 (ORCPT + 99 others); Thu, 29 Dec 2022 15:39:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234101AbiL2Uil (ORCPT ); Thu, 29 Dec 2022 15:38:41 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99B341706C for ; Thu, 29 Dec 2022 12:37:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1672346273; 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=tKf9f+QOlMAS3BoVwJkZB8zyX8Ws7eszIN1kwxfiCPs=; b=TDYnL3b83fEAZqvmHCnDcqSoa5FbE/beweeax9M2DQwsV+RJLBnyHd+2HEHnVqqBwu55oM 73P6+n5HILbEPZ1VPbUgd7NIZJOE3m2rWqJvsLWbL2qOm8Ais7dOFKgDRtSI/Nq6nH3cPT le2tVpgpL1SaTsxKeYI6+AghQIjBHzY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-132-aH7VcIvzNtyy6aed1DiV1A-1; Thu, 29 Dec 2022 15:37:48 -0500 X-MC-Unique: aH7VcIvzNtyy6aed1DiV1A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 05F741C0513D; Thu, 29 Dec 2022 20:37:48 +0000 (UTC) Received: from rules.brq.redhat.com (ovpn-208-2.brq.redhat.com [10.40.208.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6BC3112132D; Thu, 29 Dec 2022 20:37:45 +0000 (UTC) From: Vladis Dronov To: Herbert Xu , "David S . Miller" Cc: Nicolai Stange , Elliott Robert , Stephan Mueller , Eric Biggers , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Vladis Dronov Subject: [PATCH v2 3/6] crypto: xts - drop redundant xts key check Date: Thu, 29 Dec 2022 21:37:05 +0100 Message-Id: <20221229203708.13628-4-vdronov@redhat.com> In-Reply-To: <20221229203708.13628-1-vdronov@redhat.com> References: <20221229203708.13628-1-vdronov@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org xts_fallback_setkey() in xts_aes_set_key() will now enforce key size rule in FIPS mode when setting up the fallback algorithm keys, which makes the check in xts_aes_set_key() redundant or unreachable. So just drop this check. xts_fallback_setkey() now makes a key size check in xts_verify_key(): xts_fallback_setkey() crypto_skcipher_setkey() [ skcipher_setkey_unaligned() ] cipher->setkey() { .setkey = xts_setkey } xts_setkey() xts_verify_key() Signed-off-by: Vladis Dronov Reviewed-by: Eric Biggers --- arch/s390/crypto/aes_s390.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c index 526c3f40f6a2..c773820e4af9 100644 --- a/arch/s390/crypto/aes_s390.c +++ b/arch/s390/crypto/aes_s390.c @@ -398,10 +398,6 @@ static int xts_aes_set_key(struct crypto_skcipher *tfm, const u8 *in_key, if (err) return err; - /* In fips mode only 128 bit or 256 bit keys are valid */ - if (fips_enabled && key_len != 32 && key_len != 64) - return -EINVAL; - /* Pick the correct function code based on the key length */ fc = (key_len == 32) ? CPACF_KM_XTS_128 : (key_len == 64) ? CPACF_KM_XTS_256 : 0; -- 2.38.1