qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Gonglei <arei.gonglei@huawei.com>,
	qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 01/10] crypto: introduce new module for computing hash digests
Date: Tue, 2 Jun 2015 09:34:29 +0100	[thread overview]
Message-ID: <20150602083429.GB19508@redhat.com> (raw)
In-Reply-To: <878uc28six.fsf@blackfin.pond.sub.org>

On Tue, Jun 02, 2015 at 09:43:18AM +0200, Markus Armbruster wrote:
> "Daniel P. Berrange" <berrange@redhat.com> 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 <berrange@redhat.com>
> [...]
> >> > 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 :|

  reply	other threads:[~2015-06-02  8:34 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-21 10:56 [Qemu-devel] [PATCH 00/10] Consolidate crypto APIs & implementations Daniel P. Berrange
2015-05-21 10:56 ` [Qemu-devel] [PATCH 01/10] crypto: introduce new module for computing hash digests Daniel P. Berrange
2015-05-28 13:28   ` Gonglei
2015-06-01 16:46     ` Daniel P. Berrange
2015-06-02  7:43       ` Markus Armbruster
2015-06-02  8:34         ` Daniel P. Berrange [this message]
2015-05-21 10:56 ` [Qemu-devel] [PATCH 02/10] crypto: move built-in AES implementation into crypto/ Daniel P. Berrange
2015-05-21 10:56 ` [Qemu-devel] [PATCH 03/10] crypto: move built-in D3DES " Daniel P. Berrange
2015-05-21 10:56 ` [Qemu-devel] [PATCH 04/10] crypto: introduce generic cipher API & built-in implementation Daniel P. Berrange
2015-05-21 19:52   ` Richard Henderson
2015-05-22  9:10     ` Daniel P. Berrange
2015-05-29  2:39       ` Gonglei
2015-06-01 16:50         ` Daniel P. Berrange
2015-05-21 10:56 ` [Qemu-devel] [PATCH 05/10] crypto: add a gcrypt cipher implementation Daniel P. Berrange
2015-05-29  3:53   ` Gonglei
2015-06-01 16:53     ` Daniel P. Berrange
2015-05-21 10:56 ` [Qemu-devel] [PATCH 06/10] crypto: add a nettle " Daniel P. Berrange
2015-05-21 19:35   ` Richard Henderson
2015-05-29  6:36     ` Gonglei
2015-05-21 19:38   ` Richard Henderson
2015-05-22  9:05     ` Daniel P. Berrange
2015-05-21 10:56 ` [Qemu-devel] [PATCH 07/10] block: convert quorum blockdrv to use crypto APIs Daniel P. Berrange
2015-05-29  6:49   ` Gonglei
2015-06-01 16:56     ` Daniel P. Berrange
2015-05-21 10:56 ` [Qemu-devel] [PATCH 08/10] ui: convert VNC websockets " Daniel P. Berrange
2015-05-29  6:55   ` Gonglei
2015-05-21 10:56 ` [Qemu-devel] [PATCH 09/10] block: convert qcow/qcow2 to use generic cipher API Daniel P. Berrange
2015-05-29  7:16   ` Gonglei
2015-06-01 16:58     ` Daniel P. Berrange
2015-05-21 10:56 ` [Qemu-devel] [PATCH 10/10] ui: convert VNC " Daniel P. Berrange
2015-05-21 12:51   ` Eric Blake
2015-06-01 16:58     ` Daniel P. Berrange
2015-05-22 11:29 ` [Qemu-devel] [PATCH 00/10] Consolidate crypto APIs & implementations Gonglei
2015-05-22 11:37   ` Daniel P. Berrange
2015-05-22 11:50     ` Gonglei
2015-05-22 12:12       ` Daniel P. Berrange

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=20150602083429.GB19508@redhat.com \
    --to=berrange@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=armbru@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --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).