28
28
#include < ArduinoECCX08.h>
29
29
#endif
30
30
31
+ #ifndef ARDUINO_BEARSSL_DISABLE_BUILTIN_TRUST_ANCHORS
31
32
#include " BearSSLTrustAnchors.h"
33
+ #endif
32
34
#include " utility/eccX08_asn1.h"
33
35
34
36
#include " BearSSLClient.h"
35
37
38
+ #ifndef ARDUINO_BEARSSL_DISABLE_BUILTIN_TRUST_ANCHORS
36
39
BearSSLClient::BearSSLClient (Client& client) :
37
40
BearSSLClient(&client, TAs, TAs_NUM)
38
41
{
39
42
}
43
+ #endif
40
44
41
45
BearSSLClient::BearSSLClient (Client& client, const br_x509_trust_anchor* myTAs, int myNumTAs)
42
46
: BearSSLClient(&client, myTAs, myNumTAs)
@@ -49,7 +53,8 @@ BearSSLClient::BearSSLClient(Client* client, const br_x509_trust_anchor* myTAs,
49
53
_numTAs(myNumTAs),
50
54
_noSNI(false ),
51
55
_skeyDecoder(NULL ),
52
- _ecChainLen(0 )
56
+ _ecChainLen(0 ),
57
+ _br_ssl_client_init_function(br_ssl_client_init_full)
53
58
{
54
59
#ifndef ARDUINO_DISABLE_ECCX08
55
60
_ecVrfy = eccX08_vrfy_asn1;
@@ -436,8 +441,12 @@ int BearSSLClient::errorCode()
436
441
437
442
int BearSSLClient::connectSSL (const char * host)
438
443
{
439
- // initialize client context with all algorithms and hardcoded trust anchors
440
- br_ssl_client_init_full (&_sc, &_xc, _TAs, _numTAs);
444
+ if (!_br_ssl_client_init_function) {
445
+ return 0 ;
446
+ }
447
+
448
+ // initialize client context with enabled algorithms and trust anchors
449
+ _br_ssl_client_init_function (&_sc, &_xc, _TAs, _numTAs);
441
450
442
451
br_ssl_engine_set_buffers_bidi (&_sc.eng , _ibuf, sizeof (_ibuf), _obuf, sizeof (_obuf));
443
452
0 commit comments