Skip to content

Commit

Permalink
TLSSocketWrapper: allow appending ca_cert to an empty chain
Browse files Browse the repository at this point in the history
  • Loading branch information
pennam committed Nov 13, 2023
1 parent b5d44a4 commit e69150d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions connectivity/netsocket/source/TLSSocketWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,11 @@ nsapi_error_t TLSSocketWrapper::append_root_ca_cert(const void *root_ca, size_t

crt = get_ca_chain();
if (!crt) {
return NSAPI_ERROR_NO_MEMORY;
/* In no chain is configured create a new one */
return set_root_ca_cert(root_ca, len);
}

/* Parse CA certification */
/* Append root_ca to the crt chain */
int ret;
if ((ret = mbedtls_x509_crt_parse(crt, static_cast<const unsigned char *>(root_ca),
len)) != 0) {
Expand Down

0 comments on commit e69150d

Please sign in to comment.