[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 01/10] crypto: introduce new module for computin
From: |
Daniel P. Berrange |
Subject: |
Re: [Qemu-devel] [PATCH 01/10] crypto: introduce new module for computing hash digests |
Date: |
Tue, 2 Jun 2015 09:34:29 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Tue, Jun 02, 2015 at 09:43:18AM +0200, Markus Armbruster wrote:
> "Daniel P. Berrange" <address@hidden> writes:
>
> > On Thu, May 28, 2015 at 09:28:20PM +0800, Gonglei wrote:
> >> On 2015/5/21 18:56, Daniel P. Berrange wrote:
> >> > Introduce a new crypto/ directory that will (eventually) contain
> >> > all the cryptographic related code. This initially defines a
> >> > wrapper for initializing gnutls and for computing hashes with
> >> > gnutls. The former ensures that gnutls is guaranteed to be
> >> > initialized exactly once in QEMU regardless of CLI args. The
> >> > block quorum code currently fails to initialize gnutls so it
> >> > only works by luck, if VNC server TLS is not requested. The
> >> > hash APIs avoids the need to litter the rest of the code with
> >> > preprocessor checks and simplifies callers by allocating the
> >> > correct amount of memory for the requested hash.
> >> >
> >> > Signed-off-by: Daniel P. Berrange <address@hidden>
> [...]
> >> > diff --git a/vl.c b/vl.c
> >> > index 15bccc4..72313a4 100644
> >> > --- a/vl.c
> >> > +++ b/vl.c
> >> > @@ -119,6 +119,7 @@ int main(int argc, char **argv)
> >> > #include "qapi/opts-visitor.h"
> >> > #include "qom/object_interfaces.h"
> >> > #include "qapi-event.h"
> >> > +#include "crypto/init.h"
> >> >
> >> > #define DEFAULT_RAM_SIZE 128
> >> >
> >> > @@ -2777,6 +2778,7 @@ int main(int argc, char **argv, char **envp)
> >> > uint64_t ram_slots = 0;
> >> > FILE *vmstate_dump_file = NULL;
> >> > Error *main_loop_err = NULL;
> >> > + Error *err = NULL;
> >> >
> >> > qemu_init_cpu_loop();
> >> > qemu_mutex_lock_iothread();
> >> > @@ -2819,6 +2821,12 @@ int main(int argc, char **argv, char **envp)
> >> >
> >> > runstate_init();
> >> >
> >> > + if (qcrypto_init(&err) < 0) {
> >> > + fprintf(stderr, "Cannot initialize crypto: %s\n",
> >> > + error_get_pretty(err));
> >> > + error_free(err);
> >>
> >> This free is superflous (before exit) IMO.
> >
> > Personally I always free variables like this so valgrind doesn't complain
> > about leaks.
>
> Marginally useful when you do it for the complete program. QEMU
> doesn't, and making all of QEMU do it would be a fool's errand.
Ok, i'll remove it.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|