Help Implementing ECDSA using PSA crypto API of mbedTLS

Hello,

I am developing FW for a BLE Peripheral on NRF52840_DK using nRF Connect SDK v1.9.1 on VScode.

So far, Peripheral and Client are able to connect and exchange data.

When Client is sending data: with a digital signature (raw 65 bytes) and its public key (raw, 65 bytes), In the Peripheral Code,

I need help in implementing digital signature using PSA library using psa_verify_message() function.

So far, i have used these functions successfully : 

psa_crypto_init()

psa_generate_random()

psa_hash_compute()
I have the raw 65 byte public key in BE format (04 zz yy xx .. .. .. aa), needed for verification
but dont understand how shall i use it as the first argument of psa_verify_message().
I am using standard curve NIST Sec P256R1
status = psa_verify_message(psa_key_id_t key, PSA_ALG_ECDSA(PSA_ALG_SHA_256), msg, sizeof(msg), signature, sizeof(signature));
Please explain me the steps needed to use this function
Thanks.
Parents
  • Hi, 

    From what I can gather from the error statement, it could happen in heap-allocation issues. There are two heap configurations you are messing with, and I am assuming you are setting the wrong one. The configuration on the heap that can be tuned is CONFIG_MBEDTLS_HEAP_SIZE, not CONFIG_HEAP_MEM_POOL_SIZE. The heap allocation in ECP (builtin) is considerable. Maybe try it at 16KB

    I wonder what kind of driver you are using in this configuration. This would be valuable info. 

    Regards,
    Amanda

Reply
  • Hi, 

    From what I can gather from the error statement, it could happen in heap-allocation issues. There are two heap configurations you are messing with, and I am assuming you are setting the wrong one. The configuration on the heap that can be tuned is CONFIG_MBEDTLS_HEAP_SIZE, not CONFIG_HEAP_MEM_POOL_SIZE. The heap allocation in ECP (builtin) is considerable. Maybe try it at 16KB

    I wonder what kind of driver you are using in this configuration. This would be valuable info. 

    Regards,
    Amanda

Children
No Data
Related