From patchwork Wed Mar 30 14:01:20 2016 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: 8696541 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A617EC0553 for ; Wed, 30 Mar 2016 14:04:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F284C20384 for ; Wed, 30 Mar 2016 14:04:56 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 363C62037E for ; Wed, 30 Mar 2016 14:04:51 +0000 (UTC) Received: from localhost ([::1]:54342 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alGjq-0008OM-Je for patchwork-qemu-devel@patchwork.kernel.org; Wed, 30 Mar 2016 10:04:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alGje-0008L9-Eb for qemu-devel@nongnu.org; Wed, 30 Mar 2016 10:04:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alGjd-00068z-8b for qemu-devel@nongnu.org; Wed, 30 Mar 2016 10:04:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52309) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alGjd-00068n-3Y for qemu-devel@nongnu.org; Wed, 30 Mar 2016 10:04:37 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id BCDACC00DDE5; Wed, 30 Mar 2016 14:04:36 +0000 (UTC) Received: from t530wlan.home.berrange.com.com ([10.42.17.224]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2UE1ObU006667; Wed, 30 Mar 2016 10:04:35 -0400 From: "Daniel P. Berrange" To: qemu-devel@nongnu.org Date: Wed, 30 Mar 2016 15:01:20 +0100 Message-Id: <1459346480-5309-2-git-send-email-berrange@redhat.com> In-Reply-To: <1459346480-5309-1-git-send-email-berrange@redhat.com> References: <1459346480-5309-1-git-send-email-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell Subject: [Qemu-devel] [PULL v1] crypto: do an explicit check for nettle pbkdf functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Support for the PBKDF functions in nettle was not introduced until version 2.6. Some distros QEMU targets have older versions and thus lack PBKDF support. Address this by doing a check in configure for the desired function and then skipping compilation of the nettle-pbkdf.o module Reported-by: Wen Congyang Tested-by: Wen Congyang Signed-off-by: Daniel P. Berrange --- configure | 16 ++++++++++++++++ crypto/Makefile.objs | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 2832ff6..5db29f0 100755 --- a/configure +++ b/configure @@ -308,6 +308,7 @@ gnutls="" gnutls_hash="" gnutls_rnd="" nettle="" +nettle_kdf="no" gcrypt="" gcrypt_kdf="no" vte="" @@ -2335,6 +2336,17 @@ if test "$nettle" != "no"; then libs_tools="$nettle_libs $libs_tools" QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags" nettle="yes" + + cat > $TMPC << EOF +#include +int main(void) { + pbkdf2_hmac_sha256(8, NULL, 1000, 8, NULL, 8, NULL); + return 0; +} +EOF + if compile_prog "$nettle_cflags" "$nettle_libs" ; then + nettle_kdf=yes + fi else if test "$nettle" = "yes"; then feature_not_found "nettle" "Install nettle devel" @@ -4746,6 +4758,7 @@ if test "$nettle" = "yes"; then else echo "nettle $nettle" fi +echo "nettle kdf $nettle_kdf" echo "libtasn1 $tasn1" echo "VTE support $vte" echo "curses support $curses" @@ -5130,6 +5143,9 @@ fi if test "$nettle" = "yes" ; then echo "CONFIG_NETTLE=y" >> $config_host_mak echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak + if test "$nettle_kdf" = "yes" ; then + echo "CONFIG_NETTLE_KDF=y" >> $config_host_mak + fi fi if test "$tasn1" = "yes" ; then echo "CONFIG_TASN1=y" >> $config_host_mak diff --git a/crypto/Makefile.objs b/crypto/Makefile.objs index 9f2c87e..0737f48 100644 --- a/crypto/Makefile.objs +++ b/crypto/Makefile.objs @@ -11,8 +11,8 @@ crypto-obj-y += secret.o crypto-obj-$(CONFIG_GCRYPT) += random-gcrypt.o crypto-obj-$(if $(CONFIG_GCRYPT),n,$(CONFIG_GNUTLS_RND)) += random-gnutls.o crypto-obj-y += pbkdf.o -crypto-obj-$(CONFIG_NETTLE) += pbkdf-nettle.o -crypto-obj-$(if $(CONFIG_NETTLE),n,$(CONFIG_GCRYPT_KDF)) += pbkdf-gcrypt.o +crypto-obj-$(CONFIG_NETTLE_KDF) += pbkdf-nettle.o +crypto-obj-$(if $(CONFIG_NETTLE_KDF),n,$(CONFIG_GCRYPT_KDF)) += pbkdf-gcrypt.o crypto-obj-y += ivgen.o crypto-obj-y += ivgen-essiv.o crypto-obj-y += ivgen-plain.o