blob: ec24d1da6bd33d1c8269abcc67a35e0728dd33d2 (
plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "FuzzySocketControl.h"
#include "FuzzySecurityInfo.h"
#include "ipc/IPCMessageUtils.h"
#include "nsITlsHandshakeListener.h"
#include "sslt.h"
namespace mozilla {
namespace net {
FuzzySocketControl::FuzzySocketControl() {}
FuzzySocketControl::~FuzzySocketControl() {}
NS_IMPL_ISUPPORTS(FuzzySocketControl, nsITLSSocketControl)
NS_IMETHODIMP
FuzzySocketControl::GetProviderFlags(uint32_t* aProviderFlags) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySocketControl::GetKEAUsed(int16_t* aKea) {
// Can be ssl_kea_dh or ssl_kea_ecdh for HTTP2
*aKea = ssl_kea_ecdh;
return NS_OK;
}
NS_IMETHODIMP
FuzzySocketControl::GetKEAKeyBits(uint32_t* aKeyBits) {
// Must be >= 224 for ecdh and >= 2048 for dh when using HTTP2
*aKeyBits = 256;
return NS_OK;
}
NS_IMETHODIMP
FuzzySocketControl::GetSSLVersionUsed(int16_t* aSSLVersionUsed) {
// Must be >= TLS 1.2 for HTTP2
*aSSLVersionUsed = nsITLSSocketControl::TLS_VERSION_1_2;
return NS_OK;
}
NS_IMETHODIMP
FuzzySocketControl::GetSSLVersionOffered(int16_t* aSSLVersionOffered) {
*aSSLVersionOffered = nsITLSSocketControl::TLS_VERSION_1_2;
return NS_OK;
}
NS_IMETHODIMP
FuzzySocketControl::GetMACAlgorithmUsed(int16_t* aMac) {
// The only valid choice for HTTP2 is SSL_MAC_AEAD
*aMac = nsITLSSocketControl::SSL_MAC_AEAD;
return NS_OK;
}
bool FuzzySocketControl::GetDenyClientCert() { return false; }
void FuzzySocketControl::SetDenyClientCert(bool aDenyClientCert) {
// Called by mozilla::net::nsHttpConnection::StartSpdy
}
NS_IMETHODIMP
FuzzySocketControl::GetClientCertSent(bool* arg) {
*arg = false;
return NS_OK;
}
NS_IMETHODIMP
FuzzySocketControl::GetFailedVerification(bool* arg) {
*arg = false;
return NS_OK;
}
NS_IMETHODIMP
FuzzySocketControl::GetAlpnEarlySelection(nsACString& aAlpnSelected) {
// TODO: For now we don't support early selection
return NS_ERROR_NOT_AVAILABLE;
}
NS_IMETHODIMP
FuzzySocketControl::GetEarlyDataAccepted(bool* aAccepted) {
*aAccepted = false;
return NS_OK;
}
NS_IMETHODIMP
FuzzySocketControl::DriveHandshake() { return NS_OK; }
NS_IMETHODIMP
FuzzySocketControl::IsAcceptableForHost(const nsACString& hostname,
bool* _retval) {
NS_ENSURE_ARG(_retval);
*_retval = true;
return NS_OK;
}
NS_IMETHODIMP
FuzzySocketControl::TestJoinConnection(const nsACString& npnProtocol,
const nsACString& hostname, int32_t port,
bool* _retval) {
*_retval = false;
return NS_OK;
}
NS_IMETHODIMP
FuzzySocketControl::JoinConnection(const nsACString& npnProtocol,
const nsACString& hostname, int32_t port,
bool* _retval) {
*_retval = false;
return NS_OK;
}
NS_IMETHODIMP
FuzzySocketControl::ProxyStartSSL() { return NS_OK; }
NS_IMETHODIMP
FuzzySocketControl::StartTLS() { return NS_OK; }
NS_IMETHODIMP
FuzzySocketControl::SetNPNList(nsTArray<nsCString>& protocolArray) {
return NS_OK;
}
NS_IMETHODIMP
FuzzySocketControl::GetEsniTxt(nsACString& aEsniTxt) { return NS_OK; }
NS_IMETHODIMP
FuzzySocketControl::SetEsniTxt(const nsACString& aEsniTxt) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySocketControl::GetEchConfig(nsACString& aEchConfig) { return NS_OK; }
NS_IMETHODIMP
FuzzySocketControl::SetEchConfig(const nsACString& aEchConfig) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySocketControl::GetRetryEchConfig(nsACString& aEchConfig) { return NS_OK; }
NS_IMETHODIMP
FuzzySocketControl::GetPeerId(nsACString& aResult) {
aResult.Assign(""_ns);
return NS_OK;
}
NS_IMETHODIMP FuzzySocketControl::SetHandshakeCallbackListener(
nsITlsHandshakeCallbackListener* callback) {
if (callback) {
callback->HandshakeDone();
}
return NS_OK;
}
NS_IMETHODIMP
FuzzySocketControl::DisableEarlyData(void) { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHODIMP FuzzySocketControl::GetSecurityInfo(
nsITransportSecurityInfo** aSecurityInfo) {
nsCOMPtr<nsITransportSecurityInfo> securityInfo(new FuzzySecurityInfo());
securityInfo.forget(aSecurityInfo);
return NS_OK;
}
NS_IMETHODIMP
FuzzySocketControl::AsyncGetSecurityInfo(JSContext* aCx,
mozilla::dom::Promise** aPromise) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP FuzzySocketControl::Claim() { return NS_OK; }
} // namespace net
} // namespace mozilla
|