qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL v1 0/2] Merge qcrypto 2017/02/27
@ 2017-02-27 13:39 Daniel P. Berrange
  2017-02-27 13:39 ` [Qemu-devel] [PULL v1 1/2] crypto: fix leak in ivgen essiv init Daniel P. Berrange
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Daniel P. Berrange @ 2017-02-27 13:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Daniel P. Berrange

The following changes since commit d992f2f1368ceb92e6bfd8efece174110f4236ff:

  Merge remote-tracking branch 'remotes/artyom/tags/pull-sun4v-20170226' into staging (2017-02-26 22:40:23 +0000)

are available in the git repository at:

  git://github.com/berrange/qemu tags/pull-qcrypto-2017-02-27-1

for you to fetch changes up to 32c813e6c2a857b93b897901b7e20281397528a3:

  crypto: assert cipher algorithm is always valid (2017-02-27 13:37:14 +0000)

----------------------------------------------------------------
Merge qcrypto 2017/02/27 v1

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

Li Qiang (1):
  crypto: fix leak in ivgen essiv init

Prasad J Pandit (1):
  crypto: assert cipher algorithm is always valid

 crypto/cipher.c      | 8 ++------
 crypto/ivgen-essiv.c | 1 +
 2 files changed, 3 insertions(+), 6 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL v1 1/2] crypto: fix leak in ivgen essiv init
  2017-02-27 13:39 [Qemu-devel] [PULL v1 0/2] Merge qcrypto 2017/02/27 Daniel P. Berrange
@ 2017-02-27 13:39 ` Daniel P. Berrange
  2017-02-27 13:39 ` [Qemu-devel] [PULL v1 2/2] crypto: assert cipher algorithm is always valid Daniel P. Berrange
  2017-02-27 16:30 ` [Qemu-devel] [PULL v1 0/2] Merge qcrypto 2017/02/27 Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel P. Berrange @ 2017-02-27 13:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Li Qiang, Daniel P . Berrange

From: Li Qiang <liqiang6-s@360.cn>

On error path, the 'salt' doesn't been freed thus leading
a memory leak. This patch avoid this.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 crypto/ivgen-essiv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/crypto/ivgen-essiv.c b/crypto/ivgen-essiv.c
index 634de63..cba20bd 100644
--- a/crypto/ivgen-essiv.c
+++ b/crypto/ivgen-essiv.c
@@ -48,6 +48,7 @@ static int qcrypto_ivgen_essiv_init(QCryptoIVGen *ivgen,
                            &salt, &nhash,
                            errp) < 0) {
         g_free(essiv);
+        g_free(salt);
         return -1;
     }
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL v1 2/2] crypto: assert cipher algorithm is always valid
  2017-02-27 13:39 [Qemu-devel] [PULL v1 0/2] Merge qcrypto 2017/02/27 Daniel P. Berrange
  2017-02-27 13:39 ` [Qemu-devel] [PULL v1 1/2] crypto: fix leak in ivgen essiv init Daniel P. Berrange
@ 2017-02-27 13:39 ` Daniel P. Berrange
  2017-02-27 16:30 ` [Qemu-devel] [PULL v1 0/2] Merge qcrypto 2017/02/27 Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel P. Berrange @ 2017-02-27 13:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Prasad J Pandit, Daniel P . Berrange

From: Prasad J Pandit <pjp@fedoraproject.org>

Crypto routines 'qcrypto_cipher_get_block_len' and
'qcrypto_cipher_get_key_len' return non-zero cipher block and key
lengths from static arrays 'alg_block_len[]' and 'alg_key_len[]'
respectively. Returning 'zero(0)' value from either of them would
likely lead to an error condition.

Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 crypto/cipher.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/crypto/cipher.c b/crypto/cipher.c
index 9ecaff7..5a96489 100644
--- a/crypto/cipher.c
+++ b/crypto/cipher.c
@@ -63,18 +63,14 @@ static bool mode_need_iv[QCRYPTO_CIPHER_MODE__MAX] = {
 
 size_t qcrypto_cipher_get_block_len(QCryptoCipherAlgorithm alg)
 {
-    if (alg >= G_N_ELEMENTS(alg_key_len)) {
-        return 0;
-    }
+    assert(alg < G_N_ELEMENTS(alg_key_len));
     return alg_block_len[alg];
 }
 
 
 size_t qcrypto_cipher_get_key_len(QCryptoCipherAlgorithm alg)
 {
-    if (alg >= G_N_ELEMENTS(alg_key_len)) {
-        return 0;
-    }
+    assert(alg < G_N_ELEMENTS(alg_key_len));
     return alg_key_len[alg];
 }
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PULL v1 0/2] Merge qcrypto 2017/02/27
  2017-02-27 13:39 [Qemu-devel] [PULL v1 0/2] Merge qcrypto 2017/02/27 Daniel P. Berrange
  2017-02-27 13:39 ` [Qemu-devel] [PULL v1 1/2] crypto: fix leak in ivgen essiv init Daniel P. Berrange
  2017-02-27 13:39 ` [Qemu-devel] [PULL v1 2/2] crypto: assert cipher algorithm is always valid Daniel P. Berrange
@ 2017-02-27 16:30 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2017-02-27 16:30 UTC (permalink / raw)
  To: Daniel P. Berrange; +Cc: QEMU Developers

On 27 February 2017 at 13:39, Daniel P. Berrange <berrange@redhat.com> wrote:
> The following changes since commit d992f2f1368ceb92e6bfd8efece174110f4236ff:
>
>   Merge remote-tracking branch 'remotes/artyom/tags/pull-sun4v-20170226' into staging (2017-02-26 22:40:23 +0000)
>
> are available in the git repository at:
>
>   git://github.com/berrange/qemu tags/pull-qcrypto-2017-02-27-1
>
> for you to fetch changes up to 32c813e6c2a857b93b897901b7e20281397528a3:
>
>   crypto: assert cipher algorithm is always valid (2017-02-27 13:37:14 +0000)
>
> ----------------------------------------------------------------
> Merge qcrypto 2017/02/27 v1
>

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-27 16:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-27 13:39 [Qemu-devel] [PULL v1 0/2] Merge qcrypto 2017/02/27 Daniel P. Berrange
2017-02-27 13:39 ` [Qemu-devel] [PULL v1 1/2] crypto: fix leak in ivgen essiv init Daniel P. Berrange
2017-02-27 13:39 ` [Qemu-devel] [PULL v1 2/2] crypto: assert cipher algorithm is always valid Daniel P. Berrange
2017-02-27 16:30 ` [Qemu-devel] [PULL v1 0/2] Merge qcrypto 2017/02/27 Peter Maydell

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).