@@ -52,7 +52,9 @@ BearSSLClient::BearSSLClient(Client* client, const br_x509_trust_anchor* myTAs,
5252 _TAs(myTAs),
5353 _numTAs(myNumTAs),
5454 _noSNI(false ),
55+ #ifndef ARDUINO_BEARSSL_DISABLE_KEY_DECODER
5556 _skeyDecoder (NULL ),
57+ #endif
5658 _ecChainLen (0 ),
5759#ifndef ARDUINO_BEARSSL_DISABLE_FULL_CLIENT_PROFILE
5860 _br_ssl_client_init_function (br_ssl_client_init_full)
@@ -86,10 +88,12 @@ BearSSLClient::~BearSSLClient()
8688 _ecCert[0 ].data = NULL ;
8789 }
8890
91+ #ifndef ARDUINO_BEARSSL_DISABLE_KEY_DECODER
8992 if (_skeyDecoder) {
9093 free (_skeyDecoder);
9194 _skeyDecoder = NULL ;
9295 }
96+ #endif
9397}
9498
9599int BearSSLClient::connect (IPAddress ip, uint16_t port)
@@ -318,6 +322,7 @@ void BearSSLClient::setEccSlot(int ecc508KeySlot, const char cert[])
318322 }
319323}
320324
325+ #ifndef ARDUINO_BEARSSL_DISABLE_KEY_DECODER
321326void BearSSLClient::setKey (const char key[], const char cert[])
322327{
323328 // try to decode the key and cert
@@ -390,6 +395,7 @@ void BearSSLClient::setKey(const char key[], const char cert[])
390395 }
391396 }
392397}
398+ #endif
393399
394400void BearSSLClient::setEccCertParent (const char cert[])
395401{
@@ -475,6 +481,7 @@ int BearSSLClient::connectSSL(const char* host)
475481
476482 // enable client auth
477483 if (_ecCert[0 ].data_len ) {
484+ #ifndef ARDUINO_BEARSSL_DISABLE_KEY_DECODER
478485 if (_skeyDecoder) {
479486 int skeyType = br_skey_decoder_key_type (_skeyDecoder);
480487
@@ -484,8 +491,11 @@ int BearSSLClient::connectSSL(const char* host)
484491 br_ssl_client_set_single_rsa (&_sc, _ecCert, _ecChainLen, br_skey_decoder_get_rsa (_skeyDecoder), br_rsa_pkcs1_sign_get_default ());
485492 }
486493 } else {
494+ #endif
487495 br_ssl_client_set_single_ec (&_sc, _ecCert, _ecChainLen, &_ecKey, BR_KEYTYPE_KEYX | BR_KEYTYPE_SIGN, BR_KEYTYPE_EC, br_ec_get_default (), _ecSign);
496+ #ifndef ARDUINO_BEARSSL_DISABLE_KEY_DECODER
488497 }
498+ #endif
489499 }
490500
491501 // set the hostname used for SNI
@@ -588,12 +598,14 @@ void BearSSLClient::clientAppendCert(void *ctx, const void *data, size_t len)
588598 c->_ecCert [0 ].data_len += len;
589599}
590600
601+ #ifndef ARDUINO_BEARSSL_DISABLE_KEY_DECODER
591602void BearSSLClient::clientAppendKey (void *ctx, const void *data, size_t len)
592603{
593604 BearSSLClient* c = (BearSSLClient*)ctx;
594605
595606 br_skey_decoder_push (c->_skeyDecoder , data, len);
596607}
608+ #endif
597609
598610void BearSSLClient::parentAppendCert (void *ctx, const void *data, size_t len)
599611{
0 commit comments