From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932438AbbLSBbo (ORCPT ); Fri, 18 Dec 2015 20:31:44 -0500 Received: from mga14.intel.com ([192.55.52.115]:30717 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932203AbbLSBbm (ORCPT ); Fri, 18 Dec 2015 20:31:42 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,448,1444719600"; d="scan'208";a="844438863" Message-ID: <1450488694.30844.11.camel@schen9-desk2.jf.intel.com> Subject: ahash alg that does not implement import/export failed to register From: Tim Chen To: Herbert Xu , Russell King - ARM Linux Cc: linux-kernel , "; linux-crypto" , "megha.dey" Date: Fri, 18 Dec 2015 17:31:34 -0800 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.8.5 (3.8.5-2.fc19) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Herbert, There are some ahash algorithms like x86's sha1-mb and ghash that failed to register because of the newly added check of non-zero statesize from commit 8996eafd. But since there are algorithms that do not implement an import or export, there is no state required for them. Wonder if the check should be modified to something like: diff --git a/crypto/ahash.c b/crypto/ahash.c index 9c1dc8d..f512183 100644 --- a/crypto/ahash.c +++ b/crypto/ahash.c @@ -544,7 +544,10 @@ static int ahash_prepare_alg(struct ahash_alg *alg) struct crypto_alg *base = &alg->halg.base; if (alg->halg.digestsize > PAGE_SIZE / 8 || - alg->halg.statesize > PAGE_SIZE / 8 || + alg->halg.statesize > PAGE_SIZE / 8) + return -EINVAL; + + if ((alg->import || alg->export) && alg->halg.statesize == 0) return -EINVAL; Thanks. Tim