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>
This commit is contained in:
committed by
Kevin Wolf
parent
143605a200
commit
c229708848
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user