This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SDK 13.0.0 - problem with DFU

Hello,

probably I found a little bug in SDK 13

When I'm trying make a DFU via nRFConnect with prepared pkg by nrfutil I got error. And after debug session i found:

in nrf_crypto_ecdsa.h in line 100 we have a macro to create an instance of an ECDSA signature

#define NRF_CRYPTO_ECDSA_SIGNATURE_CREATE(name, type)                                           \
static uint8_t  name ## _buffer[STRING_CONCATENATE(NRF_CRYPTO_ECDSA_SIGNATURE_SIZE_, type)];    \
static nrf_value_length_t name =                                                                \
{                                                                                               \
    .p_value = name ## _buffer,                                                                 \
    .length = STRING_CONCATENATE(NRF_CRYPTO_ECDSA_SIGNATURE_SIZE_, type)                        \
}

Later in micro_ecc_lib_ecdsa.c is checking if p_value is word aligned

    // Ensure data is aligned
if (!is_word_aligned(p_private_key->p_value)    ||
    !is_word_aligned(p_hash->p_value)           ||
    !is_word_aligned(p_signature->p_value)      )
{
    return NRF_ERROR_INVALID_ADDR;
}

But it's not and in this case I can't make a DFU

When I added aligment like below:

#define NRF_CRYPTO_ECDSA_SIGNATURE_CREATE(name, type)                                           \
__ALIGN(4) static uint8_t  name ## _buffer[STRING_CONCATENATE(NRF_CRYPTO_ECDSA_SIGNATURE_SIZE_, type)];    \
static nrf_value_length_t name =                                                                \
{                                                                                               \
    .p_value = name ## _buffer,                                                                 \
    .length = STRING_CONCATENATE(NRF_CRYPTO_ECDSA_SIGNATURE_SIZE_, type)                        \
}

I'm able to make a DFU.

My solution is correct ? Or I have to change something more ?

BR, Kamil.

Related