| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | | - |
| 22 | | - |
| 23 | | - |
| 24 | | - |
| 25 | | - |
| 26 | | - |
| 27 | | - |
| 28 | | - |
| 29 | | - |
| 30 | | - |
| 31 | | - |
| 32 | | - |
| 33 | | - |
| 34 | | - |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | | - |
| 39 | | - |
| 40 | #include "qsslellipticcurve.h" | - |
| 41 | #include "qsslsocket_p.h" | - |
| 42 | #include "qsslsocket_openssl_symbols_p.h" | - |
| 43 | | - |
| 44 | #include <openssl/ssl.h> | - |
| 45 | #include <openssl/obj_mac.h> | - |
| 46 | | - |
| 47 | #include <algorithm> | - |
| 48 | | - |
| 49 | QT_BEGIN_NAMESPACE | - |
| 50 | | - |
| 51 | QString QSslEllipticCurve::shortName() const | - |
| 52 | { | - |
| 53 | QString result; | - |
| 54 | #ifndef OPENSSL_NO_EC | - |
| 55 | if (id != 0) | - |
| 56 | result = QString::fromLatin1(q_OBJ_nid2sn(id)); | - |
| 57 | #endif | - |
| 58 | return result; | - |
| 59 | } | - |
| 60 | | - |
| 61 | QString QSslEllipticCurve::longName() const | - |
| 62 | { | - |
| 63 | QString result; | - |
| 64 | #ifndef OPENSSL_NO_EC | - |
| 65 | if (id != 0) | - |
| 66 | result = QString::fromLatin1(q_OBJ_nid2ln(id)); | - |
| 67 | #endif | - |
| 68 | return result; | - |
| 69 | } | - |
| 70 | | - |
| 71 | QSslEllipticCurve QSslEllipticCurve::fromShortName(const QString &name) | - |
| 72 | { | - |
| 73 | if (name.isEmpty()) | - |
| 74 | return QSslEllipticCurve(); | - |
| 75 | | - |
| 76 | QSslSocketPrivate::ensureInitialized(); | - |
| 77 | | - |
| 78 | QSslEllipticCurve result; | - |
| 79 | | - |
| 80 | #ifndef OPENSSL_NO_EC | - |
| 81 | const QByteArray curveNameLatin1 = name.toLatin1(); | - |
| 82 | | - |
| 83 | int nid = q_OBJ_sn2nid(curveNameLatin1.data()); | - |
| 84 | | - |
| 85 | #if OPENSSL_VERSION_NUMBER >= 0x10002000L | - |
| 86 | if (nid == 0 && q_SSLeay() >= 0x10002000L) | - |
| 87 | nid = q_EC_curve_nist2nid(curveNameLatin1.data()); | - |
| 88 | #endif // OPENSSL_VERSION_NUMBER >= 0x10002000L | - |
| 89 | | - |
| 90 | result.id = nid; | - |
| 91 | #endif | - |
| 92 | | - |
| 93 | return result; | - |
| 94 | } | - |
| 95 | | - |
| 96 | QSslEllipticCurve QSslEllipticCurve::fromLongName(const QString &name) | - |
| 97 | { | - |
| 98 | if (name.isEmpty()) | - |
| 99 | return QSslEllipticCurve(); | - |
| 100 | | - |
| 101 | QSslSocketPrivate::ensureInitialized(); | - |
| 102 | | - |
| 103 | QSslEllipticCurve result; | - |
| 104 | | - |
| 105 | #ifndef OPENSSL_NO_EC | - |
| 106 | const QByteArray curveNameLatin1 = name.toLatin1(); | - |
| 107 | | - |
| 108 | int nid = q_OBJ_ln2nid(curveNameLatin1.data()); | - |
| 109 | result.id = nid; | - |
| 110 | #endif | - |
| 111 | | - |
| 112 | return result; | - |
| 113 | } | - |
| 114 | | - |
| 115 | | - |
| 116 | | - |
| 117 | | - |
| 118 | | - |
| 119 | | - |
| 120 | #ifndef NID_brainpoolP256r1 | - |
| 121 | #define NID_brainpoolP256r1 927 | - |
| 122 | #endif | - |
| 123 | | - |
| 124 | #ifndef NID_brainpoolP384r1 | - |
| 125 | #define NID_brainpoolP384r1 931 | - |
| 126 | #endif | - |
| 127 | | - |
| 128 | #ifndef NID_brainpoolP512r1 | - |
| 129 | #define NID_brainpoolP512r1 933 | - |
| 130 | #endif | - |
| 131 | | - |
| 132 | | - |
| 133 | | - |
| 134 | static const int tlsNamedCurveNIDs[] = { | - |
| 135 | | - |
| 136 | NID_sect163k1, | - |
| 137 | NID_sect163r1, | - |
| 138 | NID_sect163r2, | - |
| 139 | NID_sect193r1, | - |
| 140 | NID_sect193r2, | - |
| 141 | NID_sect233k1, | - |
| 142 | NID_sect233r1, | - |
| 143 | NID_sect239k1, | - |
| 144 | NID_sect283k1, | - |
| 145 | NID_sect283r1, | - |
| 146 | NID_sect409k1, | - |
| 147 | NID_sect409r1, | - |
| 148 | NID_sect571k1, | - |
| 149 | NID_sect571r1, | - |
| 150 | | - |
| 151 | NID_secp160k1, | - |
| 152 | NID_secp160r1, | - |
| 153 | NID_secp160r2, | - |
| 154 | NID_secp192k1, | - |
| 155 | NID_X9_62_prime192v1, | - |
| 156 | NID_secp224k1, | - |
| 157 | NID_secp224r1, | - |
| 158 | NID_secp256k1, | - |
| 159 | NID_X9_62_prime256v1, | - |
| 160 | NID_secp384r1, | - |
| 161 | NID_secp521r1, | - |
| 162 | | - |
| 163 | | - |
| 164 | NID_brainpoolP256r1, | - |
| 165 | NID_brainpoolP384r1, | - |
| 166 | NID_brainpoolP512r1 | - |
| 167 | }; | - |
| 168 | | - |
| 169 | static const size_t tlsNamedCurveNIDCount = sizeof(tlsNamedCurveNIDs) / sizeof(tlsNamedCurveNIDs[0]); | - |
| 170 | | - |
| 171 | bool QSslEllipticCurve::isTlsNamedCurve() const Q_DECL_NOTHROW | - |
| 172 | { | - |
| 173 | const int * const tlsNamedCurveNIDsEnd = tlsNamedCurveNIDs + tlsNamedCurveNIDCount; | - |
| 174 | return std::find(tlsNamedCurveNIDs, tlsNamedCurveNIDsEnd, id) != tlsNamedCurveNIDsEnd;executed 1 time by 1 test: return std::find(tlsNamedCurveNIDs, tlsNamedCurveNIDsEnd, id) != tlsNamedCurveNIDsEnd;Executed by:- tst_qsslellipticcurve - unknown status
| 1 |
| 175 | } | - |
| 176 | | - |
| 177 | QT_END_NAMESPACE | - |
| | |