On 12/21/2015 09:06 AM, Daniel P. Berrange wrote: > 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 <[email protected]> > --- > 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] = {
Will need rebasing, now that commit 7fb1cf1 has landed and renamed it
QCRYPTO_HASH_ALG__MAX.
> +++ 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']}
Otherwise looks fine. I know Markus is debating about getting rid of use
of 'prefix', and this just makes that task harder, but the current
munging would produce Q_CRYPTO_... even if you named the enum
QCryptoHashAlg, so I'm okay with it.
Reviewed-by: Eric Blake <[email protected]>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
