nRF9160: Offloaded sockets can't use MBEDTLS_USE_PSA_CRYPTO with RSA Certificates

I have app that's using MBedTLS and offloaded sockets on the nRF9160 modem. I'm using NCS 2.9.0 and it appears to me that it's not possible to set CONFIG_MBEDTLS_USE_PSA_CRYPTO when RSA certificates are required.

I have tried many combinations of config options but parsing RSA certificates without MBEDTLS_RSA_C always fails.

D: (0x200178d8): close: ctx=0x2001ef50, fd=0
D: (0x200178d8): Allocated TLS context, 0x200157e0
E: Failed to parse CA certificate, err: -0x262e
E: connect() failed. Err 22: Invalid argument
D: (0x200178d8): close: ctx=0x200157e0, fd=0
D: (0x200178d8): close: ctx=0x2001ef50, fd=1

MBEDTLS_HAS_RSA_CIPHERSUITE_REQUIREMENTS depends on MBEDTLS_RSA_C which depends on MBEDTLS_LEGACY_CRYPTO_C.

CONFIG_MBEDTLS_USE_PSA_CRYPTO is incompatible with MBEDTLS_LEGACY_CRYPTO_C.

Is it possible to use RSA certificates in NCS without selecting the deprecated CONFIG_MBEDTLS_LEGACY_CRYPTO_C?

Parents Reply
  • Voxorin, it seems like we still need legacy crypto for some cases. I think by sdk release version 3.0.0 we might be able to break the dependency on the legacy crypto completely. But this is not a promise but just a guideline on our intention. Keeping that in mind, you can probably ignore that warning and continue your development and in few months you wont see this warning when you upgrade the sdk.

Children
  • Hi Voxorion, hi Susheel,

    we have exactly the same problem, that we cannot parse the RSA certificate provided by our server.
    Same error code -0x262e, same config dependency between MBEDTLS_RSA_C  <--> CONFIG_MBEDTLS_USE_PSA_CRYPTO. Using ECC certificates is also not an option since we have no control over the provided certificate.

    We are currently on NCS release 3.0.2 so apparently the teased dependency breaks have not released so far.

    Therefore my question:

    a) Is there any known workaround so far to somehow parse RSA certificates with CONFIG_MBEDTLS_USE_PSA_CRYPTO enabled?

    b) Is there any roadmap on when the dependencies to the (soon to be) deprecated MBEDTLS_LEGACY API will be released?

    If you have any helpful information, we would really much appreciate your feedback.

    Thanks in advance!

    Jaro

Related