From patchwork Wed Dec 21 22:41:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladis Dronov X-Patchwork-Id: 35559 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp28254wrn; Wed, 21 Dec 2022 15:07:50 -0800 (PST) X-Google-Smtp-Source: AMrXdXvcvtGn/Yj2XTJSiseO5Nf6A8BVaxN8f5nB8XZeFr0L4G0uMPskMS14IKkWWeQZX7V9WV2J X-Received: by 2002:a17:902:d303:b0:189:b3bf:c0b5 with SMTP id b3-20020a170902d30300b00189b3bfc0b5mr3730322plc.34.1671664070356; Wed, 21 Dec 2022 15:07:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671664070; cv=none; d=google.com; s=arc-20160816; b=p2ZdQO3yvMXFVzbYjFWVyjTMsiGvxGStqlqUFZ5sr8OwzSEGpU4XX5v27yPJfNPuh3 6nwpH+PYzZCihmYvJ0bS1V6SwbTvKDlFsJy5SlhBMVOtLVrJmaLMJiqzIdEPpODMit2p OF23izmghBrx0vNkWC5O+u6yD23L4iICJf/pdeQaAqHmUf3D8dbwMA2i9OXlJT04pnJu +ezYuDQJWrWTxwPBF8P6fZXlpEjS5vrCJpteLbizJP5+BfZ6EtLiPUMd2GDJI7tMGCnj AcYpTsQq09ryOiYcKmvbK2ASSbDaHzBG9R43t5fYD/dkyQM2FWgKCkM7uiWAA0dDX4YU GF/g== 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=kwfJcVBxWNMAZYpPSPCoOdNBGIp3nX0+9louWAKvFDk=; b=RHHhRFL5JOw6tbL1+d5vObktPHYp+6qHogxCFmQzA3wBZVtP5gAA6d81RRAALN3IZ2 DGxi0ydOLNn9p+utFH7ihEcEszk6b0aG/rQNbRzl5bUGgHcflWxOqAamk0mGO1a8+ipw K3ABTskGgvAKfUV/5coftcfE7CBvNUZWzwD7ARvJM6sVEIIY/LZIi8ab5L7t2I//FFgu A1gu/QdVScydkk8O1wSVsk7eJxm6GPwaTAaDv7NtRvDHlUiYeJvp1qVd7KXtKkwjtJry RlEcjMCx8+URx1b1ZrMK0WQhj7MvAdN68mLi8ytD/9DI7i5cplS62B5HeA0v58hGLXok Z/dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bL9g5tse; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h7-20020a170902704700b00189eaaea1basi16304602plt.552.2022.12.21.15.07.12; Wed, 21 Dec 2022 15:07:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=bL9g5tse; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235229AbiLUWnI (ORCPT + 99 others); Wed, 21 Dec 2022 17:43:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235155AbiLUWmx (ORCPT ); Wed, 21 Dec 2022 17:42:53 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BDBCCD0 for ; Wed, 21 Dec 2022 14:42:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671662529; 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=kwfJcVBxWNMAZYpPSPCoOdNBGIp3nX0+9louWAKvFDk=; b=bL9g5tse5QJ2+wYe/PbYBnXc0qgCssyPLFVPZ49reXTA8uNPaJaHEoV0ckSOJzF0KBDw47 2Ls/EOcEGcEyR/JaLX2z53m7B8pbgh3/FQI5p8UpumxBTXhK9L0KUlVmo9BUUuYDbj6CWW /yVAi3B6yEVAmxevX+avKcOI8AGfTe4= 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-523-2MYamv_BNpCM3A4WlGyW7A-1; Wed, 21 Dec 2022 17:42:06 -0500 X-MC-Unique: 2MYamv_BNpCM3A4WlGyW7A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DF71229AA39D; Wed, 21 Dec 2022 22:42:05 +0000 (UTC) Received: from rules.brq.redhat.com (ovpn-208-11.brq.redhat.com [10.40.208.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD71240C2064; Wed, 21 Dec 2022 22:42:03 +0000 (UTC) From: Vladis Dronov To: herbert@gondor.apana.org.au, davem@davemloft.net Cc: nstange@suse.de, elliott@hpe.com, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, smueller@chronox.de, vdronov@redhat.com Subject: [PATCH 3/6] crypto: xts - drop redundant xts key check Date: Wed, 21 Dec 2022 23:41:08 +0100 Message-Id: <20221221224111.19254-4-vdronov@redhat.com> In-Reply-To: <20221221224111.19254-1-vdronov@redhat.com> References: <20221221224111.19254-1-vdronov@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752866824479914733?= X-GMAIL-MSGID: =?utf-8?q?1752866824479914733?= 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 --- 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;