From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752700AbdBETQ1 (ORCPT + 2 others); Sun, 5 Feb 2017 14:16:27 -0500 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:27285 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752194AbdBETQY (ORCPT ); Sun, 5 Feb 2017 14:16:24 -0500 From: Willy Tarreau To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux@roeck-us.net Cc: Herbert Xu , Andrey Ryabinin , Willy Tarreau Subject: [PATCH 3.10 008/319] crypto: shash - Fix has_key setting Date: Sun, 5 Feb 2017 20:09:12 +0100 Message-Id: <1486322063-7558-9-git-send-email-w@1wt.eu> X-Mailer: git-send-email 2.8.0.rc2.1.gbe9624a In-Reply-To: <1486322063-7558-1-git-send-email-w@1wt.eu> References: <1486322063-7558-1-git-send-email-w@1wt.eu> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: From: Herbert Xu commit 00420a65fa2beb3206090ead86942484df2275f3 upstream. The has_key logic is wrong for shash algorithms as they always have a setkey function. So we should instead be testing against shash_no_setkey. Fixes: a5596d633278 ("crypto: hash - Add crypto_ahash_has_setkey") Cc: stable@vger.kernel.org Reported-by: Stephan Mueller Signed-off-by: Herbert Xu Tested-by: Stephan Mueller Signed-off-by: Andrey Ryabinin Signed-off-by: Willy Tarreau --- crypto/shash.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crypto/shash.c b/crypto/shash.c index 8e4256a..ac4d763 100644 --- a/crypto/shash.c +++ b/crypto/shash.c @@ -353,11 +353,10 @@ int crypto_init_shash_ops_async(struct crypto_tfm *tfm) crt->final = shash_async_final; crt->finup = shash_async_finup; crt->digest = shash_async_digest; + crt->setkey = shash_async_setkey; + + crt->has_setkey = alg->setkey != shash_no_setkey; - if (alg->setkey) { - crt->setkey = shash_async_setkey; - crt->has_setkey = true; - } if (alg->export) crt->export = shash_async_export; if (alg->import) -- 2.8.0.rc2.1.gbe9624a