]> git.proxmox.com Git - mirror_qemu.git/blobdiff - crypto/hash-gcrypt.c
main-loop: Acquire main_context lock around os_host_main_loop_wait.
[mirror_qemu.git] / crypto / hash-gcrypt.c
index 8ea5aff4ee26b2a3043b64f0ca57eb6d65607043..7690690f705b2d89bc3de7711139029266ffdb02 100644 (file)
@@ -19,9 +19,9 @@
  */
 
 #include "qemu/osdep.h"
+#include <gcrypt.h>
 #include "qapi/error.h"
 #include "crypto/hash.h"
-#include "gcrypt.h"
 
 
 static int qcrypto_hash_alg_map[QCRYPTO_HASH_ALG__MAX] = {
@@ -55,8 +55,7 @@ int qcrypto_hash_bytesv(QCryptoHashAlgorithm alg,
     gcry_md_hd_t md;
     unsigned char *digest;
 
-    if (alg >= G_N_ELEMENTS(qcrypto_hash_alg_map) ||
-        qcrypto_hash_alg_map[alg] == GCRY_MD_NONE) {
+    if (!qcrypto_hash_supports(alg)) {
         error_setg(errp,
                    "Unknown hash algorithm %d",
                    alg);