Bug 1495120 - Wire up ESNI r=dragana

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
EKR 2018-09-28 22:37:20 +00:00
parent bda7175658
commit 1cc9f44f89

View File

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