From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aB2zK-0006z0-KK for qemu-devel@nongnu.org; Mon, 21 Dec 2015 11:07:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aB2zJ-0007eq-Mx for qemu-devel@nongnu.org; Mon, 21 Dec 2015 11:07:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36683) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aB2zJ-0007el-HS for qemu-devel@nongnu.org; Mon, 21 Dec 2015 11:07:05 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 4409519CBEF for ; Mon, 21 Dec 2015 16:07:05 +0000 (UTC) From: "Daniel P. Berrange" Date: Mon, 21 Dec 2015 16:06:51 +0000 Message-Id: <1450714014-16849-4-git-send-email-berrange@redhat.com> In-Reply-To: <1450714014-16849-1-git-send-email-berrange@redhat.com> References: <1450714014-16849-1-git-send-email-berrange@redhat.com> Subject: [Qemu-devel] [PATCH 3/6] crypto: move QCryptoHashAlgorithm enum definition into QAPI List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Markus Armbruster The QCryptoHashAlgorithm enum is defined in the crypto/hash.h header. In the future some QAPI types will want to reference the hash enums, so move the enum definition into QAPI too. Signed-off-by: Daniel P. Berrange --- crypto/hash.c | 4 ++-- include/crypto/hash.h | 9 +-------- qapi/crypto.json | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/crypto/hash.c b/crypto/hash.c index 5a47b90..b5f81c4 100644 --- a/crypto/hash.c +++ b/crypto/hash.c @@ -24,13 +24,13 @@ #include #include -static int qcrypto_hash_alg_map[QCRYPTO_HASH_ALG_LAST] = { +static int qcrypto_hash_alg_map[QCRYPTO_HASH_ALG_MAX] = { [QCRYPTO_HASH_ALG_MD5] = GNUTLS_DIG_MD5, [QCRYPTO_HASH_ALG_SHA1] = GNUTLS_DIG_SHA1, [QCRYPTO_HASH_ALG_SHA256] = GNUTLS_DIG_SHA256, }; -static size_t qcrypto_hash_alg_size[QCRYPTO_HASH_ALG_LAST] = { +static size_t qcrypto_hash_alg_size[QCRYPTO_HASH_ALG_MAX] = { [QCRYPTO_HASH_ALG_MD5] = 16, [QCRYPTO_HASH_ALG_SHA1] = 20, [QCRYPTO_HASH_ALG_SHA256] = 32, diff --git a/include/crypto/hash.h b/include/crypto/hash.h index 3d18124..41822c0 100644 --- a/include/crypto/hash.h +++ b/include/crypto/hash.h @@ -24,14 +24,7 @@ #include "qemu-common.h" #include "qapi/error.h" -typedef enum { - QCRYPTO_HASH_ALG_MD5, - QCRYPTO_HASH_ALG_SHA1, - QCRYPTO_HASH_ALG_SHA256, - - QCRYPTO_HASH_ALG_LAST -} QCryptoHashAlgorithm; - +/* See also "QCryptoHashAlgorithm" defined in qapi/crypto.json */ /** * qcrypto_hash_supports: diff --git a/qapi/crypto.json b/qapi/crypto.json index 4012659..0706ded 100644 --- a/qapi/crypto.json +++ b/qapi/crypto.json @@ -33,3 +33,18 @@ { 'enum': 'QCryptoSecretFormat', 'prefix': 'QCRYPTO_SECRET_FORMAT', 'data': ['raw', 'base64']} + + +## +# QCryptoHashAlgorithm: +# +# The supported algorithms for computing content digests +# +# @md5: MD5. Should not be used in any new code, legacy compat only +# @sha1: SHA-1. Should not be used in any new code, legacy compat only +# @sha256: SHA-256. Current recommended strong hash. +# Since: 2.6 +## +{ 'enum': 'QCryptoHashAlgorithm', + 'prefix': 'QCRYPTO_HASH_ALG', + 'data': ['md5', 'sha1', 'sha256']} -- 2.5.0