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 X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9CDCC04AB4 for ; Fri, 17 May 2019 17:51:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7468D20848 for ; Fri, 17 May 2019 17:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558115506; bh=ysAIbo/22ozqU8DB1szPTRAK2KFlDqa+HCqb4lufk5A=; h=From:To:Cc:Subject:Date:List-ID:From; b=i6vZ4TMWhIsDWZ/1zI/zkXTQsu/UkljdCeuzaqI87+zCg7OvMvhmZGG4wXgFO7tig Rwv/82FTvc08eVo77o4FKcdWHWn7D5AyiQJoYqrLr91akYL2FZirURdUvOkr3wgh9v AikU6JXSI0k8jvHFrIaetEV3m6cCLQCmLRwmpn30= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728263AbfEQRvq (ORCPT ); Fri, 17 May 2019 13:51:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:49518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725932AbfEQRvp (ORCPT ); Fri, 17 May 2019 13:51:45 -0400 Received: from ebiggers-linuxstation.mtv.corp.google.com (unknown [104.132.1.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0D1CC20815; Fri, 17 May 2019 17:51:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558115505; bh=ysAIbo/22ozqU8DB1szPTRAK2KFlDqa+HCqb4lufk5A=; h=From:To:Cc:Subject:Date:From; b=r/XUfiWlIhqNrq6uyoowbF0shQOsxUh0DR3VRokSFz/k+2ZVjrIs/+6yAr/mYJ5W3 ZNR+kYD45gBoyTOkBbP4vnknYcRIxmVBOObZOAg8++06fg/qM27Gql7Q0exEw5snP3 Yf2Umahud9bF9++A0gZUE+5uzk6fp/yVofXlOXO0= From: Eric Biggers To: stable@vger.kernel.org Cc: linux-crypto@vger.kernel.org Subject: [PATCH 4.4] crypto: chacha20poly1305 - set cra_name correctly Date: Fri, 17 May 2019 10:50:03 -0700 Message-Id: <20190517175003.118301-1-ebiggers@kernel.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Eric Biggers commit 5e27f38f1f3f45a0c938299c3a34a2d2db77165a upstream. [Please apply to 4.4-stable.] If the rfc7539 template is instantiated with specific implementations, e.g. "rfc7539(chacha20-generic,poly1305-generic)" rather than "rfc7539(chacha20,poly1305)", then the implementation names end up included in the instance's cra_name. This is incorrect because it then prevents all users from allocating "rfc7539(chacha20,poly1305)", if the highest priority implementations of chacha20 and poly1305 were selected. Also, the self-tests aren't run on an instance allocated in this way. Fix it by setting the instance's cra_name from the underlying algorithms' actual cra_names, rather than from the requested names. This matches what other templates do. Fixes: 71ebc4d1b27d ("crypto: chacha20poly1305 - Add a ChaCha20-Poly1305 AEAD construction, RFC7539") Cc: # v4.2+ Cc: Martin Willi Signed-off-by: Eric Biggers Reviewed-by: Martin Willi Signed-off-by: Herbert Xu --- crypto/chacha20poly1305.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/chacha20poly1305.c b/crypto/chacha20poly1305.c index 0214600ba071e..6c4724222e3a0 100644 --- a/crypto/chacha20poly1305.c +++ b/crypto/chacha20poly1305.c @@ -637,8 +637,8 @@ static int chachapoly_create(struct crypto_template *tmpl, struct rtattr **tb, err = -ENAMETOOLONG; if (snprintf(inst->alg.base.cra_name, CRYPTO_MAX_ALG_NAME, - "%s(%s,%s)", name, chacha_name, - poly_name) >= CRYPTO_MAX_ALG_NAME) + "%s(%s,%s)", name, chacha->cra_name, + poly->cra_name) >= CRYPTO_MAX_ALG_NAME) goto out_drop_chacha; if (snprintf(inst->alg.base.cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s(%s,%s)", name, chacha->cra_driver_name, -- 2.21.0.1020.gf2820cf01a-goog