-
-
Notifications
You must be signed in to change notification settings - Fork 92
Description
On the Uno R4 WiFi, I'd like to make use of the Renesas' chips SCE (Secure Cryptography Engine). According to the .h file, the chip does that peripheral.
ArduinoCore-renesas/variants/UNOWIFIR4/includes/ra/fsp/src/bsp/mcu/ra4m1/bsp_feature.h
Lines 97 to 99 in 80faaf8
#define BSP_FEATURE_BSP_HAS_SCE5 (1) | |
#define BSP_FEATURE_CRYPTO_HAS_SCE5B (0) | |
#define BSP_FEATURE_CRYPTO_HAS_SCE5 (1) |
In docs:
And r_sce_if.h seems to be the main header that declares the availble functions.
Creating a new .c
file and writing a small test program
#include <r_sce_if.h>
void test() {
const char* msg = "Hello";
sce_sha_md5_handle_t ctx;
uint8_t sha256_out[256 / 8];
uint32_t digestLen = 256/8;
HW_SCE_McuSpecificInit();
HW_SCE_Sha256Init(&ctx);
HW_SCE_Sha256Update(&ctx, (uint8_t*)msg, strlen(msg));
HW_SCE_Sha256Final(&ctx, sha256_out, &digestLen);
printf("Hash: ");
for(int i=0; i < 256/8; i++) printf("%02x", sha256_out[i]);
printf("\n");
}
fails at the linking stage with
main.c:(.text.test+0xe): undefined reference to `HW_SCE_Sha256Init'
main.c:(.text.test+0x20): undefined reference to `HW_SCE_Sha256Update'
main.c:(.text.test+0x2a): undefined reference to `HW_SCE_Sha256Final'
Some related datasheets very unhelpfully say
And the implementation of HW_SCE_Sha256Init()
and related is nowhere to be found in the FSP (neither v4.0 that you used for this core nor the current version).
Am I blind or do I have to sign a freaking NDA with Renesas to use the crypto accelerator hardware in a chip I already paid money for?