aboutsummaryrefslogtreecommitdiff
path: root/qemu-img.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2016-04-06 12:12:06 +0100
committerKevin Wolf <kwolf@redhat.com>2016-04-12 18:06:51 +0200
commitc229708848cc77b0277e7260f7e739d441c1d086 (patch)
treea9c124d67dcc8df97249011afbe9084d90ed64e1 /qemu-img.c
parent143605a200f9d418d62d25d91b1477b1d91c0b18 (diff)
downloadqemu-arm-c229708848cc77b0277e7260f7e739d441c1d086.tar.gz
block: initialize qcrypto API at startup
Any programs which call the qcrypto APIs should ensure that qcrypto_init() has been called before anything else which can use crypto. Essentially this means right at the start of the main method before initializing anything else. This is important because some versions of gnutls/gcrypt require explicit initialization before use. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Alex Bligh <alex@alex.org.uk> Tested-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/qemu-img.c b/qemu-img.c
index 17c5cfdffe..1697762606 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -37,6 +37,7 @@
#include "block/block_int.h"
#include "block/blockjob.h"
#include "block/qapi.h"
+#include "crypto/init.h"
#include <getopt.h>
#define QEMU_IMG_VERSION "qemu-img version " QEMU_VERSION QEMU_PKGVERSION \
@@ -3486,6 +3487,11 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}
+ if (qcrypto_init(&local_error) < 0) {
+ error_reportf_err(local_error, "cannot initialize crypto: ");
+ exit(1);
+ }
+
module_call_init(MODULE_INIT_QOM);
bdrv_init();
if (argc < 2) {