Skip to content

Commit ab08428

Browse files
pennamfacchinm
authored andcommitted
TLSSocketWrapper: allow appending ca_cert to an empty chain
1 parent 217ba15 commit ab08428

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

connectivity/netsocket/source/TLSSocketWrapper.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,11 @@ nsapi_error_t TLSSocketWrapper::append_root_ca_cert(const void *root_ca, size_t
145145

146146
crt = get_ca_chain();
147147
if (!crt) {
148-
return NSAPI_ERROR_NO_MEMORY;
148+
/* In no chain is configured create a new one */
149+
return set_root_ca_cert(root_ca, len);
149150
}
150151

151-
/* Parse CA certification */
152+
/* Append root_ca to the crt chain */
152153
int ret;
153154
if ((ret = mbedtls_x509_crt_parse(crt, static_cast<const unsigned char *>(root_ca),
154155
len)) != 0) {

0 commit comments

Comments
 (0)