summaryrefslogtreecommitdiffstats
path: root/crypto/hash-nettle.c
diff options
context:
space:
mode:
authorDaniel P. Berrange2016-07-05 18:41:45 +0200
committerDaniel P. Berrange2016-07-21 11:46:27 +0200
commit760328971218bace4ab14b01f619825607fab9c3 (patch)
treeef7561171380b99bcd49d124ea4dfc3f1a394902 /crypto/hash-nettle.c
parentcrypto: use glib as fallback for hash algorithm (diff)
downloadqemu-760328971218bace4ab14b01f619825607fab9c3.tar.gz
qemu-760328971218bace4ab14b01f619825607fab9c3.tar.xz
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-nettle.c')
-rw-r--r--crypto/hash-nettle.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/crypto/hash-nettle.c b/crypto/hash-nettle.c
index 4c6f50b65d..6a206dcb18 100644
--- a/crypto/hash-nettle.c
+++ b/crypto/hash-nettle.c
@@ -113,8 +113,7 @@ int qcrypto_hash_bytesv(QCryptoHashAlgorithm alg,
int i;
union qcrypto_hash_ctx ctx;
- if (alg >= G_N_ELEMENTS(qcrypto_hash_alg_map) ||
- qcrypto_hash_alg_map[alg].init == NULL) {
+ if (!qcrypto_hash_supports(alg)) {
error_setg(errp,
"Unknown hash algorithm %d",
alg);