Skip to content

Commit

Permalink
Adding an additional BearSSL constructor as well as a method setClien…
Browse files Browse the repository at this point in the history
…t to allow late initialisation. (#29)

This allows for the ArduinoIoTCloud firmware to intantiate ArduinoBearSSL on the stack instead of the heap.
  • Loading branch information
aentinger authored May 28, 2020
1 parent 5de9bb0 commit 885eae2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
11 changes: 8 additions & 3 deletions BearSSLClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@
#include "BearSSLClient.h"

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

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

BearSSLClient::BearSSLClient(Client* client, const br_x509_trust_anchor* myTAs, int myNumTAs) :
_client(client),
_TAs(myTAs),
_numTAs(myNumTAs),
_noSNI(false)
Expand Down
5 changes: 5 additions & 0 deletions BearSSLClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,13 @@ class BearSSLClient : public Client {
public:
BearSSLClient(Client& client);
BearSSLClient(Client& client, const br_x509_trust_anchor* myTAs, int myNumTAs);
BearSSLClient(Client* client, const br_x509_trust_anchor* myTAs, int myNumTAs);
virtual ~BearSSLClient();


inline void setClient(Client& client) { _client = &client; }


virtual int connect(IPAddress ip, uint16_t port);
virtual int connect(const char* host, uint16_t port);
virtual size_t write(uint8_t);
Expand Down

0 comments on commit 885eae2

Please sign in to comment.