mbedtls_pk_write_key_pem() does not work with secp256r1 keys (and tfm?)

Hi,

I'm writing an app that creates a CSR, has it signed by a (web-)server and subsequently uses it to authenticate to another (mqtt-)server. For the CSR generation and signing part I am using mbedtls, while for the authentication I am writing the credentials to the modem. This only works if I use an externally generated key, because I was not able to export a locally generated key via mbedtls_pk_write_key_pem(), no matter what I tried. The function exits with error code 0xc680, which doesn't seem to be defined anywhere. Furthermore, I haven't been able to use the mbedtls_strerror() function. It looks like it is being built, but the linker cannot find it.

I understand that mbedtls integration with tfm is a work in progress, but I'm struggling to keep up, and I'm afraid I got lost somewhere along the way.

So, to wrap this up let me reiterate:

  • What does mbedtls-error 0xc680 mean?
  • What do I need to do to use mbedtls_pk_write_key_pem()?
  • What do I need to do to use mbedtls_strerror()?

Thanks in advance!

Related