提交 4ffa88c9 编写于 作者: P Peter Maydell

Merge remote-tracking branch 'remotes/berrange/tags/pull-qcrypto-2017-11-08-1' into staging

Merge qcrypto 2017/11/08 v1

# gpg: Signature made Wed 08 Nov 2017 11:06:38 GMT
# gpg:                using RSA key 0xBE86EBB415104FDF
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>"
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>"
# Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E  8E3F BE86 EBB4 1510 4FDF

* remotes/berrange/tags/pull-qcrypto-2017-11-08-1:
  crypto: afalg: fix a NULL pointer dereference
  tests: Run the luks tests in test-crypto-block only if encryption is available
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
...@@ -164,11 +164,10 @@ QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgorithm alg, ...@@ -164,11 +164,10 @@ QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgorithm alg,
{ {
QCryptoCipher *cipher; QCryptoCipher *cipher;
void *ctx = NULL; void *ctx = NULL;
Error *err2 = NULL;
QCryptoCipherDriver *drv = NULL; QCryptoCipherDriver *drv = NULL;
#ifdef CONFIG_AF_ALG #ifdef CONFIG_AF_ALG
ctx = qcrypto_afalg_cipher_ctx_new(alg, mode, key, nkey, &err2); ctx = qcrypto_afalg_cipher_ctx_new(alg, mode, key, nkey, NULL);
if (ctx) { if (ctx) {
drv = &qcrypto_cipher_afalg_driver; drv = &qcrypto_cipher_afalg_driver;
} }
...@@ -177,12 +176,10 @@ QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgorithm alg, ...@@ -177,12 +176,10 @@ QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgorithm alg,
if (!ctx) { if (!ctx) {
ctx = qcrypto_cipher_ctx_new(alg, mode, key, nkey, errp); ctx = qcrypto_cipher_ctx_new(alg, mode, key, nkey, errp);
if (!ctx) { if (!ctx) {
error_free(err2);
return NULL; return NULL;
} }
drv = &qcrypto_cipher_lib_driver; drv = &qcrypto_cipher_lib_driver;
error_free(err2);
} }
cipher = g_new0(QCryptoCipher, 1); cipher = g_new0(QCryptoCipher, 1);
......
...@@ -48,19 +48,16 @@ int qcrypto_hash_bytesv(QCryptoHashAlgorithm alg, ...@@ -48,19 +48,16 @@ int qcrypto_hash_bytesv(QCryptoHashAlgorithm alg,
{ {
#ifdef CONFIG_AF_ALG #ifdef CONFIG_AF_ALG
int ret; int ret;
/*
* TODO:
* Maybe we should treat some afalg errors as fatal
*/
ret = qcrypto_hash_afalg_driver.hash_bytesv(alg, iov, niov, ret = qcrypto_hash_afalg_driver.hash_bytesv(alg, iov, niov,
result, resultlen, result, resultlen,
errp); NULL);
if (ret == 0) { if (ret == 0) {
return ret; return ret;
} }
/*
* TODO:
* Maybe we should treat some afalg errors as fatal
*/
error_free(*errp);
#endif #endif
return qcrypto_hash_lib_driver.hash_bytesv(alg, iov, niov, return qcrypto_hash_lib_driver.hash_bytesv(alg, iov, niov,
......
...@@ -90,11 +90,10 @@ QCryptoHmac *qcrypto_hmac_new(QCryptoHashAlgorithm alg, ...@@ -90,11 +90,10 @@ QCryptoHmac *qcrypto_hmac_new(QCryptoHashAlgorithm alg,
{ {
QCryptoHmac *hmac; QCryptoHmac *hmac;
void *ctx = NULL; void *ctx = NULL;
Error *err2 = NULL;
QCryptoHmacDriver *drv = NULL; QCryptoHmacDriver *drv = NULL;
#ifdef CONFIG_AF_ALG #ifdef CONFIG_AF_ALG
ctx = qcrypto_afalg_hmac_ctx_new(alg, key, nkey, &err2); ctx = qcrypto_afalg_hmac_ctx_new(alg, key, nkey, NULL);
if (ctx) { if (ctx) {
drv = &qcrypto_hmac_afalg_driver; drv = &qcrypto_hmac_afalg_driver;
} }
...@@ -107,7 +106,6 @@ QCryptoHmac *qcrypto_hmac_new(QCryptoHashAlgorithm alg, ...@@ -107,7 +106,6 @@ QCryptoHmac *qcrypto_hmac_new(QCryptoHashAlgorithm alg,
} }
drv = &qcrypto_hmac_lib_driver; drv = &qcrypto_hmac_lib_driver;
error_free(err2);
} }
hmac = g_new0(QCryptoHmac, 1); hmac = g_new0(QCryptoHmac, 1);
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
#include <sys/resource.h> #include <sys/resource.h>
#endif #endif
#if (defined(_WIN32) || defined RUSAGE_THREAD) #if (defined(_WIN32) || defined RUSAGE_THREAD) && \
(defined(CONFIG_NETTLE_KDF) || defined(CONFIG_GCRYPT_KDF))
#define TEST_LUKS #define TEST_LUKS
#else #else
#undef TEST_LUKS #undef TEST_LUKS
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册