Coverage Report

Created: 2026-05-31 06:50

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/qtbase/src/network/ssl/qsslconfiguration_p.h
Line
Count
Source
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// Copyright (C) 2014 BlackBerry Limited. All rights reserved.
3
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
// Qt-Security score:significant reason:default
5
6
/****************************************************************************
7
**
8
** In addition, as a special exception, the copyright holders listed above give
9
** permission to link the code of its release of Qt with the OpenSSL project's
10
** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the
11
** same license as the original version), and distribute the linked executables.
12
**
13
** You must comply with the GNU General Public License version 2 in all
14
** respects for all of the code used other than the "OpenSSL" code.  If you
15
** modify this file, you may extend this exception to your version of the file,
16
** but you are not obligated to do so.  If you do not wish to do so, delete
17
** this exception statement from your version of this file.
18
**
19
****************************************************************************/
20
21
#ifndef QSSLCONFIGURATION_P_H
22
#define QSSLCONFIGURATION_P_H
23
24
//
25
//  W A R N I N G
26
//  -------------
27
//
28
// This file is not part of the Qt API.  It exists for the convenience
29
// of the QSslSocket API.  This header file may change from
30
// version to version without notice, or even be removed.
31
//
32
// We mean it.
33
//
34
35
#include <QtCore/qmap.h>
36
#include <QtNetwork/private/qtnetworkglobal_p.h>
37
#include "qsslconfiguration.h"
38
#include "qlist.h"
39
#include "qsslcertificate.h"
40
#include "qsslcipher.h"
41
#include "qsslkey.h"
42
#include "qsslkeyingmaterial.h"
43
#include "qsslellipticcurve.h"
44
#include "qssldiffiehellmanparameters.h"
45
46
QT_BEGIN_NAMESPACE
47
48
class QSslConfigurationPrivate: public QSharedData
49
{
50
public:
51
    QSslConfigurationPrivate()
52
0
        : sessionProtocol(QSsl::UnknownProtocol),
53
0
          protocol(QSsl::SecureProtocols),
54
0
          peerVerifyMode(QSslSocket::AutoVerifyPeer),
55
0
          peerVerifyDepth(0),
56
0
          allowRootCertOnDemandLoading(true),
57
0
          peerSessionShared(false),
58
0
          sslOptions(QSslConfigurationPrivate::defaultSslOptions),
59
0
          dhParams(QSslDiffieHellmanParameters::defaultParameters()),
60
0
          sslSessionTicketLifeTimeHint(-1),
61
0
          ephemeralServerKey(),
62
0
          preSharedKeyIdentityHint(),
63
0
          nextProtocolNegotiationStatus(QSslConfiguration::NextProtocolNegotiationNone),
64
0
          keyingMaterial()
65
0
    { }
66
67
    QSslCertificate peerCertificate;
68
    QList<QSslCertificate> peerCertificateChain;
69
70
    QList<QSslCertificate> localCertificateChain;
71
72
    QSslKey privateKey;
73
    QSslCipher sessionCipher;
74
    QSsl::SslProtocol sessionProtocol;
75
    QList<QSslCipher> ciphers;
76
    QList<QSslCertificate> caCertificates;
77
78
    QSsl::SslProtocol protocol;
79
    QSslSocket::PeerVerifyMode peerVerifyMode;
80
    int peerVerifyDepth;
81
    bool allowRootCertOnDemandLoading;
82
    bool peerSessionShared;
83
84
    Q_AUTOTEST_EXPORT static bool peerSessionWasShared(const QSslConfiguration &configuration);
85
86
    QSsl::SslOptions sslOptions;
87
88
    static const QSsl::SslOptions defaultSslOptions;
89
90
    QList<QSslEllipticCurve> ellipticCurves;
91
92
    QSslDiffieHellmanParameters dhParams;
93
94
    QMap<QByteArray, QVariant> backendConfig;
95
96
    QByteArray sslSession;
97
    int sslSessionTicketLifeTimeHint;
98
99
    QSslKey ephemeralServerKey;
100
101
    QByteArray preSharedKeyIdentityHint;
102
103
    QList<QByteArray> nextAllowedProtocols;
104
    QByteArray nextNegotiatedProtocol;
105
    QSslConfiguration::NextProtocolNegotiationStatus nextProtocolNegotiationStatus;
106
107
    QList<QSslKeyingMaterial> keyingMaterial;
108
109
#if QT_CONFIG(dtls)
110
    bool dtlsCookieEnabled = true;
111
#else
112
    const bool dtlsCookieEnabled = false;
113
#endif // dtls
114
115
#if QT_CONFIG(ocsp)
116
    bool ocspStaplingEnabled = false;
117
#else
118
    const bool ocspStaplingEnabled = false;
119
#endif
120
121
#if QT_CONFIG(openssl)
122
    bool reportFromCallback = false;
123
    bool missingCertIsFatal = false;
124
#else
125
    const bool reportFromCallback = false;
126
    const bool missingCertIsFatal = false;
127
#endif // openssl
128
129
    // in qsslsocket.cpp:
130
    static QSslConfiguration defaultConfiguration();
131
    static void setDefaultConfiguration(const QSslConfiguration &configuration);
132
    static void deepCopyDefaultConfiguration(QSslConfigurationPrivate *config);
133
134
    static QSslConfiguration defaultDtlsConfiguration();
135
    static void setDefaultDtlsConfiguration(const QSslConfiguration &configuration);
136
};
137
138
// implemented here for inlining purposes
139
inline QSslConfiguration::QSslConfiguration(QSslConfigurationPrivate *dd)
140
0
    : d(dd)
141
0
{
142
0
}
143
144
QT_END_NAMESPACE
145
146
#endif