Bug 1805234 - provide FuzzySecurityInfo for FuzzySocketControl r=jschanck,necko-reviewers,kershaw

Differential Revision: https://phabricator.services.mozilla.com/D164620
This commit is contained in:
Dana Keeler 2022-12-14 17:33:58 +00:00
parent 32e3cc6311
commit 6b4c2ff29f
4 changed files with 211 additions and 1 deletions

View File

@ -0,0 +1,176 @@
/* -*- 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 "FuzzySecurityInfo.h"
#include "nsString.h"
namespace mozilla {
namespace net {
FuzzySecurityInfo::FuzzySecurityInfo() {}
FuzzySecurityInfo::~FuzzySecurityInfo() {}
NS_IMPL_ISUPPORTS(FuzzySecurityInfo, nsITransportSecurityInfo)
NS_IMETHODIMP
FuzzySecurityInfo::GetSecurityState(uint32_t* state) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetErrorCode(int32_t* state) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetErrorCodeString(nsAString& aErrorString) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetFailedCertChain(
nsTArray<RefPtr<nsIX509Cert>>& aFailedCertChain) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetServerCert(nsIX509Cert** aServerCert) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetSucceededCertChain(
nsTArray<RefPtr<nsIX509Cert>>& aSucceededCertChain) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetCipherName(nsACString& aCipherName) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetKeyLength(uint32_t* aKeyLength) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetSecretKeyLength(uint32_t* aSecretKeyLength) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetKeaGroupName(nsACString& aKeaGroup) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetSignatureSchemeName(nsACString& aSignatureScheme) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetProtocolVersion(uint16_t* aProtocolVersion) {
NS_ENSURE_ARG_POINTER(aProtocolVersion);
// Must be >= TLS 1.2 for HTTP2
*aProtocolVersion = nsITransportSecurityInfo::TLS_VERSION_1_2;
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetCertificateTransparencyStatus(
uint16_t* aCertificateTransparencyStatus) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetIsDelegatedCredential(bool* aIsDelegCred) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetIsAcceptedEch(bool* aIsAcceptedEch) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetOverridableErrorCategory(
OverridableErrorCategory* aOverridableErrorCode) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetMadeOCSPRequests(bool* aMadeOCSPRequests) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetUsedPrivateDNS(bool* aUsedPrivateDNS) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetIsExtendedValidation(bool* aIsEV) {
MOZ_CRASH("Unused");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::ToString(nsACString& aResult) {
MOZ_CRASH("Unused");
return NS_OK;
}
void FuzzySecurityInfo::SerializeToIPC(IPC::MessageWriter* aWriter) {
MOZ_CRASH("Unused");
}
NS_IMETHODIMP
FuzzySecurityInfo::GetNegotiatedNPN(nsACString& aNegotiatedNPN) {
aNegotiatedNPN.Assign("h2");
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetResumed(bool* aResumed) {
*aResumed = false;
return NS_OK;
}
NS_IMETHODIMP FuzzySecurityInfo::GetIsBuiltCertChainRootBuiltInRoot(
bool* aIsBuiltInRoot) {
*aIsBuiltInRoot = false;
return NS_OK;
}
NS_IMETHODIMP
FuzzySecurityInfo::GetPeerId(nsACString& aResult) {
aResult.Assign(""_ns);
return NS_OK;
}
} // namespace net
} // namespace mozilla

View File

@ -0,0 +1,30 @@
/* -*- 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/. */
#ifndef FuzzySecurityInfo_h__
#define FuzzySecurityInfo_h__
#include "nsCOMPtr.h"
#include "nsITransportSecurityInfo.h"
namespace mozilla {
namespace net {
class FuzzySecurityInfo final : public nsITransportSecurityInfo {
public:
FuzzySecurityInfo();
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSITRANSPORTSECURITYINFO
protected:
virtual ~FuzzySecurityInfo();
}; // class FuzzySecurityInfo
} // namespace net
} // namespace mozilla
#endif // FuzzySecurityInfo_h__

View File

@ -5,6 +5,8 @@
* 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"
@ -166,7 +168,8 @@ FuzzySocketControl::DisableEarlyData(void) { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHODIMP FuzzySocketControl::GetSecurityInfo(
nsITransportSecurityInfo** aSecurityInfo) {
*aSecurityInfo = nullptr;
nsCOMPtr<nsITransportSecurityInfo> securityInfo(new FuzzySecurityInfo());
securityInfo.forget(aSecurityInfo);
return NS_OK;
}

View File

@ -249,6 +249,7 @@ UNIFIED_SOURCES += [
if CONFIG["FUZZING"]:
SOURCES += [
"FuzzyLayer.cpp",
"FuzzySecurityInfo.cpp",
"FuzzySocketControl.cpp",
]