Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp83374yba; Mon, 20 May 2019 05:24:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWwssgLuhPOQrg52H9+VcyBa2gxaiLhCO2BKXCftT6k8+LXRaVgApxPQuSOPXngTOXvpot X-Received: by 2002:a65:4c07:: with SMTP id u7mr72834596pgq.93.1558355098722; Mon, 20 May 2019 05:24:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558355098; cv=none; d=google.com; s=arc-20160816; b=ZxYQHSWYYWccBpmdCcHfCWMLb1A7CluXP/V/7YROql/yVugE4mtyyO9IW+c4sFnZcw SF1khVfxrd1wLz5SfTwqhoFhX8EEDG0uMi1ct3iMYMrLZnm45dqIT/wnT4v8bCxZdh40 Zio2f1RODlZxncae+J+fwp5o+IEGlpGewd/k4EULYoynWJc/Hye+FYFVtQpKkrkLQJLw K+Oy0Efsw5ORrsNqouxD6dC5AvA3BK0nT5wDvvAlIxXyAIlfZ6pRgcryqZR67oIxbFxa wF17GoPlQvWz849e0G03KVpGyesD6HJ9ouS77EjEGblrfWJRHv0UzZul3SQjoWEA0kuC ftnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Lo8j8cpJIGb4yaulscqhHr7IAoWdFl3NcwztIOnWnMY=; b=eVBrE2ahfYvyDvu6mWdoe7Z8qnqCtTTImpnzFfajr03TaD0NqUmfQDp0fUPDc4I1w8 cgZ/RgAOS9iishWfdcC7pfnt+2HuvKNmPvQd4VQB9aZ5L3iEvVItbRxVn1s7HPcU5LDe 563HA8OqbvzCofWqgLa8VzmsOsXEJC6eaY9SWwGG9AyaqZSZ5W+jtd7iOMgpDB6S9ZoJ qXmkqGVPdt5Jjwh7NHLWsfhFfU5q6tah0i/5jWUt+nLO32bYw/322huufQN2movXilZi MJWk1RspNUrZum9K+jh/xC9sx+gqYKmndQlg2/pGjIKsEvnwM7syZnd59OdclEmxP9g4 s3Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="v/BppK2J"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z124si18956242pfz.212.2019.05.20.05.24.43; Mon, 20 May 2019 05:24:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="v/BppK2J"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388229AbfETMVn (ORCPT + 99 others); Mon, 20 May 2019 08:21:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:35432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388205AbfETMVi (ORCPT ); Mon, 20 May 2019 08:21:38 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5092E214AE; Mon, 20 May 2019 12:21:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558354897; bh=SouYgWQauP5ZFkhFFMqWevfg1i6+eLajnGKQ+6SjZq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v/BppK2JRK043mTefbXqIBWGNH8xLMYujpLEl9q0gCxoMNKf14Pn6Db1ceaEoqhP8 9YHVEaZxUAGXQcXS1/F13Bcb6moDS1QRSrE8E1D08jDdQGCuJI8a6guuy5ZuP0IRTA bFYgHKlLzT/2rzdTyK3/sTvhN9l3WSBWfsPegoMc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Willi , Eric Biggers , Herbert Xu Subject: [PATCH 4.19 021/105] crypto: chacha20poly1305 - set cra_name correctly Date: Mon, 20 May 2019 14:13:27 +0200 Message-Id: <20190520115248.489932254@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115247.060821231@linuxfoundation.org> References: <20190520115247.060821231@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Biggers commit 5e27f38f1f3f45a0c938299c3a34a2d2db77165a upstream. 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 Signed-off-by: Greg Kroah-Hartman --- crypto/chacha20poly1305.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/crypto/chacha20poly1305.c +++ b/crypto/chacha20poly1305.c @@ -647,8 +647,8 @@ static int chachapoly_create(struct cryp 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->base.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->base.cra_driver_name,