Skip to content

Commit

Permalink
ta/crypt: update to mbedTLS 3.4.0 API
Browse files Browse the repository at this point in the history
The mbedtls_pk_parse_key() has two new paramters with the new 3.x API
in. Fix the call of mbedtls_pk_parse_key(). The X.509 self test is
removed so remove the call to that test in the TA.

Signed-off-by: Jens Wiklander <[email protected]>
Acked-by: Jerome Forissier <[email protected]>
  • Loading branch information
jenswi-linaro committed Oct 5, 2023
1 parent 1013c49 commit 4eb4e56
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ta/crypt/mbedtls_taf.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ ta_entry_mbedtls_self_tests(uint32_t param_type,
DO_MBEDTLS_SELF_TEST(base64);
DO_MBEDTLS_SELF_TEST(mpi);
DO_MBEDTLS_SELF_TEST(rsa);
DO_MBEDTLS_SELF_TEST(x509);

return TEE_SUCCESS;
#else
Expand Down Expand Up @@ -187,7 +186,8 @@ static TEE_Result parse_issuer_key(mbedtls_pk_context *pk)
return TEE_ERROR_OUT_OF_MEMORY;

memcpy(buf, mid_key, mid_key_size);
ret = mbedtls_pk_parse_key(pk, buf, mid_key_size + 1, NULL, 0);
ret = mbedtls_pk_parse_key(pk, buf, mid_key_size + 1,
NULL, 0, NULL, NULL);
TEE_Free(buf);
if (ret) {
EMSG("mbedtls_pk_parse_key: failed: %#x", ret);
Expand Down Expand Up @@ -275,7 +275,7 @@ TEE_Result ta_entry_mbedtls_sign_cert(uint32_t param_type,
goto out;
}

mbedtls_x509write_crt_set_md_alg(&crt, csr.sig_md);
mbedtls_x509write_crt_set_md_alg(&crt, csr.MBEDTLS_PRIVATE(sig_md));
mbedtls_x509write_crt_set_subject_key(&crt, &csr.pk);
mbedtls_x509write_crt_set_issuer_key(&crt, &issuer_key);

Expand Down

0 comments on commit 4eb4e56

Please sign in to comment.