Skip to contentSkip to conversation

Merge qcrypto 2017/02/27

GIT PULL Applied Daniel P. Berrange 2 participants 4 messages Feb 27, 2017 Crypto API

lore
Share & tools
lore
#0 lore raw

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(-)
Signature · 1 line
2.9.3
#1 lore raw

[Qemu-devel] [PULL v1 1/2] crypto: fix leak in ivgen essiv init

From: Li Qiang <[email protected]>

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

---
 crypto/ivgen-essiv.c | 1 +
 1 file changed, 1 insertion(+)
crypto/ivgen-essiv.c +1 -0
index 634de63..cba20bd 100644
@@ -48,6 +48,7 @@ static int qcrypto_ivgen_essiv_init(QCryptoIVGen *ivgen,
                            &salt, &nhash,
                            errp) < 0) {
         g_free(essiv);
+        g_free(salt);
         return -1;
     }
 
Signature · 1 line
2.9.3
#2 lore raw

[Qemu-devel] [PULL v1 2/2] crypto: assert cipher algorithm is always valid

In reply to Daniel P. Berrange

From: Prasad J Pandit <[email protected]>

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.

---
 crypto/cipher.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
crypto/cipher.c +2 -6
index 9ecaff7..5a96489 100644
@@ -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];
 }
 
Signature · 1 line
2.9.3
#3 lore raw
In reply to Daniel P. Berrange
Quoted 6 lines · 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:

Quoted 9 lines

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