Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1715426rdb; Mon, 2 Oct 2023 20:44:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHSfd7/BFK9NNuPvW55DpCIYifzKZ3yuGXPrfUn8omVheKcIzN9KL36vXVCeJeqJFlw3qsu X-Received: by 2002:a05:6808:1511:b0:3a7:2d4c:5d4e with SMTP id u17-20020a056808151100b003a72d4c5d4emr16515039oiw.7.1696304693615; Mon, 02 Oct 2023 20:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696304693; cv=none; d=google.com; s=arc-20160816; b=WKJjtU6iRl4HDSwRzHqPyiu8VFm72/poj16XeSrP8MuaT/qJEqXS+yYiMZwbMw1feE nSeJ/iDEXK8UmKPKj4X7FgPrICzz4WHS+A7wNftW4UBKTw15HxLzU63T9hFNEjaOoORb FjlLQokyG4xxY1pvcyOj0DZNsxlOudD4UBNukVQqgp3w6nivjzHPGK7A/i4Edug2KWcR Hu7q/Y/twr96wmzuWKKVbgjjMxT0+7JfLuCDkhQB7MwFj9lIW+ZbTmOwYP9dSmO9ebdL x8yszC9mV2uuKmp+TBiCz2MxskuFP0BtahK2d7y6H+l//RtpJKkC/rhOG0oitC/GLLYA 8M6Q== 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=7I+UDZfZEHYXbV0sRxfUWdzavR7sgzgBXuJlUI1MGpA=; fh=l82EBe4859Giv8r8zr9oFIexxRwnYkkBFWiaDDuu954=; b=V9WJy/u0vvAvk3BcYYk8D1YCD/ybL1w+ezZZN4Dc/NavDZ21lyynN4Op1Kjkq6KEBL H9t2iHE31LvGIxmXybdQuDaJjuVe/GCxTLiaZuUm7BbYxBYXpdLIdSTh2yLolPM0FYtU BQNTSC5MEbxvN5rn5n4PqzQSgAB+R2gXYbxEVtYTD23g9lniVXfFn3ELHfR8FpgIrS1F 8bgrqbU4vM5Y+1qRDBuFkL+ovpadX8ND9DI4Yy4wc+ym8fgZi8Rn1yG4INGPOPTkZ5hs zz5UZVYrpmZC4sFKtC2OIdLzEKzL4Mf5en0NmASZyxiS7auCxIkV4aigevQBllPfobuS Ga+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id dw12-20020a056a00368c00b00690bd5a0bccsi530473pfb.363.2023.10.02.20.44.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 20:44:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id D77D380C4D6F; Mon, 2 Oct 2023 20:44:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230129AbjJCDow (ORCPT + 99 others); Mon, 2 Oct 2023 23:44:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230153AbjJCDov (ORCPT ); Mon, 2 Oct 2023 23:44:51 -0400 Received: from abb.hmeau.com (abb.hmeau.com [144.6.53.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC6F8C6 for ; Mon, 2 Oct 2023 20:44:48 -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 1qnWKx-002wTN-U2; Tue, 03 Oct 2023 11:44:44 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Tue, 03 Oct 2023 11:44:47 +0800 From: Herbert Xu To: Linux Crypto Mailing List Cc: Shinichiro Kawasaki , Herbert Xu Subject: [PATCH 12/16] crypto: gcm - Only access common skcipher fields on spawn Date: Tue, 3 Oct 2023 11:43:29 +0800 Message-Id: <20231003034333.1441826-13-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=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham 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-crypto@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 02 Oct 2023 20:44:53 -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/gcm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crypto/gcm.c b/crypto/gcm.c index 4ba624450c3f..91ce6e0e2afc 100644 --- a/crypto/gcm.c +++ b/crypto/gcm.c @@ -576,10 +576,10 @@ static int crypto_gcm_create_common(struct crypto_template *tmpl, const char *ctr_name, const char *ghash_name) { + struct skcipher_alg_common *ctr; u32 mask; struct aead_instance *inst; struct gcm_instance_ctx *ctx; - struct skcipher_alg *ctr; struct hash_alg_common *ghash; int err; @@ -607,13 +607,12 @@ static int crypto_gcm_create_common(struct crypto_template *tmpl, ctr_name, 0, mask); if (err) goto err_free_inst; - ctr = crypto_spawn_skcipher_alg(&ctx->ctr); + ctr = crypto_spawn_skcipher_alg_common(&ctx->ctr); /* The skcipher algorithm must be CTR mode, using 16-byte blocks. */ err = -EINVAL; if (strncmp(ctr->base.cra_name, "ctr(", 4) != 0 || - crypto_skcipher_alg_ivsize(ctr) != 16 || - ctr->base.cra_blocksize != 1) + ctr->ivsize != 16 || ctr->base.cra_blocksize != 1) goto err_free_inst; err = -ENAMETOOLONG; @@ -634,7 +633,7 @@ static int crypto_gcm_create_common(struct crypto_template *tmpl, ctr->base.cra_alignmask; inst->alg.base.cra_ctxsize = sizeof(struct crypto_gcm_ctx); inst->alg.ivsize = GCM_AES_IV_SIZE; - inst->alg.chunksize = crypto_skcipher_alg_chunksize(ctr); + inst->alg.chunksize = ctr->chunksize; inst->alg.maxauthsize = 16; inst->alg.init = crypto_gcm_init_tfm; inst->alg.exit = crypto_gcm_exit_tfm; -- 2.39.2