aboutsummaryrefslogtreecommitdiff
path: root/crypto/cipher-gcrypt.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2016-09-05 18:02:05 +0100
committerDaniel P. Berrange <berrange@redhat.com>2016-09-12 12:00:52 +0100
commit90d6f60d0727df084b62674bf2310ac74467a5a4 (patch)
tree1c567d6887ca2027f804860f49fcfc81486f17b0 /crypto/cipher-gcrypt.c
parentd9269b274a9a08c8cbae14deb514d4e30b4095cf (diff)
downloadqemu-90d6f60d0727df084b62674bf2310ac74467a5a4.zip
qemu-90d6f60d0727df084b62674bf2310ac74467a5a4.tar.gz
qemu-90d6f60d0727df084b62674bf2310ac74467a5a4.tar.bz2
crypto: report enum strings instead of values in errors
Several error messages print out the raw enum value, which is less than helpful to users, as these values are not documented, nor stable across QEMU releases. Switch to use the enum string instead. The nettle impl also had two typos where it mistakenly said "algorithm" instead of "mode", and actually reported the algorithm value too. Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'crypto/cipher-gcrypt.c')
-rw-r--r--crypto/cipher-gcrypt.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/cipher-gcrypt.c b/crypto/cipher-gcrypt.c
index 3652aa1..da3f4c7 100644
--- a/crypto/cipher-gcrypt.c
+++ b/crypto/cipher-gcrypt.c
@@ -70,7 +70,8 @@ QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgorithm alg,
gcrymode = GCRY_CIPHER_MODE_CBC;
break;
default:
- error_setg(errp, "Unsupported cipher mode %d", mode);
+ error_setg(errp, "Unsupported cipher mode %s",
+ QCryptoCipherMode_lookup[mode]);
return NULL;
}
@@ -120,7 +121,8 @@ QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgorithm alg,
break;
default:
- error_setg(errp, "Unsupported cipher algorithm %d", alg);
+ error_setg(errp, "Unsupported cipher algorithm %s",
+ QCryptoCipherAlgorithm_lookup[alg]);
return NULL;
}