RSA crypto sample in SDK 2.5.0 fails on nRF5340 Development Kit board

Hi,

The RSA crypto sample from the 2.5.0 SDK fails at psa_generate_key() returning -134. The sample is by default configured to use 2048-bit keys. 
Note that, It fails with the same error code also when changing the sample code and configuration to use say for example - changing it to CONFIG_PSA_WANT_RSA_KEY_SIZE_1536=y or configuring CONFIG_PSA_WANT_RSA_KEY_SIZE_1024=y.

Please note, the AES samples and the ECDH samples from the 2.5.0 SDK works very well on this board. I don't understand why the RSA sample application fails with the UNSUPPORTED error code.

(1) When can the basic/default RSA sample application in SDK 2.5.0 fail on the nRF5340 Development Kit?
(2) We intend to use PSA API for RSA OAEP with key size CONFIG_PSA_WANT_RSA_KEY_SIZE_3072. Is this supported in SDK 2.5.0?

Thanks,

Mathi.

#PSA #Crypto #RSA #SDK 2.5.0 #SAMPLE#nRF5340 DK #keyformat#keygeneration #openssl-versus-PSA

Parents
  • Hi, 

    It fails with the same error code when changing the sample code and configuration to use CONFIG_PSA_WANT_RSA_KEY_SIZE_1536=y or configuring CONFIG_PSA_WANT_RSA_KEY_SIZE_1024=y.

    If you check the .config under build/zephyr, you can find CONFIG_PSA_WANT_RSA_KEY_SIZE_1024=y is set by default.

    How do you modify the code? Could you elaborate on what you modified?

    (1) When can the basic/default RSA sample application in SDK 2.5.0 fail on the nRF5340 Development Kit?

    The error would give some clues. 

    (2) We intend to use PSA API for RSA OAEP with key size CONFIG_PSA_WANT_RSA_KEY_SIZE_3072. Is this supported in SDK 2.5.0?

    The default setting already has CONFIG_PSA_WANT_RSA_KEY_SIZE_3072.  You check the .config under build/zephyr. 

    Regards,
    Amanda H.

     

  • Hi Amanda,

    Thanks for the reply.
    Meanwhile, I just randomly increased the memory sizes from 16K to 20K and the default sample for key size 2048 bits, worked.
    (i.e. basically for experimentation, i just set CONFIG_MAIN_STACK_SIZE, CONFIG_HEAP_MEM_POOL_SIZE, CONFIG_MBEDTLS_HEAP_SIZE, all to 20 K) and it worked.
    I did not expect an PSA_ERR_NOT_SUPPORTED error code for memory reasons though.
    Also, I also noticed that the key_generation takes a longer time, with different key sizes.
    Will update you further.

    Mathi.




  • Hi Amanda,

    I continued further and modifed the default RSA example to try RSA_OAEP encryption for 1024-bit keys
    and that fails i.e. psa_asymmetric_encrypt() fails with error code -147(HARDWARE_FAILURE).

    This looks very similair to the problem my colleague had experienced about an year ago, see this ==>
     RSA example fails on psa_sign_hash returning -133 - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com)

    I don't know if anything has changed in the past 1 year between 2.1.1 and 2.5.0 -
    Could you please confirm whether psa_asymmetric_encrypt() for RSA 1024-bit keys is supported or not?

    Kind Regards, Mathi.

Reply Children
Related