Skip to content

Commit

Permalink
Move BearSSL _cipher* init to _clear() for consistency (esp8266#5178)
Browse files Browse the repository at this point in the history
The cipher list count/pointer was cleared separately in the three
constructors available.  Move this reset to _clear() to reduce code
duplication and keep the semantics.
  • Loading branch information
earlephilhower authored Sep 28, 2018
1 parent 5137d4d commit 8e11836
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ void WiFiClientSecure::_clear() {
_recvapp_len = 0;
_oom_err = false;
_deleteChainKeyTA = false;
_cipher_list = NULL;
_cipher_cnt = 0;
}

void WiFiClientSecure::_clearAuthenticationSettings() {
Expand All @@ -85,8 +87,6 @@ void WiFiClientSecure::_clearAuthenticationSettings() {


WiFiClientSecure::WiFiClientSecure() : WiFiClient() {
_cipher_list = NULL;
_cipher_cnt = 0;
_clear();
_clearAuthenticationSettings();
_certStore = nullptr; // Don't want to remove cert store on a clear, should be long lived
Expand Down Expand Up @@ -116,8 +116,6 @@ WiFiClientSecure::~WiFiClientSecure() {
WiFiClientSecure::WiFiClientSecure(ClientContext* client,
const BearSSLX509List *chain, const BearSSLPrivateKey *sk,
int iobuf_in_size, int iobuf_out_size, const BearSSLX509List *client_CA_ta) {
_cipher_list = NULL;
_cipher_cnt = 0;
_clear();
_clearAuthenticationSettings();
_iobuf_in_size = iobuf_in_size;
Expand All @@ -135,8 +133,6 @@ WiFiClientSecure::WiFiClientSecure(ClientContext *client,
const BearSSLX509List *chain,
unsigned cert_issuer_key_type, const BearSSLPrivateKey *sk,
int iobuf_in_size, int iobuf_out_size, const BearSSLX509List *client_CA_ta) {
_cipher_list = NULL;
_cipher_cnt = 0;
_clear();
_clearAuthenticationSettings();
_iobuf_in_size = iobuf_in_size;
Expand Down

0 comments on commit 8e11836

Please sign in to comment.