How to compute MD5 checksum?

Hi all,

I am developing a project with the nRF52840, using nRF Connect SDK 2.6.1 in Visual Studio Code.

I need to be able to compute an MD5 checksum for a dependency. I understand that MD5 is not considered secure, but security is not really at issue in this application.

I see that it looks like there is a function I could use located here:

\nRF_Connect\v2.6.1\modules\crypto\mbedtls\include\mbedtls\md5.h

My question is how can I best utilize that function? Do I need to somehow modify my cmakelists to allow me to include the file directly from that location? If so, what do I need to add in there? Or alternatively, maybe I need to add something to my prj.conf to enable the features in that folder? If so, what? Or maybe I need to do something in kconfig?

In short, it looks like there is code in place to support what I want to do, but I'm just not sure how I can get at it.

Any advice appreciated.

Thanks!

Scott

Parents Reply Children
  • I think I was able to get it working. Here's the information I needed, for reference. To use the MD5 functionality in the mbedtls stuff, I needed to:

    1) Put this in my prj.conf. I don't know what it does, why it is necessary, or where/if it is documented (??).

    CONFIG_NORDIC_SECURITY_BACKEND=y
    2) Put this in my kconfig.zephyr, at the top of the file:
    config MBEDTLS_MD5_C
        bool "In project definition"
        default y
    3) Put this in my includes in the file where I want to use the MD5 functions. Initially, it shows red squiggles underneath and says the file is not found, but after doing a build suddenly it's ok. I don't know why this is. (??)
    #include <mbedtls/md5.h>
    I think it is working because I can use the code below, as from the example zip you pointed at, and it doesn't give build errors:
        mbedtls_md5_context ctx;
        mbedtls_md5_init(&ctx);
    So, I guess I'm good. I hate this about Zephyr and the Connect SDK, though: Sometimes there are mysterious config options I need to include to make something work, and apart from just posting on devzone to ask, I don't know how I'm supposed to find this stuff out. What does CONFIG_NORDIC_SECURITY_BACKEND=y do and why do I need it? Is it documented anywhere? Why am I able to include mbedtls/md5.h? What path is that relative to? It's not where my other includes like kernel.h are, so I don't get why that works here.
  • Hi, 

    cscase said:
    What does CONFIG_NORDIC_SECURITY_BACKEND=y do and why do I need it? Is it documented anywhere?

    To configure the legacy Mbed TLS APIs, set the option CONFIG_NORDIC_SECURITY_BACKEND

    cscase said:
    Why am I able to include mbedtls/md5.h?

    Because you enable MBEDTLS_MD5_C by default in the kconfig.

    -Amanda H.

Related