Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1715491rdb; Mon, 2 Oct 2023 20:45:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IELRXbOIzhTuzuh9a8Jh9dgS84niEx29V7IvULLkeGyZEWV2YFWky1+75DQXoQv4326QdTS X-Received: by 2002:a05:6871:54b:b0:1d4:d016:229f with SMTP id t11-20020a056871054b00b001d4d016229fmr14119431oal.10.1696304708609; Mon, 02 Oct 2023 20:45:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696304708; cv=none; d=google.com; s=arc-20160816; b=AgE4luBFkOFujzFFv5llhg6wiV19epVjWHo8juDh79Y5wdCkMnNglFtqbs9gwnWndq 296ORt1zBRRJwk17yMg8kBhoG65KWBsqpty6+MeHReYErjZts0bYoNin6vaLUbam5zvW AQFEmv+LNBRQSt7z6e3x1RK+KcFHc3wBxbJf/oCHAiRGXY72j5i+YQtprqNIz/Advpz/ YHWy0D369JvT0YAyOXuNO/jBiCKzOa9YV9iz2emtqV45lPaVHrzP+J5WRN9z0S0fM49f sj7SA0B57Mi8vJjgt6hYHkWkSI1iHKu5hyMhivUgIT83abyU/qT7kyi95/8r6W7Af8HX 9gOA== 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=pR1mtIegAf/Mn/S370LQ8ImQrG6cbj+RMOSuTY6P1yU=; fh=l82EBe4859Giv8r8zr9oFIexxRwnYkkBFWiaDDuu954=; b=HG5kmQRNDF+sAcpdRot0HRU0kzadFFHaixEpbcSvVAm7IGVLIe/xaGVSSd1vPMsDEf OoIO/dKCQ5lGpfa+l8CAwPuPDn3OXX9aMzJSItRT725bPmln8rO1tbvhJ/ZBuAnHj/ec LEQvZ1baa6xsqTtKcls/SmcBdOCYSlmenFRTWec5qDe4FMQWNuHK2AsxfdBsO1RxdmKq gr34sYDG8gGQdifCvSc7bB60CS0V4khK25nVRea9tZ7l4sVEfgmQgR03LAlSLmGXoGuJ 5MoSDy22l3iK6pxBVTWrE8ONCm7KmR6dULgd/sRalREmYPTocsSs6nlGR9N/SEeEurGJ HwfQ== 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 s30-20020a63925e000000b00578e2b20624si529826pgn.72.2023.10.02.20.45.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 20:45:08 -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 2112A801BA6F; Mon, 2 Oct 2023 20:45:04 -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 S230133AbjJCDo5 (ORCPT + 99 others); Mon, 2 Oct 2023 23:44:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230146AbjJCDoy (ORCPT ); Mon, 2 Oct 2023 23:44:54 -0400 Received: from abb.hmeau.com (abb.hmeau.com [144.6.53.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB807B7 for ; Mon, 2 Oct 2023 20:44:50 -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 1qnWL0-002wUF-4g; Tue, 03 Oct 2023 11:44:47 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Tue, 03 Oct 2023 11:44:50 +0800 From: Herbert Xu To: Linux Crypto Mailing List Cc: Shinichiro Kawasaki , Herbert Xu Subject: [PATCH 14/16] crypto: lrw - Only access common skcipher fields on spawn Date: Tue, 3 Oct 2023 11:43:31 +0800 Message-Id: <20231003034333.1441826-15-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:04 -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/lrw.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/crypto/lrw.c b/crypto/lrw.c index 59260aefed28..e216fbf2b786 100644 --- a/crypto/lrw.c +++ b/crypto/lrw.c @@ -299,8 +299,8 @@ static void lrw_free_instance(struct skcipher_instance *inst) static int lrw_create(struct crypto_template *tmpl, struct rtattr **tb) { struct crypto_skcipher_spawn *spawn; + struct skcipher_alg_common *alg; struct skcipher_instance *inst; - struct skcipher_alg *alg; const char *cipher_name; char ecb_name[CRYPTO_MAX_ALG_NAME]; u32 mask; @@ -336,13 +336,13 @@ static int lrw_create(struct crypto_template *tmpl, struct rtattr **tb) if (err) goto err_free_inst; - alg = crypto_skcipher_spawn_alg(spawn); + alg = crypto_spawn_skcipher_alg_common(spawn); err = -EINVAL; if (alg->base.cra_blocksize != LRW_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), "lrw", @@ -382,10 +382,8 @@ static int lrw_create(struct crypto_template *tmpl, struct rtattr **tb) (__alignof__(be128) - 1); inst->alg.ivsize = LRW_BLOCK_SIZE; - inst->alg.min_keysize = crypto_skcipher_alg_min_keysize(alg) + - LRW_BLOCK_SIZE; - inst->alg.max_keysize = crypto_skcipher_alg_max_keysize(alg) + - LRW_BLOCK_SIZE; + inst->alg.min_keysize = alg->min_keysize + LRW_BLOCK_SIZE; + inst->alg.max_keysize = alg->max_keysize + LRW_BLOCK_SIZE; inst->alg.base.cra_ctxsize = sizeof(struct lrw_tfm_ctx); -- 2.39.2