34
34
35
35
#include " BearSSLClient.h"
36
36
37
- extern " C" void aiotc_client_profile_init (br_ssl_client_context *cc, br_x509_minimal_context *xc, const br_x509_trust_anchor *trust_anchors, size_t trust_anchors_num);
38
-
39
-
40
37
bool BearSSLClient::_sslio_closing = false ;
41
38
39
+ BearSSLClient::BearSSLClient () :
40
+ _noSNI(false ),
41
+ _get_time_func(nullptr )
42
+ {
43
+ _ecKey.curve = 0 ;
44
+ _ecKey.x = NULL ;
45
+ _ecKey.xlen = 0 ;
46
+
47
+ _ecCert.data = NULL ;
48
+ _ecCert.data_len = 0 ;
49
+ _ecCertDynamic = false ;
50
+ }
42
51
43
52
BearSSLClient::BearSSLClient (Client* client, const br_x509_trust_anchor* myTAs, int myNumTAs, GetTimeCallbackFunc func) :
44
53
_client(client),
@@ -266,8 +275,8 @@ int BearSSLClient::connectSSL(const char* host)
266
275
/* Ensure this flag is cleared so we don't terminate a just starting connection. */
267
276
_sslio_closing = false ;
268
277
269
- // initialize client context with all necessary algorithms and hardcoded trust anchors.
270
- aiotc_client_profile_init (&_sc, &_xc, _TAs, _numTAs);
278
+ // initialize client context with enabled algorithms and trust anchors
279
+ _br_ssl_client_init_function (&_sc, &_xc, _TAs, _numTAs);
271
280
272
281
br_ssl_engine_set_buffers_bidi (&_sc.eng , _ibuf, sizeof (_ibuf), _obuf, sizeof (_obuf));
273
282
@@ -278,7 +287,7 @@ int BearSSLClient::connectSSL(const char* host)
278
287
// ECC508 random success, add custom ECDSA vfry and EC sign
279
288
br_ssl_engine_set_ecdsa (&_sc.eng , eccX08_vrfy_asn1);
280
289
br_x509_minimal_set_ecdsa (&_xc, br_ssl_engine_get_ec (&_sc.eng ), br_ssl_engine_get_ecdsa (&_sc.eng ));
281
-
290
+
282
291
// enable client auth using the ECCX08
283
292
if (_ecCert.data_len && _ecKey.xlen ) {
284
293
br_ssl_client_set_single_ec (&_sc, &_ecCert, 1 , &_ecKey, BR_KEYTYPE_KEYX | BR_KEYTYPE_SIGN, BR_KEYTYPE_EC, br_ec_get_default (), eccX08_sign_asn1);
0 commit comments