psa_hash_compute with 8k message got error -141 built with nrf54l15dk_nrf54l15_cpuapp_ns target

I am implementing sha256 with hash message bigger than or equal to 8KB. I tried with nrf54l15dk_nrf54l15_cpuapp target, and it's working fine but if I try with nrf54l15dk_nrf54l15_cpuapp_ns I got an error -141(PSA_ERROR_INSUFFICIENT_MEMORY). Likewise, I tried on sample code and got the same error: C:\ncs\v2.9.1\nrf\samples\crypto\sha256

Device: nRF54L15-DK

NCS: V2.9.1

int hash_singlepart_sha256(void)
{
    uint32_t olen;
    psa_status_t status;

    uint8_t* ptrs = malloc(1024 * 8);
    if(ptrs == NULL) {
        LOG_INF("Malloc Error %d...", 1024 * 8);
    }

    memset(ptrs, 1, 8 * 1024);


    LOG_INF("Hashing using SHA256...");

    /* Calculate the SHA256 hash */
    status = psa_hash_compute(
        PSA_ALG_SHA_256, ptrs, 1024 * 8, m_hash, sizeof(m_hash), &olen);
    if (status != PSA_SUCCESS) {
        LOG_INF("psa_hash_compute failed! (Error: %d)", status);
        return APP_ERROR;
    }

    LOG_INF("Hashing successful!");
    PRINT_HEX("SHA256 hash", m_hash, sizeof(m_hash));

    return APP_SUCCESS;
}
Could you please help and advise?
Thanks,
Sophak
Related