QSslKey - clean up the code a bit (SecureTransport)

To get rid of different warnings (visible in qt-creator at least).

Change-Id: Ic7b57cbd56494704eda3f0616fcd901a8fab63db
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Timur Pocheptsov 2019-03-06 10:16:43 +01:00
parent ef840bef5c
commit 1af234f24e

View File

@ -42,7 +42,9 @@
#include <CommonCrypto/CommonCrypto.h>
QT_USE_NAMESPACE
#include <cstddef>
QT_BEGIN_NAMESPACE
static QByteArray wrapCCCrypt(CCOperation ccOp,
QSslKeyPrivate::Cipher cipher,
@ -69,12 +71,12 @@ static QByteArray wrapCCCrypt(CCOperation ccOp,
QByteArray plain(data.size() + blockSize, 0);
CCCryptorStatus status = CCCrypt(
ccOp, ccAlgorithm, kCCOptionPKCS7Padding,
key.constData(), key.size(),
key.constData(), std::size_t(key.size()),
iv.constData(),
data.constData(), data.size(),
plain.data(), plain.size(), &plainLength);
data.constData(), std::size_t(data.size()),
plain.data(), std::size_t(plain.size()), &plainLength);
if (status == kCCSuccess)
return plain.left(plainLength);
return plain.left(int(plainLength));
return QByteArray();
}
@ -87,3 +89,5 @@ QByteArray QSslKeyPrivate::encrypt(Cipher cipher, const QByteArray &data, const
{
return wrapCCCrypt(kCCEncrypt, cipher, data, key, iv);
}
QT_END_NAMESPACE