From 2190260a687f88855d8a6f4d01dbf832ccf19312 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Sat, 18 Jan 2014 20:47:45 +0100 Subject: [PATCH] Small optimization in SymmetricCipherGcrypt::processInPlace(). --- src/crypto/SymmetricCipherGcrypt.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/crypto/SymmetricCipherGcrypt.cpp b/src/crypto/SymmetricCipherGcrypt.cpp index 4c17e894b..14307949e 100644 --- a/src/crypto/SymmetricCipherGcrypt.cpp +++ b/src/crypto/SymmetricCipherGcrypt.cpp @@ -143,15 +143,18 @@ void SymmetricCipherGcrypt::processInPlace(QByteArray& data, quint64 rounds) gcry_error_t error; + char* rawData = data.data(); + int size = data.size(); + if (m_direction == SymmetricCipher::Decrypt) { for (quint64 i = 0; i != rounds; ++i) { - error = gcry_cipher_decrypt(m_ctx, data.data(), data.size(), Q_NULLPTR, 0); + error = gcry_cipher_decrypt(m_ctx, rawData, size, Q_NULLPTR, 0); Q_ASSERT(error == 0); } } else { for (quint64 i = 0; i != rounds; ++i) { - error = gcry_cipher_encrypt(m_ctx, data.data(), data.size(), Q_NULLPTR, 0); + error = gcry_cipher_encrypt(m_ctx, rawData, size, Q_NULLPTR, 0); Q_ASSERT(error == 0); } }