Skip to content

Commit 8e11836

Browse files
Move BearSSL _cipher* init to _clear() for consistency (#5178)
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.
1 parent 5137d4d commit 8e11836

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Diff for: libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ void WiFiClientSecure::_clear() {
7272
_recvapp_len = 0;
7373
_oom_err = false;
7474
_deleteChainKeyTA = false;
75+
_cipher_list = NULL;
76+
_cipher_cnt = 0;
7577
}
7678

7779
void WiFiClientSecure::_clearAuthenticationSettings() {
@@ -85,8 +87,6 @@ void WiFiClientSecure::_clearAuthenticationSettings() {
8587

8688

8789
WiFiClientSecure::WiFiClientSecure() : WiFiClient() {
88-
_cipher_list = NULL;
89-
_cipher_cnt = 0;
9090
_clear();
9191
_clearAuthenticationSettings();
9292
_certStore = nullptr; // Don't want to remove cert store on a clear, should be long lived
@@ -116,8 +116,6 @@ WiFiClientSecure::~WiFiClientSecure() {
116116
WiFiClientSecure::WiFiClientSecure(ClientContext* client,
117117
const BearSSLX509List *chain, const BearSSLPrivateKey *sk,
118118
int iobuf_in_size, int iobuf_out_size, const BearSSLX509List *client_CA_ta) {
119-
_cipher_list = NULL;
120-
_cipher_cnt = 0;
121119
_clear();
122120
_clearAuthenticationSettings();
123121
_iobuf_in_size = iobuf_in_size;
@@ -135,8 +133,6 @@ WiFiClientSecure::WiFiClientSecure(ClientContext *client,
135133
const BearSSLX509List *chain,
136134
unsigned cert_issuer_key_type, const BearSSLPrivateKey *sk,
137135
int iobuf_in_size, int iobuf_out_size, const BearSSLX509List *client_CA_ta) {
138-
_cipher_list = NULL;
139-
_cipher_cnt = 0;
140136
_clear();
141137
_clearAuthenticationSettings();
142138
_iobuf_in_size = iobuf_in_size;

0 commit comments

Comments
 (0)