Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1715438rdb; Mon, 2 Oct 2023 20:44:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHt4I6xy5el8nr73c94MUNKH1gDeiub9MW1Lu1/ad4CZmryIwTkS0WKiVDIIdGCQ3v4bWWG X-Received: by 2002:a17:903:230c:b0:1c7:26ea:b220 with SMTP id d12-20020a170903230c00b001c726eab220mr14288001plh.18.1696304694627; Mon, 02 Oct 2023 20:44:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696304694; cv=none; d=google.com; s=arc-20160816; b=BVedh1YaJw69QewtrssbnjBZ4plWD0WzpJdpAeyOm1Yxey/LLdOxslrivzBs/oI2IW Gefj7wtYd43HuYAIpKreCP22P747ap+ZYWgHdc2/aqvJ2O71amMWqTLAitSAyCDJgMX3 xI+PYjGz/m38r6kyQ12wNncSz7FirtVM9cYo0OZpdNC+RJZX/qeqcAycvB0awszA0fAH o4qTAdBvveRT6kbJ0X0u2TuAzx0kmQ3XuPA030xkn+TBulXSSqt2AlfBvSdBTSLgDptX hQyOqKUiIyB53MHSoymvRikHvn0w3F5gKL7vK0FGRljOMCJmnyP96YztOjMncHtyrQGK nOuw== 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=R/WNJTOJar2xPBOuN6zPmvBC/S9Wc+bYlR6tCm4VFbk=; fh=l82EBe4859Giv8r8zr9oFIexxRwnYkkBFWiaDDuu954=; b=gZBS+Fqq4OJGwz/Y46dgxYAvgc1OO2/kTuiVBjOI7VZjntGcnEpklTjtEzIb7i38g0 S+Agdl5t+OkcQVTsOFkZXlDA2FhaoeUviyS2dwq0KRuP/po2TYxy/lxKVd4VfBehJHgA 619CNQSrOIZw9B2oYy720zdAgnv0yLxhWyxa0VzrUsLg6WyeHxSIMv1wiKOpwLOfp26l UZirOYffmSvnl/eCyh/BPRo+14+eeO/MArC77u4gF6TNnQBJivpo6qXVJX0D1DXN44u5 6dszHyNLgLJqh6Zj1EXsUu0F/YY1iWuQV7BOVX6M1WWO0CFPZgVo/WXr2Kx2p+8nMeMX IgLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id l13-20020a170902f68d00b001b8b4330585si511057plg.510.2023.10.02.20.44.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 20:44:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:6 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 A71C9801BCB5; Mon, 2 Oct 2023 20:44:51 -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 S230154AbjJCDov (ORCPT + 99 others); Mon, 2 Oct 2023 23:44:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230126AbjJCDou (ORCPT ); Mon, 2 Oct 2023 23:44:50 -0400 Received: from abb.hmeau.com (abb.hmeau.com [144.6.53.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75C11CE for ; Mon, 2 Oct 2023 20:44:46 -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 1qnWKv-002wSR-Nt; Tue, 03 Oct 2023 11:44:42 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Tue, 03 Oct 2023 11:44:45 +0800 From: Herbert Xu To: Linux Crypto Mailing List Cc: Shinichiro Kawasaki , Herbert Xu Subject: [PATCH 10/16] crypto: ctr - Only access common skcipher fields on spawn Date: Tue, 3 Oct 2023 11:43:27 +0800 Message-Id: <20231003034333.1441826-11-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:44:52 -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/ctr.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/crypto/ctr.c b/crypto/ctr.c index 23c698b22013..1420496062d5 100644 --- a/crypto/ctr.c +++ b/crypto/ctr.c @@ -258,8 +258,8 @@ static int crypto_rfc3686_create(struct crypto_template *tmpl, struct rtattr **tb) { struct skcipher_instance *inst; - struct skcipher_alg *alg; struct crypto_skcipher_spawn *spawn; + struct skcipher_alg_common *alg; u32 mask; int err; @@ -278,11 +278,11 @@ static int crypto_rfc3686_create(struct crypto_template *tmpl, if (err) goto err_free_inst; - alg = crypto_spawn_skcipher_alg(spawn); + alg = crypto_spawn_skcipher_alg_common(spawn); /* We only support 16-byte blocks. */ err = -EINVAL; - if (crypto_skcipher_alg_ivsize(alg) != CTR_RFC3686_BLOCK_SIZE) + if (alg->ivsize != CTR_RFC3686_BLOCK_SIZE) goto err_free_inst; /* Not a stream cipher? */ @@ -303,11 +303,9 @@ static int crypto_rfc3686_create(struct crypto_template *tmpl, inst->alg.base.cra_alignmask = alg->base.cra_alignmask; inst->alg.ivsize = CTR_RFC3686_IV_SIZE; - inst->alg.chunksize = crypto_skcipher_alg_chunksize(alg); - inst->alg.min_keysize = crypto_skcipher_alg_min_keysize(alg) + - CTR_RFC3686_NONCE_SIZE; - inst->alg.max_keysize = crypto_skcipher_alg_max_keysize(alg) + - CTR_RFC3686_NONCE_SIZE; + inst->alg.chunksize = alg->chunksize; + inst->alg.min_keysize = alg->min_keysize + CTR_RFC3686_NONCE_SIZE; + inst->alg.max_keysize = alg->max_keysize + CTR_RFC3686_NONCE_SIZE; inst->alg.setkey = crypto_rfc3686_setkey; inst->alg.encrypt = crypto_rfc3686_crypt; -- 2.39.2