From patchwork Tue Jul 18 09:49:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 9847397 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D47C460392 for ; Tue, 18 Jul 2017 09:50:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9C8628516 for ; Tue, 18 Jul 2017 09:50:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE51A2853A; Tue, 18 Jul 2017 09:50:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D85EB2625B for ; Tue, 18 Jul 2017 09:50:21 +0000 (UTC) Received: from localhost ([::1]:55048 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXP92-0005q3-V7 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 18 Jul 2017 05:50:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXP8O-0005lp-QW for qemu-devel@nongnu.org; Tue, 18 Jul 2017 05:49:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXP8L-0005VZ-HJ for qemu-devel@nongnu.org; Tue, 18 Jul 2017 05:49:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51556) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dXP8L-0005VE-6Y for qemu-devel@nongnu.org; Tue, 18 Jul 2017 05:49:37 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D18057CB8C; Tue, 18 Jul 2017 09:49:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D18057CB8C Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=berrange@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D18057CB8C Received: from redhat.com (ovpn-117-31.ams2.redhat.com [10.36.117.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F69A7DFD7; Tue, 18 Jul 2017 09:49:33 +0000 (UTC) Date: Tue, 18 Jul 2017 10:49:31 +0100 From: "Daniel P. Berrange" To: longpeng.mike@gmail.com Message-ID: <20170718094931.GE11927@redhat.com> References: <1500055451-14041-1-git-send-email-longpeng.mike@gmail.com> <1500055451-14041-13-git-send-email-longpeng.mike@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1500055451-14041-13-git-send-email-longpeng.mike@gmail.com> User-Agent: Mutt/1.8.3 (2017-05-23) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 18 Jul 2017 09:49:36 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-devel] [PATCH v6 12/18] crypto: introduce some common functions for af_alg backend X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: "Daniel P. Berrange" Cc: "Longpeng\(Mike\)" , arei.gonglei@huawei.com, weidong.huang@huawei.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Jul 14, 2017 at 02:04:05PM -0400, longpeng.mike@gmail.com wrote: > From: "Longpeng(Mike)" > > The AF_ALG socket family is the userspace interface for linux > crypto API, this patch adds af_alg family support and some common > functions for af_alg backend. It'll be used by afalg-backend crypto > latter. > > Signed-off-by: Longpeng(Mike) > --- > configure | 30 +++++++++++++ > crypto/Makefile.objs | 1 + > crypto/afalg.c | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++ > crypto/afalgpriv.h | 54 ++++++++++++++++++++++++ > 4 files changed, 201 insertions(+) > create mode 100644 crypto/afalg.c > create mode 100644 crypto/afalgpriv.h > > diff --git a/configure b/configure > index 902653a..4beab2a 100755 > --- a/configure > +++ b/configure > @@ -375,6 +375,7 @@ libnfs="" > coroutine="" > coroutine_pool="" > debug_stack_usage="no" > +crypto_afalg="no" > seccomp="" > glusterfs="" > glusterfs_xlator_opt="no" > @@ -1124,6 +1125,8 @@ for opt do > ;; > --enable-debug-stack-usage) debug_stack_usage="yes" > ;; > + --enable-crypto-afalg) crypto_afalg="yes" > + ;; We should have an --disable flag too for consistency, even though it is the default currently. > --disable-docs) docs="no" > ;; > --enable-docs) docs="yes" > @@ -1443,6 +1446,8 @@ Advanced options (experts only): > xen pv domain builder > --enable-debug-stack-usage > track the maximum stack usage of stacks created by qemu_alloc_stack > + --enable-crypto-afalg > + enable afalg-backend crypto and try to use it first. > > Optional features, enabled with --enable-FEATURE and > disabled with --disable-FEATURE, default is enabled if available: > @@ -4834,6 +4839,24 @@ if compile_prog "" "" ; then > have_af_vsock=yes > fi > > +########################################## > +# check for usable AF_ALG environment > +hava_af_alg=no typo s/af_alg/afalg/ > +cat > $TMPC << EOF > +#include > +#include > +#include > +#include > +int main(void) { > + int sock; > + sock = socket(AF_ALG, SOCK_SEQPACKET, 0); > + return sock; > +} > +EOF > +if compile_prog "" "" ; then > + have_afalg=yes > +fi If the user requests afalg and the compile test fails, we should report an error. > + > ################################################# > # Sparc implicitly links with --relax, which is > # incompatible with -r, so --no-relax should be > @@ -5300,6 +5323,7 @@ echo "seccomp support $seccomp" > echo "coroutine backend $coroutine" > echo "coroutine pool $coroutine_pool" > echo "debug stack usage $debug_stack_usage" > +echo "crypto afalg $crypto_afalg" > echo "GlusterFS support $glusterfs" > echo "gcov $gcov_tool" > echo "gcov enabled $gcov" > @@ -5811,6 +5835,12 @@ if test "$debug_stack_usage" = "yes" ; then > echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak > fi > > +if test "$crypto_afalg" = "yes" ; then > + if test "$have_afalg" = "yes" ; then The check for have_afalg=yes is redundant if we report an error earlier > + echo "CONFIG_AF_ALG=y" >> $config_host_mak > + fi > +fi > + > if test "$open_by_handle_at" = "yes" ; then > echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak > fi These are minor points, so I'm going to squash the following into your change when merging: Regards, Daniel diff --git a/configure b/configure index 83e6f9772f..9237b50b99 100755 --- a/configure +++ b/configure @@ -1127,6 +1127,8 @@ for opt do ;; --enable-crypto-afalg) crypto_afalg="yes" ;; + --disable-crypto-afalg) crypto_afalg="no" + ;; --disable-docs) docs="no" ;; --enable-docs) docs="yes" @@ -1446,8 +1448,6 @@ Advanced options (experts only): xen pv domain builder --enable-debug-stack-usage track the maximum stack usage of stacks created by qemu_alloc_stack - --enable-crypto-afalg - enable afalg-backend crypto and try to use it first. Optional features, enabled with --enable-FEATURE and disabled with --disable-FEATURE, default is enabled if available: @@ -1523,6 +1523,7 @@ disabled with --disable-FEATURE, default is enabled if available: qom-cast-debug cast debugging support tools build qemu-io, qemu-nbd and qemu-image tools vxhs Veritas HyperScale vDisk backend support + crypto-afalg Linux AF_ALG crypto backend driver NOTE: The object files are built at the place where configure is launched EOF @@ -4841,7 +4842,7 @@ fi ########################################## # check for usable AF_ALG environment -hava_af_alg=no +hava_afalg=no cat > $TMPC << EOF #include #include @@ -4856,6 +4857,14 @@ EOF if compile_prog "" "" ; then have_afalg=yes fi +if test "$crypto_afalg" = "yes" +then + if test "$have_afalg" != "yes" + then + error_exit "AF_ALG requested but could not be detected" + fi +fi + ################################################# # Sparc implicitly links with --relax, which is @@ -5836,9 +5845,7 @@ if test "$debug_stack_usage" = "yes" ; then fi if test "$crypto_afalg" = "yes" ; then - if test "$have_afalg" = "yes" ; then - echo "CONFIG_AF_ALG=y" >> $config_host_mak - fi + echo "CONFIG_AF_ALG=y" >> $config_host_mak fi if test "$open_by_handle_at" = "yes" ; then