Skip to content

Commit

Permalink
platform: add logs to tls mbedtls module
Browse files Browse the repository at this point in the history
  • Loading branch information
joelguittet committed Oct 30, 2023
1 parent a9e578c commit eb5cf42
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions platform/tls/generic/mbedtls/src/mender-tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ mender_tls_pem_write_buffer(const unsigned char *der_data, size_t der_len, char
size_t use_len = 0;
mbedtls_base64_encode(NULL, 0, &use_len, der_data, der_len);
if (0 == use_len) {
mender_log_error("Unable to compute length");
ret = MENDER_FAIL;
goto END;
}
Expand All @@ -524,12 +525,14 @@ mender_tls_pem_write_buffer(const unsigned char *der_data, size_t der_len, char

/* Allocate memory to store PEM data */
if (NULL == (encode_buf = (unsigned char *)malloc(use_len))) {
mender_log_error("Unable to allocate memory");
ret = MENDER_FAIL;
goto END;
}

/* Convert DER data */
if (0 != mbedtls_base64_encode(encode_buf, use_len, &use_len, der_data, der_len)) {
mender_log_error("Unable to convert data to base64 format");
ret = MENDER_FAIL;
goto END;
}
Expand Down

0 comments on commit eb5cf42

Please sign in to comment.