Merge qcrypto 2017/11/08 v1

-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABCAAGBQJaAuU+AAoJEL6G67QVEE/fsnkP/jdqkt5suVfAgGHIi4nsUNZI
 eaKuOEX26rIy6oaX11XmsEdLtxWMkEN2PaaD9axBbxhhfi1SuXY757Zgfhv3OV86
 sYWfvdCilkOY2sgU/xPLwh9NP/JaomYxFJvEBBTVUqd/QF/r3f0URTPipg+qiwWM
 EFtLi39+Tfmsjd6AsgLif0yXQTSEVWYUpCDC3whYDG+5xk8x3wgKCKNpYmk+cc8n
 SoUUP8njEX6jrqgF9syiSDrz3fLOebhdyA91K6RiCyuMHG/J+dyQ8ZywapTdhjlA
 lwfdyzbFxgcMj6tEUMv1UL40LiA5TRhBXxbfmMP3Ah84yONQI3HeONi6axGpxQF5
 MLaBPc06sNx8bokgK+SOVOx61DPRhiUcVHeYlOYyaaJG9bFaTYvhi/nDqjcPYRsk
 z+x2Gn5t5xikX0kFFZKZKXmdbDKGhTQvNT5Zbfv4+F7JYrqHJIS/LIvF4E6bxMT6
 t93eL+AIq+2lZ1cbmJNGanPinppMZb0nPnPumqTRLmlSEC799Y0ANIJ4SA+xrGec
 FV8EDcijs0Tmto9eYkBfaqFvHnsWKn7KQtGzstKvq4vMWc1Dc3oaNM/zhuE0ifJF
 U9L1gRwCFfM2RoeUVIwBUCDfnCDEx45xOwSctmQW0v9H+1ZiSDNFO4KqIrvNGg+M
 xF15fh/59fUYE/yP7g2w
 =+xi3
 -----END PGP SIGNATURE-----

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: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2017-11-10 16:01:35 +00:00
commit 4ffa88c99c
4 changed files with 10 additions and 17 deletions

View File

@ -164,11 +164,10 @@ QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgorithm alg,
{
QCryptoCipher *cipher;
void *ctx = NULL;
Error *err2 = NULL;
QCryptoCipherDriver *drv = NULL;
#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) {
drv = &qcrypto_cipher_afalg_driver;
}
@ -177,12 +176,10 @@ QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgorithm alg,
if (!ctx) {
ctx = qcrypto_cipher_ctx_new(alg, mode, key, nkey, errp);
if (!ctx) {
error_free(err2);
return NULL;
}
drv = &qcrypto_cipher_lib_driver;
error_free(err2);
}
cipher = g_new0(QCryptoCipher, 1);

View File

@ -48,19 +48,16 @@ int qcrypto_hash_bytesv(QCryptoHashAlgorithm alg,
{
#ifdef CONFIG_AF_ALG
int ret;
ret = qcrypto_hash_afalg_driver.hash_bytesv(alg, iov, niov,
result, resultlen,
errp);
if (ret == 0) {
return ret;
}
/*
* TODO:
* Maybe we should treat some afalg errors as fatal
*/
error_free(*errp);
ret = qcrypto_hash_afalg_driver.hash_bytesv(alg, iov, niov,
result, resultlen,
NULL);
if (ret == 0) {
return ret;
}
#endif
return qcrypto_hash_lib_driver.hash_bytesv(alg, iov, niov,

View File

@ -90,11 +90,10 @@ QCryptoHmac *qcrypto_hmac_new(QCryptoHashAlgorithm alg,
{
QCryptoHmac *hmac;
void *ctx = NULL;
Error *err2 = NULL;
QCryptoHmacDriver *drv = NULL;
#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) {
drv = &qcrypto_hmac_afalg_driver;
}
@ -107,7 +106,6 @@ QCryptoHmac *qcrypto_hmac_new(QCryptoHashAlgorithm alg,
}
drv = &qcrypto_hmac_lib_driver;
error_free(err2);
}
hmac = g_new0(QCryptoHmac, 1);

View File

@ -28,7 +28,8 @@
#include <sys/resource.h>
#endif
#if (defined(_WIN32) || defined RUSAGE_THREAD)
#if (defined(_WIN32) || defined RUSAGE_THREAD) && \
(defined(CONFIG_NETTLE_KDF) || defined(CONFIG_GCRYPT_KDF))
#define TEST_LUKS
#else
#undef TEST_LUKS