Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1715764rdb; Mon, 2 Oct 2023 20:46:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEtyiJWTFFntuD+vOlq2t2FxZYFJSVaPLUuYsMAlNnS4MRmAgegaJBKVZMlWW7QuSfCK37l X-Received: by 2002:a05:6870:5622:b0:1dd:4271:3a88 with SMTP id m34-20020a056870562200b001dd42713a88mr14477858oao.58.1696304766097; Mon, 02 Oct 2023 20:46:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696304766; cv=none; d=google.com; s=arc-20160816; b=JoGDFBTzde3PhKPe831mHoyovb5K03Nhrlxnyx8YOPOK1GdGYEoVaZKibLUdtbJrew uLbSBFaelbX4zpsxtQ1X/qSPFaJY5mO73RnIdo0UXagn7G2z9Kw6hREgrSKFyJWcuNDK yEQ+9JBrRRJwzLWXZf9FbEcPBhn3LTm9yVmGO43ZkWIaj2js/weYa1sJ0d83yLEf9f8/ GCcMqbs1hKFteHMOlE/XYDWTd2Hmf0STX3c21Kb/M9OaSWi99k4QRbQ75f1R02hooC04 SI3IiFGwXNP3qYY9yXxHwiDWnsQ+Agge/U9sIjBPtjHBfUbbhfQ8uUXyaxr8p5izKunB 5znA== 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; bh=1i9eG8Y6fUXms60F7DioxzLI8iPky/7KZmWhjYPRG6E=; fh=l82EBe4859Giv8r8zr9oFIexxRwnYkkBFWiaDDuu954=; b=OcbsqCF4vvawsTgqd+KML7V0BR9Qdbl2yZ/vz///nEHLRRe3ySAiwQW3EU4Vn+qySz /3S1jX1zbJ7eFWs315ARq1F/QRBxouKBoblnZJiTorkiNEXFC0pUQbPbP5NOm7x/z7KY pKqMwKbvgolJpoMpxmYTCZx8u0rl7KPnj+DQOhMR32H9h8uk6XqyLXAPNxVIqepRj+vt k3AaE7I7gh1B7JRhNV2aMFHlOWYYTkOg85EvbZsjfNMuVH8cQonN/aiOtjbdhzt4smU5 bSIYPte+OtUnHDb0YhBqbQ0Nw71oJAJZsEm9MW13YOG+5ALROqN1TGzFnkN8e+u3g3Rx 26tg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id bt26-20020a63291a000000b0057c3fe0131dsi135487pgb.30.2023.10.02.20.46.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 20:46:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id D6CEE8076D30; Mon, 2 Oct 2023 20:45:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239055AbjJCDpK (ORCPT + 99 others); Mon, 2 Oct 2023 23:45:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238022AbjJCDo4 (ORCPT ); Mon, 2 Oct 2023 23:44:56 -0400 Received: from abb.hmeau.com (abb.hmeau.com [144.6.53.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03564C6 for ; Mon, 2 Oct 2023 20:44:52 -0700 (PDT) Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1qnWL1-002wUR-7C; Tue, 03 Oct 2023 11:44:48 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Tue, 03 Oct 2023 11:44:51 +0800 From: Herbert Xu To: Linux Crypto Mailing List Cc: Shinichiro Kawasaki , Herbert Xu Subject: [PATCH 15/16] crypto: xts - Only access common skcipher fields on spawn Date: Tue, 3 Oct 2023 11:43:32 +0800 Message-Id: <20231003034333.1441826-16-herbert@gondor.apana.org.au> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231003034333.1441826-1-herbert@gondor.apana.org.au> References: <20231003034333.1441826-1-herbert@gondor.apana.org.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 02 Oct 2023 20:45:11 -0700 (PDT) As skcipher spawns may be of the type lskcipher, only the common fields may be accessed. This was already the case but use the correct helpers to make this more obvious. Signed-off-by: Herbert Xu --- crypto/xts.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crypto/xts.c b/crypto/xts.c index 548b302c6c6a..9237b1433367 100644 --- a/crypto/xts.c +++ b/crypto/xts.c @@ -338,9 +338,9 @@ static void xts_free_instance(struct skcipher_instance *inst) static int xts_create(struct crypto_template *tmpl, struct rtattr **tb) { + struct skcipher_alg_common *alg; struct skcipher_instance *inst; struct xts_instance_ctx *ctx; - struct skcipher_alg *alg; const char *cipher_name; u32 mask; int err; @@ -375,13 +375,13 @@ static int xts_create(struct crypto_template *tmpl, struct rtattr **tb) if (err) goto err_free_inst; - alg = crypto_skcipher_spawn_alg(&ctx->spawn); + alg = crypto_spawn_skcipher_alg_common(&ctx->spawn); err = -EINVAL; if (alg->base.cra_blocksize != XTS_BLOCK_SIZE) goto err_free_inst; - if (crypto_skcipher_alg_ivsize(alg)) + if (alg->ivsize) goto err_free_inst; err = crypto_inst_setname(skcipher_crypto_instance(inst), "xts", @@ -421,8 +421,8 @@ static int xts_create(struct crypto_template *tmpl, struct rtattr **tb) (__alignof__(u64) - 1); inst->alg.ivsize = XTS_BLOCK_SIZE; - inst->alg.min_keysize = crypto_skcipher_alg_min_keysize(alg) * 2; - inst->alg.max_keysize = crypto_skcipher_alg_max_keysize(alg) * 2; + inst->alg.min_keysize = alg->min_keysize * 2; + inst->alg.max_keysize = alg->max_keysize * 2; inst->alg.base.cra_ctxsize = sizeof(struct xts_tfm_ctx); -- 2.39.2