summary refs log tree commit diff stats
path: root/crypto/hash-glib.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2016-07-05 17:41:45 +0100
committerDaniel P. Berrange <berrange@redhat.com>2016-07-21 10:46:27 +0100
commit760328971218bace4ab14b01f619825607fab9c3 (patch)
treeef7561171380b99bcd49d124ea4dfc3f1a394902 /crypto/hash-glib.c
parent2165477c0f65d20fdfbdb2ddcd4e0e7fe8f61df5 (diff)
downloadfocaccia-qemu-760328971218bace4ab14b01f619825607fab9c3.tar.gz
focaccia-qemu-760328971218bace4ab14b01f619825607fab9c3.zip
crypto: don't open-code qcrypto_hash_supports
Call the existing qcrypto_hash_supports method from
qcrypto_hash_bytesv instead of open-coding it again.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'crypto/hash-glib.c')
-rw-r--r--crypto/hash-glib.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/crypto/hash-glib.c b/crypto/hash-glib.c
index cb68a3b0d7..ec99ac9df9 100644
--- a/crypto/hash-glib.c
+++ b/crypto/hash-glib.c
@@ -57,8 +57,7 @@ int qcrypto_hash_bytesv(QCryptoHashAlgorithm alg,
     int i, ret;
     GChecksum *cs;
 
-    if (alg >= G_N_ELEMENTS(qcrypto_hash_alg_map) ||
-        qcrypto_hash_alg_map[alg] == -1) {
+    if (!qcrypto_hash_supports(alg)) {
         error_setg(errp,
                    "Unknown hash algorithm %d",
                    alg);