RSA Decryption Failure (-147) while sending and receiving data from Modem on UART

Hi there. I have been working on a small project where I am using an encryption library for communication over ble. I am receiving encrypted token over ble charcteristics. Then i use Crypto libraries to decrypt the token and perform modem function on UART. While communicating over UART with modem i send and receive data from modem.. when I receive consecutive tokens on BLE, initially MCU is able to decrypt the tokens. but after 5-6 tokens it start failing to decrypt the exact same token. When I disable uart tx then this issue does not come... or may be it is delay enough..
I need help in this. I am not able to understand what causes the failure in decryption.

Parents Reply Children
  • psa_status_t status;
    int out_size = 0;
    status = psa_asymmetric_decrypt(m_locker_rsa_keypair_handle,
                      PSA_ALG_RSA_PKCS1V15_CRYPT,
                      m_rsa_enc_key,
                      t_ble_rsa_header_size, NULL, 0,
                      m_aes_key,
                     AES_KEY_SIZE, &out_size);

    if (status != PSA_SUCCESS)
    {
             sb_print_log(LOG_DEBUG," --->decrypt_message_rsa failed! (Error: %d)", status);
             return status;
    }

    this is giving -147

    which is :

    /** A hardware failure was detected.
    *
    * A hardware failure may be transient or permanent depending on the
    * cause. */
    #define PSA_ERROR_HARDWARE_FAILURE ((psa_status_t)-147)
  • The issue has been resolved. It was a memory leak in the UART callback which was affecting the buffers that are being used in decryption.

Related