From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, peter.maydell@linaro.org
Subject: [Qemu-devel] [PULL 03/13] block: initialize qcrypto API at startup
Date: Tue, 12 Apr 2016 18:18:58 +0200 [thread overview]
Message-ID: <1460477948-24686-4-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1460477948-24686-1-git-send-email-kwolf@redhat.com>
From: "Daniel P. Berrange" <berrange@redhat.com>
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>
---
qemu-img.c | 6 ++++++
qemu-io.c | 6 ++++++
qemu-nbd.c | 7 +++++++
3 files changed, 19 insertions(+)
diff --git a/qemu-img.c b/qemu-img.c
index 17c5cfd..1697762 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) {
diff --git a/qemu-io.c b/qemu-io.c
index 0a738f1..288bba8 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -23,6 +23,7 @@
#include "sysemu/block-backend.h"
#include "block/block_int.h"
#include "trace/control.h"
+#include "crypto/init.h"
#define CMD_NOFILE_OK 0x01
@@ -443,6 +444,11 @@ int main(int argc, char **argv)
progname = basename(argv[0]);
qemu_init_exec_dir(argv[0]);
+ if (qcrypto_init(&local_error) < 0) {
+ error_reportf_err(local_error, "cannot initialize crypto: ");
+ exit(1);
+ }
+
module_call_init(MODULE_INIT_QOM);
qemu_add_opts(&qemu_object_opts);
bdrv_init();
diff --git a/qemu-nbd.c b/qemu-nbd.c
index c2e4d3f..b5751f8 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -31,6 +31,7 @@
#include "qapi/qmp/qstring.h"
#include "qom/object_interfaces.h"
#include "io/channel-socket.h"
+#include "crypto/init.h"
#include <getopt.h>
#include <libgen.h>
@@ -519,6 +520,12 @@ int main(int argc, char **argv)
memset(&sa_sigterm, 0, sizeof(sa_sigterm));
sa_sigterm.sa_handler = termsig_handler;
sigaction(SIGTERM, &sa_sigterm, NULL);
+
+ if (qcrypto_init(&local_err) < 0) {
+ error_reportf_err(local_err, "cannot initialize crypto: ");
+ exit(1);
+ }
+
module_call_init(MODULE_INIT_QOM);
qemu_add_opts(&qemu_object_opts);
qemu_init_exec_dir(argv[0]);
--
1.8.3.1
next prev parent reply other threads:[~2016-04-12 16:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-12 16:18 [Qemu-devel] [PULL 00/13] Block patches for 2.6 Kevin Wolf
2016-04-12 16:18 ` [Qemu-devel] [PULL 01/13] iotests: fix the broken 026.nocache output Kevin Wolf
2016-04-12 16:18 ` [Qemu-devel] [PULL 02/13] qemu-img: fix formatting of error message Kevin Wolf
2016-04-12 16:18 ` Kevin Wolf [this message]
2016-04-12 16:18 ` [Qemu-devel] [PULL 04/13] iotests: Make 150 use qemu-img map instead of du Kevin Wolf
2016-04-12 16:19 ` [Qemu-devel] [PULL 05/13] vpc: fix return value check for blk_pwrite Kevin Wolf
2016-04-12 16:19 ` [Qemu-devel] [PULL 06/13] qcow2: Prevent backing file names longer than 1023 Kevin Wolf
2016-04-12 16:19 ` [Qemu-devel] [PULL 07/13] MAINTAINERS: Block layer core, qcow2 and blkdebug Kevin Wolf
2016-04-12 16:19 ` [Qemu-devel] [PULL 08/13] qemu-iotests: check: don't place files with predictable names in /tmp Kevin Wolf
2016-04-12 16:19 ` [Qemu-devel] [PULL 09/13] qemu-iotests: fix 051 on non-PC architectures Kevin Wolf
2016-04-12 16:19 ` [Qemu-devel] [PULL 10/13] qemu-iotests: iotests.VM: remove qtest socket on error Kevin Wolf
2016-04-12 16:19 ` [Qemu-devel] [PULL 11/13] qemu-iotests: 148: properly skip test if quorum support is missing Kevin Wolf
2016-04-12 16:19 ` [Qemu-devel] [PULL 12/13] qemu-iotests: 068: don't require KVM Kevin Wolf
2016-04-12 16:19 ` [Qemu-devel] [PULL 13/13] qemu-iotests: iotests.py: get rid of __all__ Kevin Wolf
2016-04-13 15:32 ` [Qemu-devel] [PULL 00/13] Block patches for 2.6 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1460477948-24686-4-git-send-email-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).