From patchwork Tue Jan 3 00:33:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Longpeng (Mike, Cloud Infrastructure Service Product Dept.)" X-Patchwork-Id: 710356 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id 3tsw866xmBz9sCX for ; Tue, 3 Jan 2017 11:40:06 +1100 (AEDT) Received: from localhost ([::1]:59660 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOD92-0007Lr-Sw for incoming@patchwork.ozlabs.org; Mon, 02 Jan 2017 19:40:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOD3c-0002wX-4H for qemu-devel@nongnu.org; Mon, 02 Jan 2017 19:34:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cOD3Y-0001Ku-VQ for qemu-devel@nongnu.org; Mon, 02 Jan 2017 19:34:28 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:6867) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1cOD3Y-0001JU-8a for qemu-devel@nongnu.org; Mon, 02 Jan 2017 19:34:24 -0500 Received: from 172.24.1.60 (EHLO szxeml433-hub.china.huawei.com) ([172.24.1.60]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id CNM61323; Tue, 03 Jan 2017 08:34:17 +0800 (CST) Received: from localhost (10.177.246.209) by szxeml433-hub.china.huawei.com (10.82.67.210) with Microsoft SMTP Server id 14.3.235.1; Tue, 3 Jan 2017 08:34:07 +0800 From: "Longpeng(Mike)" To: Date: Tue, 3 Jan 2017 08:33:06 +0800 Message-ID: <1483403591-2564-2-git-send-email-longpeng2@huawei.com> X-Mailer: git-send-email 1.8.4.msysgit.0 In-Reply-To: <1483403591-2564-1-git-send-email-longpeng2@huawei.com> References: <1483403591-2564-1-git-send-email-longpeng2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.246.209] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 119.145.14.66 Subject: [Qemu-devel] [PATCH 1/6] configure: add CONFIG_GCRYPT/NETTLE_AEAD item 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: , Cc: "Longpeng\(Mike\)" , arei.gonglei@huawei.com, qemu-devel@nongnu.org, wu.wubin@huawei.com, jianjay.zhou@huawei.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This item will be used for gcrypt/nettle backed AEAD algorithms. It's hardly to decide which version of gcrypt/nettle started supporting AEAD algorithms, but it's easily for us to making a test in configure to know whether current gcrypt/nettle support AEAD. Signed-off-by: Longpeng(Mike) --- configure | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/configure b/configure index 218df87..14f558c 100755 --- a/configure +++ b/configure @@ -309,8 +309,10 @@ tls_priority="NORMAL" gnutls="" gnutls_rnd="" nettle="" +nettle_aead="no" nettle_kdf="no" gcrypt="" +gcrypt_aead="no" gcrypt_hmac="no" gcrypt_kdf="no" vte="" @@ -2429,6 +2431,19 @@ EOF if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then gcrypt_hmac=yes fi + + cat > $TMPC << EOF +#include +int main(void) { + gcry_cipher_hd_t handle; + gcry_cipher_open(&handle, 0, 0, 0); + gcry_cipher_authenticate(handle, NULL, 0); + return 0; +} +EOF + if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then + gcrypt_aead=yes + fi else if test "$gcrypt" = "yes"; then feature_not_found "gcrypt" "Install gcrypt devel" @@ -2460,6 +2475,21 @@ EOF if compile_prog "$nettle_cflags" "$nettle_libs" ; then nettle_kdf=yes fi + + cat > $TMPC << EOF +#include +#include +#include +#include +int main(void) { + ccm_aes128_encrypt(NULL, 0, NULL, NULL); + gcm_aes128_encrypt(NULL, 0, NULL, NULL); + return 0; +} +EOF + if compile_prog "$nettle_cflags" "$nettle_libs" ; then + nettle_aead=yes + fi else if test "$nettle" = "yes"; then feature_not_found "nettle" "Install nettle devel" @@ -5399,6 +5429,9 @@ if test "$gnutls_rnd" = "yes" ; then fi if test "$gcrypt" = "yes" ; then echo "CONFIG_GCRYPT=y" >> $config_host_mak + if test "$gcrypt_aead" = "yes" ; then + echo "CONFIG_GCRYPT_AEAD=y" >> $config_host_mak + fi if test "$gcrypt_hmac" = "yes" ; then echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak fi @@ -5409,6 +5442,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_aead" = "yes" ; then + echo "CONFIG_NETTLE_AEAD=y" >> $config_host_mak + fi if test "$nettle_kdf" = "yes" ; then echo "CONFIG_NETTLE_KDF=y" >> $config_host_mak fi