Skip to content

Commit 504a875

Browse files
committed
Disable parent certificate functions if chain length is 1
1 parent 04cdddf commit 504a875

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Diff for: src/BearSSLClient.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ void BearSSLClient::setKey(const char key[], const char cert[])
411411
}
412412
#endif
413413

414+
#if BEAR_SSL_CLIENT_CHAIN_SIZE > 1
414415
void BearSSLClient::setEccCertParent(const char cert[])
415416
{
416417
// try to decode the cert
@@ -457,6 +458,7 @@ void BearSSLClient::setEccCertParent(const char cert[])
457458
}
458459
}
459460
}
461+
#endif
460462

461463
int BearSSLClient::errorCode()
462464
{
@@ -621,11 +623,12 @@ void BearSSLClient::clientAppendKey(void *ctx, const void *data, size_t len)
621623
}
622624
#endif
623625

626+
#if BEAR_SSL_CLIENT_CHAIN_SIZE > 1
624627
void BearSSLClient::parentAppendCert(void *ctx, const void *data, size_t len)
625628
{
626629
BearSSLClient* c = (BearSSLClient*)ctx;
627630

628631
memcpy(&c->_ecCert[1].data[c->_ecCert[1].data_len], data, len);
629632
c->_ecCert[1].data_len += len;
630633
}
631-
634+
#endif

Diff for: src/BearSSLClient.h

+4
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ class BearSSLClient : public Client {
101101
#ifndef ARDUINO_BEARSSL_DISABLE_KEY_DECODER
102102
void setKey(const char key[], const char cert[]);
103103
#endif
104+
#if BEAR_SSL_CLIENT_CHAIN_SIZE > 1
104105
void setEccCertParent(const char cert[]);
106+
#endif
105107

106108
int errorCode();
107109

@@ -113,7 +115,9 @@ class BearSSLClient : public Client {
113115
#ifndef ARDUINO_BEARSSL_DISABLE_KEY_DECODER
114116
static void clientAppendKey(void *ctx, const void *data, size_t len);
115117
#endif
118+
#if BEAR_SSL_CLIENT_CHAIN_SIZE > 1
116119
static void parentAppendCert(void *ctx, const void *data, size_t len);
120+
#endif
117121

118122
private:
119123
Client* _client;

0 commit comments

Comments
 (0)