enable internal sha256

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
SaSh_4649506
Level 2
Level 2
5 replies posted 5 questions asked 5 sign-ins

Hi all,

I want to use internal uECC library, which I have enabled by including in the MakeFile : ota2_bootloader.mk, by adding: GLOBAL_INCLUDES  += ..\..\..\WICED\security\BESL\mbedtls_open\include\mbedtls.

I want to know how to enable the internal SHA256 library to be able to use the files: sha256.h and sha256.c. (location: 43xxx_Wi-Fi/WICED/security/BESL/mbedtls_open/include/mbedtls)

TIA!

0 Likes
1 Solution
GauravS_31
Moderator
Moderator
Moderator
10 questions asked 250 solutions authored 250 sign-ins

To enable uECC, the macro WICED_CONFIG_ENABLE_MBEDTLS_ECC_ALT should be defined in mbedtls/config.h. This will allow mbedTLS to invoke uECC functions as they are used.

By default, CYW54907 uses dedicated hwcrypto engine to perform SHA256 operations using functions defined in sha256_alt.c. Whereas, sha256.c performs the SHA256 operations in software. If you want to use sha256.c, you can go to BCM4390x.mk and change GLOBAL_DEFINES +=  PLATFORM_HAS_HW_CRYPTO_SUPPORT to GLOBAL_DEFINES +=  WICED_CONFIG_DONOT_USE_HW_CRYPTO.

View solution in original post

0 Likes
2 Replies
GauravS_31
Moderator
Moderator
Moderator
10 questions asked 250 solutions authored 250 sign-ins

To enable uECC, the macro WICED_CONFIG_ENABLE_MBEDTLS_ECC_ALT should be defined in mbedtls/config.h. This will allow mbedTLS to invoke uECC functions as they are used.

By default, CYW54907 uses dedicated hwcrypto engine to perform SHA256 operations using functions defined in sha256_alt.c. Whereas, sha256.c performs the SHA256 operations in software. If you want to use sha256.c, you can go to BCM4390x.mk and change GLOBAL_DEFINES +=  PLATFORM_HAS_HW_CRYPTO_SUPPORT to GLOBAL_DEFINES +=  WICED_CONFIG_DONOT_USE_HW_CRYPTO.

0 Likes
GauravS_31
Moderator
Moderator
Moderator
10 questions asked 250 solutions authored 250 sign-ins

I have tested the following crypto functions in wiced_ota2_image.c in WICED version Wiced_006.002.001.0002 using the build statement waf.ota2_bootloader-CYW954907AEVAL1F-NoOS-NoNS download run:

        mbedtls_sha256_init( &ctx );

            mbedtls_sha256_starts( &ctx, 0 );

            mbedtls_sha256_update( &ctx, MESSAGE, n );

            mbedtls_sha256_finish( &ctx, hash );

            mbedtls_sha256_free( &ctx );

No makefile changes were required and no additional header file was included. I do not see any build error. I would suggest you to make a separate clean installation of WICED 6.2.1 and only write the 5 mbedtls sha256 functions in wiced_ota2_image.c and build the ota2_bootloader project.