Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1716464rdb; Mon, 2 Oct 2023 20:48:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGaVlsPXXD7LdB+UwgBVfVYW3prDNsxHeWrmneQNUpmrUuUoTBGOpayOcrsNQHIdKLBTCF1 X-Received: by 2002:a05:6a00:148f:b0:690:c1a6:1c3b with SMTP id v15-20020a056a00148f00b00690c1a61c3bmr14902118pfu.33.1696304915864; Mon, 02 Oct 2023 20:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696304915; cv=none; d=google.com; s=arc-20160816; b=yAopPSDHHIaD8vUtNk95cn59lcplO43m1wjp9u+KBk42HiHhThq5CgAQfMC59SaIYw L6D0B3KLdJkJeJ0s54z80MPDoTw0vTa/cmB55w13HoLveYMpkBELKaHhg8GsgaG9+cMs nyomvBXJE25OTZrfQx4dduFZn3ZEq2NGwAa0m5uKOAaZyqQgTxvoM6Qs4Od53nD7jVef OKHL44wch8+QH3XPT/iWKcXKCAGadMEP0YPb2VzZpCI86Co0lyb3am+EeRSCrTVYvSYT cJps16BYkFAQ5/GLKCD2xqqa2ZXboc3bY3tTYWw0RNJIsPU4lisst4CHByBzKhCgxmWa DLtg== 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=Awie5s+9mXlyNKezxyElnAeotCyYG0b560tVWz19j1A=; fh=l82EBe4859Giv8r8zr9oFIexxRwnYkkBFWiaDDuu954=; b=teL1k8YrACNQc/M2rIl8iy8/4m1SqCFddTHodGG3UDjRSRkCs/0pu6L3I4MflCoL6D wBQ3NQ1W82NW6Y/pBcWm32zv//O8cEefQLXNe4iTr3POJiM583viOGmAdz1dL0QnaXxc V4sNfxDDdDqhcVKoNrH0bHsUQLfn6w4S0pTQh2mY39iq26U1rBH/v534zuFFcndG+kp0 B2svyEh4qSz9HgLi4oZi7om1qq0cwBLJgN6Bv9sb8ESo4bZ6n7/LA0dCvnJj8dQ1VnHa Hg4omdihC8Fv5FPMr2fURBYCa9Z7E+sYhKe5VMP+tPKU4oxwZDKD/Oo+QKtrNn/5lPUQ Vajg== 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 u11-20020a6540cb000000b0057745535158si522336pgp.181.2023.10.02.20.48.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 20:48:35 -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 BE9CC807C5CB; Mon, 2 Oct 2023 20:48:33 -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 S229437AbjJCDsY (ORCPT + 99 others); Mon, 2 Oct 2023 23:48:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239026AbjJCDos (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 30507C4 for ; Mon, 2 Oct 2023 20:44:44 -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 1qnWKt-002wRa-Fl; Tue, 03 Oct 2023 11:44:40 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Tue, 03 Oct 2023 11:44:43 +0800 From: Herbert Xu To: Linux Crypto Mailing List Cc: Shinichiro Kawasaki , Herbert Xu Subject: [PATCH 08/16] crypto: ccm - Only access common skcipher fields on spawn Date: Tue, 3 Oct 2023 11:43:25 +0800 Message-Id: <20231003034333.1441826-9-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:33 -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/ccm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crypto/ccm.c b/crypto/ccm.c index a9453129c51c..7af89a5b745c 100644 --- a/crypto/ccm.c +++ b/crypto/ccm.c @@ -447,10 +447,10 @@ static int crypto_ccm_create_common(struct crypto_template *tmpl, const char *ctr_name, const char *mac_name) { + struct skcipher_alg_common *ctr; u32 mask; struct aead_instance *inst; struct ccm_instance_ctx *ictx; - struct skcipher_alg *ctr; struct hash_alg_common *mac; int err; @@ -478,13 +478,12 @@ static int crypto_ccm_create_common(struct crypto_template *tmpl, ctr_name, 0, mask); if (err) goto err_free_inst; - ctr = crypto_spawn_skcipher_alg(&ictx->ctr); + ctr = crypto_spawn_skcipher_alg_common(&ictx->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; /* ctr and cbcmac must use the same underlying block cipher. */ @@ -507,7 +506,7 @@ static int crypto_ccm_create_common(struct crypto_template *tmpl, inst->alg.base.cra_alignmask = mac->base.cra_alignmask | ctr->base.cra_alignmask; inst->alg.ivsize = 16; - inst->alg.chunksize = crypto_skcipher_alg_chunksize(ctr); + inst->alg.chunksize = ctr->chunksize; inst->alg.maxauthsize = 16; inst->alg.base.cra_ctxsize = sizeof(struct crypto_ccm_ctx); inst->alg.init = crypto_ccm_init_tfm; -- 2.39.2