Bug 1729952 [wpt PR 30477] - Fix timeout in grid-positioned-item-dynamic-change-006...
[gecko.git] / netwerk / base / FuzzySecurityInfo.cpp
bloba665b4d0b10a563f441b2d56ddbba664d61d4861
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "FuzzySecurityInfo.h"
8 #include "mozilla/Logging.h"
9 #include "mozilla/OriginAttributes.h"
10 #include "nsThreadManager.h"
12 namespace mozilla {
13 namespace net {
15 FuzzySecurityInfo::FuzzySecurityInfo() {}
17 FuzzySecurityInfo::~FuzzySecurityInfo() {}
19 NS_IMPL_ISUPPORTS(FuzzySecurityInfo, nsITransportSecurityInfo,
20 nsIInterfaceRequestor, nsISSLSocketControl)
22 NS_IMETHODIMP
23 FuzzySecurityInfo::GetErrorCode(int32_t* state) {
24 *state = 0;
25 return NS_OK;
28 NS_IMETHODIMP
29 FuzzySecurityInfo::GetSecurityState(uint32_t* state) {
30 *state = 0;
31 return NS_OK;
34 NS_IMETHODIMP
35 FuzzySecurityInfo::GetErrorCodeString(nsAString& aErrorString) {
36 MOZ_CRASH("Unused");
37 return NS_OK;
40 NS_IMETHODIMP
41 FuzzySecurityInfo::GetFailedCertChain(
42 nsTArray<RefPtr<nsIX509Cert>>& aFailedCertChain) {
43 MOZ_CRASH("Unused");
44 return NS_OK;
47 NS_IMETHODIMP
48 FuzzySecurityInfo::GetServerCert(nsIX509Cert** aServerCert) {
49 NS_ENSURE_ARG_POINTER(aServerCert);
50 // This method is called by nsHttpChannel::ProcessSSLInformation()
51 // in order to display certain information in the console.
52 // Returning NULL is okay here and handled by the caller.
53 *aServerCert = NULL;
54 return NS_OK;
57 NS_IMETHODIMP
58 FuzzySecurityInfo::GetSucceededCertChain(
59 nsTArray<RefPtr<nsIX509Cert>>& aSucceededCertChain) {
60 MOZ_CRASH("Unused");
61 return NS_OK;
64 NS_IMETHODIMP
65 FuzzySecurityInfo::GetCipherName(nsACString& aCipherName) {
66 MOZ_CRASH("Unused");
67 return NS_OK;
70 NS_IMETHODIMP
71 FuzzySecurityInfo::GetKeyLength(uint32_t* aKeyLength) {
72 MOZ_CRASH("Unused");
73 return NS_OK;
76 NS_IMETHODIMP
77 FuzzySecurityInfo::GetSecretKeyLength(uint32_t* aSecretKeyLength) {
78 MOZ_CRASH("Unused");
79 *aSecretKeyLength = 4096;
80 return NS_OK;
83 NS_IMETHODIMP
84 FuzzySecurityInfo::GetKeaGroupName(nsACString& aKeaGroup) {
85 MOZ_CRASH("Unused");
86 return NS_OK;
89 NS_IMETHODIMP
90 FuzzySecurityInfo::GetSignatureSchemeName(nsACString& aSignatureScheme) {
91 MOZ_CRASH("Unused");
92 return NS_OK;
95 NS_IMETHODIMP
96 FuzzySecurityInfo::GetProtocolVersion(uint16_t* aProtocolVersion) {
97 NS_ENSURE_ARG_POINTER(aProtocolVersion);
98 // Must be >= TLS 1.2 for HTTP2
99 *aProtocolVersion = nsITransportSecurityInfo::TLS_VERSION_1_2;
100 return NS_OK;
103 NS_IMETHODIMP
104 FuzzySecurityInfo::GetCertificateTransparencyStatus(
105 uint16_t* aCertificateTransparencyStatus) {
106 NS_ENSURE_ARG_POINTER(aCertificateTransparencyStatus);
107 MOZ_CRASH("Unused");
108 return NS_OK;
111 NS_IMETHODIMP
112 FuzzySecurityInfo::GetIsDomainMismatch(bool* aIsDomainMismatch) {
113 NS_ENSURE_ARG_POINTER(aIsDomainMismatch);
114 *aIsDomainMismatch = false;
115 return NS_OK;
118 NS_IMETHODIMP
119 FuzzySecurityInfo::GetIsNotValidAtThisTime(bool* aIsNotValidAtThisTime) {
120 NS_ENSURE_ARG_POINTER(aIsNotValidAtThisTime);
121 *aIsNotValidAtThisTime = false;
122 return NS_OK;
125 NS_IMETHODIMP
126 FuzzySecurityInfo::GetIsUntrusted(bool* aIsUntrusted) {
127 NS_ENSURE_ARG_POINTER(aIsUntrusted);
128 *aIsUntrusted = false;
129 return NS_OK;
132 NS_IMETHODIMP
133 FuzzySecurityInfo::GetIsExtendedValidation(bool* aIsEV) {
134 NS_ENSURE_ARG_POINTER(aIsEV);
135 *aIsEV = true;
136 return NS_OK;
139 NS_IMETHODIMP
140 FuzzySecurityInfo::GetIsDelegatedCredential(bool* aIsDelegCred) {
141 NS_ENSURE_ARG_POINTER(aIsDelegCred);
142 *aIsDelegCred = false;
143 return NS_OK;
146 NS_IMETHODIMP
147 FuzzySecurityInfo::GetIsAcceptedEch(bool* aIsAcceptedEch) {
148 NS_ENSURE_ARG_POINTER(aIsAcceptedEch);
149 *aIsAcceptedEch = false;
150 return NS_OK;
153 NS_IMETHODIMP
154 FuzzySecurityInfo::GetInterface(const nsIID& uuid, void** result) {
155 if (!NS_IsMainThread()) {
156 MOZ_CRASH("FuzzySecurityInfo::GetInterface called off the main thread");
157 return NS_ERROR_NOT_SAME_THREAD;
160 nsresult rv = NS_ERROR_NO_INTERFACE;
161 if (mCallbacks) {
162 rv = mCallbacks->GetInterface(uuid, result);
164 return rv;
167 NS_IMETHODIMP
168 FuzzySecurityInfo::GetNotificationCallbacks(
169 nsIInterfaceRequestor** aCallbacks) {
170 nsCOMPtr<nsIInterfaceRequestor> ir(mCallbacks);
171 ir.forget(aCallbacks);
172 return NS_OK;
175 NS_IMETHODIMP
176 FuzzySecurityInfo::SetNotificationCallbacks(nsIInterfaceRequestor* aCallbacks) {
177 mCallbacks = aCallbacks;
178 return NS_OK;
181 NS_IMETHODIMP
182 FuzzySecurityInfo::GetProviderFlags(uint32_t* aProviderFlags) {
183 MOZ_CRASH("Unused");
184 return NS_OK;
187 NS_IMETHODIMP
188 FuzzySecurityInfo::GetProviderTlsFlags(uint32_t* aProviderTlsFlags) {
189 MOZ_CRASH("Unused");
190 return NS_OK;
193 NS_IMETHODIMP
194 FuzzySecurityInfo::GetKEAUsed(int16_t* aKea) {
195 // Can be ssl_kea_dh or ssl_kea_ecdh for HTTP2
196 *aKea = ssl_kea_ecdh;
197 return NS_OK;
200 NS_IMETHODIMP
201 FuzzySecurityInfo::GetKEAKeyBits(uint32_t* aKeyBits) {
202 // Must be >= 224 for ecdh and >= 2048 for dh when using HTTP2
203 *aKeyBits = 256;
204 return NS_OK;
207 NS_IMETHODIMP
208 FuzzySecurityInfo::GetSSLVersionUsed(int16_t* aSSLVersionUsed) {
209 // Must be >= TLS 1.2 for HTTP2
210 *aSSLVersionUsed = nsISSLSocketControl::TLS_VERSION_1_2;
211 return NS_OK;
214 NS_IMETHODIMP
215 FuzzySecurityInfo::GetSSLVersionOffered(int16_t* aSSLVersionOffered) {
216 *aSSLVersionOffered = nsISSLSocketControl::TLS_VERSION_1_2;
217 return NS_OK;
220 NS_IMETHODIMP
221 FuzzySecurityInfo::GetMACAlgorithmUsed(int16_t* aMac) {
222 // The only valid choice for HTTP2 is SSL_MAC_AEAD
223 *aMac = nsISSLSocketControl::SSL_MAC_AEAD;
224 return NS_OK;
227 NS_IMETHODIMP
228 FuzzySecurityInfo::GetClientCert(nsIX509Cert** aClientCert) {
229 NS_ENSURE_ARG_POINTER(aClientCert);
230 *aClientCert = nullptr;
231 return NS_OK;
234 NS_IMETHODIMP
235 FuzzySecurityInfo::SetClientCert(nsIX509Cert* aClientCert) {
236 MOZ_CRASH("Unused");
237 return NS_OK;
240 bool FuzzySecurityInfo::GetDenyClientCert() { return false; }
242 void FuzzySecurityInfo::SetDenyClientCert(bool aDenyClientCert) {
243 // Called by mozilla::net::nsHttpConnection::StartSpdy
246 NS_IMETHODIMP
247 FuzzySecurityInfo::GetClientCertSent(bool* arg) {
248 *arg = false;
249 return NS_OK;
252 NS_IMETHODIMP
253 FuzzySecurityInfo::GetFailedVerification(bool* arg) {
254 *arg = false;
255 return NS_OK;
258 NS_IMETHODIMP
259 FuzzySecurityInfo::GetNegotiatedNPN(nsACString& aNegotiatedNPN) {
260 aNegotiatedNPN = "h2";
261 return NS_OK;
264 NS_IMETHODIMP
265 FuzzySecurityInfo::GetAlpnEarlySelection(nsACString& aAlpnSelected) {
266 // TODO: For now we don't support early selection
267 return NS_ERROR_NOT_AVAILABLE;
270 NS_IMETHODIMP
271 FuzzySecurityInfo::GetEarlyDataAccepted(bool* aAccepted) {
272 *aAccepted = false;
273 return NS_OK;
276 NS_IMETHODIMP
277 FuzzySecurityInfo::GetResumed(bool* aResumed) {
278 *aResumed = false;
279 return NS_OK;
282 NS_IMETHODIMP
283 FuzzySecurityInfo::DriveHandshake() { return NS_OK; }
285 NS_IMETHODIMP
286 FuzzySecurityInfo::IsAcceptableForHost(const nsACString& hostname,
287 bool* _retval) {
288 NS_ENSURE_ARG(_retval);
289 *_retval = true;
290 return NS_OK;
293 NS_IMETHODIMP
294 FuzzySecurityInfo::TestJoinConnection(const nsACString& npnProtocol,
295 const nsACString& hostname, int32_t port,
296 bool* _retval) {
297 *_retval = false;
298 return NS_OK;
301 NS_IMETHODIMP
302 FuzzySecurityInfo::JoinConnection(const nsACString& npnProtocol,
303 const nsACString& hostname, int32_t port,
304 bool* _retval) {
305 *_retval = false;
306 return NS_OK;
309 NS_IMETHODIMP
310 FuzzySecurityInfo::ProxyStartSSL() { return NS_OK; }
312 NS_IMETHODIMP
313 FuzzySecurityInfo::StartTLS() { return NS_OK; }
315 NS_IMETHODIMP
316 FuzzySecurityInfo::SetNPNList(nsTArray<nsCString>& protocolArray) {
317 return NS_OK;
320 NS_IMETHODIMP
321 FuzzySecurityInfo::GetEsniTxt(nsACString& aEsniTxt) { return NS_OK; }
323 NS_IMETHODIMP
324 FuzzySecurityInfo::SetEsniTxt(const nsACString& aEsniTxt) {
325 MOZ_CRASH("Unused");
326 return NS_OK;
329 NS_IMETHODIMP
330 FuzzySecurityInfo::GetEchConfig(nsACString& aEchConfig) { return NS_OK; }
332 NS_IMETHODIMP
333 FuzzySecurityInfo::SetEchConfig(const nsACString& aEchConfig) {
334 MOZ_CRASH("Unused");
335 return NS_OK;
338 NS_IMETHODIMP
339 FuzzySecurityInfo::GetRetryEchConfig(nsACString& aEchConfig) { return NS_OK; }
341 void FuzzySecurityInfo::SerializeToIPC(IPC::Message* aMsg) {
342 MOZ_CRASH("Unused");
345 bool FuzzySecurityInfo::DeserializeFromIPC(const IPC::Message* aMsg,
346 PickleIterator* aIter) {
347 MOZ_CRASH("Unused");
348 return false;
351 NS_IMETHODIMP
352 FuzzySecurityInfo::GetPeerId(nsACString& aResult) {
353 aResult.Assign(""_ns);
354 return NS_OK;
357 NS_IMETHODIMP FuzzySecurityInfo::SetIsBuiltCertChainRootBuiltInRoot(
358 bool aIsBuiltInRoot) {
359 return NS_OK;
362 NS_IMETHODIMP FuzzySecurityInfo::GetIsBuiltCertChainRootBuiltInRoot(
363 bool* aIsBuiltInRoot) {
364 *aIsBuiltInRoot = false;
365 return NS_OK;
368 NS_IMETHODIMP FuzzySecurityInfo::DisableEarlyData(void) {
369 return NS_OK;
372 NS_IMETHODIMP FuzzySecurityInfo::SetHandshakeCallbackListener(
373 nsITlsHandshakeCallbackListener* callback) {
374 return NS_OK;
377 } // namespace net
378 } // namespace mozilla