Received: by 10.223.185.116 with SMTP id b49csp2378040wrg; Thu, 15 Feb 2018 10:40:46 -0800 (PST) X-Google-Smtp-Source: AH8x226v3HupnAghS6AenKpshPG710HEZd1mIHgB5wQdGpgH9MTYBaDLI6YqbVQ7zzXagb+/bCUe X-Received: by 2002:a17:902:7c0a:: with SMTP id x10-v6mr3396639pll.59.1518720046704; Thu, 15 Feb 2018 10:40:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518720046; cv=none; d=google.com; s=arc-20160816; b=WUWHGs/oxzdnqTnLRJX1zdKPG18tsZEHCivuAfI8B7VF85nQCf4Ca8mH0ovJnup/kK s/tLfbBwxyBJhx2qyrsiKs42ZWMQj5haJzOX3comWL6+qrmQhaTT29Ge8NH0q1y2TjfY wejm/djZtJyC9ZmYmE41A/xbVB7Hw3uNPRVYeGWAeraq7MZAVvdHu7zK+2/PvseGcXjR KB9wEcftDUwUZssa11rharYww17x0iZETYb5adDYeDP+Ynt8RoeP++DBwTMqf3L1b/kP YxZzFwSsNgiomvtKBW+5Ihuxxj/lpvmcDzlHwdKUvX7w5EWaMnuKTorDPbToYIjE49Q1 vHVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=WF+r7Mwj6dz4+/ow6MOnavPkl7uZOWV7ReU5lS4hIc8=; b=rF2xrkn0KouZ0zajDTIITGiGWt6lGe1KtGGkUD/QY+dcpZ9ZMCMAiQxDFXlfm9WHOB S+mLMmylmJ0plFugnPi5pJZM6G8/5ei+ZkgAV8L5+dM6Pwsg8+eGd3ykGMvgKtRiQWLT 8m70iIgEuiAWJQw+poeAq9pqX5w/BhHgsZDaWGiV3Y6qIGBp2XrbFcEhuGRJKW2a7n+G /SqnJZI4h1XHu3eMHYaoSYeEIsgNSrGtxnCu6rUXNm8lkv51Uw0iGeEYVt1c1Kk/ieHH IcDFGnZZVrrrzVkUE96A7IOodhZKIpRlm0afBZIYY1HFEi1cfQQxE1lnTwGTgpPWOdeo EvmA== ARC-Authentication-Results: i=1; mx.google.com; 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 t64si1239473pgb.294.2018.02.15.10.40.31; Thu, 15 Feb 2018 10:40:46 -0800 (PST) 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; 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 S1162796AbeBOPXw (ORCPT + 99 others); Thu, 15 Feb 2018 10:23:52 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:51592 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162736AbeBOPXq (ORCPT ); Thu, 15 Feb 2018 10:23:46 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 99545F91; Thu, 15 Feb 2018 15:23:30 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Biggers , Herbert Xu Subject: [PATCH 4.4 069/108] crypto: poly1305 - remove ->setkey() method Date: Thu, 15 Feb 2018 16:17:06 +0100 Message-Id: <20180215151232.012311293@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151222.267507937@linuxfoundation.org> References: <20180215151222.267507937@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Biggers commit a16e772e664b9a261424107784804cffc8894977 upstream. Since Poly1305 requires a nonce per invocation, the Linux kernel implementations of Poly1305 don't use the crypto API's keying mechanism and instead expect the key and nonce as the first 32 bytes of the data. But ->setkey() is still defined as a stub returning an error code. This prevents Poly1305 from being used through AF_ALG and will also break it completely once we start enforcing that all crypto API users (not just AF_ALG) call ->setkey() if present. Fix it by removing crypto_poly1305_setkey(), leaving ->setkey as NULL. Signed-off-by: Eric Biggers Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- arch/x86/crypto/poly1305_glue.c | 1 - crypto/poly1305_generic.c | 17 +++++------------ include/crypto/poly1305.h | 2 -- 3 files changed, 5 insertions(+), 15 deletions(-) --- a/arch/x86/crypto/poly1305_glue.c +++ b/arch/x86/crypto/poly1305_glue.c @@ -164,7 +164,6 @@ static struct shash_alg alg = { .init = poly1305_simd_init, .update = poly1305_simd_update, .final = crypto_poly1305_final, - .setkey = crypto_poly1305_setkey, .descsize = sizeof(struct poly1305_simd_desc_ctx), .base = { .cra_name = "poly1305", --- a/crypto/poly1305_generic.c +++ b/crypto/poly1305_generic.c @@ -51,17 +51,6 @@ int crypto_poly1305_init(struct shash_de } EXPORT_SYMBOL_GPL(crypto_poly1305_init); -int crypto_poly1305_setkey(struct crypto_shash *tfm, - const u8 *key, unsigned int keylen) -{ - /* Poly1305 requires a unique key for each tag, which implies that - * we can't set it on the tfm that gets accessed by multiple users - * simultaneously. Instead we expect the key as the first 32 bytes in - * the update() call. */ - return -ENOTSUPP; -} -EXPORT_SYMBOL_GPL(crypto_poly1305_setkey); - static void poly1305_setrkey(struct poly1305_desc_ctx *dctx, const u8 *key) { /* r &= 0xffffffc0ffffffc0ffffffc0fffffff */ @@ -80,6 +69,11 @@ static void poly1305_setskey(struct poly dctx->s[3] = le32_to_cpuvp(key + 12); } +/* + * Poly1305 requires a unique key for each tag, which implies that we can't set + * it on the tfm that gets accessed by multiple users simultaneously. Instead we + * expect the key as the first 32 bytes in the update() call. + */ unsigned int crypto_poly1305_setdesckey(struct poly1305_desc_ctx *dctx, const u8 *src, unsigned int srclen) { @@ -285,7 +279,6 @@ static struct shash_alg poly1305_alg = { .init = crypto_poly1305_init, .update = crypto_poly1305_update, .final = crypto_poly1305_final, - .setkey = crypto_poly1305_setkey, .descsize = sizeof(struct poly1305_desc_ctx), .base = { .cra_name = "poly1305", --- a/include/crypto/poly1305.h +++ b/include/crypto/poly1305.h @@ -30,8 +30,6 @@ struct poly1305_desc_ctx { }; int crypto_poly1305_init(struct shash_desc *desc); -int crypto_poly1305_setkey(struct crypto_shash *tfm, - const u8 *key, unsigned int keylen); unsigned int crypto_poly1305_setdesckey(struct poly1305_desc_ctx *dctx, const u8 *src, unsigned int srclen); int crypto_poly1305_update(struct shash_desc *desc,