[Qemu-devel] [PULL v1 00/18] Merge crypto 201/07/18

Daniel P. Berrange posted 18 patches 8 years, 6 months ago
Only 17 patches received!
There is a newer version of this series
configure                         |  37 +++++++
crypto/Makefile.objs              |   3 +
crypto/afalg.c                    | 116 +++++++++++++++++++
crypto/afalgpriv.h                |  64 +++++++++++
crypto/cipher-afalg.c             | 226 ++++++++++++++++++++++++++++++++++++++
crypto/cipher-builtin.c           | 125 ++++++++++-----------
crypto/cipher-gcrypt.c            | 105 ++++++++++--------
crypto/cipher-nettle.c            |  84 ++++++++------
crypto/cipher.c                   |  80 ++++++++++++++
crypto/cipherpriv.h               |  56 ++++++++++
crypto/hash-afalg.c               | 214 ++++++++++++++++++++++++++++++++++++
crypto/hash-gcrypt.c              |  19 +++-
crypto/hash-glib.c                |  19 +++-
crypto/hash-nettle.c              |  19 +++-
crypto/hash.c                     |  30 +++++
crypto/hashpriv.h                 |  39 +++++++
crypto/hmac-gcrypt.c              |  42 ++++---
crypto/hmac-glib.c                |  63 ++++++-----
crypto/hmac-nettle.c              |  42 ++++---
crypto/hmac.c                     |  58 ++++++++++
crypto/hmacpriv.h                 |  48 ++++++++
include/crypto/cipher.h           |   1 +
{crypto => include/crypto}/hmac.h |   1 +
tests/.gitignore                  |   3 +
tests/Makefile.include            |  13 ++-
tests/benchmark-crypto-cipher.c   |  88 +++++++++++++++
tests/benchmark-crypto-hash.c     |  67 +++++++++++
tests/benchmark-crypto-hmac.c     |  82 ++++++++++++++
28 files changed, 1499 insertions(+), 245 deletions(-)
create mode 100644 crypto/afalg.c
create mode 100644 crypto/afalgpriv.h
create mode 100644 crypto/cipher-afalg.c
create mode 100644 crypto/cipherpriv.h
create mode 100644 crypto/hash-afalg.c
create mode 100644 crypto/hashpriv.h
create mode 100644 crypto/hmacpriv.h
rename {crypto => include/crypto}/hmac.h (99%)
create mode 100644 tests/benchmark-crypto-cipher.c
create mode 100644 tests/benchmark-crypto-hash.c
create mode 100644 tests/benchmark-crypto-hmac.c
[Qemu-devel] [PULL v1 00/18] Merge crypto 201/07/18
Posted by Daniel P. Berrange 8 years, 6 months ago
The following changes since commit 6c6076662d98c068059983d411cb2a8987ba5670:

  Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2017-07-14 12:16:09 +0100)

are available in the git repository at:

  git://github.com/berrange/qemu tags/pull-qcrypto-2017-07-18-1

for you to fetch changes up to 0e0fb56bcc8145d956bf527bfedc2be42bca101f:

  tests: crypto: add hmac speed benchmark support (2017-07-18 11:18:30 +0100)

----------------------------------------------------------------
Merge crypto 2017/07/18 v1

----------------------------------------------------------------

Longpeng(Mike) (18):
  crypto: cipher: introduce context free function
  crypto: cipher: introduce qcrypto_cipher_ctx_new for gcrypt-backend
  crypto: cipher: introduce qcrypto_cipher_ctx_new for nettle-backend
  crypto: cipher: introduce qcrypto_cipher_ctx_new for builtin-backend
  crypto: cipher: add cipher driver framework
  crypto: hash: add hash driver framework
  crypto: hmac: move crypto/hmac.h into include/crypto/
  crypto: hmac: introduce qcrypto_hmac_ctx_new for gcrypt-backend
  crypto: hmac: introduce qcrypto_hmac_ctx_new for nettle-backend
  crypto: hmac: introduce qcrypto_hmac_ctx_new for glib-backend
  crypto: hmac: add hmac driver framework
  crypto: introduce some common functions for af_alg backend
  crypto: cipher: add afalg-backend cipher support
  crypto: hash: add afalg-backend hash support
  crypto: hmac: add af_alg-backend hmac support
  tests: crypto: add cipher speed benchmark support
  tests: crypto: add hash speed benchmark support
  tests: crypto: add hmac speed benchmark support

 configure                         |  37 +++++++
 crypto/Makefile.objs              |   3 +
 crypto/afalg.c                    | 116 +++++++++++++++++++
 crypto/afalgpriv.h                |  64 +++++++++++
 crypto/cipher-afalg.c             | 226 ++++++++++++++++++++++++++++++++++++++
 crypto/cipher-builtin.c           | 125 ++++++++++-----------
 crypto/cipher-gcrypt.c            | 105 ++++++++++--------
 crypto/cipher-nettle.c            |  84 ++++++++------
 crypto/cipher.c                   |  80 ++++++++++++++
 crypto/cipherpriv.h               |  56 ++++++++++
 crypto/hash-afalg.c               | 214 ++++++++++++++++++++++++++++++++++++
 crypto/hash-gcrypt.c              |  19 +++-
 crypto/hash-glib.c                |  19 +++-
 crypto/hash-nettle.c              |  19 +++-
 crypto/hash.c                     |  30 +++++
 crypto/hashpriv.h                 |  39 +++++++
 crypto/hmac-gcrypt.c              |  42 ++++---
 crypto/hmac-glib.c                |  63 ++++++-----
 crypto/hmac-nettle.c              |  42 ++++---
 crypto/hmac.c                     |  58 ++++++++++
 crypto/hmacpriv.h                 |  48 ++++++++
 include/crypto/cipher.h           |   1 +
 {crypto => include/crypto}/hmac.h |   1 +
 tests/.gitignore                  |   3 +
 tests/Makefile.include            |  13 ++-
 tests/benchmark-crypto-cipher.c   |  88 +++++++++++++++
 tests/benchmark-crypto-hash.c     |  67 +++++++++++
 tests/benchmark-crypto-hmac.c     |  82 ++++++++++++++
 28 files changed, 1499 insertions(+), 245 deletions(-)
 create mode 100644 crypto/afalg.c
 create mode 100644 crypto/afalgpriv.h
 create mode 100644 crypto/cipher-afalg.c
 create mode 100644 crypto/cipherpriv.h
 create mode 100644 crypto/hash-afalg.c
 create mode 100644 crypto/hashpriv.h
 create mode 100644 crypto/hmacpriv.h
 rename {crypto => include/crypto}/hmac.h (99%)
 create mode 100644 tests/benchmark-crypto-cipher.c
 create mode 100644 tests/benchmark-crypto-hash.c
 create mode 100644 tests/benchmark-crypto-hmac.c

-- 
2.13.0


Re: [Qemu-devel] [PULL v1 00/18] Merge crypto 201/07/18
Posted by Peter Maydell 8 years, 6 months ago
On 18 July 2017 at 11:25, Daniel P. Berrange <berrange@redhat.com> wrote:
> The following changes since commit 6c6076662d98c068059983d411cb2a8987ba5670:
>
>   Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2017-07-14 12:16:09 +0100)
>
> are available in the git repository at:
>
>   git://github.com/berrange/qemu tags/pull-qcrypto-2017-07-18-1
>
> for you to fetch changes up to 0e0fb56bcc8145d956bf527bfedc2be42bca101f:
>
>   tests: crypto: add hmac speed benchmark support (2017-07-18 11:18:30 +0100)
>
> ----------------------------------------------------------------
> Merge crypto 2017/07/18 v1
>
> ----------------------------------------------------------------

Hi; I'm afraid this failed to build on clang (x86 Linux, FreeBSD,
OSX):

  CC      crypto/cipher.o
/home/petmay01/linaro/qemu-for-merges/crypto/cipher.c:177:9: error:
variable 'drv' is used uninitialized whenever 'if' condition is false
[-Werror,-Wsometimes-uninitialized]
    if (!ctx) {
        ^~~~
/home/petmay01/linaro/qemu-for-merges/crypto/cipher.c:192:30: note:
uninitialized use occurs here
    cipher->driver = (void *)drv;
                             ^~~
/home/petmay01/linaro/qemu-for-merges/crypto/cipher.c:177:5: note:
remove the 'if' if its condition is always true
    if (!ctx) {
    ^~~~~~~~~~
/home/petmay01/linaro/qemu-for-merges/crypto/cipher.c:168:29: note:
initialize the variable 'drv' to silence this warning
    QCryptoCipherDriver *drv;
                            ^
                             = NULL
1 error generated.

and also

  CC      crypto/hmac.o
/home/petmay01/linaro/qemu-for-merges/crypto/hmac.c:103:9: error:
variable 'drv' is used uninitialized whenever 'if' condition is false
[-Werror,-Wsometimes-uninitialized]
    if (!ctx) {
        ^~~~
/home/petmay01/linaro/qemu-for-merges/crypto/hmac.c:116:28: note:
uninitialized use occurs here
    hmac->driver = (void *)drv;
                           ^~~
/home/petmay01/linaro/qemu-for-merges/crypto/hmac.c:103:5: note:
remove the 'if' if its condition is always true
    if (!ctx) {
    ^~~~~~~~~~
/home/petmay01/linaro/qemu-for-merges/crypto/hmac.c:94:27: note:
initialize the variable 'drv' to silence this warning
    QCryptoHmacDriver *drv;
                          ^
                           = NULL


Looks like a false positive, I think :-(

thanks
-- PMM

Re: [Qemu-devel] [PULL v1 00/18] Merge crypto 201/07/18
Posted by Daniel P. Berrange 8 years, 6 months ago
On Wed, Jul 19, 2017 at 09:11:17AM +0100, Peter Maydell wrote:
> On 18 July 2017 at 11:25, Daniel P. Berrange <berrange@redhat.com> wrote:
> > The following changes since commit 6c6076662d98c068059983d411cb2a8987ba5670:
> >
> >   Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2017-07-14 12:16:09 +0100)
> >
> > are available in the git repository at:
> >
> >   git://github.com/berrange/qemu tags/pull-qcrypto-2017-07-18-1
> >
> > for you to fetch changes up to 0e0fb56bcc8145d956bf527bfedc2be42bca101f:
> >
> >   tests: crypto: add hmac speed benchmark support (2017-07-18 11:18:30 +0100)
> >
> > ----------------------------------------------------------------
> > Merge crypto 2017/07/18 v1
> >
> > ----------------------------------------------------------------
> 
> Hi; I'm afraid this failed to build on clang (x86 Linux, FreeBSD,
> OSX):
> 
>   CC      crypto/cipher.o
> /home/petmay01/linaro/qemu-for-merges/crypto/cipher.c:177:9: error:
> variable 'drv' is used uninitialized whenever 'if' condition is false
> [-Werror,-Wsometimes-uninitialized]
>     if (!ctx) {
>         ^~~~
> /home/petmay01/linaro/qemu-for-merges/crypto/cipher.c:192:30: note:
> uninitialized use occurs here
>     cipher->driver = (void *)drv;
>                              ^~~
> /home/petmay01/linaro/qemu-for-merges/crypto/cipher.c:177:5: note:
> remove the 'if' if its condition is always true
>     if (!ctx) {
>     ^~~~~~~~~~
> /home/petmay01/linaro/qemu-for-merges/crypto/cipher.c:168:29: note:
> initialize the variable 'drv' to silence this warning
>     QCryptoCipherDriver *drv;
>                             ^
>                              = NULL
> 1 error generated.
> 
> and also
> 
>   CC      crypto/hmac.o
> /home/petmay01/linaro/qemu-for-merges/crypto/hmac.c:103:9: error:
> variable 'drv' is used uninitialized whenever 'if' condition is false
> [-Werror,-Wsometimes-uninitialized]
>     if (!ctx) {
>         ^~~~
> /home/petmay01/linaro/qemu-for-merges/crypto/hmac.c:116:28: note:
> uninitialized use occurs here
>     hmac->driver = (void *)drv;
>                            ^~~
> /home/petmay01/linaro/qemu-for-merges/crypto/hmac.c:103:5: note:
> remove the 'if' if its condition is always true
>     if (!ctx) {
>     ^~~~~~~~~~
> /home/petmay01/linaro/qemu-for-merges/crypto/hmac.c:94:27: note:
> initialize the variable 'drv' to silence this warning
>     QCryptoHmacDriver *drv;
>                           ^
>                            = NULL
> 
> 
> Looks like a false positive, I think :-(

Ok, I'll investigate.

BTW, any idea what's different between your clang builds and the
clang builds that travis does - the latter passed on both OS-X
and Linux.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

Re: [Qemu-devel] [PULL v1 00/18] Merge crypto 201/07/18
Posted by Daniel P. Berrange 8 years, 6 months ago
On Wed, Jul 19, 2017 at 09:28:01AM +0100, Daniel P. Berrange wrote:
> On Wed, Jul 19, 2017 at 09:11:17AM +0100, Peter Maydell wrote:
> > On 18 July 2017 at 11:25, Daniel P. Berrange <berrange@redhat.com> wrote:
> > > The following changes since commit 6c6076662d98c068059983d411cb2a8987ba5670:
> > >
> > >   Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2017-07-14 12:16:09 +0100)
> > >
> > > are available in the git repository at:
> > >
> > >   git://github.com/berrange/qemu tags/pull-qcrypto-2017-07-18-1
> > >
> > > for you to fetch changes up to 0e0fb56bcc8145d956bf527bfedc2be42bca101f:
> > >
> > >   tests: crypto: add hmac speed benchmark support (2017-07-18 11:18:30 +0100)
> > >
> > > ----------------------------------------------------------------
> > > Merge crypto 2017/07/18 v1
> > >
> > > ----------------------------------------------------------------
> > 
> > Hi; I'm afraid this failed to build on clang (x86 Linux, FreeBSD,
> > OSX):
> > 
> >   CC      crypto/cipher.o
> > /home/petmay01/linaro/qemu-for-merges/crypto/cipher.c:177:9: error:
> > variable 'drv' is used uninitialized whenever 'if' condition is false
> > [-Werror,-Wsometimes-uninitialized]
> >     if (!ctx) {
> >         ^~~~
> > /home/petmay01/linaro/qemu-for-merges/crypto/cipher.c:192:30: note:
> > uninitialized use occurs here
> >     cipher->driver = (void *)drv;
> >                              ^~~
> > /home/petmay01/linaro/qemu-for-merges/crypto/cipher.c:177:5: note:
> > remove the 'if' if its condition is always true
> >     if (!ctx) {
> >     ^~~~~~~~~~
> > /home/petmay01/linaro/qemu-for-merges/crypto/cipher.c:168:29: note:
> > initialize the variable 'drv' to silence this warning
> >     QCryptoCipherDriver *drv;
> >                             ^
> >                              = NULL
> > 1 error generated.
> > 
> > and also
> > 
> >   CC      crypto/hmac.o
> > /home/petmay01/linaro/qemu-for-merges/crypto/hmac.c:103:9: error:
> > variable 'drv' is used uninitialized whenever 'if' condition is false
> > [-Werror,-Wsometimes-uninitialized]
> >     if (!ctx) {
> >         ^~~~
> > /home/petmay01/linaro/qemu-for-merges/crypto/hmac.c:116:28: note:
> > uninitialized use occurs here
> >     hmac->driver = (void *)drv;
> >                            ^~~
> > /home/petmay01/linaro/qemu-for-merges/crypto/hmac.c:103:5: note:
> > remove the 'if' if its condition is always true
> >     if (!ctx) {
> >     ^~~~~~~~~~
> > /home/petmay01/linaro/qemu-for-merges/crypto/hmac.c:94:27: note:
> > initialize the variable 'drv' to silence this warning
> >     QCryptoHmacDriver *drv;
> >                           ^
> >                            = NULL
> > 
> > 
> > Looks like a false positive, I think :-(
> 
> Ok, I'll investigate.
> 
> BTW, any idea what's different between your clang builds and the
> clang builds that travis does - the latter passed on both OS-X
> and Linux.

Never mind, I just it must just be a newer version of clang - the travis
clang build uses 3.4.0 on Linux and 7.3.0 (?!?!??) on OS-X, where as latest
I see for Linux is 4.0.0

/me wonders how OS-X clang versions map to Lnux clang versions ??!

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

Re: [Qemu-devel] [PULL v1 00/18] Merge crypto 201/07/18
Posted by Daniel P. Berrange 8 years, 6 months ago
On Wed, Jul 19, 2017 at 09:11:17AM +0100, Peter Maydell wrote:
> On 18 July 2017 at 11:25, Daniel P. Berrange <berrange@redhat.com> wrote:
> > The following changes since commit 6c6076662d98c068059983d411cb2a8987ba5670:
> >
> >   Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2017-07-14 12:16:09 +0100)
> >
> > are available in the git repository at:
> >
> >   git://github.com/berrange/qemu tags/pull-qcrypto-2017-07-18-1
> >
> > for you to fetch changes up to 0e0fb56bcc8145d956bf527bfedc2be42bca101f:
> >
> >   tests: crypto: add hmac speed benchmark support (2017-07-18 11:18:30 +0100)
> >
> > ----------------------------------------------------------------
> > Merge crypto 2017/07/18 v1
> >
> > ----------------------------------------------------------------
> 
> Hi; I'm afraid this failed to build on clang (x86 Linux, FreeBSD,
> OSX):
> 
>   CC      crypto/cipher.o
> /home/petmay01/linaro/qemu-for-merges/crypto/cipher.c:177:9: error:
> variable 'drv' is used uninitialized whenever 'if' condition is false
> [-Werror,-Wsometimes-uninitialized]
>     if (!ctx) {
>         ^~~~
> /home/petmay01/linaro/qemu-for-merges/crypto/cipher.c:192:30: note:
> uninitialized use occurs here
>     cipher->driver = (void *)drv;
>                              ^~~
> /home/petmay01/linaro/qemu-for-merges/crypto/cipher.c:177:5: note:
> remove the 'if' if its condition is always true
>     if (!ctx) {
>     ^~~~~~~~~~
> /home/petmay01/linaro/qemu-for-merges/crypto/cipher.c:168:29: note:
> initialize the variable 'drv' to silence this warning
>     QCryptoCipherDriver *drv;
>                             ^
>                              = NULL
> 1 error generated.
> 
> and also
> 
>   CC      crypto/hmac.o
> /home/petmay01/linaro/qemu-for-merges/crypto/hmac.c:103:9: error:
> variable 'drv' is used uninitialized whenever 'if' condition is false
> [-Werror,-Wsometimes-uninitialized]
>     if (!ctx) {
>         ^~~~
> /home/petmay01/linaro/qemu-for-merges/crypto/hmac.c:116:28: note:
> uninitialized use occurs here
>     hmac->driver = (void *)drv;
>                            ^~~
> /home/petmay01/linaro/qemu-for-merges/crypto/hmac.c:103:5: note:
> remove the 'if' if its condition is always true
>     if (!ctx) {
>     ^~~~~~~~~~
> /home/petmay01/linaro/qemu-for-merges/crypto/hmac.c:94:27: note:
> initialize the variable 'drv' to silence this warning
>     QCryptoHmacDriver *drv;
>                           ^
>                            = NULL
> 
> 
> Looks like a false positive, I think :-(

Yes, both false positives - in v2 I initialized the 'drv' variable to NULL
in both cases to stop it getting confused.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

[Qemu-devel] [PULL v1 07/18] crypto: hmac: move crypto/hmac.h into include/crypto/
Posted by Daniel P. Berrange 8 years, 6 months ago
From: "Longpeng(Mike)" <longpeng2@huawei.com>

Moves crypto/hmac.h into include/crypto/, likes cipher.h and hash.h

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 {crypto => include/crypto}/hmac.h | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename {crypto => include/crypto}/hmac.h (100%)

diff --git a/crypto/hmac.h b/include/crypto/hmac.h
similarity index 100%
rename from crypto/hmac.h
rename to include/crypto/hmac.h
-- 
2.13.0