Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1716484rdb; Mon, 2 Oct 2023 20:48:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFXc9f8OZoJmODNxWRCP75SLJww0cjGQDm0bNtazMMqVQ7zmTLftLyOuNGfwwx4ur5XCqAP X-Received: by 2002:a05:6a00:3a20:b0:690:d0d4:b757 with SMTP id fj32-20020a056a003a2000b00690d0d4b757mr15401113pfb.20.1696304918974; Mon, 02 Oct 2023 20:48:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696304918; cv=none; d=google.com; s=arc-20160816; b=f0JD/63R8ZMH7qaf5TJZNyV+Q41n+4KS4zCoe8pGZzFTzcB4Y/m3ShxozEtbhqw4r7 EOlIO3sfCjlEjPaxlD8QaFWa8NXOrBOtm+rDpySX6mJUGBQ/rZkk32Dd1k/lE3mvHSJ8 B1Ur8Odnapgg5HdbyT95nwzBl3IVRZVt0J75Rsi8x10bRuN9JtLTY7AOqXx4fHsqXeKV EOPxTDjpcDmjAi4V2ghtEA8UCp8b3Qqtga4tLKibdr19D0JuQ6y16jcF7hvZ1NZuiX4p MKvaYUR8RH+jM4xwznEIieiNSyxZ7YgmkH/ec/hx8RRKNl1FhZJZfInXaWSZAGsLINzG I50g== 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=GEAHW1dMXO9XHfBzzDRzfpxJ0e+Z8OBW/wD2Ch4PXrk=; fh=l82EBe4859Giv8r8zr9oFIexxRwnYkkBFWiaDDuu954=; b=SzHtvwMElQNbmzIwHf2HTXWN2XP5hz7SMmX05AaNNCcnQ2589pTgGKYSiGZshBFabx PyWvbX5qAH0huM39PJ9bV+s0r+81g4vjRH+V0H6Q39R8x25xAxOoWpa56smyEm942GYX U17Y5n+obSE4yOJBcqmUx9i0EkuBeE8GIB6Ck8afx16Y0YwHG2fpRsREj5MVw4aEwJSx zXWUWZyywUHTmEg4XNEooE42d9E2kgFoCZ14UdmocU3vZnG/1BnZgb5VrpzURs0B5Y9k Y7uuw89A/bz0T+t7pChJqHlpkfSUDv/Cf6GcRBE5FJfRQ4N2zLm2ykyCg74qVg9Dcggx o4lw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id cd6-20020a056a00420600b00690fc88e4acsi525668pfb.228.2023.10.02.20.48.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 20:48:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id C5E0D807C5CB; Mon, 2 Oct 2023 20:48:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230099AbjJCDsZ (ORCPT + 99 others); Mon, 2 Oct 2023 23:48:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230144AbjJCDos (ORCPT ); Mon, 2 Oct 2023 23:44:48 -0400 Received: from abb.hmeau.com (abb.hmeau.com [144.6.53.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68E8ABF for ; Mon, 2 Oct 2023 20:44:45 -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 1qnWKu-002wRu-Jm; Tue, 03 Oct 2023 11:44:41 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Tue, 03 Oct 2023 11:44:44 +0800 From: Herbert Xu To: Linux Crypto Mailing List Cc: Shinichiro Kawasaki , Herbert Xu Subject: [PATCH 09/16] crypto: chacha20poly1305 - Only access common skcipher fields on spawn Date: Tue, 3 Oct 2023 11:43:26 +0800 Message-Id: <20231003034333.1441826-10-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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 02 Oct 2023 20:48:36 -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/chacha20poly1305.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crypto/chacha20poly1305.c b/crypto/chacha20poly1305.c index 3a905c5d8f53..0e2e208d98f9 100644 --- a/crypto/chacha20poly1305.c +++ b/crypto/chacha20poly1305.c @@ -558,7 +558,7 @@ static int chachapoly_create(struct crypto_template *tmpl, struct rtattr **tb, u32 mask; struct aead_instance *inst; struct chachapoly_instance_ctx *ctx; - struct skcipher_alg *chacha; + struct skcipher_alg_common *chacha; struct hash_alg_common *poly; int err; @@ -579,7 +579,7 @@ static int chachapoly_create(struct crypto_template *tmpl, struct rtattr **tb, crypto_attr_alg_name(tb[1]), 0, mask); if (err) goto err_free_inst; - chacha = crypto_spawn_skcipher_alg(&ctx->chacha); + chacha = crypto_spawn_skcipher_alg_common(&ctx->chacha); err = crypto_grab_ahash(&ctx->poly, aead_crypto_instance(inst), crypto_attr_alg_name(tb[2]), 0, mask); @@ -591,7 +591,7 @@ static int chachapoly_create(struct crypto_template *tmpl, struct rtattr **tb, if (poly->digestsize != POLY1305_DIGEST_SIZE) goto err_free_inst; /* Need 16-byte IV size, including Initial Block Counter value */ - if (crypto_skcipher_alg_ivsize(chacha) != CHACHA_IV_SIZE) + if (chacha->ivsize != CHACHA_IV_SIZE) goto err_free_inst; /* Not a stream cipher? */ if (chacha->base.cra_blocksize != 1) @@ -615,7 +615,7 @@ static int chachapoly_create(struct crypto_template *tmpl, struct rtattr **tb, inst->alg.base.cra_ctxsize = sizeof(struct chachapoly_ctx) + ctx->saltlen; inst->alg.ivsize = ivsize; - inst->alg.chunksize = crypto_skcipher_alg_chunksize(chacha); + inst->alg.chunksize = chacha->chunksize; inst->alg.maxauthsize = POLY1305_DIGEST_SIZE; inst->alg.init = chachapoly_init; inst->alg.exit = chachapoly_exit; -- 2.39.2