summaryrefslogtreecommitdiffstats
path: root/src/plugins/tls/openssl/qdtls_openssl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/tls/openssl/qdtls_openssl.cpp')
-rw-r--r--src/plugins/tls/openssl/qdtls_openssl.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/plugins/tls/openssl/qdtls_openssl.cpp b/src/plugins/tls/openssl/qdtls_openssl.cpp
index fe8cbf23e0..fc07a29ec8 100644
--- a/src/plugins/tls/openssl/qdtls_openssl.cpp
+++ b/src/plugins/tls/openssl/qdtls_openssl.cpp
@@ -1,11 +1,7 @@
// Copyright (C) 2018 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-#ifndef NOMINMAX
-#define NOMINMAX
-#endif // NOMINMAX
-
-#include <QtNetwork/private/qnativesocketengine_p.h>
+#include <QtNetwork/private/qnativesocketengine_p_p.h>
#include "qsslsocket_openssl_symbols_p.h"
#include "qdtls_openssl_p.h"
@@ -182,7 +178,7 @@ extern "C" int q_generate_cookie_callback(SSL *ssl, unsigned char *dst,
QMessageAuthenticationCode hmac(dtls->hashAlgorithm, dtls->secret);
hmac.addData(peerData);
- const QByteArray cookie = hmac.result();
+ const QByteArrayView cookie = hmac.resultView();
Q_ASSERT(cookie.size() >= 0);
// DTLS1_COOKIE_LENGTH is erroneously 256 bytes long, must be 255 - RFC 6347, 4.2.1.
*cookieLength = qMin(DTLS1_COOKIE_LENGTH - 1, cookie.size());
@@ -205,7 +201,7 @@ extern "C" int q_verify_cookie_callback(SSL *ssl, const unsigned char *cookie,
return 0;
return newCookieLength == cookieLength
- && !std::memcmp(cookie, newCookie, cookieLength);
+ && !q_CRYPTO_memcmp(cookie, newCookie, size_t(cookieLength));
}
extern "C" int q_X509DtlsCallback(int ok, X509_STORE_CTX *ctx)
@@ -1252,12 +1248,12 @@ unsigned QDtlsPrivateOpenSSL::pskClientCallback(const char *hint, char *identity
return 0;
// Copy data back into OpenSSL
- const int identityLength = qMin(pskAuthenticator.identity().length(),
+ const int identityLength = qMin(pskAuthenticator.identity().size(),
pskAuthenticator.maximumIdentityLength());
std::memcpy(identity, pskAuthenticator.identity().constData(), identityLength);
identity[identityLength] = 0;
- const int pskLength = qMin(pskAuthenticator.preSharedKey().length(),
+ const int pskLength = qMin(pskAuthenticator.preSharedKey().size(),
pskAuthenticator.maximumPreSharedKeyLength());
std::memcpy(psk, pskAuthenticator.preSharedKey().constData(), pskLength);
@@ -1283,7 +1279,7 @@ unsigned QDtlsPrivateOpenSSL::pskServerCallback(const char *identity, unsigned c
return 0;
// Copy data back into OpenSSL
- const int pskLength = qMin(pskAuthenticator.preSharedKey().length(),
+ const int pskLength = qMin(pskAuthenticator.preSharedKey().size(),
pskAuthenticator.maximumPreSharedKeyLength());
std::memcpy(psk, pskAuthenticator.preSharedKey().constData(), pskLength);
@@ -1328,7 +1324,7 @@ bool QDtlsPrivateOpenSSL::verifyPeer()
// Translate errors from the error list into QSslErrors
using CertClass = QTlsPrivate::X509CertificateOpenSSL;
errors.reserve(errors.size() + opensslErrors.size());
- for (const auto &error : qAsConst(opensslErrors)) {
+ for (const auto &error : std::as_const(opensslErrors)) {
const auto value = peerCertificateChain.value(error.depth);
errors << CertClass::openSSLErrorToQSslError(error.code, value);
}