[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH WIP 18/30] crypto: move QCryptoHashAlgorithm enum de
From: |
Daniel P. Berrange |
Subject: |
[Qemu-devel] [PATCH WIP 18/30] crypto: move QCryptoHashAlgorithm enum definition into QAPI |
Date: |
Fri, 20 Nov 2015 18:04:18 +0000 |
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 <address@hidden>
---
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 <gnutls/gnutls.h>
#include <gnutls/crypto.h>
-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 88d9ead..a83be0e 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
- [Qemu-devel] [PATCH WIP 08/30] qemu-io: add support for --object command line arg, (continued)
- [Qemu-devel] [PATCH WIP 08/30] qemu-io: add support for --object command line arg, Daniel P. Berrange, 2015/11/20
- [Qemu-devel] [PATCH WIP 06/30] qemu-img: add support for --object command line arg, Daniel P. Berrange, 2015/11/20
- [Qemu-devel] [PATCH WIP 09/30] qemu-io: allow specifying image as a set of options args, Daniel P. Berrange, 2015/11/20
- [Qemu-devel] [PATCH WIP 28/30] block: add generic full disk encryption driver, Daniel P. Berrange, 2015/11/20
- [Qemu-devel] [PATCH WIP 27/30] crypto: implement the LUKS block encryption format, Daniel P. Berrange, 2015/11/20
- [Qemu-devel] [PATCH WIP 22/30] crypto: add support for PBKDF2 algorithm, Daniel P. Berrange, 2015/11/20
- [Qemu-devel] [PATCH WIP 16/30] crypto: add ability to query the cipher key, block & IV lens, Daniel P. Berrange, 2015/11/20
- [Qemu-devel] [PATCH WIP 11/30] qemu-img: allow specifying image as a set of options args, Daniel P. Berrange, 2015/11/20
- [Qemu-devel] [PATCH WIP 15/30] qcow2: make qcow2_encrypt_sectors encrypt in place, Daniel P. Berrange, 2015/11/20
- [Qemu-devel] [PATCH WIP 21/30] crypto: add cryptographic random byte source, Daniel P. Berrange, 2015/11/20
- [Qemu-devel] [PATCH WIP 18/30] crypto: move QCryptoHashAlgorithm enum definition into QAPI,
Daniel P. Berrange <=
- [Qemu-devel] [PATCH WIP 25/30] crypto: fix transposed arguments in cipher error message, Daniel P. Berrange, 2015/11/20
- [Qemu-devel] [PATCH WIP 23/30] crypto: add support for generating initialization vectors, Daniel P. Berrange, 2015/11/20
- [Qemu-devel] [PATCH WIP 29/30] qcow2: convert QCow2 to use QCryptoBlock for encryption, Daniel P. Berrange, 2015/11/20
- [Qemu-devel] [PATCH WIP 30/30] qcow2: add LUKS full disk encryption support, Daniel P. Berrange, 2015/11/20