Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6400441ybi; Wed, 29 May 2019 07:19:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqydDofnqKwBvPBssYjrb6lxLVgEgsYbhgGWuTmEpYw480OtSRuj9GaGSXb/Zq5ICWRp/xi0 X-Received: by 2002:a62:5296:: with SMTP id g144mr27991430pfb.3.1559139547984; Wed, 29 May 2019 07:19:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559139547; cv=none; d=google.com; s=arc-20160816; b=uthwJ1tVlkaK031d094JhlL5O8iwi7C6tSrFyfVR0Eie7X/PHYa/XFHXSdTVaQADVK jt4UHN4/qH9M+RAlrZvalYf88G1lfJjE091gpc9IoZAsrdYTpK+qpkT05Mri61PscWBj PPuiM0tt9JRClTwvIP2peDFb6wV1pk/C/De1pqCbB9a2+wLcKDrU/ibKc59hXucN4wqR 1frRsk9G5bKByEHhiSvKIpxB+w7yIchTMf7FNitytdcH/wxRnkxwX8gj02+7FgHynIhG z592QdTynRtG08UhGBFbDJpWYNxDmOX00fr9M/H6mPM9/RsHcEbJVqKbefVYXaapjfZI lxeQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hEg459JKNjMZU93JrKXvFePGJVmrCgpuxqZhr0jzbp8=; b=ra9iMuhvpKCDK3mLCUpsAlMPi47esWkpZ+KObrO8Pav7/GdWPLw2VOedrEMHYTFIRd 093YOTh1IaklUGrpxRsqKe+ktrabGqG96pxoVFNFZImdu7LUkJNs0LlM3KI/Frhnc1EM y67apwzvmjeY/avpUQKPWU17bZ6Hwyv8qwtl36UFzquVzdH33/KE7vdgxb8SGlWe9G8r rm3093B7w8tBkZZpxmvJd2ebN69O2QIAOKrIVClpnccAIGRWv60KnjYQpNo2KuiIeyVq Q4drztAKox9fvxTM5DG65zj3JGntbqX9BCgCgVq4r+is3dJJft4yjwctqYA1A6xKGUZW prpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@chronox.de header.s=strato-dkim-0002 header.b=MoTNBWxW; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 d9si24434618plo.395.2019.05.29.07.18.51; Wed, 29 May 2019 07:19:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@chronox.de header.s=strato-dkim-0002 header.b=MoTNBWxW; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726225AbfE2OSa (ORCPT + 99 others); Wed, 29 May 2019 10:18:30 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.217]:35002 "EHLO mo4-p00-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726139AbfE2OS3 (ORCPT ); Wed, 29 May 2019 10:18:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1559139504; s=strato-dkim-0002; d=chronox.de; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=hEg459JKNjMZU93JrKXvFePGJVmrCgpuxqZhr0jzbp8=; b=MoTNBWxWOJMYve8LSVFmJmi5Xoi//VRDxfPTEM7kJ+N5+yCmktvX7CfusM3BMIjjAx 25DTHCrshPODC8kAcABML59xo/ahklHSyrn+MC4/QfqiqqmLCO3mAqlWf9t4NQkvjS8I pdWG1xYBDAXERUcUmLPReJ1MNHS6oQEw9adiqS0OnyQRImIoCEGobXljpSH26Dmv9pUZ OyeARhHi43VHp/4YoCRMTW/GrU8gn2jn9hLzcfrQ83tbr7tedfaqnPFlu1GHwV68Hcno D0Whax7kDeWnHFgB7iid3dJo/E6qaIwniIUP+c46LF10jYqiRhPm7I32orQLMnBoUcyt koVg== X-RZG-AUTH: ":P2ERcEykfu11Y98lp/T7+hdri+uKZK8TKWEqNyiHySGSa9k9xmwdNnzHHXDbLvSf34ur" X-RZG-CLASS-ID: mo00 Received: from tauon.chronox.de by smtp.strato.de (RZmta 44.18 DYNA|AUTH) with ESMTPSA id R0373fv4TEIIvuo (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Wed, 29 May 2019 16:18:18 +0200 (CEST) From: Stephan Mueller To: David Gstir Cc: Linux Crypto Mailing List , linux-kernel@vger.kernel.org, Richard Weinberger Subject: Re: Can an ahash driver be used through shash API? Date: Wed, 29 May 2019 16:18:18 +0200 Message-ID: <4256916.YlTHG9RRyR@tauon.chronox.de> In-Reply-To: <729A4150-93A0-456B-B7AB-6D3A446E600E@sigma-star.at> References: <729A4150-93A0-456B-B7AB-6D3A446E600E@sigma-star.at> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Am Mittwoch, 29. Mai 2019, 16:04:47 CEST schrieb David Gstir: Hi David, > Hi! > > I've done some testing with hardware acceleration of hash functions > and noticed that, when using the synchronous message digest API (shash), > some drivers are not usable. In my case the CAAM driver for SHA256. > Using the asynchronous interface (ahash), everything works as expected. > Looking at the driver source, the CAAM driver only implements the ahash > interface. > > I'm wondering if there a way to use an ahash driver through the shash > interface? Short: no. > > I've seen that it does actually work the other way around, since > crypto_init_shash_ops_async() in crypto/shash.c takes care of translating > calls from ahash to shash and that's how the *-generic drivers are usable > through the ahash API. The crypto_alloc_shash will only identify cipher implementations that were registered with the CRYPTO_ALG_TYPE_SHASH flag. That flag is set when a cipher is registered using crypto_register_shash. Thus, ciphers registered with crypto_register_ahash will not bear this flag and thus will not be found by the allocation function. Ciao Stephan