Skip to content

Add support for not sending any SNI #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/BearSSLClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,25 @@
#include "BearSSLClient.h"

BearSSLClient::BearSSLClient(Client& client) :
BearSSLClient(client, TAs, TAs_NUM)
BearSSLClient(client, TAs, TAs_NUM, false)
{
}

BearSSLClient::BearSSLClient(Client& client, bool noSNI) :
BearSSLClient(client, TAs, TAs_NUM, noSNI)
{
}

BearSSLClient::BearSSLClient(Client& client, const br_x509_trust_anchor* myTAs, int myNumTAs) :
BearSSLClient(client, TAs, TAs_NUM, false)
{
}

BearSSLClient::BearSSLClient(Client& client, const br_x509_trust_anchor* myTAs, int myNumTAs, bool noSNI) :
_client(&client),
_TAs(myTAs),
_numTAs(myNumTAs)
_numTAs(myNumTAs),
_noSNI(noSNI)
{
_ecKey.curve = 0;
_ecKey.x = NULL;
Expand Down Expand Up @@ -72,7 +83,7 @@ int BearSSLClient::connect(const char* host, uint16_t port)
return 0;
}

return connectSSL(host);
return connectSSL(_noSNI ? NULL : host);
}

size_t BearSSLClient::write(uint8_t b)
Expand Down
4 changes: 4 additions & 0 deletions src/BearSSLClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ class BearSSLClient : public Client {

public:
BearSSLClient(Client& client);
BearSSLClient(Client& client, bool noSNI);
BearSSLClient(Client& client, const br_x509_trust_anchor* myTAs, int myNumTAs);
BearSSLClient(Client& client, const br_x509_trust_anchor* myTAs, int myNumTAs, bool noSNI);
virtual ~BearSSLClient();

virtual int connect(IPAddress ip, uint16_t port);
Expand Down Expand Up @@ -72,6 +74,8 @@ class BearSSLClient : public Client {
const br_x509_trust_anchor* _TAs;
int _numTAs;

bool _noSNI;

br_ec_private_key _ecKey;
br_x509_certificate _ecCert;
bool _ecCertDynamic;
Expand Down