From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F1F7BC433F5 for ; Mon, 2 May 2022 18:26:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8/wnMfJTW6QC5Pxs3jZMEWZ8p3QaF5YguP2mGwziMjs=; b=2Pq0S1zZIpfgEJ RQEPQEEW+bf1alu2yfKp3OX+JaH91sU2FjdHuwGOYAPEbgY5WizoDmes5ua7mfqpWrr/ZvHWDMCsG l8cwg0tEtBlsn5ZTepb8e5S6WVd9HjT7r584yiNY5bgYAVPfhmcpNN6FO2Ad7n7V3Z+DTyN7NZkWZ QwrlbfFA2DSV6jVu/3M/gvaw+gTXH7G8zcaPdLRsph5lYm1MUMXC0jlhkJwjYgetumxJm4dQMOP2V t89JhocJs+WuJai+/JRj6gsuOpJR6X+UKWfL3wYkh/qBptonXu7yEy9n1JLbJlr1y56hCPrqEew8+ 8yxCybhwH8D7BKtE7rNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlak3-002BmL-Qk; Mon, 02 May 2022 18:25:51 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlajz-002BlE-Vt for linux-arm-kernel@lists.infradead.org; Mon, 02 May 2022 18:25:49 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4CE1861418; Mon, 2 May 2022 18:25:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C510C385AC; Mon, 2 May 2022 18:25:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651515946; bh=ncTCFSyVR5oNOKxDNDoyId0YCv+2m5GgxZbKB3yRx98=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ca81ZNr2MXyjSUqFZt3V5H3ygFJkmdDLzSaY5UmJC+ay8JCRxVjIUBBTCGdjVoVsC 02LCmZVEGBtsD5R5ps4R5LLcVLIUG95A2R08pKHozuCcC5lOpvlCseqlxEd1UmdZGL XmtbhnkWfJPqk6x8F5qeVr2EPNV2gmmgmPOegL0SH8HaY5nQ8BFrm76i2ckDTAZDFF ul5HSA21tNDQWo/SHCqdAhEo/l+3bMJafeO9Rwupr9YbuDJqk6rwXwe9zaA36k7uVd 5Xx/pimakatwjIL0GU2nLh5EQpuYyJT2vo2/p0NfnDCZnm99nL72ZA2u0FCZcBlMEZ PdqoFbABoqXnQ== Date: Mon, 2 May 2022 11:25:44 -0700 From: Eric Biggers To: Nathan Huckleberry Cc: linux-crypto@vger.kernel.org, linux-fscrypt.vger.kernel.org@google.com, Herbert Xu , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Paul Crowley , Sami Tolvanen , Ard Biesheuvel Subject: Re: [PATCH v5 3/8] crypto: hctr2 - Add HCTR2 support Message-ID: References: <20220427003759.1115361-1-nhuck@google.com> <20220427003759.1115361-4-nhuck@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220427003759.1115361-4-nhuck@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220502_112548_100653_D0EAF254 X-CRM114-Status: GOOD ( 13.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Apr 27, 2022 at 12:37:54AM +0000, Nathan Huckleberry wrote: > +static int hctr2_create_common(struct crypto_template *tmpl, > + struct rtattr **tb, > + const char *xctr_name, > + const char *polyval_name) > +{ > + u32 mask; > + struct skcipher_instance *inst; > + struct hctr2_instance_ctx *ictx; > + struct skcipher_alg *xctr_alg; > + struct crypto_alg *blockcipher_alg; > + struct shash_alg *polyval_alg; > + char blockcipher_name[CRYPTO_MAX_ALG_NAME]; > + int len; > + int err; > + > + err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_SKCIPHER, &mask); > + if (err) > + return err; > + > + inst = kzalloc(sizeof(*inst) + sizeof(*ictx), GFP_KERNEL); > + if (!inst) > + return -ENOMEM; > + ictx = skcipher_instance_ctx(inst); > + > + /* Stream cipher, xctr(block_cipher) */ > + err = crypto_grab_skcipher(&ictx->xctr_spawn, > + skcipher_crypto_instance(inst), > + xctr_name, 0, mask); > + if (err) > + goto err_free_inst; > + xctr_alg = crypto_spawn_skcipher_alg(&ictx->xctr_spawn); > + > + err = -EINVAL; > + if (strncmp(xctr_alg->base.cra_name, "xctr(", 5)) > + goto err_free_inst; > + len = strscpy(blockcipher_name, xctr_name + 5, > + sizeof(blockcipher_name)); Found a bug here; 'xctr_name' in the strscpy() statement needs to be xctr_alg->base.cra_name. Otherwise something like 'hctr2_base(xctr-aes-aesni,polyval-clmulni)' doesn't work, as it will try to extract the block cipher name from the driver name "xctr-aes-aesni" instead of from the algorithm name "xctr(aes)" as intended. - Eric _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel