summaryrefslogtreecommitdiffstats
path: root/src/network/ssl/qsslkey_openssl.cpp
diff options
context:
space:
mode:
authorMÃ¥rten Nordheim <marten.nordheim@qt.io>2018-08-07 10:29:46 +0200
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2018-08-09 05:34:51 +0000
commit89d4c600a512d9aea35bb4d763e43fe81b138824 (patch)
tree8d2d0fc816b940ea6a17c42c3153aff7464fddd7 /src/network/ssl/qsslkey_openssl.cpp
parentc1117ac496df9f7e47fdc82306bb4e20848a04d4 (diff)
Ssl: clang-tidy modernize-use-nullptr
And reflow the text where it exceeds the 100 column limit. Change-Id: I0d270c6a74a4c6ecba30e4e4d38a5d8f2cf81040 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/network/ssl/qsslkey_openssl.cpp')
-rw-r--r--src/network/ssl/qsslkey_openssl.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/network/ssl/qsslkey_openssl.cpp b/src/network/ssl/qsslkey_openssl.cpp
index 6e5a4c76e9..9a43e67772 100644
--- a/src/network/ssl/qsslkey_openssl.cpp
+++ b/src/network/ssl/qsslkey_openssl.cpp
@@ -62,24 +62,24 @@ void QSslKeyPrivate::clear(bool deep)
if (algorithm == QSsl::Rsa && rsa) {
if (deep)
q_RSA_free(rsa);
- rsa = 0;
+ rsa = nullptr;
}
if (algorithm == QSsl::Dsa && dsa) {
if (deep)
q_DSA_free(dsa);
- dsa = 0;
+ dsa = nullptr;
}
#ifndef OPENSSL_NO_EC
if (algorithm == QSsl::Ec && ec) {
if (deep)
q_EC_KEY_free(ec);
- ec = 0;
+ ec = nullptr;
}
#endif
if (algorithm == QSsl::Opaque && opaque) {
if (deep)
q_EVP_PKEY_free(opaque);
- opaque = 0;
+ opaque = nullptr;
}
}
@@ -150,21 +150,21 @@ void QSslKeyPrivate::decodePem(const QByteArray &pem, const QByteArray &passPhra
if (algorithm == QSsl::Rsa) {
RSA *result = (type == QSsl::PublicKey)
- ? q_PEM_read_bio_RSA_PUBKEY(bio, &rsa, 0, phrase)
- : q_PEM_read_bio_RSAPrivateKey(bio, &rsa, 0, phrase);
+ ? q_PEM_read_bio_RSA_PUBKEY(bio, &rsa, nullptr, phrase)
+ : q_PEM_read_bio_RSAPrivateKey(bio, &rsa, nullptr, phrase);
if (rsa && rsa == result)
isNull = false;
} else if (algorithm == QSsl::Dsa) {
DSA *result = (type == QSsl::PublicKey)
- ? q_PEM_read_bio_DSA_PUBKEY(bio, &dsa, 0, phrase)
- : q_PEM_read_bio_DSAPrivateKey(bio, &dsa, 0, phrase);
+ ? q_PEM_read_bio_DSA_PUBKEY(bio, &dsa, nullptr, phrase)
+ : q_PEM_read_bio_DSAPrivateKey(bio, &dsa, nullptr, phrase);
if (dsa && dsa == result)
isNull = false;
#ifndef OPENSSL_NO_EC
} else if (algorithm == QSsl::Ec) {
EC_KEY *result = (type == QSsl::PublicKey)
- ? q_PEM_read_bio_EC_PUBKEY(bio, &ec, 0, phrase)
- : q_PEM_read_bio_ECPrivateKey(bio, &ec, 0, phrase);
+ ? q_PEM_read_bio_EC_PUBKEY(bio, &ec, nullptr, phrase)
+ : q_PEM_read_bio_ECPrivateKey(bio, &ec, nullptr, phrase);
if (ec && ec == result)
isNull = false;
#endif
@@ -215,8 +215,8 @@ QByteArray QSslKeyPrivate::toPem(const QByteArray &passPhrase) const
fail = true;
} else {
if (!q_PEM_write_bio_RSAPrivateKey(
- bio, rsa, cipher,
- const_cast<uchar *>((const uchar *)passPhrase.data()), passPhrase.size(), 0, 0)) {
+ bio, rsa, cipher, const_cast<uchar *>((const uchar *)passPhrase.data()),
+ passPhrase.size(), nullptr, nullptr)) {
fail = true;
}
}
@@ -226,8 +226,8 @@ QByteArray QSslKeyPrivate::toPem(const QByteArray &passPhrase) const
fail = true;
} else {
if (!q_PEM_write_bio_DSAPrivateKey(
- bio, dsa, cipher,
- const_cast<uchar *>((const uchar *)passPhrase.data()), passPhrase.size(), 0, 0)) {
+ bio, dsa, cipher, const_cast<uchar *>((const uchar *)passPhrase.data()),
+ passPhrase.size(), nullptr, nullptr)) {
fail = true;
}
}
@@ -237,9 +237,9 @@ QByteArray QSslKeyPrivate::toPem(const QByteArray &passPhrase) const
if (!q_PEM_write_bio_EC_PUBKEY(bio, ec))
fail = true;
} else {
- if (!q_PEM_write_bio_ECPrivateKey(
- bio, ec, cipher,
- const_cast<uchar *>((const uchar *)passPhrase.data()), passPhrase.size(), 0, 0)) {
+ if (!q_PEM_write_bio_ECPrivateKey(bio, ec, cipher,
+ const_cast<uchar *>((const uchar *)passPhrase.data()),
+ passPhrase.size(), nullptr, nullptr)) {
fail = true;
}
}
@@ -272,13 +272,13 @@ Qt::HANDLE QSslKeyPrivate::handle() const
return Qt::HANDLE(ec);
#endif
default:
- return Qt::HANDLE(NULL);
+ return Qt::HANDLE(nullptr);
}
}
static QByteArray doCrypt(QSslKeyPrivate::Cipher cipher, const QByteArray &data, const QByteArray &key, const QByteArray &iv, int enc)
{
- const EVP_CIPHER* type = 0;
+ const EVP_CIPHER* type = nullptr;
int i = 0, len = 0;
switch (cipher) {
@@ -314,10 +314,10 @@ static QByteArray doCrypt(QSslKeyPrivate::Cipher cipher, const QByteArray &data,
q_EVP_CIPHER_CTX_init(ctx);
#endif
- q_EVP_CipherInit(ctx, type, NULL, NULL, enc);
+ q_EVP_CipherInit(ctx, type, nullptr, nullptr, enc);
q_EVP_CIPHER_CTX_set_key_length(ctx, key.size());
if (cipher == QSslKeyPrivate::Rc2Cbc)
- q_EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC2_KEY_BITS, 8 * key.size(), NULL);
+ q_EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC2_KEY_BITS, 8 * key.size(), nullptr);
#if QT_CONFIG(opensslv11)
// EVP_CipherInit in 1.1 resets the context thus making the calls above useless.