Bug 1495120 - Wire up ESNI r=dragana

Differential Revision: https://phabricator.services.mozilla.com/D7221

--HG--
extra : source : d2edbb87f3d283ab2c2fb6f8ad3408f792a6bd27
This commit is contained in:
EKR 2018-09-28 22:37:20 +00:00
parent 85fd583cf2
commit 030f8b7c79

View File

@ -15,6 +15,7 @@
#include "ScopedNSSTypes.h" #include "ScopedNSSTypes.h"
#include "SharedSSLState.h" #include "SharedSSLState.h"
#include "keyhi.h" #include "keyhi.h"
#include "mozilla/Base64.h"
#include "mozilla/Casting.h" #include "mozilla/Casting.h"
#include "mozilla/DebugOnly.h" #include "mozilla/DebugOnly.h"
#include "mozilla/Logging.h" #include "mozilla/Logging.h"
@ -1020,16 +1021,22 @@ nsNSSSocketInfo::SetEsniTxt(const nsACString & aEsniTxt)
mEsniTxt = aEsniTxt; mEsniTxt = aEsniTxt;
if (mEsniTxt.Length()) { if (mEsniTxt.Length()) {
fprintf(stderr,"\n\nTODO - SSL_EnableSNI() [%s] (%d bytes)\n", nsAutoCString esniBin;
mEsniTxt.get(), mEsniTxt.Length()); if (NS_OK != Base64Decode(mEsniTxt, esniBin)) {
MOZ_LOG(gPIPNSSLog, LogLevel::Error,
#if 0 ("[%p] Invalid ESNIKeys record. Couldn't base64 decode\n",
if (SECSuccess != SSL_EnableESNI(mFd, (void*) mFd));
reinterpret_cast<const PRUint8*>(mEsniTxt.get()), return NS_OK;
mEsniTxt.Length(), "dummy.invalid")) { }
return NS_ERROR_FAILURE;
if (SECSuccess != SSL_EnableESNI(mFd,
reinterpret_cast<const PRUint8*>(esniBin.get()),
esniBin.Length(), nullptr)) {
MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("[%p] Invalid ESNIKeys record %s\n",
(void*) mFd,
PR_ErrorToName(PR_GetError())));
return NS_OK;
} }
#endif
} }
return NS_OK; return NS_OK;